From ad3c9f2af814c84582fdd1649e49ec4f68572c5a Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 27 Jul 2012 17:35:30 +0000 Subject: [PATCH] Libc-825.24.tar.gz --- BSDmakefile | 289 - GNUmakefile | 12 - Info.plist | 1 - Libc.xcodeproj/project.pbxproj | 15877 ++++++++++++++++ .../contents.xcworkspacedata | 7 + Makefile | 101 - Makefile.fbsd_begin | 25 - Makefile.fbsd_end | 72 - Makefile.features | 135 - Makefile.inc | 105 - Makefile.nbsd_begin | 24 - Makefile.nbsd_end | 63 - Makefile.obsd_begin | 24 - Makefile.obsd_end | 63 - Makefile.xbs | 487 - Platforms/{iPhone => iphoneos}/Makefile.inc | 16 +- Platforms/{MacOSX => macosx}/Makefile.inc | 16 +- arm/Makefile.inc | 8 - arm/gen/Makefile.inc | 6 - arm/pthreads/Makefile.inc | 14 - arm/pthreads/get_cpu_capabilities.s | 36 - arm/pthreads/start_wqthread.s | 9 +- arm/pthreads/thread_start.s | 7 +- arm/stdlib/gdtoa.mk | 1 - arm/string/Makefile.inc | 51 - arm/string/bcopy_CortexA8.s | 840 + arm/string/bcopy_CortexA9.s | 399 + arm/string/bcopy_Generic.s | 384 + arm/string/bcopy_Swift.s | 318 + arm/string/bzero_CortexA8.s | 155 + arm/string/bzero_CortexA9.s | 106 + arm/string/bzero_Generic.s | 145 + arm/string/bzero_Swift.s | 117 + arm/string/dyld_resolvers.c | 98 + arm/string/ffs.s | 27 + arm/string/memcmp.s | 94 + arm/string/memset_pattern.s | 313 + arm/string/memset_pattern_Swift.s | 275 + arm/string/strchr.s | 38 + arm/string/strcmp.s | 158 +- arm/string/strlen.s | 94 +- arm/string/strncmp.s | 154 + arm/string/strncpy.s | 0 arm/string/strnlen.s | 149 + arm/string/strstr.s | 126 + arm/sys/Makefile.inc | 19 - ppc/string/fls.s => arm/sys/OSAtomic.c | 11 +- arm/sys/OSAtomic.h | 180 + arm/sys/OSAtomic.s | 634 - arm/{string/strcpy.s => sys/OSAtomicUP.c} | 10 +- arm/sys/OSAtomic_resolvers.c | 42 +- include/objc/malloc.h => arm/sys/Spinlocks.c | 12 +- arm/sys/SpinlocksUP.c | 32 + .../sys/SpinlocksWFE.c | 23 +- arm/sys/_longjmp.s | 4 +- arm/sys/_setjmp.s | 4 +- arm/sys/gcc_atomic.c | 34 +- compat-43/FreeBSD/creat.c | 14 +- compat-43/FreeBSD/creat.c.patch | 30 - compat-43/FreeBSD/gethostid.3 | 8 +- compat-43/FreeBSD/gethostid.3.patch | 17 - compat-43/FreeBSD/gethostid.c | 2 +- compat-43/FreeBSD/gethostid.c.patch | 11 - compat-43/FreeBSD/killpg.2 | 19 +- compat-43/FreeBSD/killpg.2.patch | 45 - compat-43/FreeBSD/killpg.c | 14 +- compat-43/FreeBSD/killpg.c.patch | 30 - compat-43/FreeBSD/setpgrp.c | 11 +- compat-43/FreeBSD/setpgrp.c.patch | 19 - compat-43/Makefile.inc | 41 - compat-43/creat-fbsd.c | 58 - compat-43/creat.2 | 1 - compat-43/gethostid-fbsd.c | 54 - compat-43/gethostid.3 | 78 - compat-43/getwd-fbsd.c | 1 - compat-43/killpg-fbsd.c | 61 - compat-43/killpg.2 | 105 - compat-43/sethostid-fbsd.c | 1 - compat-43/setpgrp-fbsd.c | 48 - compat-43/setrgid-fbsd.c | 1 - compat-43/setruid-fbsd.c | 1 - compat-43/setruid.3 | 1 - darwin/Makefile.inc | 24 - darwin/OSAtomicLoadStoreEx.c | 318 + darwin/SpinlocksLoadStoreEx.c | 124 + darwin/_dirhelper.c | 44 +- darwin/dirhelper_priv.h | 1 + darwin/forceLibcToBuild.c | 6 + darwin/libproc.c | 82 + darwin/libproc.h | 7 + darwin/libproc_internal.h | 13 +- db/Makefile.inc | 10 - db/btree/FreeBSD/{extern.h => bt_extern.h} | 0 db/btree/FreeBSD/bt_overflow.c | 4 +- db/btree/FreeBSD/bt_overflow.c.patch | 20 - db/btree/FreeBSD/bt_seq.c | 5 +- db/btree/FreeBSD/bt_seq.c.patch | 24 - db/btree/FreeBSD/bt_split.c | 10 +- db/btree/FreeBSD/bt_split.c.patch | 47 - db/btree/FreeBSD/btree.h | 2 +- db/btree/FreeBSD/btree.h.patch | 8 - db/btree/Makefile.inc | 31 - db/btree/bt_close-fbsd.c | 1 - db/btree/bt_conv-fbsd.c | 1 - db/btree/bt_delete-fbsd.c | 1 - db/btree/bt_extern.h | 1 - db/btree/bt_get-fbsd.c | 1 - db/btree/bt_open-fbsd.c | 1 - db/btree/bt_overflow-fbsd.c | 216 - db/btree/bt_page-fbsd.c | 1 - db/btree/bt_put-fbsd.c | 1 - db/btree/bt_search-fbsd.c | 1 - db/btree/bt_seq-fbsd.c | 442 - db/btree/bt_split-fbsd.c | 796 - db/btree/bt_utils-fbsd.c | 1 - db/btree/btree.h | 380 - db/db/Makefile.inc | 12 - db/db/db-fbsd.c | 1 - db/hash/FreeBSD/hash.c | 7 +- db/hash/FreeBSD/hash.c.patch | 30 - db/hash/FreeBSD/hash.h | 2 + db/hash/FreeBSD/hash.h.patch | 11 - db/hash/FreeBSD/hash_bigkey.c | 2 +- db/hash/FreeBSD/hash_bigkey.c.patch | 11 - db/hash/FreeBSD/hash_buf.c | 4 +- db/hash/FreeBSD/hash_buf.c.patch | 20 - db/hash/FreeBSD/{extern.h => hash_extern.h} | 0 db/hash/FreeBSD/hash_func.c | 2 +- db/hash/FreeBSD/hash_func.c.patch | 11 - db/hash/FreeBSD/hash_log2.c | 2 +- db/hash/FreeBSD/hash_log2.c.patch | 11 - db/hash/FreeBSD/hash_page.c | 18 +- db/hash/FreeBSD/hash_page.c.patch | 48 - db/hash/FreeBSD/ndbm.c | 25 +- db/hash/FreeBSD/ndbm.c.patch | 62 - db/hash/Makefile.inc | 28 - db/hash/hash-fbsd.c | 963 - db/hash/hash-fbsd.c.orig | 964 - db/hash/hash.h | 292 - db/hash/hash_bigkey-fbsd.c | 646 - db/hash/hash_buf-fbsd.c | 358 - db/hash/hash_extern.h | 1 - db/hash/hash_func-fbsd.c | 210 - db/hash/hash_log2-fbsd.c | 52 - db/hash/hash_page-fbsd.c | 948 - db/hash/ndbm-fbsd.c | 242 - db/hash/page.h | 1 - db/man/FreeBSD/dbm.3 | 106 +- db/man/FreeBSD/dbm.3.patch | 192 - db/man/Makefile.inc | 33 - db/man/btree.3 | 1 - db/man/dbm.3 | 274 - db/man/dbopen.3 | 1 - db/man/hash.3 | 1 - db/man/mpool.3 | 1 - db/man/recno.3 | 1 - db/mpool/FreeBSD/mpool.c | 20 +- db/mpool/FreeBSD/mpool.c.patch | 50 - db/mpool/Makefile.inc | 15 - db/mpool/mpool-fbsd.c | 445 - db/recno/FreeBSD/extern.h | 51 - db/recno/FreeBSD/extern.h.patch | 11 - db/recno/{ => FreeBSD}/rec_extern.h | 2 +- db/recno/FreeBSD/recno.h | 4 +- db/recno/FreeBSD/recno.h.patch | 8 - db/recno/Makefile.inc | 26 - db/recno/rec_close-fbsd.c | 1 - db/recno/rec_delete-fbsd.c | 1 - db/recno/rec_get-fbsd.c | 1 - db/recno/rec_open-fbsd.c | 1 - db/recno/rec_put-fbsd.c | 1 - db/recno/rec_search-fbsd.c | 1 - db/recno/rec_seq-fbsd.c | 1 - db/recno/rec_utils-fbsd.c | 1 - emulated/Makefile.inc | 20 - fbsdcompat/_fpmath.h | 31 +- fbsdcompat/sys/cdefs.h | 77 +- fixdups.ed | 2 - gdtoa/FreeBSD/_hdtoa.c | 25 +- gdtoa/FreeBSD/_hdtoa.c.patch | 118 - gdtoa/FreeBSD/_ldtoa.c | 34 +- gdtoa/FreeBSD/_ldtoa.c.patch | 97 - gdtoa/FreeBSD/gdtoa-gethex.c | 67 +- gdtoa/FreeBSD/gdtoa-gethex.c.patch | 106 - gdtoa/FreeBSD/gdtoa-hexnan.c | 59 + gdtoa/FreeBSD/gdtoa-hexnan.c.patch | 136 - gdtoa/FreeBSD/gdtoa-misc.c | 56 + gdtoa/FreeBSD/gdtoa-misc.c.patch | 103 - gdtoa/FreeBSD/gdtoa-strtod.c | 57 +- gdtoa/FreeBSD/gdtoa-strtod.c.patch | 167 - gdtoa/FreeBSD/gdtoa-strtodg.c | 55 +- gdtoa/FreeBSD/gdtoa-strtodg.c.patch | 163 - gdtoa/FreeBSD/gdtoa-strtof.c | 22 +- gdtoa/FreeBSD/gdtoa-strtof.c.patch | 49 - gdtoa/FreeBSD/gdtoa-strtopdd.c | 64 +- gdtoa/FreeBSD/gdtoa-strtopdd.c.patch | 151 - gdtoa/FreeBSD/gdtoa-strtopx.c | 11 +- gdtoa/FreeBSD/gdtoa-strtopx.c.patch | 37 - gdtoa/FreeBSD/gdtoa-strtord.c | 24 - gdtoa/FreeBSD/gdtoa-strtord.c.patch | 30 - gdtoa/FreeBSD/gdtoa.h | 6 +- gdtoa/FreeBSD/gdtoa.h.patch | 24 - gdtoa/FreeBSD/gdtoaimp.h | 227 +- gdtoa/FreeBSD/gdtoaimp.h.patch | 285 - gdtoa/FreeBSD/machdep_ldisd.c | 8 + gdtoa/FreeBSD/machdep_ldisd.c.patch | 14 - gdtoa/FreeBSD/machdep_ldisdd.c | 14 +- gdtoa/FreeBSD/machdep_ldisdd.c.patch | 38 - gdtoa/FreeBSD/machdep_ldisx.c | 14 +- gdtoa/FreeBSD/machdep_ldisx.c.patch | 29 - gdtoa/Makefile.inc | 25 - gdtoa/_hdtoa-fbsd.c | 344 - gdtoa/_ldtoa-fbsd.c | 140 - gdtoa/arith.h | 15 +- gdtoa/gd_qnan.h | 2 +- gdtoa/gdtoa-dmisc-fbsd.c | 1 - gdtoa/gdtoa-dtoa-fbsd.c | 1 - gdtoa/gdtoa-gdtoa-fbsd.c | 1 - gdtoa/gdtoa-gethex-fbsd.c | 407 - gdtoa/gdtoa-gmisc-fbsd.c | 1 - gdtoa/gdtoa-hd_init-fbsd.c | 1 - gdtoa/gdtoa-hexnan-fbsd.c | 214 - gdtoa/gdtoa-misc-fbsd.c | 931 - gdtoa/gdtoa-smisc-fbsd.c | 1 - gdtoa/gdtoa-strtod-fbsd.c | 1044 - gdtoa/gdtoa-strtodg-fbsd.c | 1096 -- gdtoa/gdtoa-strtof-fbsd.c | 94 - gdtoa/gdtoa-strtopdd-fbsd.c | 241 - gdtoa/gdtoa-strtopx-fbsd.c | 114 - gdtoa/gdtoa-strtord-fbsd.c | 69 - gdtoa/gdtoa-sum-fbsd.c | 1 - gdtoa/gdtoa-ulp-fbsd.c | 1 - gdtoa/gdtoa.h | 154 - gdtoa/gdtoa_fltrnds.h | 1 - gdtoa/gdtoaimp.h | 741 - gdtoa/glue-fbsd.c | 1 - gdtoa/machdep_ldisd-fbsd.c | 51 - gdtoa/machdep_ldisdd-fbsd.c | 65 - gdtoa/machdep_ldisx-fbsd.c | 57 - gen/FreeBSD/_rand48.c | 34 +- gen/FreeBSD/_rand48.c.patch | 40 - gen/FreeBSD/alarm.3 | 4 +- gen/FreeBSD/alarm.3.patch | 13 - gen/FreeBSD/arc4random.c.patch | 0 gen/FreeBSD/assert.c | 49 +- gen/FreeBSD/assert.c.patch | 69 - gen/FreeBSD/basename.3 | 25 +- gen/FreeBSD/basename.3.patch | 44 - gen/FreeBSD/basename.c | 4 + gen/FreeBSD/basename.c.patch | 18 - gen/FreeBSD/closedir.c | 2 + gen/FreeBSD/closedir.c.patch | 12 - gen/FreeBSD/ctermid.3 | 19 +- gen/FreeBSD/ctermid.3.patch | 54 - gen/FreeBSD/daemon.3 | 2 + gen/FreeBSD/daemon.3.patch | 11 - gen/FreeBSD/daemon.c | 35 +- gen/FreeBSD/daemon.c.patch | 58 - gen/FreeBSD/dirname.3 | 23 +- gen/FreeBSD/dirname.3.patch | 46 - gen/FreeBSD/dirname.c | 4 + gen/FreeBSD/dirname.c.patch | 13 - gen/FreeBSD/drand48.c | 6 +- gen/FreeBSD/drand48.c.patch | 16 - gen/FreeBSD/erand48.c | 8 +- gen/FreeBSD/erand48.c.patch | 15 - gen/FreeBSD/err.3 | 32 +- gen/FreeBSD/err.3.patch | 66 - gen/FreeBSD/err.c | 170 +- gen/FreeBSD/err.c.patch | 233 - gen/FreeBSD/exec.3 | 61 +- gen/FreeBSD/exec.3.patch | 146 - gen/FreeBSD/exec.c | 11 +- gen/FreeBSD/exec.c.patch | 35 - gen/FreeBSD/fmtmsg.c | 67 +- gen/FreeBSD/fmtmsg.c.patch | 101 - gen/FreeBSD/fnmatch.3 | 13 +- gen/FreeBSD/fnmatch.3.patch | 22 - gen/FreeBSD/fnmatch.c | 266 +- gen/FreeBSD/fnmatch.c.patch | 399 - gen/FreeBSD/ftok.3 | 23 +- gen/FreeBSD/ftok.3.patch | 57 - gen/FreeBSD/getcap.c | 15 +- gen/FreeBSD/getcap.c.patch | 73 - gen/FreeBSD/getcwd.c | 113 +- gen/FreeBSD/getcwd.c.patch | 148 - gen/FreeBSD/gethostname.3 | 8 +- gen/FreeBSD/gethostname.3.patch | 31 - gen/FreeBSD/gethostname.c | 14 + gen/FreeBSD/gethostname.c.patch | 36 - gen/FreeBSD/getlogin.c | 6 +- gen/FreeBSD/getlogin.c.patch | 29 - gen/FreeBSD/getmntinfo.3 | 34 +- gen/FreeBSD/getmntinfo.3.patch | 71 - .../getmntinfo64.c} | 0 gen/FreeBSD/getmntinfo64.c.patch | 37 - gen/FreeBSD/getprogname.3 | 3 +- gen/FreeBSD/getprogname.3.patch | 12 - gen/FreeBSD/getprogname.c | 2 + gen/FreeBSD/getprogname.c.patch | 11 - gen/FreeBSD/glob.3 | 91 +- gen/FreeBSD/glob.3.patch | 176 - gen/FreeBSD/glob.c | 270 +- gen/FreeBSD/glob.c.patch | 634 - gen/FreeBSD/isatty.c | 12 +- gen/FreeBSD/isatty.c.patch | 27 - gen/FreeBSD/jrand48.c | 5 +- gen/FreeBSD/jrand48.c.patch | 12 - gen/FreeBSD/lcong48.c | 12 +- gen/FreeBSD/lcong48.c.patch | 23 - gen/FreeBSD/lockf.3 | 30 +- gen/FreeBSD/lockf.3.patch | 80 - gen/FreeBSD/lockf.c | 23 +- gen/FreeBSD/lockf.c.patch | 45 - gen/FreeBSD/lrand48.c | 6 +- gen/FreeBSD/lrand48.c.patch | 16 - gen/FreeBSD/makecontext.3 | 6 +- gen/FreeBSD/makecontext.3.patch | 22 - gen/FreeBSD/mrand48.c | 6 +- gen/FreeBSD/mrand48.c.patch | 16 - gen/FreeBSD/nice.c | 15 +- gen/FreeBSD/nice.c.patch | 34 - gen/FreeBSD/nrand48.c | 5 +- gen/FreeBSD/nrand48.c.patch | 12 - gen/FreeBSD/opendir.c | 39 +- gen/FreeBSD/opendir.c.patch | 74 - gen/FreeBSD/pause.c | 12 +- gen/FreeBSD/pause.c.patch | 28 - gen/FreeBSD/popen.3 | 36 +- gen/FreeBSD/popen.3.patch | 96 - gen/FreeBSD/popen.c | 168 +- gen/FreeBSD/popen.c.patch | 255 - gen/FreeBSD/pselect.3 | 18 +- gen/FreeBSD/pselect.3.patch | 51 - gen/FreeBSD/pselect.c | 10 + gen/FreeBSD/pselect.c.patch | 25 - gen/FreeBSD/psignal.3 | 13 + gen/FreeBSD/psignal.3.patch | 22 - gen/FreeBSD/rand48.3 | 61 +- gen/FreeBSD/rand48.3.patch | 109 - gen/FreeBSD/rand48.h | 53 +- gen/FreeBSD/rand48.h.patch | 67 - gen/FreeBSD/readdir.c | 6 + gen/FreeBSD/readdir.c.patch | 24 - gen/FreeBSD/readpassphrase.c | 9 +- gen/FreeBSD/readpassphrase.c.patch | 34 - gen/FreeBSD/scandir.3 | 32 +- gen/FreeBSD/scandir.3.patch | 75 - gen/FreeBSD/scandir.c | 19 +- gen/FreeBSD/scandir.c.patch | 28 - gen/{scandir_b-fbsd.c => FreeBSD/scandir_b.c} | 7 +- gen/FreeBSD/scandir_b.c.patch | 69 - gen/FreeBSD/seed48.c | 16 +- gen/FreeBSD/seed48.c.patch | 30 - gen/FreeBSD/setmode.c | 29 +- gen/FreeBSD/setmode.c.patch | 103 - gen/FreeBSD/setprogname.c | 20 +- gen/FreeBSD/setprogname.c.patch | 37 - gen/FreeBSD/siginterrupt.3 | 4 +- gen/FreeBSD/siginterrupt.3.patch | 13 - gen/FreeBSD/siglist.c | 1 - gen/FreeBSD/siglist.c.patch | 7 - gen/FreeBSD/signal.3 | 24 +- gen/FreeBSD/signal.3.patch | 68 - gen/FreeBSD/signal.c | 34 +- gen/FreeBSD/signal.c.patch | 53 - gen/FreeBSD/signbit.3 | 10 +- gen/FreeBSD/signbit.3.patch | 23 - gen/FreeBSD/sleep.3 | 8 +- gen/FreeBSD/sleep.3.patch | 26 - gen/FreeBSD/sleep.c | 5 + gen/FreeBSD/sleep.c.patch | 14 - gen/FreeBSD/srand48.c | 12 +- gen/FreeBSD/srand48.c.patch | 23 - gen/FreeBSD/sysconf.c | 131 +- gen/FreeBSD/sysconf.c.patch | 271 - gen/FreeBSD/sysctl.3 | 54 +- gen/FreeBSD/sysctl.3.patch | 139 - gen/FreeBSD/sysctl.c | 28 +- gen/FreeBSD/sysctl.c.patch | 38 - gen/FreeBSD/telldir.c | 45 +- gen/FreeBSD/telldir.c.patch | 96 - gen/FreeBSD/telldir.h | 15 +- gen/FreeBSD/telldir.h.patch | 34 - gen/FreeBSD/termios.c | 33 +- gen/FreeBSD/termios.c.patch | 105 - gen/FreeBSD/time.3 | 3 +- gen/FreeBSD/time.3.patch | 12 - gen/FreeBSD/time.c | 10 + gen/FreeBSD/time.c.patch | 32 - gen/FreeBSD/times.3 | 6 +- gen/FreeBSD/times.3.patch | 22 - gen/FreeBSD/ttyname.3 | 28 +- gen/FreeBSD/ttyname.3.patch | 72 - gen/FreeBSD/ttyname.c | 103 +- gen/FreeBSD/ttyname.c.patch | 165 - gen/FreeBSD/ualarm.3 | 19 +- gen/FreeBSD/ualarm.3.patch | 47 - gen/FreeBSD/ulimit.3 | 15 +- gen/FreeBSD/ulimit.3.patch | 40 - gen/FreeBSD/unvis.c | 11 +- gen/FreeBSD/unvis.c.patch | 41 - gen/FreeBSD/usleep.3 | 28 +- gen/FreeBSD/usleep.3.patch | 49 - gen/FreeBSD/usleep.c | 10 +- gen/FreeBSD/usleep.c.patch | 30 - gen/FreeBSD/utime.3 | 23 +- gen/FreeBSD/utime.3.patch | 52 - gen/FreeBSD/vis.c | 14 +- gen/FreeBSD/vis.c.patch | 61 - gen/FreeBSD/wait.c | 12 +- gen/FreeBSD/wait.c.patch | 24 - gen/FreeBSD/waitpid.c | 23 +- gen/FreeBSD/waitpid.c.patch | 35 - gen/Makefile.inc | 491 - gen/NetBSD/endutxent.3 | 179 +- gen/NetBSD/endutxent.3.patch | 237 - gen/NetBSD/getlastlogx.3 | 66 +- gen/NetBSD/getlastlogx.3.patch | 149 - gen/NetBSD/utmpx.5 | 109 +- gen/NetBSD/utmpx.5.patch | 136 - gen/NetBSD/utmpx.c | 586 +- gen/NetBSD/utmpx.c.patch | 765 - gen/_rand48-fbsd.c | 21 - gen/_simple.h | 1 + gen/alarm-fbsd.c | 1 - gen/alarm.3 | 94 - gen/arc4random-fbsd.c | 351 - gen/arc4random.3 | 1 - gen/asl.3 | 94 +- gen/asl.c | 776 +- gen/asl_core.c | 509 +- gen/asl_core.h | 58 +- gen/asl_fd.c | 289 + gen/asl_file.c | 17 +- gen/asl_file.h | 4 +- gen/asl_ipc.defs | 2 +- gen/asl_legacy1.c | 66 +- gen/asl_legacy1.h | 26 +- gen/asl_msg.c | 1966 +- gen/asl_msg.h | 51 +- gen/asl_private.h | 21 +- gen/asl_store.c | 2 +- gen/asl_store.h | 4 +- gen/asl_util.c | 2 +- gen/assert-fbsd.c | 93 - gen/assumes.c | 327 +- gen/assumes.h | 173 +- gen/basename-fbsd.c | 88 - gen/basename.3 | 120 - gen/clock-fbsd.c | 1 - gen/clock.3 | 1 - gen/closedir-fbsd.c | 72 - gen/confstr.3 | 5 + gen/confstr.c | 53 +- gen/ctermid-fbsd.c | 1 - gen/ctermid.3 | 108 - gen/daemon-fbsd.c | 124 - gen/daemon.3 | 114 - gen/directory.3 | 7 +- .../pthreads/pthread_self_64.s => gen/dirfd.c | 23 +- gen/dirname-fbsd.c | 81 - gen/dirname.3 | 114 - gen/drand48-fbsd.c | 25 - gen/endutxent.3 | 335 - gen/endutxent.3.orig | 202 - gen/erand48-fbsd.c | 26 - gen/err-fbsd.c | 311 - gen/err.3 | 263 - gen/errlst.c | 2 + gen/exec-fbsd.c | 289 - gen/exec.3 | 326 - gen/fmtcheck-fbsd.c | 1 - gen/fmtcheck.3 | 1 - gen/fmtmsg-fbsd.c | 271 - gen/fmtmsg.3 | 1 - gen/fnmatch-fbsd.c | 471 - gen/fnmatch.3 | 162 - gen/ftok-fbsd.c | 1 - gen/ftok.3 | 88 - gen/getbsize-fbsd.c | 1 - gen/getbsize.3 | 1 - gen/getcap-fbsd.c | 1058 - gen/getcap-fbsd.c.orig | 1055 - gen/getcap.3 | 1 - gen/getcontext.3 | 1 - gen/getcwd-fbsd.c | 334 - gen/getcwd.3 | 1 - gen/gethostname-fbsd.c | 71 - gen/gethostname.3 | 131 - gen/getlastlogx.3 | 139 - gen/getlastlogx.3.orig | 173 - gen/getlogin-fbsd.c | 101 - gen/getmntinfo-fbsd.c | 1 - gen/getmntinfo.3 | 135 - gen/getmntinfo64-fbsd.c.orig | 68 - gen/getpagesize-fbsd.c | 1 - gen/getpagesize.3 | 1 - gen/getpass.3 | 1 - gen/getpeereid-fbsd.c | 1 - gen/getpeereid.3 | 1 - gen/getprogname-fbsd.c | 19 - gen/getprogname.3 | 93 - gen/glob-fbsd.c | 998 - gen/glob.3 | 546 - gen/isatty-fbsd.c | 56 - gen/jrand48-fbsd.c | 25 - gen/lcong48-fbsd.c | 25 - gen/lockf-fbsd.c | 96 - gen/lockf.3 | 270 - gen/lrand48-fbsd.c | 24 - gen/magazine_malloc.c | 36 +- gen/makecontext.3 | 122 - gen/malloc.c | 24 +- gen/mrand48-fbsd.c | 24 - gen/nice-fbsd.c | 65 - gen/nice.3 | 1 - gen/nrand48-fbsd.c | 25 - gen/opendir-fbsd.c | 277 - gen/pause-fbsd.c | 58 - gen/pause-fbsd.c.orig | 48 - gen/pause.3 | 1 - gen/platfunc.c | 8 +- gen/popen-fbsd.c | 262 - gen/popen.3 | 205 - gen/pselect-fbsd.c | 88 - gen/pselect.3 | 127 - gen/psignal-fbsd.c | 1 - gen/psignal.3 | 122 - gen/raise-fbsd.c | 1 - gen/raise.3 | 1 - gen/rand48.3 | 201 - gen/rand48.h | 81 - gen/readdir-fbsd.c | 138 - gen/readpassphrase-fbsd.c | 181 - gen/readpassphrase.3 | 1 - gen/rewinddir-fbsd.c | 1 - gen/scandir-fbsd.c | 132 - gen/scandir.3 | 134 - gen/seed48-fbsd.c | 29 - gen/seekdir-fbsd.c | 1 - gen/sethostname-fbsd.c | 1 - gen/setmode-fbsd.c | 469 - gen/setmode.3 | 1 - gen/setprogname-fbsd.c | 33 - gen/siginterrupt-fbsd.c | 1 - gen/siginterrupt.3 | 120 - gen/siglist-fbsd.c | 106 - gen/signal-fbsd.c | 91 - gen/signal.3 | 276 - gen/signbit.3 | 53 - gen/sleep-fbsd.c | 72 - gen/sleep.3 | 83 - gen/srand48-fbsd.c | 22 - gen/stack_logging.c | 3 +- gen/stack_logging.h | 2 + gen/stack_logging_disk.c | 75 +- gen/stringlist-fbsd.c | 1 - gen/stringlist.3 | 1 - gen/sync_volume_np.3 | 81 + gen/sync_volume_np.c | 80 + gen/sysconf-fbsd.c | 627 - gen/sysconf.3 | 1 - gen/sysctl-fbsd.c | 209 - gen/sysctl.3 | 870 - gen/sysctlbyname-fbsd.c | 1 - gen/sysctlnametomib-fbsd.c | 1 - gen/telldir-fbsd.c | 170 - gen/telldir.h | 77 - gen/termios-fbsd.c | 285 - gen/thread_stack_pcs.c | 6 +- gen/time-fbsd.c | 63 - gen/time.3 | 101 - gen/times-fbsd.c | 1 - gen/times.3 | 146 - gen/timezone-fbsd.c | 1 - gen/timezone.3 | 1 - gen/ttyname-fbsd.c | 212 - gen/ttyname.3 | 135 - gen/ttyslot-fbsd.c | 1 - gen/ualarm-fbsd.c | 1 - gen/ualarm.3 | 100 - gen/ucontext.3 | 1 - gen/ulimit-fbsd.c | 1 - gen/ulimit.3 | 101 - gen/unvis-fbsd.c | 296 - gen/unvis.3 | 1 - gen/usleep-fbsd.c | 54 - gen/usleep.3 | 84 - gen/utime-fbsd.c | 1 - gen/utime.3 | 95 - gen/utmpx-nbsd.c | 578 - gen/utmpx.5 | 101 - gen/vis-fbsd.c | 205 - gen/vis.3 | 1 - gen/wait-fbsd.c | 60 - gen/wait3-fbsd.c | 1 - gen/waitpid-fbsd.c | 71 - gen/zone.c | 187 - gmon/Makefile.inc | 37 - gmon/gmon.c | 573 +- i386/gen/Makefile.inc | 24 - i386/pthreads/Makefile.inc | 17 - i386/pthreads/get_cpu_capabilities.s | 35 - i386/pthreads/pthread_mutex_lock.s | 6 +- i386/stdlib/gdtoa.mk | 2 - i386/string/Makefile.inc | 44 - i386/sys/Makefile.inc | 20 - i386/sys/OSAtomic.s | 9 +- include/FreeBSD/nl_types.h | 9 +- include/FreeBSD/nl_types.h.patch | 32 - include/Makefile.inc | 126 - include/NetBSD/utmpx.h | 153 +- include/NetBSD/utmpx.h.patch | 207 - include/arpa/Makefile.inc | 5 - include/asl.h | 114 +- include/dirent.h | 130 +- include/err.h | 24 +- include/grp.h | 117 - include/inttypes.h | 38 +- include/libkern/Makefile.inc | 7 - include/libkern/OSAtomic.h | 9 - include/libkern/OSMemoryNotification.h | 34 +- include/libkern/OSThermalNotification.h | 1 + include/limits.h | 10 +- include/malloc/Makefile.inc | 2 - include/nl_types.h | 106 - include/objc/Makefile.inc | 2 - include/objc/zone.h | 66 - include/protocols/Makefile.inc | 5 - include/pwd.h | 148 - include/regex.h | 176 +- include/secure/Makefile.inc | 5 - include/secure/_stdio.h | 12 +- include/setjmp.h | 62 +- include/spawn_private.h | 12 + include/stdio.h | 38 +- include/stdlib.h | 2 +- include/sys/Makefile.inc | 3 - include/sys/cdefs.h | 12 +- include/unistd.h | 25 +- include/utmpx.h | 185 - include/wchar.h | 27 +- include/xlocale.h | 3 + include/xlocale/Makefile.inc | 6 - include/xlocale/_regex.h | 50 + include/xlocale/_stdio.h | 36 +- include/xlocale/_stdlib.h | 3 +- include/xlocale/_wchar.h | 37 +- internat/Makefile.inc | 6 - internat/NXCType.c | 599 - internat/NXCType.h | 59 - internat/NXIsDigit.c | 37 - internat/NXIsGraph.c | 38 - internat/NXIsLower.c | 37 - internat/NXIsPrint.c | 38 - internat/NXIsPunct.c | 37 - internat/NXIsSpace.c | 37 - internat/NXIsUpper.c | 37 - internat/NXIsXDigit.c | 37 - internat/NXToAscii.c | 251 - internat/NXToLower.c | 36 - internat/NXToUpper.c | 36 - internat/_NXToLower.c | 38 - internat/_NXToUpper.c | 38 - interposable.list | 33 - locale/FreeBSD/ascii.c | 39 +- locale/FreeBSD/ascii.c.patch | 89 - locale/FreeBSD/big5.c | 31 +- locale/FreeBSD/big5.c.patch | 74 - locale/FreeBSD/btowc.3 | 46 +- locale/FreeBSD/btowc.3.patch | 72 - locale/FreeBSD/btowc.c | 13 +- locale/FreeBSD/btowc.c.patch | 40 - locale/FreeBSD/collate.c | 937 +- locale/FreeBSD/collate.c.patch | 1019 - locale/FreeBSD/collate.h | 74 +- locale/FreeBSD/collate.h.patch | 103 - locale/FreeBSD/collcmp.c | 10 +- locale/FreeBSD/collcmp.c.patch | 27 - locale/FreeBSD/ctype.3 | 9 +- locale/FreeBSD/ctype.3.patch | 25 - locale/FreeBSD/digittoint.3 | 25 +- locale/FreeBSD/digittoint.3.patch | 50 - locale/FreeBSD/euc.c | 47 +- locale/FreeBSD/euc.c.patch | 118 - locale/FreeBSD/fix_grouping.c | 14 +- locale/FreeBSD/fix_grouping.c.patch | 27 - locale/FreeBSD/gb18030.c | 33 +- locale/FreeBSD/gb18030.c.patch | 86 - locale/FreeBSD/gb2312.c | 34 +- locale/FreeBSD/gb2312.c.patch | 85 - locale/FreeBSD/gbk.c | 31 +- locale/FreeBSD/gbk.c.patch | 74 - locale/FreeBSD/isalnum.3 | 3 +- locale/FreeBSD/isalnum.3.patch | 19 - locale/FreeBSD/isalpha.3 | 3 +- locale/FreeBSD/isalpha.3.patch | 19 - locale/FreeBSD/isblank.3 | 1 + locale/FreeBSD/isblank.3.patch | 10 - locale/FreeBSD/iscntrl.3 | 3 +- locale/FreeBSD/iscntrl.3.patch | 19 - locale/FreeBSD/isdigit.3 | 1 + locale/FreeBSD/isdigit.3.patch | 10 - locale/FreeBSD/isgraph.3 | 3 +- locale/FreeBSD/isgraph.3.patch | 19 - locale/FreeBSD/isideogram.3 | 3 +- locale/FreeBSD/isideogram.3.patch | 12 - locale/FreeBSD/islower.3 | 1 + locale/FreeBSD/islower.3.patch | 10 - locale/FreeBSD/isphonogram.3 | 3 +- locale/FreeBSD/isphonogram.3.patch | 12 - locale/FreeBSD/isprint.3 | 3 +- locale/FreeBSD/isprint.3.patch | 19 - locale/FreeBSD/ispunct.3 | 5 +- locale/FreeBSD/ispunct.3.patch | 28 - locale/FreeBSD/isrune.3 | 3 +- locale/FreeBSD/isrune.3.patch | 12 - locale/FreeBSD/isspace.3 | 5 +- locale/FreeBSD/isspace.3.patch | 22 - locale/FreeBSD/isspecial.3 | 3 +- locale/FreeBSD/isspecial.3.patch | 12 - locale/FreeBSD/isupper.3 | 3 +- locale/FreeBSD/isupper.3.patch | 19 - locale/FreeBSD/iswalnum.3 | 11 +- locale/FreeBSD/iswalnum.3.patch | 36 - locale/FreeBSD/isxdigit.3 | 1 + locale/FreeBSD/isxdigit.3.patch | 10 - locale/FreeBSD/ldpart.c | 30 +- locale/FreeBSD/ldpart.c.patch | 65 - locale/FreeBSD/ldpart.h | 2 +- locale/FreeBSD/ldpart.h.patch | 11 - locale/FreeBSD/lmessages.c | 76 +- locale/FreeBSD/lmessages.c.patch | 112 - locale/FreeBSD/lmessages.h | 6 +- locale/FreeBSD/lmessages.h.patch | 21 - locale/FreeBSD/lmonetary.c | 126 +- locale/FreeBSD/lmonetary.c.patch | 202 - locale/FreeBSD/lmonetary.h | 6 +- locale/FreeBSD/lmonetary.h.patch | 21 - locale/FreeBSD/lnumeric.c | 86 +- locale/FreeBSD/lnumeric.c.patch | 131 - locale/FreeBSD/lnumeric.h | 6 +- locale/FreeBSD/lnumeric.h.patch | 20 - locale/FreeBSD/localeconv.3 | 23 +- locale/FreeBSD/localeconv.3.patch | 52 - locale/FreeBSD/localeconv.c | 115 +- locale/FreeBSD/localeconv.c.patch | 163 - locale/FreeBSD/mblen.3 | 47 +- locale/FreeBSD/mblen.3.patch | 93 - locale/FreeBSD/mblen.c | 16 +- locale/FreeBSD/mblen.c.patch | 39 - locale/FreeBSD/mblocal.h | 44 +- locale/FreeBSD/mblocal.h.patch | 56 - locale/FreeBSD/mbrlen.3 | 35 +- locale/FreeBSD/mbrlen.3.patch | 76 - locale/FreeBSD/mbrlen.c | 18 +- locale/FreeBSD/mbrlen.c.patch | 31 - locale/FreeBSD/mbrtowc.3 | 42 +- locale/FreeBSD/mbrtowc.3.patch | 89 - locale/FreeBSD/mbrtowc.c | 18 +- locale/FreeBSD/mbrtowc.c.patch | 32 - locale/FreeBSD/mbsinit.3 | 22 +- locale/FreeBSD/mbsinit.3.patch | 58 - locale/FreeBSD/mbsinit.c | 13 +- locale/FreeBSD/mbsinit.c.patch | 26 - locale/FreeBSD/mbsnrtowcs.c | 29 +- locale/FreeBSD/mbsnrtowcs.c.patch | 69 - locale/FreeBSD/mbsrtowcs.3 | 59 +- locale/FreeBSD/mbsrtowcs.3.patch | 96 - locale/FreeBSD/mbsrtowcs.c | 18 +- locale/FreeBSD/mbsrtowcs.c.patch | 35 - locale/FreeBSD/mbstowcs.3 | 38 +- locale/FreeBSD/mbstowcs.3.patch | 69 - locale/FreeBSD/mbstowcs.c | 14 +- locale/FreeBSD/mbstowcs.c.patch | 34 - locale/FreeBSD/mbtowc.3 | 46 +- locale/FreeBSD/mbtowc.3.patch | 97 - locale/FreeBSD/mbtowc.c | 17 +- locale/FreeBSD/mbtowc.c.patch | 40 - locale/FreeBSD/mskanji.c | 31 +- locale/FreeBSD/mskanji.c.patch | 74 - locale/FreeBSD/nextwctype.3 | 17 +- locale/FreeBSD/nextwctype.3.patch | 47 - locale/FreeBSD/nextwctype.c | 16 +- locale/FreeBSD/nextwctype.c.patch | 48 - locale/FreeBSD/nl_langinfo.3 | 25 +- locale/FreeBSD/nl_langinfo.3.patch | 48 - locale/FreeBSD/nl_langinfo.c | 67 +- locale/FreeBSD/nl_langinfo.c.patch | 167 - locale/FreeBSD/none.c | 65 +- locale/FreeBSD/none.c.patch | 127 - locale/FreeBSD/rune.c | 184 +- locale/FreeBSD/rune.c.patch | 292 - locale/{ => FreeBSD}/rune32.h | 5 + locale/FreeBSD/runetype.c | 14 +- locale/FreeBSD/runetype.c.patch | 39 - locale/FreeBSD/setlocale.3 | 11 +- locale/FreeBSD/setlocale.3.patch | 32 - locale/FreeBSD/setlocale.c | 56 +- locale/FreeBSD/setlocale.c.patch | 178 - locale/FreeBSD/setlocale.h | 4 +- locale/FreeBSD/setlocale.h.patch | 18 - locale/FreeBSD/setrunelocale.c | 173 +- locale/FreeBSD/setrunelocale.c.patch | 249 - locale/FreeBSD/table.c | 225 +- locale/FreeBSD/table.c.patch | 244 - locale/FreeBSD/tolower.3 | 27 +- locale/FreeBSD/tolower.3.patch | 60 - locale/FreeBSD/tolower.c | 23 +- locale/FreeBSD/tolower.c.patch | 50 - locale/FreeBSD/toupper.3 | 27 +- locale/FreeBSD/toupper.3.patch | 60 - locale/FreeBSD/toupper.c | 23 +- locale/FreeBSD/toupper.c.patch | 50 - locale/FreeBSD/towlower.3 | 27 +- locale/FreeBSD/towlower.3.patch | 55 - locale/FreeBSD/towupper.3 | 27 +- locale/FreeBSD/towupper.3.patch | 55 - locale/{utf2-fbsd.c => FreeBSD/utf2.c} | 2 + locale/FreeBSD/utf2.c.patch | 246 - locale/FreeBSD/utf8.c | 55 +- locale/FreeBSD/utf8.c.patch | 160 - locale/FreeBSD/wcrtomb.3 | 37 +- locale/FreeBSD/wcrtomb.3.patch | 81 - locale/FreeBSD/wcrtomb.c | 18 +- locale/FreeBSD/wcrtomb.c.patch | 31 - locale/FreeBSD/wcsftime.3 | 34 +- locale/FreeBSD/wcsftime.3.patch | 68 - locale/FreeBSD/wcsftime.c | 27 +- locale/FreeBSD/wcsftime.c.patch | 81 - locale/FreeBSD/wcsnrtombs.c | 33 +- locale/FreeBSD/wcsnrtombs.c.patch | 82 - locale/FreeBSD/wcsrtombs.3 | 67 +- locale/FreeBSD/wcsrtombs.3.patch | 111 - locale/FreeBSD/wcsrtombs.c | 18 +- locale/FreeBSD/wcsrtombs.c.patch | 35 - locale/FreeBSD/wcstod.3 | 33 +- locale/FreeBSD/wcstod.3.patch | 68 - locale/FreeBSD/wcstod.c | 83 +- locale/FreeBSD/wcstod.c.patch | 125 - locale/FreeBSD/wcstof.c | 53 +- locale/FreeBSD/wcstof.c.patch | 85 - locale/FreeBSD/wcstoimax.c | 20 +- locale/FreeBSD/wcstoimax.c.patch | 60 - locale/FreeBSD/wcstol.3 | 79 +- locale/FreeBSD/wcstol.3.patch | 131 - locale/FreeBSD/wcstol.c | 18 +- locale/FreeBSD/wcstol.c.patch | 58 - locale/FreeBSD/wcstold.c | 53 +- locale/FreeBSD/wcstold.c.patch | 85 - locale/FreeBSD/wcstoll.c | 18 +- locale/FreeBSD/wcstoll.c.patch | 58 - locale/FreeBSD/wcstombs.3 | 41 +- locale/FreeBSD/wcstombs.3.patch | 78 - locale/FreeBSD/wcstombs.c | 14 +- locale/FreeBSD/wcstombs.c.patch | 34 - locale/FreeBSD/wcstoul.c | 18 +- locale/FreeBSD/wcstoul.c.patch | 58 - locale/FreeBSD/wcstoull.c | 20 +- locale/FreeBSD/wcstoull.c.patch | 60 - locale/FreeBSD/wcstoumax.c | 20 +- locale/FreeBSD/wcstoumax.c.patch | 60 - locale/FreeBSD/wctob.c | 13 +- locale/FreeBSD/wctob.c.patch | 33 - locale/FreeBSD/wctomb.3 | 50 +- locale/FreeBSD/wctomb.3.patch | 96 - locale/FreeBSD/wctomb.c | 16 +- locale/FreeBSD/wctomb.c.patch | 38 - locale/FreeBSD/wctrans.3 | 46 +- locale/FreeBSD/wctrans.3.patch | 82 - locale/FreeBSD/wctrans.c | 26 +- locale/FreeBSD/wctrans.c.patch | 59 - locale/FreeBSD/wctype.3 | 46 +- locale/FreeBSD/wctype.3.patch | 87 - locale/FreeBSD/wctype.c | 34 +- locale/FreeBSD/wctype.c.patch | 54 - locale/FreeBSD/wcwidth.3 | 29 +- locale/FreeBSD/wcwidth.3.patch | 64 - locale/FreeBSD/wcwidth.c | 12 +- locale/FreeBSD/wcwidth.c.patch | 26 - locale/Makefile.inc | 269 - locale/ascii-fbsd.c | 186 - locale/big5-fbsd.c | 174 - locale/big5.5 | 1 - locale/btowc-fbsd.c | 62 - locale/btowc.3 | 117 - locale/collate-fbsd.c | 954 - locale/collate.h | 123 - locale/collcmp-fbsd.c | 46 - locale/ctype.3 | 158 - locale/digittoint.3 | 78 - locale/euc-fbsd.c | 277 - locale/euc.5 | 1 - locale/fix_grouping-fbsd.c | 98 - locale/gb18030-fbsd.c | 222 - locale/gb18030.5 | 1 - locale/gb2312-fbsd.c | 157 - locale/gb2312.5 | 1 - locale/gbk-fbsd.c | 167 - locale/gbk.5 | 1 - locale/isalnum.3 | 104 - locale/isalpha.3 | 102 - locale/isascii.3 | 1 - locale/isblank.3 | 85 - locale/iscntrl.3 | 92 - locale/isdigit.3 | 103 - locale/isgraph.3 | 107 - locale/isideogram.3 | 58 - locale/islower.3 | 92 - locale/isphonogram.3 | 58 - locale/isprint.3 | 105 - locale/ispunct.3 | 97 - locale/isrune.3 | 64 - locale/isspace.3 | 89 - locale/isspecial.3 | 57 - locale/isupper.3 | 92 - locale/iswalnum.3 | 165 - locale/isxdigit.3 | 103 - locale/ldpart-fbsd.c | 158 - locale/ldpart.h | 39 - locale/lmessages-fbsd.c | 123 - locale/lmessages.h | 44 - locale/lmonetary-fbsd.c | 230 - locale/lmonetary.h | 61 - locale/lnumeric-fbsd.c | 129 - locale/lnumeric.h | 43 - locale/localeconv-fbsd.c | 195 - locale/localeconv.3 | 239 - locale/mblen-fbsd.c | 58 - locale/mblen.3 | 127 - locale/mblocal.h | 64 - locale/mbrlen-fbsd.c | 49 - locale/mbrlen.3 | 168 - locale/mbrtowc-fbsd.c | 50 - locale/mbrtowc.3 | 161 - locale/mbsinit-fbsd.c | 47 - locale/mbsinit.3 | 81 - locale/mbsnrtowcs-fbsd.c | 102 - locale/mbsrtowcs-fbsd.c | 53 - locale/mbsrtowcs.3 | 174 - locale/mbstowcs-fbsd.c | 55 - locale/mbstowcs.3 | 107 - locale/mbtowc-fbsd.c | 59 - locale/mbtowc.3 | 134 - locale/mskanji-fbsd.c | 159 - locale/mskanji.5 | 1 - locale/multibyte.3 | 1 - locale/nextwctype-fbsd.c | 100 - locale/nextwctype.3 | 80 - locale/nl_langinfo-fbsd.c | 190 - locale/nl_langinfo.3 | 109 - locale/nomacros-fbsd.c | 1 - locale/none-fbsd.c | 171 - locale/rune-fbsd.c | 365 - locale/runetype-fbsd.c | 76 - locale/setlocale-fbsd.c | 356 - locale/setlocale.3 | 177 - locale/setlocale.h | 42 - locale/setrunelocale-fbsd.c | 209 - locale/table-fbsd.c | 468 - locale/toascii.3 | 1 - locale/tolower-fbsd.c | 83 - locale/tolower.3 | 98 - locale/toupper-fbsd.c | 83 - locale/toupper.3 | 98 - locale/towlower.3 | 85 - locale/towupper.3 | 85 - locale/utf8-fbsd.c | 430 - locale/utf8.5 | 1 - locale/wcrtomb-fbsd.c | 49 - locale/wcrtomb.3 | 128 - locale/wcsftime-fbsd.c | 119 - locale/wcsftime.3 | 88 - locale/wcsnrtombs-fbsd.c | 122 - locale/wcsrtombs-fbsd.c | 53 - locale/wcsrtombs.3 | 175 - locale/wcstod-fbsd.c | 125 - locale/wcstod.3 | 90 - locale/wcstof-fbsd.c | 93 - locale/wcstoimax-fbsd.c | 134 - locale/wcstol-fbsd.c | 127 - locale/wcstol.3 | 141 - locale/wcstold-fbsd.c | 93 - locale/wcstoll-fbsd.c | 133 - locale/wcstombs-fbsd.c | 55 - locale/wcstombs.3 | 111 - locale/wcstoul-fbsd.c | 125 - locale/wcstoull-fbsd.c | 132 - locale/wcstoumax-fbsd.c | 132 - locale/wctob-fbsd.c | 54 - locale/wctomb-fbsd.c | 57 - locale/wctomb.3 | 128 - locale/wctrans-fbsd.c | 100 - locale/wctrans.3 | 156 - locale/wctype-fbsd.c | 88 - locale/wctype.3 | 153 - locale/wcwidth-fbsd.c | 60 - locale/wcwidth.3 | 106 - locale/xlocale.c | 2 +- makeCombos | 50 - man/FreeBSD/stdarg.3 | 77 +- man/FreeBSD/stdarg.3.patch | 126 - man/Makefile.inc | 39 - man/manpages.lst | 423 + man/stdarg.3 | 245 - net/FreeBSD/inet.3 | 68 +- net/FreeBSD/inet.3.patch | 113 - net/FreeBSD/inet_addr.c | 20 +- net/FreeBSD/inet_addr.c.patch | 13 - net/FreeBSD/inet_net.3 | 10 +- net/FreeBSD/inet_net.3.patch | 26 - net/FreeBSD/inet_net_pton.c | 4 + net/FreeBSD/inet_net_pton.c.patch | 13 - net/FreeBSD/inet_network.c | 4 + net/FreeBSD/inet_network.c.patch | 13 - net/FreeBSD/inet_ntoa.c | 2 + net/FreeBSD/inet_ntoa.c.patch | 18 - net/FreeBSD/nsap_addr.c | 14 +- net/FreeBSD/nsap_addr.c.patch | 42 - net/FreeBSD/recv.c | 12 +- net/FreeBSD/recv.c.patch | 25 - net/FreeBSD/send.c | 12 +- net/FreeBSD/send.c.patch | 25 - net/FreeBSD/sockatmark.3 | 2 +- net/FreeBSD/sockatmark.3.patch | 11 - net/FreeBSD/sourcefilter.3 | 4 +- net/FreeBSD/sourcefilter.3.patch | 13 - net/FreeBSD/sourcefilter.c | 7 + net/FreeBSD/sourcefilter.c.patch | 23 - net/Makefile.inc | 69 - net/addr2ascii-fbsd.c | 1 - net/addr2ascii.3 | 1 - net/ascii2addr-fbsd.c | 1 - net/inet.3 | 329 - net/inet_addr-fbsd.c | 219 - net/inet_lnaof-fbsd.c | 1 - net/inet_makeaddr-fbsd.c | 1 - net/inet_net.3 | 167 - net/inet_net_ntop-fbsd.c | 1 - net/inet_net_pton-fbsd.c | 420 - net/inet_neta-fbsd.c | 1 - net/inet_netof-fbsd.c | 1 - net/inet_network-fbsd.c | 115 - net/inet_ntoa-fbsd.c | 80 - net/linkaddr-fbsd.c | 1 - net/linkaddr.3 | 1 - net/nsap_addr-fbsd.c | 132 - net/recv-fbsd.c | 60 - net/send-fbsd.c | 60 - net/sockatmark-fbsd.c | 1 - net/sockatmark.3 | 123 - net/sourcefilter-fbsd.c | 409 - net/sourcefilter.3 | 238 - nls/FreeBSD/msgcat.c | 85 +- nls/FreeBSD/msgcat.c.patch | 204 - nls/FreeBSD/msgcat.h | 33 +- nls/FreeBSD/msgcat.h.patch | 85 - nls/Makefile.inc | 21 - nls/catclose.3 | 1 - nls/catgets.3 | 1 - nls/catopen.3 | 1 - nls/msgcat-fbsd.c | 470 - nls/msgcat.h | 149 - posix1e/Makefile.inc | 74 - posix1e/acl_translate.c | 2 +- ppc/gen/Makefile.inc | 22 - ppc/gen/_ctx_start.S | 62 - ppc/gen/_setcontext.S | 76 - ppc/gen/abs.s | 63 - ppc/gen/assymdefs.c | 88 - ppc/gen/fp.h | 63 - ppc/gen/genassym.c | 206 - ppc/gen/genassym.h | 127 - ppc/gen/getcontext.S | 62 - ppc/gen/getmcontext.c | 82 - ppc/gen/icacheinval.s | 42 - ppc/gen/makecontext.c | 160 - ppc/gen/mcount.s | 45 - ppc/gen/setcontext.c | 42 - ppc/gen/swapcontext.c | 81 - ppc/pthreads/Makefile.inc | 7 - ppc/pthreads/get_cpu_capabilities.s | 35 - ppc/pthreads/init_cpu_capabilities.c | 42 - ppc/pthreads/pthread_getspecific.s | 34 - ppc/pthreads/pthread_self.s | 31 - ppc/pthreads/pthread_set_self.s | 29 - ppc/stdlib/gdtoa.mk | 8 - ppc/string/Makefile.inc | 27 - ppc/string/bcopy.s | 43 - ppc/string/bzero.s | 48 - ppc/string/ffs.s | 50 - ppc/string/ffsl.s | 59 - ppc/string/flsl.s | 36 - ppc/string/memcmp.s | 176 - ppc/string/memset.s | 300 - ppc/string/strcat.s | 171 - ppc/string/strcmp.s | 184 - ppc/string/strcpy.s | 132 - ppc/string/strlcat.s | 288 - ppc/string/strlcpy.s | 197 - ppc/string/strlen.s | 100 - ppc/string/strncat.s | 225 - ppc/string/strncmp.s | 208 - ppc/string/strncpy.s | 170 - ppc/sys/Makefile.inc | 10 - ppc/sys/OSAtomic.s | 487 - ppc/sys/_longjmp.s | 174 - ppc/sys/_setjmp.h | 130 - ppc/sys/_setjmp.s | 142 - ppc/sys/_sigtramp.s | 529 - ppc/sys/ldbl64.s | 76 - ppc/sys/longjmp.s | 83 - ppc/sys/ppc_gettimeofday.s | 32 - ppc/sys/setjmp.s | 87 - ppc64/gen/Makefile.inc | 11 - ppc64/pthreads/Makefile.inc | 9 - ppc64/pthreads/pthread_getspecific_64.s | 36 - ppc64/stdlib/gdtoa.mk | 5 - ppc64/string/Makefile.inc | 25 - ppc64/sys/Makefile.inc | 10 - pthreads/Makefile.inc | 119 - pthreads/plockstat.d | 3 +- pthreads/pthread.c | 282 +- pthreads/pthread_cancelable.c | 11 +- pthreads/pthread_cond.c | 89 +- pthreads/pthread_internals.h | 9 +- pthreads/pthread_machdep.h | 151 +- pthreads/pthread_mutex.c | 25 +- pthreads/pthread_rwlock.c | 36 +- pthreads/pthread_workqueue.h | 12 + pthreads/thread_setup.c | 2 +- regex/FreeBSD/cclass.h | 63 - regex/FreeBSD/cname.h | 200 +- regex/FreeBSD/cname.h.patch | 13 - regex/FreeBSD/engine.c | 1191 -- regex/FreeBSD/engine.c.patch | 184 - regex/FreeBSD/re_format.7 | 346 +- regex/FreeBSD/regcomp.c | 1776 -- regex/FreeBSD/regcomp.c.patch | 514 - regex/FreeBSD/regerror.c | 12 +- regex/FreeBSD/regerror.c.patch | 38 - regex/FreeBSD/regex.3 | 326 +- regex/FreeBSD/regex.3.patch | 67 - regex/FreeBSD/regex2.h | 192 - regex/FreeBSD/regex2.h.patch | 70 - regex/FreeBSD/regexec.c | 233 - regex/FreeBSD/regexec.c.patch | 55 - regex/FreeBSD/regfree.c | 89 - regex/FreeBSD/regfree.c.patch | 10 - regex/Makefile.inc | 31 - regex/TRE/config.h | 262 + regex/TRE/lib/regcomp.c | 203 + regex/TRE/lib/regexec.c | 558 + regex/TRE/lib/tre-ast.c | 226 + regex/TRE/lib/tre-ast.h | 141 + regex/TRE/lib/tre-compile.c | 3445 ++++ regex/TRE/lib/tre-compile.h | 27 + regex/TRE/lib/tre-internal.h | 354 + regex/TRE/lib/tre-match-backtrack.c | 789 + regex/TRE/lib/tre-match-parallel.c | 526 + regex/TRE/lib/tre-match-utils.h | 620 + regex/TRE/lib/tre-mem.c | 155 + regex/TRE/lib/tre-mem.h | 68 + regex/TRE/lib/tre-parse.c | 2334 +++ regex/TRE/lib/tre-parse.h | 62 + regex/TRE/lib/tre-stack.c | 125 + regex/TRE/lib/tre-stack.h | 77 + regex/TRE/lib/tre.h | 328 + regex/TRE/lib/xmalloc.h | 77 + regex/TRE/tre-0.8.0.tar.bz2 | Bin 0 -> 380714 bytes regex/TRE/tre-config.h | 44 + regex/TRE/tre-last-matched.h | 109 + regex/cclass.h | 1 - regex/cname.h | 138 - regex/cname.h.orig | 138 - regex/engine.c | 1203 -- regex/re_format.7 | 1 - regex/regcomp-fbsd.c | 1876 -- regex/regerror-fbsd.c | 174 - regex/regerror-fbsd.c.orig | 174 - regex/regex.3 | 735 - regex/regex2.h | 202 - regex/regexec-fbsd.c | 239 - regex/regfree-fbsd.c | 90 - regex/utils.h | 1 - rpc/Makefile.inc | 171 - secure/Makefile.inc | 21 - secure/snprintf_chk.c | 3 +- secure/sprintf_chk.c | 3 +- secure/vsnprintf_chk.c | 3 +- secure/vsprintf_chk.c | 3 +- stdio/FreeBSD/asprintf.c | 16 +- stdio/FreeBSD/asprintf.c.patch | 32 - stdio/FreeBSD/dprintf.c | 17 +- stdio/FreeBSD/dprintf.c.patch | 33 - stdio/FreeBSD/fclose.c | 9 +- stdio/FreeBSD/fclose.c.patch | 25 - stdio/FreeBSD/fdopen.c | 11 +- stdio/FreeBSD/fdopen.c.patch | 27 - stdio/FreeBSD/fflush.c | 24 +- stdio/FreeBSD/fflush.c.patch | 25 - stdio/FreeBSD/fgetln.3 | 3 + stdio/FreeBSD/fgetln.3.patch | 12 - stdio/FreeBSD/fgetln.c | 6 + stdio/FreeBSD/fgetln.c.patch | 29 - stdio/FreeBSD/fgetwc.c | 26 +- stdio/FreeBSD/fgetwc.c.patch | 61 - stdio/FreeBSD/fgetwln.3 | 17 +- stdio/FreeBSD/fgetwln.3.patch | 44 - stdio/FreeBSD/fgetwln.c | 10 +- stdio/FreeBSD/fgetwln.c.patch | 30 - stdio/FreeBSD/fgetws.3 | 37 +- stdio/FreeBSD/fgetws.3.patch | 88 - stdio/FreeBSD/fgetws.c | 21 +- stdio/FreeBSD/fgetws.c.patch | 64 - stdio/FreeBSD/findfp.c | 102 +- stdio/FreeBSD/findfp.c.patch | 192 - stdio/FreeBSD/flags.c | 9 +- stdio/FreeBSD/flags.c.patch | 21 - stdio/FreeBSD/flockfile.3 | 27 +- stdio/FreeBSD/flockfile.3.patch | 74 - stdio/FreeBSD/fopen.3 | 37 +- stdio/FreeBSD/fopen.3.patch | 89 - stdio/FreeBSD/fopen.c | 13 +- stdio/FreeBSD/fopen.c.patch | 31 - stdio/FreeBSD/fprintf.c | 17 +- stdio/FreeBSD/fprintf.c.patch | 33 - stdio/FreeBSD/fputs.3 | 31 +- stdio/FreeBSD/fputs.3.patch | 63 - stdio/FreeBSD/fputs.c | 10 + stdio/FreeBSD/fputs.c.patch | 32 - stdio/FreeBSD/fputwc.c | 27 +- stdio/FreeBSD/fputwc.c.patch | 61 - stdio/FreeBSD/fputws.3 | 32 +- stdio/FreeBSD/fputws.3.patch | 68 - stdio/FreeBSD/fputws.c | 21 +- stdio/FreeBSD/fputws.c.patch | 60 - stdio/FreeBSD/fread.3 | 14 +- stdio/FreeBSD/fread.3.patch | 49 - stdio/FreeBSD/fread.c | 57 +- stdio/FreeBSD/fread.c.patch | 82 - stdio/FreeBSD/freopen.c | 15 +- stdio/FreeBSD/freopen.c.patch | 57 - stdio/FreeBSD/fscanf.c | 19 +- stdio/FreeBSD/fscanf.c.patch | 35 - stdio/FreeBSD/fseek.3 | 58 +- stdio/FreeBSD/fseek.3.patch | 83 - stdio/FreeBSD/ftell.c | 2 + stdio/FreeBSD/ftell.c.patch | 11 - stdio/FreeBSD/funopen.c | 3 +- stdio/FreeBSD/funopen.c.patch | 12 - stdio/FreeBSD/fwide.3 | 8 +- stdio/FreeBSD/fwide.3.patch | 18 - stdio/FreeBSD/fwprintf.c | 18 +- stdio/FreeBSD/fwprintf.c.patch | 34 - stdio/FreeBSD/fwrite.c | 3 +- stdio/FreeBSD/fwrite.c.patch | 14 - stdio/FreeBSD/fwscanf.c | 18 +- stdio/FreeBSD/fwscanf.c.patch | 34 - stdio/FreeBSD/getc.3 | 4 +- stdio/FreeBSD/getc.3.patch | 20 - stdio/FreeBSD/getline.3 | 29 - stdio/FreeBSD/getline.3.patch | 45 - stdio/FreeBSD/getwc.3 | 11 +- stdio/FreeBSD/getwc.3.patch | 40 - stdio/FreeBSD/getwc.c | 12 +- stdio/FreeBSD/getwc.c.patch | 26 - stdio/FreeBSD/getwchar.c | 12 +- stdio/FreeBSD/getwchar.c.patch | 26 - stdio/FreeBSD/local.h | 52 +- stdio/FreeBSD/local.h.patch | 94 - stdio/FreeBSD/makebuf.c | 14 +- stdio/FreeBSD/makebuf.c.patch | 44 - stdio/FreeBSD/mktemp.3 | 41 +- stdio/FreeBSD/mktemp.3.patch | 90 - stdio/FreeBSD/mktemp.c | 2 +- stdio/FreeBSD/mktemp.c.patch | 11 - stdio/FreeBSD/printf-pos.c | 46 +- stdio/FreeBSD/printf-pos.c.patch | 128 - stdio/FreeBSD/printf.3 | 102 +- stdio/FreeBSD/printf.3.patch | 189 - stdio/FreeBSD/printf.c | 17 +- stdio/FreeBSD/printf.c.patch | 33 - stdio/FreeBSD/printfcommon.h | 22 +- stdio/FreeBSD/printfcommon.h.patch | 86 - stdio/FreeBSD/printflocal.h | 30 + stdio/FreeBSD/printflocal.h.patch | 60 - stdio/FreeBSD/putc.3 | 30 +- stdio/FreeBSD/putc.3.patch | 56 - stdio/FreeBSD/puts.c | 10 +- stdio/FreeBSD/puts.c.patch | 30 - stdio/FreeBSD/putwc.3 | 21 +- stdio/FreeBSD/putwc.3.patch | 46 - stdio/FreeBSD/putwc.c | 12 +- stdio/FreeBSD/putwc.c.patch | 26 - stdio/FreeBSD/putwchar.c | 12 +- stdio/FreeBSD/putwchar.c.patch | 26 - stdio/FreeBSD/refill.c | 21 +- stdio/FreeBSD/refill.c.patch | 41 - stdio/FreeBSD/remove.3 | 2 +- stdio/FreeBSD/remove.3.patch | 11 - stdio/FreeBSD/rewind.c | 2 +- stdio/FreeBSD/rewind.c.patch | 12 - stdio/FreeBSD/scanf.3 | 71 +- stdio/FreeBSD/scanf.3.patch | 151 - stdio/FreeBSD/scanf.c | 19 +- stdio/FreeBSD/scanf.c.patch | 35 - stdio/FreeBSD/setbuf.3 | 43 +- stdio/FreeBSD/setbuf.3.patch | 79 - stdio/FreeBSD/snprintf.c | 32 +- stdio/FreeBSD/snprintf.c.patch | 52 - stdio/FreeBSD/sprintf.c | 24 +- stdio/FreeBSD/sprintf.c.patch | 42 - stdio/FreeBSD/sscanf.c | 33 +- stdio/FreeBSD/sscanf.c.patch | 57 - stdio/FreeBSD/stdio.3 | 39 +- stdio/FreeBSD/stdio.3.patch | 113 - stdio/FreeBSD/swprintf.c | 19 +- stdio/FreeBSD/swprintf.c.patch | 35 - stdio/FreeBSD/swscanf.c | 19 +- stdio/FreeBSD/swscanf.c.patch | 35 - stdio/FreeBSD/tempnam.c | 37 +- stdio/FreeBSD/tempnam.c.patch | 69 - stdio/FreeBSD/tmpnam.3 | 48 +- stdio/FreeBSD/tmpnam.3.patch | 112 - stdio/FreeBSD/tmpnam.c | 20 +- stdio/FreeBSD/tmpnam.c.patch | 41 - stdio/FreeBSD/ungetc.3 | 21 +- stdio/FreeBSD/ungetc.3.patch | 43 - stdio/FreeBSD/ungetwc.3 | 45 +- stdio/FreeBSD/ungetwc.3.patch | 83 - stdio/FreeBSD/ungetwc.c | 22 +- stdio/FreeBSD/ungetwc.c.patch | 51 - stdio/FreeBSD/vasprintf.c | 22 +- stdio/FreeBSD/vasprintf.c.patch | 54 - stdio/FreeBSD/vdprintf.c | 16 +- stdio/FreeBSD/vdprintf.c.patch | 44 - stdio/FreeBSD/vfprintf.c | 479 +- stdio/FreeBSD/vfprintf.c.patch | 864 - stdio/FreeBSD/vfscanf.c | 256 +- stdio/FreeBSD/vfscanf.c.patch | 612 - stdio/FreeBSD/vfwprintf.c | 496 +- stdio/FreeBSD/vfwprintf.c.patch | 927 - stdio/FreeBSD/vfwscanf.c | 248 +- stdio/FreeBSD/vfwscanf.c.patch | 589 - stdio/FreeBSD/vprintf.c | 12 +- stdio/FreeBSD/vprintf.c.patch | 25 - stdio/FreeBSD/vscanf.c | 19 +- stdio/FreeBSD/vscanf.c.patch | 35 - stdio/FreeBSD/vsnprintf.c | 17 +- stdio/FreeBSD/vsnprintf.c.patch | 46 - stdio/FreeBSD/vsprintf.c | 16 +- stdio/FreeBSD/vsprintf.c.patch | 40 - stdio/FreeBSD/vsscanf.c | 20 +- stdio/FreeBSD/vsscanf.c.patch | 46 - stdio/FreeBSD/vswprintf.c | 21 +- stdio/FreeBSD/vswprintf.c.patch | 63 - stdio/FreeBSD/vswscanf.c | 22 +- stdio/FreeBSD/vswscanf.c.patch | 61 - stdio/FreeBSD/vwprintf.c | 12 +- stdio/FreeBSD/vwprintf.c.patch | 26 - stdio/FreeBSD/vwscanf.c | 12 +- stdio/FreeBSD/vwscanf.c.patch | 26 - stdio/FreeBSD/wbuf.c | 5 +- stdio/FreeBSD/wbuf.c.patch | 22 - stdio/FreeBSD/wprintf.3 | 59 +- stdio/FreeBSD/wprintf.3.patch | 113 - stdio/FreeBSD/wprintf.c | 18 +- stdio/FreeBSD/wprintf.c.patch | 34 - stdio/FreeBSD/wscanf.3 | 74 +- stdio/FreeBSD/wscanf.3.patch | 147 - stdio/FreeBSD/wscanf.c | 18 +- stdio/FreeBSD/wscanf.c.patch | 34 - stdio/Makefile.inc | 189 - stdio/_flock_stub-fbsd.c | 1 - stdio/asprintf-fbsd.c | 63 - stdio/clrerr-fbsd.c | 1 - stdio/dprintf-fbsd.c | 59 - stdio/fclose-fbsd.c | 78 - stdio/fclose.3 | 1 - stdio/fdopen-fbsd.c | 107 - stdio/feof-fbsd.c | 1 - stdio/ferror-fbsd.c | 1 - stdio/ferror.3 | 1 - stdio/fflush-fbsd.c | 150 - stdio/fflush.3 | 1 - stdio/fgetc-fbsd.c | 1 - stdio/fgetln-fbsd.c | 170 - stdio/fgetln.3 | 128 - stdio/fgetpos-fbsd.c | 1 - stdio/fgets-fbsd.c | 1 - stdio/fgets.3 | 1 - stdio/fgetwc-fbsd.c | 114 - stdio/fgetwln-fbsd.c | 73 - stdio/fgetwln.3 | 129 - stdio/fgetws-fbsd.c | 113 - stdio/fgetws.3 | 146 - stdio/fileno-fbsd.c | 1 - stdio/findfp-fbsd.c | 298 - stdio/flags-fbsd.c | 97 - stdio/floatio.h | 1 - stdio/flockfile.3 | 105 - stdio/fopen-fbsd.c | 108 - stdio/fopen.3 | 304 - stdio/fprintf-fbsd.c | 67 - stdio/fpurge-fbsd.c | 1 - stdio/fputc-fbsd.c | 1 - stdio/fputs-fbsd.c | 78 - stdio/fputs.3 | 127 - stdio/fputwc-fbsd.c | 103 - stdio/fputws-fbsd.c | 84 - stdio/fputws.3 | 110 - stdio/fread-fbsd.c | 141 - stdio/fread.3 | 107 - stdio/freopen-fbsd.c | 249 - stdio/fscanf-fbsd.c | 75 - stdio/fseek-fbsd.c | 1 - stdio/fseek.3 | 305 - stdio/fsetpos-fbsd.c | 1 - stdio/ftell-fbsd.c | 141 - stdio/funopen-fbsd.c | 77 - stdio/funopen.3 | 1 - stdio/fvwrite-fbsd.c | 1 - stdio/fvwrite.h | 1 - stdio/fwalk-fbsd.c | 1 - stdio/fwide-fbsd.c | 1 - stdio/fwide.3 | 99 - stdio/fwprintf-fbsd.c | 61 - stdio/fwrite-fbsd.c | 84 - stdio/fwscanf-fbsd.c | 61 - stdio/getc-fbsd.c | 1 - stdio/getc.3 | 170 - stdio/getchar-fbsd.c | 1 - stdio/getdelim-fbsd.c | 1 - stdio/getline-fbsd.c | 1 - stdio/getline.3 | 135 - stdio/gets-fbsd.c | 1 - stdio/getw-fbsd.c | 1 - stdio/getwc-fbsd.c | 58 - stdio/getwc.3 | 121 - stdio/getwchar-fbsd.c | 57 - stdio/glue.h | 1 - stdio/local.h | 155 - stdio/makebuf-fbsd.c | 126 - stdio/mktemp-fbsd.c | 201 - stdio/mktemp.3 | 264 - stdio/perror-fbsd.c | 1 - stdio/printf-fbsd.c | 67 - stdio/printf-pos-fbsd.c | 798 - stdio/printf.3 | 932 - stdio/printfcommon.h | 301 - stdio/printflocal.h | 124 - stdio/putc-fbsd.c | 1 - stdio/putc.3 | 181 - stdio/putchar-fbsd.c | 1 - stdio/puts-fbsd.c | 77 - stdio/putw-fbsd.c | 1 - stdio/putwc-fbsd.c | 58 - stdio/putwc.3 | 118 - stdio/putwchar-fbsd.c | 57 - stdio/refill-fbsd.c | 163 - stdio/remove-fbsd.c | 1 - stdio/remove.3 | 83 - stdio/rewind-fbsd.c | 61 - stdio/rget-fbsd.c | 1 - stdio/scanf-fbsd.c | 75 - stdio/scanf.3 | 540 - stdio/setbuf-fbsd.c | 1 - stdio/setbuf.3 | 224 - stdio/setbuffer-fbsd.c | 1 - stdio/setvbuf-fbsd.c | 1 - stdio/snprintf-fbsd.c | 70 - stdio/sprintf-fbsd.c | 68 - stdio/sscanf-fbsd.c | 68 - stdio/stdio-fbsd.c | 1 - stdio/stdio.3 | 366 - stdio/swprintf-fbsd.c | 62 - stdio/swscanf-fbsd.c | 62 - stdio/tempnam-fbsd.c | 115 - stdio/tmpfile-fbsd.c | 1 - stdio/tmpnam-fbsd.c | 75 - stdio/tmpnam.3 | 264 - stdio/ungetc-fbsd.c | 1 - stdio/ungetc.3 | 101 - stdio/ungetwc-fbsd.c | 93 - stdio/ungetwc.3 | 118 - stdio/vasprintf-fbsd.c | 84 - stdio/vdprintf-fbsd.c | 78 - stdio/vfprintf-fbsd.c | 1419 -- stdio/vfscanf-fbsd.c | 1194 -- stdio/vfwprintf-fbsd.c | 1482 -- stdio/vfwscanf-fbsd.c | 944 - stdio/vprintf-fbsd.c | 56 - stdio/vscanf-fbsd.c | 73 - stdio/vsnprintf-fbsd.c | 87 - stdio/vsprintf-fbsd.c | 70 - stdio/vsscanf-fbsd.c | 91 - stdio/vswprintf-fbsd.c | 108 - stdio/vswscanf-fbsd.c | 110 - stdio/vwprintf-fbsd.c | 49 - stdio/vwscanf-fbsd.c | 49 - stdio/wbuf-fbsd.c | 94 - stdio/wprintf-fbsd.c | 61 - stdio/wprintf.3 | 655 - stdio/wscanf-fbsd.c | 61 - stdio/wscanf.3 | 509 - stdio/wsetup-fbsd.c | 1 - stdlib/FreeBSD/abort.3 | 7 + stdlib/FreeBSD/abort.3.patch | 16 - stdlib/FreeBSD/abort.c | 91 +- stdlib/FreeBSD/abort.c.patch | 128 - stdlib/FreeBSD/abs.3 | 8 +- stdlib/FreeBSD/abs.3.patch | 20 - stdlib/FreeBSD/alloca.3 | 23 +- stdlib/FreeBSD/alloca.3.patch | 69 - stdlib/FreeBSD/atexit.3 | 45 +- stdlib/FreeBSD/atexit.3.patch | 83 - stdlib/FreeBSD/atexit.c | 59 +- stdlib/FreeBSD/atexit.c.patch | 142 - stdlib/FreeBSD/atexit.h | 2 +- stdlib/FreeBSD/atexit.h.patch | 8 - stdlib/FreeBSD/atof.3 | 33 +- stdlib/FreeBSD/atof.3.patch | 78 - stdlib/FreeBSD/atof.c | 13 +- stdlib/FreeBSD/atof.c.patch | 26 - stdlib/FreeBSD/atoi.3 | 35 +- stdlib/FreeBSD/atoi.3.patch | 73 - stdlib/FreeBSD/atoi.c | 13 +- stdlib/FreeBSD/atoi.c.patch | 26 - stdlib/FreeBSD/atol.3 | 45 +- stdlib/FreeBSD/atol.3.patch | 91 - stdlib/FreeBSD/atol.c | 13 +- stdlib/FreeBSD/atol.c.patch | 26 - stdlib/FreeBSD/atoll.c | 13 +- stdlib/FreeBSD/atoll.c.patch | 26 - stdlib/FreeBSD/bsearch.3 | 43 +- stdlib/FreeBSD/bsearch.3.patch | 83 - stdlib/FreeBSD/bsearch.c | 28 + stdlib/FreeBSD/bsearch.c.patch | 34 - stdlib/FreeBSD/div.3 | 12 +- stdlib/FreeBSD/div.3.patch | 31 - stdlib/FreeBSD/exit.c | 17 +- stdlib/FreeBSD/exit.c.patch | 34 - stdlib/FreeBSD/getenv.3 | 78 +- stdlib/FreeBSD/getenv.3.patch | 121 - stdlib/FreeBSD/getenv.c | 24 +- stdlib/FreeBSD/getenv.c.patch | 56 - stdlib/FreeBSD/getopt.c | 20 +- stdlib/FreeBSD/getopt.c.patch | 59 - stdlib/FreeBSD/getsubopt.3 | 28 +- stdlib/FreeBSD/getsubopt.3.patch | 69 - .../heapsort_b.c} | 0 stdlib/FreeBSD/heapsort_b.c.patch | 15 - .../heapsort_r.c} | 0 stdlib/FreeBSD/heapsort_r.c.patch | 51 - stdlib/FreeBSD/imaxdiv.3 | 8 +- stdlib/FreeBSD/imaxdiv.3.patch | 25 - stdlib/FreeBSD/insque.3 | 2 +- stdlib/FreeBSD/insque.3.patch | 11 - stdlib/FreeBSD/labs.3 | 4 +- stdlib/FreeBSD/labs.3.patch | 18 - stdlib/FreeBSD/ldiv.3 | 7 +- stdlib/FreeBSD/ldiv.3.patch | 21 - stdlib/FreeBSD/llabs.3 | 4 +- stdlib/FreeBSD/llabs.3.patch | 17 - stdlib/FreeBSD/lldiv.3 | 8 +- stdlib/FreeBSD/lldiv.3.patch | 25 - stdlib/FreeBSD/lsearch.3 | 16 +- stdlib/FreeBSD/lsearch.3.patch | 41 - stdlib/FreeBSD/memory.3 | 87 +- stdlib/FreeBSD/memory.3.patch | 118 - stdlib/FreeBSD/merge.c | 3 +- stdlib/FreeBSD/merge.c.patch | 12 - stdlib/{merge_b-fbsd.c => FreeBSD/merge_b.c} | 0 stdlib/FreeBSD/merge_b.c.patch | 92 - stdlib/{ => FreeBSD}/psort.3 | 0 stdlib/{psort-fbsd.c => FreeBSD/psort.c} | 0 stdlib/FreeBSD/psort_b.c | 1 + stdlib/FreeBSD/psort_r.c | 1 + stdlib/FreeBSD/putenv.c | 66 +- stdlib/FreeBSD/putenv.c.patch | 94 - stdlib/FreeBSD/qsort.3 | 140 +- stdlib/FreeBSD/qsort.3.patch | 245 - stdlib/FreeBSD/qsort.c | 93 +- stdlib/FreeBSD/qsort.c.patch | 153 - stdlib/FreeBSD/qsort_r.c.patch | 8 - stdlib/FreeBSD/radixsort.c | 31 +- stdlib/FreeBSD/radixsort.c.patch | 84 - stdlib/FreeBSD/rand.3 | 28 +- stdlib/FreeBSD/rand.3.patch | 59 - stdlib/FreeBSD/random.3 | 81 +- stdlib/FreeBSD/random.3.patch | 151 - stdlib/FreeBSD/random.c | 18 +- stdlib/FreeBSD/random.c.patch | 56 - stdlib/FreeBSD/realpath.3 | 104 +- stdlib/FreeBSD/realpath.3.patch | 158 - stdlib/FreeBSD/realpath.c | 209 +- stdlib/FreeBSD/realpath.c.patch | 315 - stdlib/FreeBSD/setenv.c | 464 +- stdlib/FreeBSD/setenv.c.patch | 390 - stdlib/FreeBSD/strhash.c | 3 +- stdlib/FreeBSD/strhash.c.patch | 19 - stdlib/FreeBSD/strtod.3 | 40 +- stdlib/FreeBSD/strtod.3.patch | 82 - stdlib/FreeBSD/strtoimax.c | 14 +- stdlib/FreeBSD/strtoimax.c.patch | 48 - stdlib/FreeBSD/strtol.3 | 71 +- stdlib/FreeBSD/strtol.3.patch | 161 - stdlib/FreeBSD/strtol.c | 14 +- stdlib/FreeBSD/strtol.c.patch | 48 - stdlib/FreeBSD/strtoll.c | 14 +- stdlib/FreeBSD/strtoll.c.patch | 48 - stdlib/FreeBSD/strtoq.c | 12 +- stdlib/FreeBSD/strtoq.c.patch | 26 - stdlib/FreeBSD/strtoul.3 | 56 +- stdlib/FreeBSD/strtoul.3.patch | 126 - stdlib/FreeBSD/strtoul.c | 14 +- stdlib/FreeBSD/strtoul.c.patch | 47 - stdlib/FreeBSD/strtoull.c | 14 +- stdlib/FreeBSD/strtoull.c.patch | 47 - stdlib/FreeBSD/strtoumax.c | 14 +- stdlib/FreeBSD/strtoumax.c.patch | 47 - stdlib/FreeBSD/strtouq.c | 12 +- stdlib/FreeBSD/strtouq.c.patch | 26 - stdlib/FreeBSD/system.3 | 6 +- stdlib/FreeBSD/system.3.patch | 27 - stdlib/FreeBSD/system.c | 88 +- stdlib/FreeBSD/system.c.patch | 129 - stdlib/FreeBSD/tsearch.3 | 93 +- stdlib/FreeBSD/tsearch.3.patch | 161 - stdlib/Makefile.inc | 224 - stdlib/NetBSD/strfmon.3 | 55 +- stdlib/NetBSD/strfmon.3.patch | 94 - stdlib/NetBSD/strfmon.c | 110 +- stdlib/NetBSD/strfmon.c.patch | 277 - stdlib/OpenBSD/ecvt.3 | 4 +- stdlib/OpenBSD/ecvt.3.patch | 14 - stdlib/OpenBSD/ecvt.c | 7 +- stdlib/OpenBSD/ecvt.c.patch | 35 - stdlib/OpenBSD/gcvt.c | 4 +- stdlib/OpenBSD/gcvt.c.patch | 20 - stdlib/_Exit_-fbsd.c | 1 - stdlib/abort-fbsd.c | 162 - stdlib/abort.3 | 86 - stdlib/abs-fbsd.c | 1 - stdlib/abs.3 | 73 - stdlib/alloca.3 | 89 - stdlib/atexit-fbsd.c | 240 - stdlib/atexit.3 | 111 - stdlib/atof-fbsd.c | 54 - stdlib/atof.3 | 114 - stdlib/atoi-fbsd.c | 54 - stdlib/atoi.3 | 110 - stdlib/atol-fbsd.c | 54 - stdlib/atol.3 | 162 - stdlib/atoll-fbsd.c | 51 - stdlib/bsearch-fbsd.c | 107 - stdlib/bsearch.3 | 114 - stdlib/div-fbsd.c | 1 - stdlib/div.3 | 70 - stdlib/ecvt-obsd.c | 108 - stdlib/ecvt.3 | 165 - stdlib/exit-fbsd.c | 58 - stdlib/exit.3 | 1 - stdlib/gcvt-obsd.c | 113 - stdlib/getenv-fbsd.c | 103 - stdlib/getenv.3 | 238 - stdlib/getopt-fbsd.c | 149 - stdlib/getopt.3 | 1 - stdlib/getopt_long-fbsd.c | 1 - stdlib/getopt_long.3 | 1 - stdlib/getsubopt-fbsd.c | 1 - stdlib/getsubopt.3 | 149 - stdlib/hcreate-fbsd.c | 1 - stdlib/hcreate.3 | 1 - stdlib/heapsort-fbsd.c | 1 - stdlib/imaxabs-fbsd.c | 1 - stdlib/imaxabs.3 | 1 - stdlib/imaxdiv-fbsd.c | 1 - stdlib/imaxdiv.3 | 73 - stdlib/insque-fbsd.c | 1 - stdlib/insque.3 | 61 - stdlib/labs-fbsd.c | 1 - stdlib/labs.3 | 67 - stdlib/ldiv-fbsd.c | 1 - stdlib/ldiv.3 | 72 - stdlib/llabs-fbsd.c | 1 - stdlib/llabs.3 | 62 - stdlib/lldiv-fbsd.c | 1 - stdlib/lldiv.3 | 73 - stdlib/lsearch-fbsd.c | 1 - stdlib/lsearch.3 | 105 - stdlib/memory.3 | 136 - stdlib/merge-fbsd.c | 352 - stdlib/psort.3.patch | 347 - stdlib/psort.c.patch | 334 - stdlib/psort_b-fbsd.c | 444 - stdlib/psort_r-fbsd.c | 444 - stdlib/putenv-fbsd.c | 115 - stdlib/qsort-fbsd.c | 254 - stdlib/qsort.3 | 364 - stdlib/qsort_b-fbsd.c | 2 +- stdlib/qsort_r-fbsd.c | 8 - stdlib/radixsort-fbsd.c | 352 - stdlib/radixsort.3 | 1 - stdlib/rand-fbsd.c | 1 - stdlib/rand.3 | 125 - stdlib/random-fbsd.c | 510 - stdlib/random.3 | 236 - stdlib/reallocf-fbsd.c | 1 - stdlib/realpath-fbsd.c | 370 - stdlib/realpath.3 | 150 - stdlib/remque-fbsd.c | 1 - stdlib/setenv-fbsd.c | 386 - stdlib/strfmon-nbsd.c | 659 - stdlib/strfmon.3 | 208 - stdlib/strhash-fbsd.c | 406 - stdlib/strtod.3 | 216 - stdlib/strtoimax-fbsd.c | 150 - stdlib/strtol-fbsd.c | 150 - stdlib/strtol.3 | 257 - stdlib/strtoll-fbsd.c | 150 - stdlib/strtoq-fbsd.c | 58 - stdlib/strtoul-fbsd.c | 128 - stdlib/strtoul.3 | 254 - stdlib/strtoull-fbsd.c | 128 - stdlib/strtoumax-fbsd.c | 128 - stdlib/strtouq-fbsd.c | 58 - stdlib/system-fbsd.c | 148 - stdlib/system.3 | 99 - stdlib/tdelete-fbsd.c | 1 - stdlib/tfind-fbsd.c | 1 - stdlib/tsearch-fbsd.c | 1 - stdlib/tsearch.3 | 181 - stdlib/twalk-fbsd.c | 1 - stdtime/FreeBSD/asctime.c | 4 +- stdtime/FreeBSD/asctime.c.patch | 13 - stdtime/FreeBSD/ctime.3 | 95 +- stdtime/FreeBSD/ctime.3.patch | 224 - stdtime/FreeBSD/ftime.3 | 23 +- stdtime/FreeBSD/ftime.3.patch | 48 - stdtime/FreeBSD/localtime.c | 709 +- stdtime/FreeBSD/localtime.c.patch | 1309 -- stdtime/FreeBSD/strftime.3 | 35 +- stdtime/FreeBSD/strftime.3.patch | 84 - stdtime/FreeBSD/strftime.c | 151 +- stdtime/FreeBSD/strftime.c.patch | 439 - stdtime/FreeBSD/strptime.3 | 42 +- stdtime/FreeBSD/strptime.3.patch | 92 - stdtime/FreeBSD/strptime.c | 348 +- stdtime/FreeBSD/strptime.c.patch | 659 - stdtime/FreeBSD/timelocal.c | 63 +- stdtime/FreeBSD/timelocal.c.patch | 88 - stdtime/FreeBSD/timelocal.h | 6 +- stdtime/FreeBSD/timelocal.h.patch | 21 - stdtime/FreeBSD/tzfile.5 | 2 +- stdtime/FreeBSD/tzfile.5.patch | 11 - stdtime/FreeBSD/tzfile.h | 18 + stdtime/FreeBSD/tzfile.h.patch | 35 - stdtime/Makefile.inc | 43 - stdtime/asctime-fbsd.c | 140 - stdtime/ctime.3 | 377 - stdtime/difftime-fbsd.c | 1 - stdtime/ftime-fbsd.c | 1 - stdtime/ftime.3 | 93 - stdtime/localtime-fbsd.c | 2427 --- stdtime/private.h | 1 - stdtime/strftime-fbsd.c | 661 - stdtime/strftime.3 | 299 - stdtime/strptime-fbsd.c | 702 - stdtime/strptime.3 | 197 - stdtime/time2posix.3 | 1 - stdtime/time32-fbsd.c | 1 - stdtime/timelocal-fbsd.c | 154 - stdtime/timelocal.h | 57 - stdtime/tzfile.5 | 138 - stdtime/tzfile.h | 210 - string/FreeBSD/bcmp.3 | 8 +- string/FreeBSD/bcmp.3.patch | 25 - string/FreeBSD/bcopy.3 | 10 +- string/FreeBSD/bcopy.3.patch | 28 - stdlib/atexit.h => string/FreeBSD/bcopy.c | 10 +- string/FreeBSD/bstring.3 | 70 +- string/FreeBSD/bstring.3.patch | 101 - string/FreeBSD/bzero.3 | 10 +- string/FreeBSD/bzero.3.patch | 25 - .../strlcpy.s => string/FreeBSD/bzero.c | 0 string/FreeBSD/bzero.c.patch | 8 - string/FreeBSD/ffs.3 | 38 +- string/FreeBSD/ffs.3.patch | 76 - string/FreeBSD/index.3 | 6 +- string/FreeBSD/index.3.patch | 22 - string/FreeBSD/memccpy.3 | 20 +- string/FreeBSD/memccpy.3.patch | 44 - string/FreeBSD/memchr.3 | 40 +- string/FreeBSD/memchr.3.patch | 66 - string/FreeBSD/memcmp.3 | 12 +- string/FreeBSD/memcmp.3.patch | 28 - string/FreeBSD/memcpy.3 | 46 +- string/FreeBSD/memcpy.3.patch | 74 - string/FreeBSD/memcpy.c | 5 + string/FreeBSD/memcpy.c.patch | 8 - string/FreeBSD/memmove.3 | 14 +- string/FreeBSD/memmove.3.patch | 36 - string/FreeBSD/memmove.c | 5 + string/FreeBSD/memmove.c.patch | 8 - string/FreeBSD/memset.3 | 5 +- string/FreeBSD/memset.3.patch | 28 - string/FreeBSD/rindex.3 | 4 +- string/FreeBSD/rindex.3.patch | 13 - string/FreeBSD/stpcpy.c | 46 - string/FreeBSD/stpncpy.c | 45 - string/FreeBSD/strcasecmp.3 | 46 +- string/FreeBSD/strcasecmp.3.patch | 77 - string/FreeBSD/strcasecmp.c | 33 +- string/FreeBSD/strcasecmp.c.patch | 68 - string/FreeBSD/strcasestr.c | 19 +- string/FreeBSD/strcasestr.c.patch | 46 - string/FreeBSD/strcat.3 | 28 +- string/FreeBSD/strcat.3.patch | 72 - string/FreeBSD/strcat.c | 46 - string/FreeBSD/strchr.3 | 14 +- string/FreeBSD/strchr.3.patch | 38 - string/FreeBSD/strchr.c.patch | 8 - string/FreeBSD/strcmp.3 | 13 +- string/FreeBSD/strcmp.3.patch | 30 - db/recno/recno.h => string/FreeBSD/strcmp.c | 12 +- string/FreeBSD/strcoll.3 | 29 +- string/FreeBSD/strcoll.3.patch | 54 - string/FreeBSD/strcoll.c | 69 +- string/FreeBSD/strcoll.c.patch | 87 - string/FreeBSD/strcpy.3 | 74 +- string/FreeBSD/strcpy.3.patch | 157 - string/FreeBSD/strcpy.c | 45 - string/FreeBSD/strcspn.3 | 19 +- string/FreeBSD/strcspn.3.patch | 42 - string/FreeBSD/strdup.3 | 18 +- string/FreeBSD/strdup.3.patch | 47 - string/FreeBSD/strerror.3 | 20 +- string/FreeBSD/strerror.3.patch | 51 - string/FreeBSD/strerror.c | 16 +- string/FreeBSD/strerror.c.patch | 50 - string/FreeBSD/string.3 | 144 +- string/FreeBSD/string.3.patch | 193 - string/FreeBSD/strlcat.c | 58 - string/FreeBSD/strlcpy.3 | 3 + string/FreeBSD/strlcpy.3.patch | 12 - string/FreeBSD/strlcpy.c | 54 - string/FreeBSD/strlen.c | 2 +- string/FreeBSD/strmode.3 | 5 +- string/FreeBSD/strmode.3.patch | 14 - string/FreeBSD/strncat.c | 62 - string/FreeBSD/strncpy.c | 62 - string/FreeBSD/strpbrk.3 | 15 +- string/FreeBSD/strpbrk.3.patch | 32 - string/FreeBSD/strrchr.3 | 91 - string/FreeBSD/strrchr.3.patch | 14 - string/FreeBSD/strrchr.c.patch | 8 - string/FreeBSD/strsignal.c | 36 +- string/FreeBSD/strsignal.c.patch | 77 - string/FreeBSD/strspn.3 | 17 +- string/FreeBSD/strspn.3.patch | 36 - string/FreeBSD/strstr.3 | 61 +- string/FreeBSD/strstr.3.patch | 123 - string/FreeBSD/strtok.3 | 11 +- string/FreeBSD/strtok.3.patch | 21 - string/FreeBSD/strxfrm.3 | 39 +- string/FreeBSD/strxfrm.3.patch | 89 - string/FreeBSD/strxfrm.c | 114 +- string/FreeBSD/strxfrm.c.patch | 142 - string/FreeBSD/swab.3 | 31 +- string/FreeBSD/swab.3.patch | 59 - string/FreeBSD/swab.c | 2 + string/FreeBSD/swab.c.patch | 11 - string/FreeBSD/wcscasecmp.c | 14 +- string/FreeBSD/wcscasecmp.c.patch | 33 - string/FreeBSD/wcscoll.3 | 37 +- string/FreeBSD/wcscoll.3.patch | 77 - string/FreeBSD/wcscoll.c | 242 +- string/FreeBSD/wcscoll.c.patch | 271 - string/FreeBSD/wcsncasecmp.c | 14 +- string/FreeBSD/wcsncasecmp.c.patch | 37 - string/FreeBSD/wcstok.3 | 24 +- string/FreeBSD/wcstok.3.patch | 62 - string/FreeBSD/wcswidth.3 | 31 +- string/FreeBSD/wcswidth.3.patch | 61 - string/FreeBSD/wcswidth.c | 14 +- string/FreeBSD/wcswidth.c.patch | 35 - string/FreeBSD/wcsxfrm.3 | 48 +- string/FreeBSD/wcsxfrm.3.patch | 101 - string/FreeBSD/wcsxfrm.c | 85 +- string/FreeBSD/wcsxfrm.c.patch | 123 - string/FreeBSD/wmemchr.3 | 46 +- string/FreeBSD/wmemchr.3.patch | 105 - string/Makefile.inc | 135 - string/bcmp-fbsd.c | 1 - string/bcmp.3 | 77 - string/bcopy.3 | 77 - string/bstring.3 | 152 - string/bzero.3 | 74 - string/ffs.3 | 97 - string/index-fbsd.c | 1 - string/index.3 | 102 - string/memccpy-fbsd.c | 1 - string/memccpy.3 | 80 - string/memchr-fbsd.c | 1 - string/memchr.3 | 83 - string/memcmp-fbsd.c | 1 - string/memcmp.3 | 86 - string/memcpy.3 | 90 - string/memmem-fbsd.c | 1 - string/memmem.3 | 1 - string/memmove.3 | 79 - string/memset-fbsd.c | 1 - string/memset.3 | 71 - string/memset_pattern.c | 71 + string/rindex-fbsd.c | 1 - string/rindex.3 | 92 - string/stpcpy-fbsd.c | 1 - internat/NXIsAscii.c => string/stpcpy.c | 23 +- string/stpncpy-fbsd.c | 1 - string/stpncpy.c | 48 + string/strcasecmp-fbsd.c | 91 - string/strcasecmp.3 | 137 - string/strcasestr-fbsd.c | 71 - string/strcat-fbsd.c | 1 - string/strcat.3 | 167 - string/strcat.c | 37 + string/strchr-fbsd.c | 5 - string/strchr.3 | 102 - string/strcmp.3 | 108 - string/strcoll-fbsd.c | 68 - string/strcoll.3 | 96 - string/strcpy-fbsd.c | 1 - string/strcpy.3 | 238 - internat/NXIsAlpha.c => string/strcpy.c | 24 +- string/strcspn-fbsd.c | 1 - string/strcspn.3 | 91 - string/strdup-fbsd.c | 1 - string/strdup.3 | 88 - string/strerror-fbsd.c | 134 - string/strerror.3 | 194 - string/string.3 | 223 - string/strlcat-fbsd.c | 1 - internat/NXIsCntrl.c => string/strlcat.c | 27 +- string/strlcpy-fbsd.c | 1 - string/strlcpy.3 | 208 - internat/NXIsAlNum.c => string/strlcpy.c | 25 +- string/strlen-fbsd.c | 1 - string/strlen.3 | 1 - string/strmode-fbsd.c | 1 - string/strmode.3 | 145 - string/strncat-fbsd.c | 1 - string/strncat.c | 42 + string/strncmp-fbsd.c | 1 - string/strncpy-fbsd.c | 1 - string/strncpy.c | 42 + string/strndup-fbsd.c | 1 - string/strnlen-fbsd.c | 1 - string/strnstr-fbsd.c | 1 - string/strpbrk-fbsd.c | 1 - string/strpbrk.3 | 80 - string/strrchr-fbsd.c | 5 - string/strrchr.3 | 94 - string/strsep-fbsd.c | 1 - string/strsep.3 | 1 - string/strsignal-fbsd.c | 148 - string/strspn-fbsd.c | 1 - string/strspn.3 | 87 - string/strstr-fbsd.c | 1 - string/strstr.3 | 174 - string/strtok-fbsd.c | 1 - string/strtok.3 | 179 - string/strxfrm-fbsd.c | 145 - string/strxfrm.3 | 119 - string/swab-fbsd.c | 61 - string/swab.3 | 81 - string/wcpcpy-fbsd.c | 1 - string/wcpncpy-fbsd.c | 1 - string/wcscasecmp-fbsd.c | 53 - string/wcscat-fbsd.c | 1 - string/wcschr-fbsd.c | 1 - string/wcscmp-fbsd.c | 1 - string/wcscoll-fbsd.c | 248 - string/wcscoll.3 | 129 - string/wcscpy-fbsd.c | 1 - string/wcscspn-fbsd.c | 1 - string/wcsdup-fbsd.c | 1 - string/wcslcat-fbsd.c | 1 - string/wcslcpy-fbsd.c | 1 - string/wcslen-fbsd.c | 1 - string/wcsncasecmp-fbsd.c | 57 - string/wcsncat-fbsd.c | 1 - string/wcsncmp-fbsd.c | 1 - string/wcsncpy-fbsd.c | 1 - string/wcsnlen-fbsd.c | 1 - string/wcspbrk-fbsd.c | 1 - string/wcsrchr-fbsd.c | 1 - string/wcsspn-fbsd.c | 1 - string/wcsstr-fbsd.c | 1 - string/wcstok-fbsd.c | 1 - string/wcstok.3 | 137 - string/wcswidth-fbsd.c | 67 - string/wcswidth.3 | 83 - string/wcsxfrm-fbsd.c | 109 - string/wcsxfrm.3 | 144 - string/wmemchr-fbsd.c | 1 - string/wmemchr.3 | 186 - string/wmemcmp-fbsd.c | 1 - string/wmemcpy-fbsd.c | 1 - string/wmemmove-fbsd.c | 1 - string/wmemset-fbsd.c | 1 - sys/Makefile.inc | 239 - sys/OSMemoryNotification.c | 76 +- sys/OSThermalNotification.c | 43 +- sys/OpenBSD/stack_protector.c | 129 +- sys/OpenBSD/stack_protector.c.patch | 157 - sys/__libc_init.c | 6 + sys/getiopolicy_np.3 | 45 + sys/getiopolicy_np.c | 30 +- sys/posix_spawn.c | 153 + sys/stack_protector-obsd.c | 139 - threads/Makefile.inc | 7 - threads/cprocs.c | 13 +- threads/cthreads.h | 2 +- util/Makefile.inc | 26 - util/mkpath_np.3 | 80 + util/mkpath_np.c | 193 + uuid/Makefile.inc | 58 - uuid/clear-uuid.c | 1 - uuid/compare-uuid.c | 1 - uuid/copy-uuid.c | 1 - uuid/gen_uuid-uuid.c | 272 - uuid/isnull-uuid.c | 1 - uuid/pack-uuid.c | 1 - uuid/parse-uuid.c | 1 - uuid/unpack-uuid.c | 1 - uuid/unparse-uuid.c | 86 - uuid/uuid.3 | 66 - uuid/uuid.3-uuid.in | 1 - uuid/uuidP.h | 78 - uuid/uuid_clear.3 | 60 - uuid/uuid_clear.3-uuid.in | 1 - uuid/uuid_compare.3 | 66 - uuid/uuid_compare.3-uuid.in | 1 - uuid/uuid_copy.3 | 62 - uuid/uuid_copy.3-uuid.in | 1 - uuid/uuid_generate.3 | 103 - uuid/uuid_generate.3-uuid.in | 1 - uuid/uuid_is_null.3 | 61 - uuid/uuid_is_null.3-uuid.in | 1 - uuid/uuid_parse.3 | 70 - uuid/uuid_parse.3-uuid.in | 1 - uuid/uuid_unparse.3 | 87 - uuid/uuid_unparse.3-uuid.in | 87 - uuid/uuidsrc/gen_uuid.c | 69 +- uuid/uuidsrc/gen_uuid.c.patch | 94 - uuid/uuidsrc/unparse.c | 30 +- uuid/uuidsrc/unparse.c.patch | 48 - uuid/uuidsrc/uuidP.h | 2 +- uuid/uuidsrc/uuidP.h.patch | 11 - uuid/uuidsrc/uuid_unparse.3.in | 19 +- uuid/uuidsrc/uuid_unparse.3.in.patch | 34 - x86_64/gen/Makefile.inc | 20 - x86_64/gen/_setcontext.S | 4 +- {ppc => x86_64}/gen/setjmperr.c | 30 +- x86_64/pthreads/Makefile.inc | 19 - x86_64/pthreads/get_cpu_capabilities.s | 36 - x86_64/pthreads/pthread_mutex_lock.s | 4 +- x86_64/stdlib/gdtoa.mk | 2 - x86_64/string/Makefile.inc | 40 - x86_64/string/bcopy.c | 2 +- x86_64/string/bcopy_sse3x.s | 2 +- x86_64/string/bcopy_sse42.s | 2 +- x86_64/string/bzero.c | 2 +- x86_64/string/bzero_sse2.s | 2 +- x86_64/string/bzero_sse42.s | 2 +- x86_64/string/memcpy.c | 2 +- x86_64/string/memmove.c | 2 +- x86_64/sys/Makefile.inc | 19 - x86_64/sys/OSAtomic.s | 9 +- x86_64/sys/_sigtramp.s | 4 +- x86_64/sys/atomic.c | 2 +- x86_64/sys/i386_gettimeofday_asm.s | 6 +- x86_64/sys/spinlocks.c | 2 +- x86_64/sys/spinlocks_asm.s | 2 +- xcodescripts/build_linklists.sh | 32 + xcodescripts/clean_simulator.sh | 7 + xcodescripts/force_libc_to_build.sh | 13 + xcodescripts/generate_features.pl | 225 + xcodescripts/headers.sh | 182 + xcodescripts/libc.xcconfig | 107 + xcodescripts/manpages.sh | 56 + xcodescripts/mig_headers.sh | 13 + .../patch_headers_variants.pl | 79 +- xcodescripts/sanitise_headers.sh | 21 + .../strip-header.ed | 0 xcodescripts/variants.xcconfig | 99 + 2099 files changed, 52490 insertions(+), 159640 deletions(-) delete mode 100644 BSDmakefile delete mode 100644 GNUmakefile delete mode 100644 Info.plist create mode 100644 Libc.xcodeproj/project.pbxproj create mode 100644 Libc.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 Makefile delete mode 100644 Makefile.fbsd_begin delete mode 100644 Makefile.fbsd_end delete mode 100644 Makefile.features delete mode 100644 Makefile.inc delete mode 100644 Makefile.nbsd_begin delete mode 100644 Makefile.nbsd_end delete mode 100644 Makefile.obsd_begin delete mode 100644 Makefile.obsd_end delete mode 100644 Makefile.xbs rename Platforms/{iPhone => iphoneos}/Makefile.inc (75%) rename Platforms/{MacOSX => macosx}/Makefile.inc (77%) delete mode 100644 arm/Makefile.inc delete mode 100644 arm/gen/Makefile.inc delete mode 100644 arm/pthreads/Makefile.inc delete mode 100644 arm/pthreads/get_cpu_capabilities.s delete mode 100644 arm/stdlib/gdtoa.mk delete mode 100644 arm/string/Makefile.inc create mode 100644 arm/string/bcopy_Swift.s create mode 100644 arm/string/bzero_Swift.s create mode 100644 arm/string/memset_pattern_Swift.s delete mode 100644 arm/string/strncpy.s delete mode 100644 arm/sys/Makefile.inc rename ppc/string/fls.s => arm/sys/OSAtomic.c (87%) create mode 100644 arm/sys/OSAtomic.h delete mode 100644 arm/sys/OSAtomic.s rename arm/{string/strcpy.s => sys/OSAtomicUP.c} (88%) rename include/objc/malloc.h => arm/sys/Spinlocks.c (84%) create mode 100644 arm/sys/SpinlocksUP.c rename ppc64/pthreads/pthread_set_self_64.s => arm/sys/SpinlocksWFE.c (82%) delete mode 100644 compat-43/FreeBSD/creat.c.patch delete mode 100644 compat-43/FreeBSD/gethostid.3.patch delete mode 100644 compat-43/FreeBSD/gethostid.c.patch delete mode 100644 compat-43/FreeBSD/killpg.2.patch delete mode 100644 compat-43/FreeBSD/killpg.c.patch delete mode 100644 compat-43/FreeBSD/setpgrp.c.patch delete mode 100644 compat-43/Makefile.inc delete mode 100644 compat-43/creat-fbsd.c delete mode 120000 compat-43/creat.2 delete mode 100644 compat-43/gethostid-fbsd.c delete mode 100644 compat-43/gethostid.3 delete mode 120000 compat-43/getwd-fbsd.c delete mode 100644 compat-43/killpg-fbsd.c delete mode 100644 compat-43/killpg.2 delete mode 120000 compat-43/sethostid-fbsd.c delete mode 100644 compat-43/setpgrp-fbsd.c delete mode 120000 compat-43/setrgid-fbsd.c delete mode 120000 compat-43/setruid-fbsd.c delete mode 120000 compat-43/setruid.3 delete mode 100644 darwin/Makefile.inc create mode 100644 darwin/OSAtomicLoadStoreEx.c create mode 100644 darwin/SpinlocksLoadStoreEx.c create mode 100644 darwin/forceLibcToBuild.c delete mode 100644 db/Makefile.inc rename db/btree/FreeBSD/{extern.h => bt_extern.h} (100%) delete mode 100644 db/btree/FreeBSD/bt_overflow.c.patch delete mode 100644 db/btree/FreeBSD/bt_seq.c.patch delete mode 100644 db/btree/FreeBSD/bt_split.c.patch delete mode 100644 db/btree/FreeBSD/btree.h.patch delete mode 100644 db/btree/Makefile.inc delete mode 120000 db/btree/bt_close-fbsd.c delete mode 120000 db/btree/bt_conv-fbsd.c delete mode 120000 db/btree/bt_delete-fbsd.c delete mode 120000 db/btree/bt_extern.h delete mode 120000 db/btree/bt_get-fbsd.c delete mode 120000 db/btree/bt_open-fbsd.c delete mode 100644 db/btree/bt_overflow-fbsd.c delete mode 120000 db/btree/bt_page-fbsd.c delete mode 120000 db/btree/bt_put-fbsd.c delete mode 120000 db/btree/bt_search-fbsd.c delete mode 100644 db/btree/bt_seq-fbsd.c delete mode 100644 db/btree/bt_split-fbsd.c delete mode 120000 db/btree/bt_utils-fbsd.c delete mode 100644 db/btree/btree.h delete mode 100644 db/db/Makefile.inc delete mode 120000 db/db/db-fbsd.c delete mode 100644 db/hash/FreeBSD/hash.c.patch delete mode 100644 db/hash/FreeBSD/hash.h.patch delete mode 100644 db/hash/FreeBSD/hash_bigkey.c.patch delete mode 100644 db/hash/FreeBSD/hash_buf.c.patch rename db/hash/FreeBSD/{extern.h => hash_extern.h} (100%) delete mode 100644 db/hash/FreeBSD/hash_func.c.patch delete mode 100644 db/hash/FreeBSD/hash_log2.c.patch delete mode 100644 db/hash/FreeBSD/hash_page.c.patch delete mode 100644 db/hash/FreeBSD/ndbm.c.patch delete mode 100644 db/hash/Makefile.inc delete mode 100644 db/hash/hash-fbsd.c delete mode 100644 db/hash/hash-fbsd.c.orig delete mode 100644 db/hash/hash.h delete mode 100644 db/hash/hash_bigkey-fbsd.c delete mode 100644 db/hash/hash_buf-fbsd.c delete mode 120000 db/hash/hash_extern.h delete mode 100644 db/hash/hash_func-fbsd.c delete mode 100644 db/hash/hash_log2-fbsd.c delete mode 100644 db/hash/hash_page-fbsd.c delete mode 100644 db/hash/ndbm-fbsd.c delete mode 120000 db/hash/page.h delete mode 100644 db/man/FreeBSD/dbm.3.patch delete mode 100644 db/man/Makefile.inc delete mode 120000 db/man/btree.3 delete mode 100644 db/man/dbm.3 delete mode 120000 db/man/dbopen.3 delete mode 120000 db/man/hash.3 delete mode 120000 db/man/mpool.3 delete mode 120000 db/man/recno.3 delete mode 100644 db/mpool/FreeBSD/mpool.c.patch delete mode 100644 db/mpool/Makefile.inc delete mode 100644 db/mpool/mpool-fbsd.c delete mode 100644 db/recno/FreeBSD/extern.h delete mode 100644 db/recno/FreeBSD/extern.h.patch rename db/recno/{ => FreeBSD}/rec_extern.h (98%) delete mode 100644 db/recno/FreeBSD/recno.h.patch delete mode 100644 db/recno/Makefile.inc delete mode 120000 db/recno/rec_close-fbsd.c delete mode 120000 db/recno/rec_delete-fbsd.c delete mode 120000 db/recno/rec_get-fbsd.c delete mode 120000 db/recno/rec_open-fbsd.c delete mode 120000 db/recno/rec_put-fbsd.c delete mode 120000 db/recno/rec_search-fbsd.c delete mode 120000 db/recno/rec_seq-fbsd.c delete mode 120000 db/recno/rec_utils-fbsd.c delete mode 100644 emulated/Makefile.inc delete mode 100644 fixdups.ed delete mode 100644 gdtoa/FreeBSD/_hdtoa.c.patch delete mode 100644 gdtoa/FreeBSD/_ldtoa.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-gethex.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-hexnan.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-misc.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtod.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtodg.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtof.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtopdd.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtopx.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa-strtord.c.patch delete mode 100644 gdtoa/FreeBSD/gdtoa.h.patch delete mode 100644 gdtoa/FreeBSD/gdtoaimp.h.patch delete mode 100644 gdtoa/FreeBSD/machdep_ldisd.c.patch delete mode 100644 gdtoa/FreeBSD/machdep_ldisdd.c.patch delete mode 100644 gdtoa/FreeBSD/machdep_ldisx.c.patch delete mode 100644 gdtoa/Makefile.inc delete mode 100644 gdtoa/_hdtoa-fbsd.c delete mode 100644 gdtoa/_ldtoa-fbsd.c delete mode 120000 gdtoa/gdtoa-dmisc-fbsd.c delete mode 120000 gdtoa/gdtoa-dtoa-fbsd.c delete mode 120000 gdtoa/gdtoa-gdtoa-fbsd.c delete mode 100644 gdtoa/gdtoa-gethex-fbsd.c delete mode 120000 gdtoa/gdtoa-gmisc-fbsd.c delete mode 120000 gdtoa/gdtoa-hd_init-fbsd.c delete mode 100644 gdtoa/gdtoa-hexnan-fbsd.c delete mode 100644 gdtoa/gdtoa-misc-fbsd.c delete mode 120000 gdtoa/gdtoa-smisc-fbsd.c delete mode 100644 gdtoa/gdtoa-strtod-fbsd.c delete mode 100644 gdtoa/gdtoa-strtodg-fbsd.c delete mode 100644 gdtoa/gdtoa-strtof-fbsd.c delete mode 100644 gdtoa/gdtoa-strtopdd-fbsd.c delete mode 100644 gdtoa/gdtoa-strtopx-fbsd.c delete mode 100644 gdtoa/gdtoa-strtord-fbsd.c delete mode 120000 gdtoa/gdtoa-sum-fbsd.c delete mode 120000 gdtoa/gdtoa-ulp-fbsd.c delete mode 100644 gdtoa/gdtoa.h delete mode 120000 gdtoa/gdtoa_fltrnds.h delete mode 100644 gdtoa/gdtoaimp.h delete mode 120000 gdtoa/glue-fbsd.c delete mode 100644 gdtoa/machdep_ldisd-fbsd.c delete mode 100644 gdtoa/machdep_ldisdd-fbsd.c delete mode 100644 gdtoa/machdep_ldisx-fbsd.c delete mode 100644 gen/FreeBSD/_rand48.c.patch delete mode 100644 gen/FreeBSD/alarm.3.patch delete mode 100644 gen/FreeBSD/arc4random.c.patch delete mode 100644 gen/FreeBSD/assert.c.patch delete mode 100644 gen/FreeBSD/basename.3.patch delete mode 100644 gen/FreeBSD/basename.c.patch delete mode 100644 gen/FreeBSD/closedir.c.patch delete mode 100644 gen/FreeBSD/ctermid.3.patch delete mode 100644 gen/FreeBSD/daemon.3.patch delete mode 100644 gen/FreeBSD/daemon.c.patch delete mode 100644 gen/FreeBSD/dirname.3.patch delete mode 100644 gen/FreeBSD/dirname.c.patch delete mode 100644 gen/FreeBSD/drand48.c.patch delete mode 100644 gen/FreeBSD/erand48.c.patch delete mode 100644 gen/FreeBSD/err.3.patch delete mode 100644 gen/FreeBSD/err.c.patch delete mode 100644 gen/FreeBSD/exec.3.patch delete mode 100644 gen/FreeBSD/exec.c.patch delete mode 100644 gen/FreeBSD/fmtmsg.c.patch delete mode 100644 gen/FreeBSD/fnmatch.3.patch delete mode 100644 gen/FreeBSD/fnmatch.c.patch delete mode 100644 gen/FreeBSD/ftok.3.patch delete mode 100644 gen/FreeBSD/getcap.c.patch delete mode 100644 gen/FreeBSD/getcwd.c.patch delete mode 100644 gen/FreeBSD/gethostname.3.patch delete mode 100644 gen/FreeBSD/gethostname.c.patch delete mode 100644 gen/FreeBSD/getlogin.c.patch delete mode 100644 gen/FreeBSD/getmntinfo.3.patch rename gen/{getmntinfo64-fbsd.c => FreeBSD/getmntinfo64.c} (100%) delete mode 100644 gen/FreeBSD/getmntinfo64.c.patch delete mode 100644 gen/FreeBSD/getprogname.3.patch delete mode 100644 gen/FreeBSD/getprogname.c.patch delete mode 100644 gen/FreeBSD/glob.3.patch delete mode 100644 gen/FreeBSD/glob.c.patch delete mode 100644 gen/FreeBSD/isatty.c.patch delete mode 100644 gen/FreeBSD/jrand48.c.patch delete mode 100644 gen/FreeBSD/lcong48.c.patch delete mode 100644 gen/FreeBSD/lockf.3.patch delete mode 100644 gen/FreeBSD/lockf.c.patch delete mode 100644 gen/FreeBSD/lrand48.c.patch delete mode 100644 gen/FreeBSD/makecontext.3.patch delete mode 100644 gen/FreeBSD/mrand48.c.patch delete mode 100644 gen/FreeBSD/nice.c.patch delete mode 100644 gen/FreeBSD/nrand48.c.patch delete mode 100644 gen/FreeBSD/opendir.c.patch delete mode 100644 gen/FreeBSD/pause.c.patch delete mode 100644 gen/FreeBSD/popen.3.patch delete mode 100644 gen/FreeBSD/popen.c.patch delete mode 100644 gen/FreeBSD/pselect.3.patch delete mode 100644 gen/FreeBSD/pselect.c.patch delete mode 100644 gen/FreeBSD/psignal.3.patch delete mode 100644 gen/FreeBSD/rand48.3.patch delete mode 100644 gen/FreeBSD/rand48.h.patch delete mode 100644 gen/FreeBSD/readdir.c.patch delete mode 100644 gen/FreeBSD/readpassphrase.c.patch delete mode 100644 gen/FreeBSD/scandir.3.patch delete mode 100644 gen/FreeBSD/scandir.c.patch rename gen/{scandir_b-fbsd.c => FreeBSD/scandir_b.c} (94%) delete mode 100644 gen/FreeBSD/scandir_b.c.patch delete mode 100644 gen/FreeBSD/seed48.c.patch delete mode 100644 gen/FreeBSD/setmode.c.patch delete mode 100644 gen/FreeBSD/setprogname.c.patch delete mode 100644 gen/FreeBSD/siginterrupt.3.patch delete mode 100644 gen/FreeBSD/siglist.c.patch delete mode 100644 gen/FreeBSD/signal.3.patch delete mode 100644 gen/FreeBSD/signal.c.patch delete mode 100644 gen/FreeBSD/signbit.3.patch delete mode 100644 gen/FreeBSD/sleep.3.patch delete mode 100644 gen/FreeBSD/sleep.c.patch delete mode 100644 gen/FreeBSD/srand48.c.patch delete mode 100644 gen/FreeBSD/sysconf.c.patch delete mode 100644 gen/FreeBSD/sysctl.3.patch delete mode 100644 gen/FreeBSD/sysctl.c.patch delete mode 100644 gen/FreeBSD/telldir.c.patch delete mode 100644 gen/FreeBSD/telldir.h.patch delete mode 100644 gen/FreeBSD/termios.c.patch delete mode 100644 gen/FreeBSD/time.3.patch delete mode 100644 gen/FreeBSD/time.c.patch delete mode 100644 gen/FreeBSD/times.3.patch delete mode 100644 gen/FreeBSD/ttyname.3.patch delete mode 100644 gen/FreeBSD/ttyname.c.patch delete mode 100644 gen/FreeBSD/ualarm.3.patch delete mode 100644 gen/FreeBSD/ulimit.3.patch delete mode 100644 gen/FreeBSD/unvis.c.patch delete mode 100644 gen/FreeBSD/usleep.3.patch delete mode 100644 gen/FreeBSD/usleep.c.patch delete mode 100644 gen/FreeBSD/utime.3.patch delete mode 100644 gen/FreeBSD/vis.c.patch delete mode 100644 gen/FreeBSD/wait.c.patch delete mode 100644 gen/FreeBSD/waitpid.c.patch delete mode 100644 gen/Makefile.inc delete mode 100644 gen/NetBSD/endutxent.3.patch delete mode 100644 gen/NetBSD/getlastlogx.3.patch delete mode 100644 gen/NetBSD/utmpx.5.patch delete mode 100644 gen/NetBSD/utmpx.c.patch delete mode 100644 gen/_rand48-fbsd.c delete mode 120000 gen/alarm-fbsd.c delete mode 100644 gen/alarm.3 delete mode 100644 gen/arc4random-fbsd.c delete mode 120000 gen/arc4random.3 create mode 100644 gen/asl_fd.c delete mode 100644 gen/assert-fbsd.c delete mode 100644 gen/basename-fbsd.c delete mode 100644 gen/basename.3 delete mode 120000 gen/clock-fbsd.c delete mode 120000 gen/clock.3 delete mode 100644 gen/closedir-fbsd.c delete mode 120000 gen/ctermid-fbsd.c delete mode 100644 gen/ctermid.3 delete mode 100644 gen/daemon-fbsd.c delete mode 100644 gen/daemon.3 rename ppc64/pthreads/pthread_self_64.s => gen/dirfd.c (77%) delete mode 100644 gen/dirname-fbsd.c delete mode 100644 gen/dirname.3 delete mode 100644 gen/drand48-fbsd.c delete mode 100644 gen/endutxent.3 delete mode 100644 gen/endutxent.3.orig delete mode 100644 gen/erand48-fbsd.c delete mode 100644 gen/err-fbsd.c delete mode 100644 gen/err.3 delete mode 100644 gen/exec-fbsd.c delete mode 100644 gen/exec.3 delete mode 120000 gen/fmtcheck-fbsd.c delete mode 120000 gen/fmtcheck.3 delete mode 100644 gen/fmtmsg-fbsd.c delete mode 120000 gen/fmtmsg.3 delete mode 100644 gen/fnmatch-fbsd.c delete mode 100644 gen/fnmatch.3 delete mode 120000 gen/ftok-fbsd.c delete mode 100644 gen/ftok.3 delete mode 120000 gen/getbsize-fbsd.c delete mode 120000 gen/getbsize.3 delete mode 100644 gen/getcap-fbsd.c delete mode 100644 gen/getcap-fbsd.c.orig delete mode 120000 gen/getcap.3 delete mode 120000 gen/getcontext.3 delete mode 100644 gen/getcwd-fbsd.c delete mode 120000 gen/getcwd.3 delete mode 100644 gen/gethostname-fbsd.c delete mode 100644 gen/gethostname.3 delete mode 100644 gen/getlastlogx.3 delete mode 100644 gen/getlastlogx.3.orig delete mode 100644 gen/getlogin-fbsd.c delete mode 120000 gen/getmntinfo-fbsd.c delete mode 100644 gen/getmntinfo.3 delete mode 100644 gen/getmntinfo64-fbsd.c.orig delete mode 120000 gen/getpagesize-fbsd.c delete mode 120000 gen/getpagesize.3 delete mode 120000 gen/getpass.3 delete mode 120000 gen/getpeereid-fbsd.c delete mode 120000 gen/getpeereid.3 delete mode 100644 gen/getprogname-fbsd.c delete mode 100644 gen/getprogname.3 delete mode 100644 gen/glob-fbsd.c delete mode 100644 gen/glob.3 delete mode 100644 gen/isatty-fbsd.c delete mode 100644 gen/jrand48-fbsd.c delete mode 100644 gen/lcong48-fbsd.c delete mode 100644 gen/lockf-fbsd.c delete mode 100644 gen/lockf.3 delete mode 100644 gen/lrand48-fbsd.c delete mode 100644 gen/makecontext.3 delete mode 100644 gen/mrand48-fbsd.c delete mode 100644 gen/nice-fbsd.c delete mode 120000 gen/nice.3 delete mode 100644 gen/nrand48-fbsd.c delete mode 100644 gen/opendir-fbsd.c delete mode 100644 gen/pause-fbsd.c delete mode 100644 gen/pause-fbsd.c.orig delete mode 120000 gen/pause.3 delete mode 100644 gen/popen-fbsd.c delete mode 100644 gen/popen.3 delete mode 100644 gen/pselect-fbsd.c delete mode 100644 gen/pselect.3 delete mode 120000 gen/psignal-fbsd.c delete mode 100644 gen/psignal.3 delete mode 120000 gen/raise-fbsd.c delete mode 120000 gen/raise.3 delete mode 100644 gen/rand48.3 delete mode 100644 gen/rand48.h delete mode 100644 gen/readdir-fbsd.c delete mode 100644 gen/readpassphrase-fbsd.c delete mode 120000 gen/readpassphrase.3 delete mode 120000 gen/rewinddir-fbsd.c delete mode 100644 gen/scandir-fbsd.c delete mode 100644 gen/scandir.3 delete mode 100644 gen/seed48-fbsd.c delete mode 120000 gen/seekdir-fbsd.c delete mode 120000 gen/sethostname-fbsd.c delete mode 100644 gen/setmode-fbsd.c delete mode 120000 gen/setmode.3 delete mode 100644 gen/setprogname-fbsd.c delete mode 120000 gen/siginterrupt-fbsd.c delete mode 100644 gen/siginterrupt.3 delete mode 100644 gen/siglist-fbsd.c delete mode 100644 gen/signal-fbsd.c delete mode 100644 gen/signal.3 delete mode 100644 gen/signbit.3 delete mode 100644 gen/sleep-fbsd.c delete mode 100644 gen/sleep.3 delete mode 100644 gen/srand48-fbsd.c delete mode 120000 gen/stringlist-fbsd.c delete mode 120000 gen/stringlist.3 create mode 100644 gen/sync_volume_np.3 create mode 100644 gen/sync_volume_np.c delete mode 100644 gen/sysconf-fbsd.c delete mode 120000 gen/sysconf.3 delete mode 100644 gen/sysctl-fbsd.c delete mode 100644 gen/sysctl.3 delete mode 120000 gen/sysctlbyname-fbsd.c delete mode 120000 gen/sysctlnametomib-fbsd.c delete mode 100644 gen/telldir-fbsd.c delete mode 100644 gen/telldir.h delete mode 100644 gen/termios-fbsd.c delete mode 100644 gen/time-fbsd.c delete mode 100644 gen/time.3 delete mode 120000 gen/times-fbsd.c delete mode 100644 gen/times.3 delete mode 120000 gen/timezone-fbsd.c delete mode 120000 gen/timezone.3 delete mode 100644 gen/ttyname-fbsd.c delete mode 100644 gen/ttyname.3 delete mode 120000 gen/ttyslot-fbsd.c delete mode 120000 gen/ualarm-fbsd.c delete mode 100644 gen/ualarm.3 delete mode 120000 gen/ucontext.3 delete mode 120000 gen/ulimit-fbsd.c delete mode 100644 gen/ulimit.3 delete mode 100644 gen/unvis-fbsd.c delete mode 120000 gen/unvis.3 delete mode 100644 gen/usleep-fbsd.c delete mode 100644 gen/usleep.3 delete mode 120000 gen/utime-fbsd.c delete mode 100644 gen/utime.3 delete mode 100644 gen/utmpx-nbsd.c delete mode 100644 gen/utmpx.5 delete mode 100644 gen/vis-fbsd.c delete mode 120000 gen/vis.3 delete mode 100644 gen/wait-fbsd.c delete mode 120000 gen/wait3-fbsd.c delete mode 100644 gen/waitpid-fbsd.c delete mode 100644 gen/zone.c delete mode 100644 gmon/Makefile.inc delete mode 100644 i386/gen/Makefile.inc delete mode 100644 i386/pthreads/Makefile.inc delete mode 100644 i386/pthreads/get_cpu_capabilities.s delete mode 100644 i386/stdlib/gdtoa.mk delete mode 100644 i386/string/Makefile.inc delete mode 100644 i386/sys/Makefile.inc delete mode 100644 include/FreeBSD/nl_types.h.patch delete mode 100644 include/Makefile.inc delete mode 100644 include/NetBSD/utmpx.h.patch delete mode 100644 include/arpa/Makefile.inc delete mode 100644 include/grp.h delete mode 100644 include/libkern/Makefile.inc delete mode 100644 include/malloc/Makefile.inc delete mode 100644 include/nl_types.h delete mode 100644 include/objc/Makefile.inc delete mode 100644 include/objc/zone.h delete mode 100644 include/protocols/Makefile.inc delete mode 100644 include/pwd.h delete mode 100644 include/secure/Makefile.inc delete mode 100644 include/sys/Makefile.inc delete mode 100644 include/utmpx.h delete mode 100644 include/xlocale/Makefile.inc create mode 100644 include/xlocale/_regex.h delete mode 100644 internat/Makefile.inc delete mode 100644 internat/NXCType.c delete mode 100644 internat/NXCType.h delete mode 100644 internat/NXIsDigit.c delete mode 100644 internat/NXIsGraph.c delete mode 100644 internat/NXIsLower.c delete mode 100644 internat/NXIsPrint.c delete mode 100644 internat/NXIsPunct.c delete mode 100644 internat/NXIsSpace.c delete mode 100644 internat/NXIsUpper.c delete mode 100644 internat/NXIsXDigit.c delete mode 100644 internat/NXToAscii.c delete mode 100644 internat/NXToLower.c delete mode 100644 internat/NXToUpper.c delete mode 100644 internat/_NXToLower.c delete mode 100644 internat/_NXToUpper.c delete mode 100644 interposable.list delete mode 100644 locale/FreeBSD/ascii.c.patch delete mode 100644 locale/FreeBSD/big5.c.patch delete mode 100644 locale/FreeBSD/btowc.3.patch delete mode 100644 locale/FreeBSD/btowc.c.patch delete mode 100644 locale/FreeBSD/collate.c.patch delete mode 100644 locale/FreeBSD/collate.h.patch delete mode 100644 locale/FreeBSD/collcmp.c.patch delete mode 100644 locale/FreeBSD/ctype.3.patch delete mode 100644 locale/FreeBSD/digittoint.3.patch delete mode 100644 locale/FreeBSD/euc.c.patch delete mode 100644 locale/FreeBSD/fix_grouping.c.patch delete mode 100644 locale/FreeBSD/gb18030.c.patch delete mode 100644 locale/FreeBSD/gb2312.c.patch delete mode 100644 locale/FreeBSD/gbk.c.patch delete mode 100644 locale/FreeBSD/isalnum.3.patch delete mode 100644 locale/FreeBSD/isalpha.3.patch delete mode 100644 locale/FreeBSD/isblank.3.patch delete mode 100644 locale/FreeBSD/iscntrl.3.patch delete mode 100644 locale/FreeBSD/isdigit.3.patch delete mode 100644 locale/FreeBSD/isgraph.3.patch delete mode 100644 locale/FreeBSD/isideogram.3.patch delete mode 100644 locale/FreeBSD/islower.3.patch delete mode 100644 locale/FreeBSD/isphonogram.3.patch delete mode 100644 locale/FreeBSD/isprint.3.patch delete mode 100644 locale/FreeBSD/ispunct.3.patch delete mode 100644 locale/FreeBSD/isrune.3.patch delete mode 100644 locale/FreeBSD/isspace.3.patch delete mode 100644 locale/FreeBSD/isspecial.3.patch delete mode 100644 locale/FreeBSD/isupper.3.patch delete mode 100644 locale/FreeBSD/iswalnum.3.patch delete mode 100644 locale/FreeBSD/isxdigit.3.patch delete mode 100644 locale/FreeBSD/ldpart.c.patch delete mode 100644 locale/FreeBSD/ldpart.h.patch delete mode 100644 locale/FreeBSD/lmessages.c.patch delete mode 100644 locale/FreeBSD/lmessages.h.patch delete mode 100644 locale/FreeBSD/lmonetary.c.patch delete mode 100644 locale/FreeBSD/lmonetary.h.patch delete mode 100644 locale/FreeBSD/lnumeric.c.patch delete mode 100644 locale/FreeBSD/lnumeric.h.patch delete mode 100644 locale/FreeBSD/localeconv.3.patch delete mode 100644 locale/FreeBSD/localeconv.c.patch delete mode 100644 locale/FreeBSD/mblen.3.patch delete mode 100644 locale/FreeBSD/mblen.c.patch delete mode 100644 locale/FreeBSD/mblocal.h.patch delete mode 100644 locale/FreeBSD/mbrlen.3.patch delete mode 100644 locale/FreeBSD/mbrlen.c.patch delete mode 100644 locale/FreeBSD/mbrtowc.3.patch delete mode 100644 locale/FreeBSD/mbrtowc.c.patch delete mode 100644 locale/FreeBSD/mbsinit.3.patch delete mode 100644 locale/FreeBSD/mbsinit.c.patch delete mode 100644 locale/FreeBSD/mbsnrtowcs.c.patch delete mode 100644 locale/FreeBSD/mbsrtowcs.3.patch delete mode 100644 locale/FreeBSD/mbsrtowcs.c.patch delete mode 100644 locale/FreeBSD/mbstowcs.3.patch delete mode 100644 locale/FreeBSD/mbstowcs.c.patch delete mode 100644 locale/FreeBSD/mbtowc.3.patch delete mode 100644 locale/FreeBSD/mbtowc.c.patch delete mode 100644 locale/FreeBSD/mskanji.c.patch delete mode 100644 locale/FreeBSD/nextwctype.3.patch delete mode 100644 locale/FreeBSD/nextwctype.c.patch delete mode 100644 locale/FreeBSD/nl_langinfo.3.patch delete mode 100644 locale/FreeBSD/nl_langinfo.c.patch delete mode 100644 locale/FreeBSD/none.c.patch delete mode 100644 locale/FreeBSD/rune.c.patch rename locale/{ => FreeBSD}/rune32.h (50%) delete mode 100644 locale/FreeBSD/runetype.c.patch delete mode 100644 locale/FreeBSD/setlocale.3.patch delete mode 100644 locale/FreeBSD/setlocale.c.patch delete mode 100644 locale/FreeBSD/setlocale.h.patch delete mode 100644 locale/FreeBSD/setrunelocale.c.patch delete mode 100644 locale/FreeBSD/table.c.patch delete mode 100644 locale/FreeBSD/tolower.3.patch delete mode 100644 locale/FreeBSD/tolower.c.patch delete mode 100644 locale/FreeBSD/toupper.3.patch delete mode 100644 locale/FreeBSD/toupper.c.patch delete mode 100644 locale/FreeBSD/towlower.3.patch delete mode 100644 locale/FreeBSD/towupper.3.patch rename locale/{utf2-fbsd.c => FreeBSD/utf2.c} (99%) delete mode 100644 locale/FreeBSD/utf2.c.patch delete mode 100644 locale/FreeBSD/utf8.c.patch delete mode 100644 locale/FreeBSD/wcrtomb.3.patch delete mode 100644 locale/FreeBSD/wcrtomb.c.patch delete mode 100644 locale/FreeBSD/wcsftime.3.patch delete mode 100644 locale/FreeBSD/wcsftime.c.patch delete mode 100644 locale/FreeBSD/wcsnrtombs.c.patch delete mode 100644 locale/FreeBSD/wcsrtombs.3.patch delete mode 100644 locale/FreeBSD/wcsrtombs.c.patch delete mode 100644 locale/FreeBSD/wcstod.3.patch delete mode 100644 locale/FreeBSD/wcstod.c.patch delete mode 100644 locale/FreeBSD/wcstof.c.patch delete mode 100644 locale/FreeBSD/wcstoimax.c.patch delete mode 100644 locale/FreeBSD/wcstol.3.patch delete mode 100644 locale/FreeBSD/wcstol.c.patch delete mode 100644 locale/FreeBSD/wcstold.c.patch delete mode 100644 locale/FreeBSD/wcstoll.c.patch delete mode 100644 locale/FreeBSD/wcstombs.3.patch delete mode 100644 locale/FreeBSD/wcstombs.c.patch delete mode 100644 locale/FreeBSD/wcstoul.c.patch delete mode 100644 locale/FreeBSD/wcstoull.c.patch delete mode 100644 locale/FreeBSD/wcstoumax.c.patch delete mode 100644 locale/FreeBSD/wctob.c.patch delete mode 100644 locale/FreeBSD/wctomb.3.patch delete mode 100644 locale/FreeBSD/wctomb.c.patch delete mode 100644 locale/FreeBSD/wctrans.3.patch delete mode 100644 locale/FreeBSD/wctrans.c.patch delete mode 100644 locale/FreeBSD/wctype.3.patch delete mode 100644 locale/FreeBSD/wctype.c.patch delete mode 100644 locale/FreeBSD/wcwidth.3.patch delete mode 100644 locale/FreeBSD/wcwidth.c.patch delete mode 100644 locale/Makefile.inc delete mode 100644 locale/ascii-fbsd.c delete mode 100644 locale/big5-fbsd.c delete mode 120000 locale/big5.5 delete mode 100644 locale/btowc-fbsd.c delete mode 100644 locale/btowc.3 delete mode 100644 locale/collate-fbsd.c delete mode 100644 locale/collate.h delete mode 100644 locale/collcmp-fbsd.c delete mode 100644 locale/ctype.3 delete mode 100644 locale/digittoint.3 delete mode 100644 locale/euc-fbsd.c delete mode 120000 locale/euc.5 delete mode 100644 locale/fix_grouping-fbsd.c delete mode 100644 locale/gb18030-fbsd.c delete mode 120000 locale/gb18030.5 delete mode 100644 locale/gb2312-fbsd.c delete mode 120000 locale/gb2312.5 delete mode 100644 locale/gbk-fbsd.c delete mode 120000 locale/gbk.5 delete mode 100644 locale/isalnum.3 delete mode 100644 locale/isalpha.3 delete mode 120000 locale/isascii.3 delete mode 100644 locale/isblank.3 delete mode 100644 locale/iscntrl.3 delete mode 100644 locale/isdigit.3 delete mode 100644 locale/isgraph.3 delete mode 100644 locale/isideogram.3 delete mode 100644 locale/islower.3 delete mode 100644 locale/isphonogram.3 delete mode 100644 locale/isprint.3 delete mode 100644 locale/ispunct.3 delete mode 100644 locale/isrune.3 delete mode 100644 locale/isspace.3 delete mode 100644 locale/isspecial.3 delete mode 100644 locale/isupper.3 delete mode 100644 locale/iswalnum.3 delete mode 100644 locale/isxdigit.3 delete mode 100644 locale/ldpart-fbsd.c delete mode 100644 locale/ldpart.h delete mode 100644 locale/lmessages-fbsd.c delete mode 100644 locale/lmessages.h delete mode 100644 locale/lmonetary-fbsd.c delete mode 100644 locale/lmonetary.h delete mode 100644 locale/lnumeric-fbsd.c delete mode 100644 locale/lnumeric.h delete mode 100644 locale/localeconv-fbsd.c delete mode 100644 locale/localeconv.3 delete mode 100644 locale/mblen-fbsd.c delete mode 100644 locale/mblen.3 delete mode 100644 locale/mblocal.h delete mode 100644 locale/mbrlen-fbsd.c delete mode 100644 locale/mbrlen.3 delete mode 100644 locale/mbrtowc-fbsd.c delete mode 100644 locale/mbrtowc.3 delete mode 100644 locale/mbsinit-fbsd.c delete mode 100644 locale/mbsinit.3 delete mode 100644 locale/mbsnrtowcs-fbsd.c delete mode 100644 locale/mbsrtowcs-fbsd.c delete mode 100644 locale/mbsrtowcs.3 delete mode 100644 locale/mbstowcs-fbsd.c delete mode 100644 locale/mbstowcs.3 delete mode 100644 locale/mbtowc-fbsd.c delete mode 100644 locale/mbtowc.3 delete mode 100644 locale/mskanji-fbsd.c delete mode 120000 locale/mskanji.5 delete mode 120000 locale/multibyte.3 delete mode 100644 locale/nextwctype-fbsd.c delete mode 100644 locale/nextwctype.3 delete mode 100644 locale/nl_langinfo-fbsd.c delete mode 100644 locale/nl_langinfo.3 delete mode 120000 locale/nomacros-fbsd.c delete mode 100644 locale/none-fbsd.c delete mode 100644 locale/rune-fbsd.c delete mode 100644 locale/runetype-fbsd.c delete mode 100644 locale/setlocale-fbsd.c delete mode 100644 locale/setlocale.3 delete mode 100644 locale/setlocale.h delete mode 100644 locale/setrunelocale-fbsd.c delete mode 100644 locale/table-fbsd.c delete mode 120000 locale/toascii.3 delete mode 100644 locale/tolower-fbsd.c delete mode 100644 locale/tolower.3 delete mode 100644 locale/toupper-fbsd.c delete mode 100644 locale/toupper.3 delete mode 100644 locale/towlower.3 delete mode 100644 locale/towupper.3 delete mode 100644 locale/utf8-fbsd.c delete mode 120000 locale/utf8.5 delete mode 100644 locale/wcrtomb-fbsd.c delete mode 100644 locale/wcrtomb.3 delete mode 100644 locale/wcsftime-fbsd.c delete mode 100644 locale/wcsftime.3 delete mode 100644 locale/wcsnrtombs-fbsd.c delete mode 100644 locale/wcsrtombs-fbsd.c delete mode 100644 locale/wcsrtombs.3 delete mode 100644 locale/wcstod-fbsd.c delete mode 100644 locale/wcstod.3 delete mode 100644 locale/wcstof-fbsd.c delete mode 100644 locale/wcstoimax-fbsd.c delete mode 100644 locale/wcstol-fbsd.c delete mode 100644 locale/wcstol.3 delete mode 100644 locale/wcstold-fbsd.c delete mode 100644 locale/wcstoll-fbsd.c delete mode 100644 locale/wcstombs-fbsd.c delete mode 100644 locale/wcstombs.3 delete mode 100644 locale/wcstoul-fbsd.c delete mode 100644 locale/wcstoull-fbsd.c delete mode 100644 locale/wcstoumax-fbsd.c delete mode 100644 locale/wctob-fbsd.c delete mode 100644 locale/wctomb-fbsd.c delete mode 100644 locale/wctomb.3 delete mode 100644 locale/wctrans-fbsd.c delete mode 100644 locale/wctrans.3 delete mode 100644 locale/wctype-fbsd.c delete mode 100644 locale/wctype.3 delete mode 100644 locale/wcwidth-fbsd.c delete mode 100644 locale/wcwidth.3 delete mode 100755 makeCombos delete mode 100644 man/FreeBSD/stdarg.3.patch delete mode 100644 man/Makefile.inc create mode 100644 man/manpages.lst delete mode 100644 man/stdarg.3 delete mode 100644 net/FreeBSD/inet.3.patch delete mode 100644 net/FreeBSD/inet_addr.c.patch delete mode 100644 net/FreeBSD/inet_net.3.patch delete mode 100644 net/FreeBSD/inet_net_pton.c.patch delete mode 100644 net/FreeBSD/inet_network.c.patch delete mode 100644 net/FreeBSD/inet_ntoa.c.patch delete mode 100644 net/FreeBSD/nsap_addr.c.patch delete mode 100644 net/FreeBSD/recv.c.patch delete mode 100644 net/FreeBSD/send.c.patch delete mode 100644 net/FreeBSD/sockatmark.3.patch delete mode 100644 net/FreeBSD/sourcefilter.3.patch delete mode 100644 net/FreeBSD/sourcefilter.c.patch delete mode 100644 net/Makefile.inc delete mode 120000 net/addr2ascii-fbsd.c delete mode 120000 net/addr2ascii.3 delete mode 120000 net/ascii2addr-fbsd.c delete mode 100644 net/inet.3 delete mode 100644 net/inet_addr-fbsd.c delete mode 120000 net/inet_lnaof-fbsd.c delete mode 120000 net/inet_makeaddr-fbsd.c delete mode 100644 net/inet_net.3 delete mode 120000 net/inet_net_ntop-fbsd.c delete mode 100644 net/inet_net_pton-fbsd.c delete mode 120000 net/inet_neta-fbsd.c delete mode 120000 net/inet_netof-fbsd.c delete mode 100644 net/inet_network-fbsd.c delete mode 100644 net/inet_ntoa-fbsd.c delete mode 120000 net/linkaddr-fbsd.c delete mode 120000 net/linkaddr.3 delete mode 100644 net/nsap_addr-fbsd.c delete mode 100644 net/recv-fbsd.c delete mode 100644 net/send-fbsd.c delete mode 120000 net/sockatmark-fbsd.c delete mode 100644 net/sockatmark.3 delete mode 100644 net/sourcefilter-fbsd.c delete mode 100644 net/sourcefilter.3 delete mode 100644 nls/FreeBSD/msgcat.c.patch delete mode 100644 nls/FreeBSD/msgcat.h.patch delete mode 100644 nls/Makefile.inc delete mode 120000 nls/catclose.3 delete mode 120000 nls/catgets.3 delete mode 120000 nls/catopen.3 delete mode 100644 nls/msgcat-fbsd.c delete mode 100644 nls/msgcat.h delete mode 100644 posix1e/Makefile.inc delete mode 100644 ppc/gen/Makefile.inc delete mode 100644 ppc/gen/_ctx_start.S delete mode 100644 ppc/gen/_setcontext.S delete mode 100644 ppc/gen/abs.s delete mode 100644 ppc/gen/assymdefs.c delete mode 100644 ppc/gen/fp.h delete mode 100644 ppc/gen/genassym.c delete mode 100644 ppc/gen/genassym.h delete mode 100644 ppc/gen/getcontext.S delete mode 100644 ppc/gen/getmcontext.c delete mode 100644 ppc/gen/icacheinval.s delete mode 100644 ppc/gen/makecontext.c delete mode 100644 ppc/gen/mcount.s delete mode 100644 ppc/gen/setcontext.c delete mode 100644 ppc/gen/swapcontext.c delete mode 100644 ppc/pthreads/Makefile.inc delete mode 100644 ppc/pthreads/get_cpu_capabilities.s delete mode 100644 ppc/pthreads/init_cpu_capabilities.c delete mode 100644 ppc/pthreads/pthread_getspecific.s delete mode 100644 ppc/pthreads/pthread_self.s delete mode 100644 ppc/pthreads/pthread_set_self.s delete mode 100644 ppc/stdlib/gdtoa.mk delete mode 100644 ppc/string/Makefile.inc delete mode 100644 ppc/string/bcopy.s delete mode 100644 ppc/string/bzero.s delete mode 100644 ppc/string/ffs.s delete mode 100644 ppc/string/ffsl.s delete mode 100644 ppc/string/flsl.s delete mode 100644 ppc/string/memcmp.s delete mode 100644 ppc/string/memset.s delete mode 100644 ppc/string/strcat.s delete mode 100644 ppc/string/strcmp.s delete mode 100644 ppc/string/strcpy.s delete mode 100644 ppc/string/strlcat.s delete mode 100644 ppc/string/strlcpy.s delete mode 100644 ppc/string/strlen.s delete mode 100644 ppc/string/strncat.s delete mode 100644 ppc/string/strncmp.s delete mode 100644 ppc/string/strncpy.s delete mode 100644 ppc/sys/Makefile.inc delete mode 100644 ppc/sys/OSAtomic.s delete mode 100644 ppc/sys/_longjmp.s delete mode 100644 ppc/sys/_setjmp.h delete mode 100644 ppc/sys/_setjmp.s delete mode 100644 ppc/sys/_sigtramp.s delete mode 100644 ppc/sys/ldbl64.s delete mode 100644 ppc/sys/longjmp.s delete mode 100644 ppc/sys/ppc_gettimeofday.s delete mode 100644 ppc/sys/setjmp.s delete mode 100644 ppc64/gen/Makefile.inc delete mode 100644 ppc64/pthreads/Makefile.inc delete mode 100644 ppc64/pthreads/pthread_getspecific_64.s delete mode 100644 ppc64/stdlib/gdtoa.mk delete mode 100644 ppc64/string/Makefile.inc delete mode 100644 ppc64/sys/Makefile.inc delete mode 100644 pthreads/Makefile.inc delete mode 100644 regex/FreeBSD/cclass.h delete mode 100644 regex/FreeBSD/cname.h.patch delete mode 100644 regex/FreeBSD/engine.c delete mode 100644 regex/FreeBSD/engine.c.patch delete mode 100644 regex/FreeBSD/regcomp.c delete mode 100644 regex/FreeBSD/regcomp.c.patch delete mode 100644 regex/FreeBSD/regerror.c.patch delete mode 100644 regex/FreeBSD/regex.3.patch delete mode 100644 regex/FreeBSD/regex2.h delete mode 100644 regex/FreeBSD/regex2.h.patch delete mode 100644 regex/FreeBSD/regexec.c delete mode 100644 regex/FreeBSD/regexec.c.patch delete mode 100644 regex/FreeBSD/regfree.c delete mode 100644 regex/FreeBSD/regfree.c.patch delete mode 100644 regex/Makefile.inc create mode 100644 regex/TRE/config.h create mode 100644 regex/TRE/lib/regcomp.c create mode 100644 regex/TRE/lib/regexec.c create mode 100644 regex/TRE/lib/tre-ast.c create mode 100644 regex/TRE/lib/tre-ast.h create mode 100644 regex/TRE/lib/tre-compile.c create mode 100644 regex/TRE/lib/tre-compile.h create mode 100644 regex/TRE/lib/tre-internal.h create mode 100644 regex/TRE/lib/tre-match-backtrack.c create mode 100644 regex/TRE/lib/tre-match-parallel.c create mode 100644 regex/TRE/lib/tre-match-utils.h create mode 100644 regex/TRE/lib/tre-mem.c create mode 100644 regex/TRE/lib/tre-mem.h create mode 100644 regex/TRE/lib/tre-parse.c create mode 100644 regex/TRE/lib/tre-parse.h create mode 100644 regex/TRE/lib/tre-stack.c create mode 100644 regex/TRE/lib/tre-stack.h create mode 100644 regex/TRE/lib/tre.h create mode 100644 regex/TRE/lib/xmalloc.h create mode 100644 regex/TRE/tre-0.8.0.tar.bz2 create mode 100644 regex/TRE/tre-config.h create mode 100644 regex/TRE/tre-last-matched.h delete mode 120000 regex/cclass.h delete mode 100644 regex/cname.h delete mode 100644 regex/cname.h.orig delete mode 100644 regex/engine.c delete mode 120000 regex/re_format.7 delete mode 100644 regex/regcomp-fbsd.c delete mode 100644 regex/regerror-fbsd.c delete mode 100644 regex/regerror-fbsd.c.orig delete mode 100644 regex/regex.3 delete mode 100644 regex/regex2.h delete mode 100644 regex/regexec-fbsd.c delete mode 100644 regex/regfree-fbsd.c delete mode 120000 regex/utils.h delete mode 100644 rpc/Makefile.inc delete mode 100644 secure/Makefile.inc delete mode 100644 stdio/FreeBSD/asprintf.c.patch delete mode 100644 stdio/FreeBSD/dprintf.c.patch delete mode 100644 stdio/FreeBSD/fclose.c.patch delete mode 100644 stdio/FreeBSD/fdopen.c.patch delete mode 100644 stdio/FreeBSD/fflush.c.patch delete mode 100644 stdio/FreeBSD/fgetln.3.patch delete mode 100644 stdio/FreeBSD/fgetln.c.patch delete mode 100644 stdio/FreeBSD/fgetwc.c.patch delete mode 100644 stdio/FreeBSD/fgetwln.3.patch delete mode 100644 stdio/FreeBSD/fgetwln.c.patch delete mode 100644 stdio/FreeBSD/fgetws.3.patch delete mode 100644 stdio/FreeBSD/fgetws.c.patch delete mode 100644 stdio/FreeBSD/findfp.c.patch delete mode 100644 stdio/FreeBSD/flags.c.patch delete mode 100644 stdio/FreeBSD/flockfile.3.patch delete mode 100644 stdio/FreeBSD/fopen.3.patch delete mode 100644 stdio/FreeBSD/fopen.c.patch delete mode 100644 stdio/FreeBSD/fprintf.c.patch delete mode 100644 stdio/FreeBSD/fputs.3.patch delete mode 100644 stdio/FreeBSD/fputs.c.patch delete mode 100644 stdio/FreeBSD/fputwc.c.patch delete mode 100644 stdio/FreeBSD/fputws.3.patch delete mode 100644 stdio/FreeBSD/fputws.c.patch delete mode 100644 stdio/FreeBSD/fread.3.patch delete mode 100644 stdio/FreeBSD/fread.c.patch delete mode 100644 stdio/FreeBSD/freopen.c.patch delete mode 100644 stdio/FreeBSD/fscanf.c.patch delete mode 100644 stdio/FreeBSD/fseek.3.patch delete mode 100644 stdio/FreeBSD/ftell.c.patch delete mode 100644 stdio/FreeBSD/funopen.c.patch delete mode 100644 stdio/FreeBSD/fwide.3.patch delete mode 100644 stdio/FreeBSD/fwprintf.c.patch delete mode 100644 stdio/FreeBSD/fwrite.c.patch delete mode 100644 stdio/FreeBSD/fwscanf.c.patch delete mode 100644 stdio/FreeBSD/getc.3.patch delete mode 100644 stdio/FreeBSD/getline.3.patch delete mode 100644 stdio/FreeBSD/getwc.3.patch delete mode 100644 stdio/FreeBSD/getwc.c.patch delete mode 100644 stdio/FreeBSD/getwchar.c.patch delete mode 100644 stdio/FreeBSD/local.h.patch delete mode 100644 stdio/FreeBSD/makebuf.c.patch delete mode 100644 stdio/FreeBSD/mktemp.3.patch delete mode 100644 stdio/FreeBSD/mktemp.c.patch delete mode 100644 stdio/FreeBSD/printf-pos.c.patch delete mode 100644 stdio/FreeBSD/printf.3.patch delete mode 100644 stdio/FreeBSD/printf.c.patch delete mode 100644 stdio/FreeBSD/printfcommon.h.patch delete mode 100644 stdio/FreeBSD/printflocal.h.patch delete mode 100644 stdio/FreeBSD/putc.3.patch delete mode 100644 stdio/FreeBSD/puts.c.patch delete mode 100644 stdio/FreeBSD/putwc.3.patch delete mode 100644 stdio/FreeBSD/putwc.c.patch delete mode 100644 stdio/FreeBSD/putwchar.c.patch delete mode 100644 stdio/FreeBSD/refill.c.patch delete mode 100644 stdio/FreeBSD/remove.3.patch delete mode 100644 stdio/FreeBSD/rewind.c.patch delete mode 100644 stdio/FreeBSD/scanf.3.patch delete mode 100644 stdio/FreeBSD/scanf.c.patch delete mode 100644 stdio/FreeBSD/setbuf.3.patch delete mode 100644 stdio/FreeBSD/snprintf.c.patch delete mode 100644 stdio/FreeBSD/sprintf.c.patch delete mode 100644 stdio/FreeBSD/sscanf.c.patch delete mode 100644 stdio/FreeBSD/stdio.3.patch delete mode 100644 stdio/FreeBSD/swprintf.c.patch delete mode 100644 stdio/FreeBSD/swscanf.c.patch delete mode 100644 stdio/FreeBSD/tempnam.c.patch delete mode 100644 stdio/FreeBSD/tmpnam.3.patch delete mode 100644 stdio/FreeBSD/tmpnam.c.patch delete mode 100644 stdio/FreeBSD/ungetc.3.patch delete mode 100644 stdio/FreeBSD/ungetwc.3.patch delete mode 100644 stdio/FreeBSD/ungetwc.c.patch delete mode 100644 stdio/FreeBSD/vasprintf.c.patch delete mode 100644 stdio/FreeBSD/vdprintf.c.patch delete mode 100644 stdio/FreeBSD/vfprintf.c.patch delete mode 100644 stdio/FreeBSD/vfscanf.c.patch delete mode 100644 stdio/FreeBSD/vfwprintf.c.patch delete mode 100644 stdio/FreeBSD/vfwscanf.c.patch delete mode 100644 stdio/FreeBSD/vprintf.c.patch delete mode 100644 stdio/FreeBSD/vscanf.c.patch delete mode 100644 stdio/FreeBSD/vsnprintf.c.patch delete mode 100644 stdio/FreeBSD/vsprintf.c.patch delete mode 100644 stdio/FreeBSD/vsscanf.c.patch delete mode 100644 stdio/FreeBSD/vswprintf.c.patch delete mode 100644 stdio/FreeBSD/vswscanf.c.patch delete mode 100644 stdio/FreeBSD/vwprintf.c.patch delete mode 100644 stdio/FreeBSD/vwscanf.c.patch delete mode 100644 stdio/FreeBSD/wbuf.c.patch delete mode 100644 stdio/FreeBSD/wprintf.3.patch delete mode 100644 stdio/FreeBSD/wprintf.c.patch delete mode 100644 stdio/FreeBSD/wscanf.3.patch delete mode 100644 stdio/FreeBSD/wscanf.c.patch delete mode 100644 stdio/Makefile.inc delete mode 120000 stdio/_flock_stub-fbsd.c delete mode 100644 stdio/asprintf-fbsd.c delete mode 120000 stdio/clrerr-fbsd.c delete mode 100644 stdio/dprintf-fbsd.c delete mode 100644 stdio/fclose-fbsd.c delete mode 120000 stdio/fclose.3 delete mode 100644 stdio/fdopen-fbsd.c delete mode 120000 stdio/feof-fbsd.c delete mode 120000 stdio/ferror-fbsd.c delete mode 120000 stdio/ferror.3 delete mode 100644 stdio/fflush-fbsd.c delete mode 120000 stdio/fflush.3 delete mode 120000 stdio/fgetc-fbsd.c delete mode 100644 stdio/fgetln-fbsd.c delete mode 100644 stdio/fgetln.3 delete mode 120000 stdio/fgetpos-fbsd.c delete mode 120000 stdio/fgets-fbsd.c delete mode 120000 stdio/fgets.3 delete mode 100644 stdio/fgetwc-fbsd.c delete mode 100644 stdio/fgetwln-fbsd.c delete mode 100644 stdio/fgetwln.3 delete mode 100644 stdio/fgetws-fbsd.c delete mode 100644 stdio/fgetws.3 delete mode 120000 stdio/fileno-fbsd.c delete mode 100644 stdio/findfp-fbsd.c delete mode 100644 stdio/flags-fbsd.c delete mode 120000 stdio/floatio.h delete mode 100644 stdio/flockfile.3 delete mode 100644 stdio/fopen-fbsd.c delete mode 100644 stdio/fopen.3 delete mode 100644 stdio/fprintf-fbsd.c delete mode 120000 stdio/fpurge-fbsd.c delete mode 120000 stdio/fputc-fbsd.c delete mode 100644 stdio/fputs-fbsd.c delete mode 100644 stdio/fputs.3 delete mode 100644 stdio/fputwc-fbsd.c delete mode 100644 stdio/fputws-fbsd.c delete mode 100644 stdio/fputws.3 delete mode 100644 stdio/fread-fbsd.c delete mode 100644 stdio/fread.3 delete mode 100644 stdio/freopen-fbsd.c delete mode 100644 stdio/fscanf-fbsd.c delete mode 120000 stdio/fseek-fbsd.c delete mode 100644 stdio/fseek.3 delete mode 120000 stdio/fsetpos-fbsd.c delete mode 100644 stdio/ftell-fbsd.c delete mode 100644 stdio/funopen-fbsd.c delete mode 120000 stdio/funopen.3 delete mode 120000 stdio/fvwrite-fbsd.c delete mode 120000 stdio/fvwrite.h delete mode 120000 stdio/fwalk-fbsd.c delete mode 120000 stdio/fwide-fbsd.c delete mode 100644 stdio/fwide.3 delete mode 100644 stdio/fwprintf-fbsd.c delete mode 100644 stdio/fwrite-fbsd.c delete mode 100644 stdio/fwscanf-fbsd.c delete mode 120000 stdio/getc-fbsd.c delete mode 100644 stdio/getc.3 delete mode 120000 stdio/getchar-fbsd.c delete mode 120000 stdio/getdelim-fbsd.c delete mode 120000 stdio/getline-fbsd.c delete mode 100644 stdio/getline.3 delete mode 120000 stdio/gets-fbsd.c delete mode 120000 stdio/getw-fbsd.c delete mode 100644 stdio/getwc-fbsd.c delete mode 100644 stdio/getwc.3 delete mode 100644 stdio/getwchar-fbsd.c delete mode 120000 stdio/glue.h delete mode 100644 stdio/local.h delete mode 100644 stdio/makebuf-fbsd.c delete mode 100644 stdio/mktemp-fbsd.c delete mode 100644 stdio/mktemp.3 delete mode 120000 stdio/perror-fbsd.c delete mode 100644 stdio/printf-fbsd.c delete mode 100644 stdio/printf-pos-fbsd.c delete mode 100644 stdio/printf.3 delete mode 100644 stdio/printfcommon.h delete mode 100644 stdio/printflocal.h delete mode 120000 stdio/putc-fbsd.c delete mode 100644 stdio/putc.3 delete mode 120000 stdio/putchar-fbsd.c delete mode 100644 stdio/puts-fbsd.c delete mode 120000 stdio/putw-fbsd.c delete mode 100644 stdio/putwc-fbsd.c delete mode 100644 stdio/putwc.3 delete mode 100644 stdio/putwchar-fbsd.c delete mode 100644 stdio/refill-fbsd.c delete mode 120000 stdio/remove-fbsd.c delete mode 100644 stdio/remove.3 delete mode 100644 stdio/rewind-fbsd.c delete mode 120000 stdio/rget-fbsd.c delete mode 100644 stdio/scanf-fbsd.c delete mode 100644 stdio/scanf.3 delete mode 120000 stdio/setbuf-fbsd.c delete mode 100644 stdio/setbuf.3 delete mode 120000 stdio/setbuffer-fbsd.c delete mode 120000 stdio/setvbuf-fbsd.c delete mode 100644 stdio/snprintf-fbsd.c delete mode 100644 stdio/sprintf-fbsd.c delete mode 100644 stdio/sscanf-fbsd.c delete mode 120000 stdio/stdio-fbsd.c delete mode 100644 stdio/stdio.3 delete mode 100644 stdio/swprintf-fbsd.c delete mode 100644 stdio/swscanf-fbsd.c delete mode 100644 stdio/tempnam-fbsd.c delete mode 120000 stdio/tmpfile-fbsd.c delete mode 100644 stdio/tmpnam-fbsd.c delete mode 100644 stdio/tmpnam.3 delete mode 120000 stdio/ungetc-fbsd.c delete mode 100644 stdio/ungetc.3 delete mode 100644 stdio/ungetwc-fbsd.c delete mode 100644 stdio/ungetwc.3 delete mode 100644 stdio/vasprintf-fbsd.c delete mode 100644 stdio/vdprintf-fbsd.c delete mode 100644 stdio/vfprintf-fbsd.c delete mode 100644 stdio/vfscanf-fbsd.c delete mode 100644 stdio/vfwprintf-fbsd.c delete mode 100644 stdio/vfwscanf-fbsd.c delete mode 100644 stdio/vprintf-fbsd.c delete mode 100644 stdio/vscanf-fbsd.c delete mode 100644 stdio/vsnprintf-fbsd.c delete mode 100644 stdio/vsprintf-fbsd.c delete mode 100644 stdio/vsscanf-fbsd.c delete mode 100644 stdio/vswprintf-fbsd.c delete mode 100644 stdio/vswscanf-fbsd.c delete mode 100644 stdio/vwprintf-fbsd.c delete mode 100644 stdio/vwscanf-fbsd.c delete mode 100644 stdio/wbuf-fbsd.c delete mode 100644 stdio/wprintf-fbsd.c delete mode 100644 stdio/wprintf.3 delete mode 100644 stdio/wscanf-fbsd.c delete mode 100644 stdio/wscanf.3 delete mode 120000 stdio/wsetup-fbsd.c delete mode 100644 stdlib/FreeBSD/abort.3.patch delete mode 100644 stdlib/FreeBSD/abort.c.patch delete mode 100644 stdlib/FreeBSD/abs.3.patch delete mode 100644 stdlib/FreeBSD/alloca.3.patch delete mode 100644 stdlib/FreeBSD/atexit.3.patch delete mode 100644 stdlib/FreeBSD/atexit.c.patch delete mode 100644 stdlib/FreeBSD/atexit.h.patch delete mode 100644 stdlib/FreeBSD/atof.3.patch delete mode 100644 stdlib/FreeBSD/atof.c.patch delete mode 100644 stdlib/FreeBSD/atoi.3.patch delete mode 100644 stdlib/FreeBSD/atoi.c.patch delete mode 100644 stdlib/FreeBSD/atol.3.patch delete mode 100644 stdlib/FreeBSD/atol.c.patch delete mode 100644 stdlib/FreeBSD/atoll.c.patch delete mode 100644 stdlib/FreeBSD/bsearch.3.patch delete mode 100644 stdlib/FreeBSD/bsearch.c.patch delete mode 100644 stdlib/FreeBSD/div.3.patch delete mode 100644 stdlib/FreeBSD/exit.c.patch delete mode 100644 stdlib/FreeBSD/getenv.3.patch delete mode 100644 stdlib/FreeBSD/getenv.c.patch delete mode 100644 stdlib/FreeBSD/getopt.c.patch delete mode 100644 stdlib/FreeBSD/getsubopt.3.patch rename stdlib/{heapsort_b-fbsd.c => FreeBSD/heapsort_b.c} (100%) delete mode 100644 stdlib/FreeBSD/heapsort_b.c.patch rename stdlib/{heapsort_r-fbsd.c => FreeBSD/heapsort_r.c} (100%) delete mode 100644 stdlib/FreeBSD/heapsort_r.c.patch delete mode 100644 stdlib/FreeBSD/imaxdiv.3.patch delete mode 100644 stdlib/FreeBSD/insque.3.patch delete mode 100644 stdlib/FreeBSD/labs.3.patch delete mode 100644 stdlib/FreeBSD/ldiv.3.patch delete mode 100644 stdlib/FreeBSD/llabs.3.patch delete mode 100644 stdlib/FreeBSD/lldiv.3.patch delete mode 100644 stdlib/FreeBSD/lsearch.3.patch delete mode 100644 stdlib/FreeBSD/memory.3.patch delete mode 100644 stdlib/FreeBSD/merge.c.patch rename stdlib/{merge_b-fbsd.c => FreeBSD/merge_b.c} (100%) delete mode 100644 stdlib/FreeBSD/merge_b.c.patch rename stdlib/{ => FreeBSD}/psort.3 (100%) rename stdlib/{psort-fbsd.c => FreeBSD/psort.c} (100%) create mode 120000 stdlib/FreeBSD/psort_b.c create mode 120000 stdlib/FreeBSD/psort_r.c delete mode 100644 stdlib/FreeBSD/putenv.c.patch delete mode 100644 stdlib/FreeBSD/qsort.3.patch delete mode 100644 stdlib/FreeBSD/qsort.c.patch delete mode 100644 stdlib/FreeBSD/qsort_r.c.patch delete mode 100644 stdlib/FreeBSD/radixsort.c.patch delete mode 100644 stdlib/FreeBSD/rand.3.patch delete mode 100644 stdlib/FreeBSD/random.3.patch delete mode 100644 stdlib/FreeBSD/random.c.patch delete mode 100644 stdlib/FreeBSD/realpath.3.patch delete mode 100644 stdlib/FreeBSD/realpath.c.patch delete mode 100644 stdlib/FreeBSD/setenv.c.patch delete mode 100644 stdlib/FreeBSD/strhash.c.patch delete mode 100644 stdlib/FreeBSD/strtod.3.patch delete mode 100644 stdlib/FreeBSD/strtoimax.c.patch delete mode 100644 stdlib/FreeBSD/strtol.3.patch delete mode 100644 stdlib/FreeBSD/strtol.c.patch delete mode 100644 stdlib/FreeBSD/strtoll.c.patch delete mode 100644 stdlib/FreeBSD/strtoq.c.patch delete mode 100644 stdlib/FreeBSD/strtoul.3.patch delete mode 100644 stdlib/FreeBSD/strtoul.c.patch delete mode 100644 stdlib/FreeBSD/strtoull.c.patch delete mode 100644 stdlib/FreeBSD/strtoumax.c.patch delete mode 100644 stdlib/FreeBSD/strtouq.c.patch delete mode 100644 stdlib/FreeBSD/system.3.patch delete mode 100644 stdlib/FreeBSD/system.c.patch delete mode 100644 stdlib/FreeBSD/tsearch.3.patch delete mode 100644 stdlib/Makefile.inc delete mode 100644 stdlib/NetBSD/strfmon.3.patch delete mode 100644 stdlib/NetBSD/strfmon.c.patch delete mode 100644 stdlib/OpenBSD/ecvt.3.patch delete mode 100644 stdlib/OpenBSD/ecvt.c.patch delete mode 100644 stdlib/OpenBSD/gcvt.c.patch delete mode 120000 stdlib/_Exit_-fbsd.c delete mode 100644 stdlib/abort-fbsd.c delete mode 100644 stdlib/abort.3 delete mode 120000 stdlib/abs-fbsd.c delete mode 100644 stdlib/abs.3 delete mode 100644 stdlib/alloca.3 delete mode 100644 stdlib/atexit-fbsd.c delete mode 100644 stdlib/atexit.3 delete mode 100644 stdlib/atof-fbsd.c delete mode 100644 stdlib/atof.3 delete mode 100644 stdlib/atoi-fbsd.c delete mode 100644 stdlib/atoi.3 delete mode 100644 stdlib/atol-fbsd.c delete mode 100644 stdlib/atol.3 delete mode 100644 stdlib/atoll-fbsd.c delete mode 100644 stdlib/bsearch-fbsd.c delete mode 100644 stdlib/bsearch.3 delete mode 120000 stdlib/div-fbsd.c delete mode 100644 stdlib/div.3 delete mode 100644 stdlib/ecvt-obsd.c delete mode 100644 stdlib/ecvt.3 delete mode 100644 stdlib/exit-fbsd.c delete mode 120000 stdlib/exit.3 delete mode 100644 stdlib/gcvt-obsd.c delete mode 100644 stdlib/getenv-fbsd.c delete mode 100644 stdlib/getenv.3 delete mode 100644 stdlib/getopt-fbsd.c delete mode 120000 stdlib/getopt.3 delete mode 120000 stdlib/getopt_long-fbsd.c delete mode 120000 stdlib/getopt_long.3 delete mode 120000 stdlib/getsubopt-fbsd.c delete mode 100644 stdlib/getsubopt.3 delete mode 120000 stdlib/hcreate-fbsd.c delete mode 120000 stdlib/hcreate.3 delete mode 120000 stdlib/heapsort-fbsd.c delete mode 120000 stdlib/imaxabs-fbsd.c delete mode 120000 stdlib/imaxabs.3 delete mode 120000 stdlib/imaxdiv-fbsd.c delete mode 100644 stdlib/imaxdiv.3 delete mode 120000 stdlib/insque-fbsd.c delete mode 100644 stdlib/insque.3 delete mode 120000 stdlib/labs-fbsd.c delete mode 100644 stdlib/labs.3 delete mode 120000 stdlib/ldiv-fbsd.c delete mode 100644 stdlib/ldiv.3 delete mode 120000 stdlib/llabs-fbsd.c delete mode 100644 stdlib/llabs.3 delete mode 120000 stdlib/lldiv-fbsd.c delete mode 100644 stdlib/lldiv.3 delete mode 120000 stdlib/lsearch-fbsd.c delete mode 100644 stdlib/lsearch.3 delete mode 100644 stdlib/memory.3 delete mode 100644 stdlib/merge-fbsd.c delete mode 100644 stdlib/psort.3.patch delete mode 100644 stdlib/psort.c.patch delete mode 100644 stdlib/psort_b-fbsd.c delete mode 100644 stdlib/psort_r-fbsd.c delete mode 100644 stdlib/putenv-fbsd.c delete mode 100644 stdlib/qsort-fbsd.c delete mode 100644 stdlib/qsort.3 delete mode 100644 stdlib/qsort_r-fbsd.c delete mode 100644 stdlib/radixsort-fbsd.c delete mode 120000 stdlib/radixsort.3 delete mode 120000 stdlib/rand-fbsd.c delete mode 100644 stdlib/rand.3 delete mode 100644 stdlib/random-fbsd.c delete mode 100644 stdlib/random.3 delete mode 120000 stdlib/reallocf-fbsd.c delete mode 100644 stdlib/realpath-fbsd.c delete mode 100644 stdlib/realpath.3 delete mode 120000 stdlib/remque-fbsd.c delete mode 100644 stdlib/setenv-fbsd.c delete mode 100644 stdlib/strfmon-nbsd.c delete mode 100644 stdlib/strfmon.3 delete mode 100644 stdlib/strhash-fbsd.c delete mode 100644 stdlib/strtod.3 delete mode 100644 stdlib/strtoimax-fbsd.c delete mode 100644 stdlib/strtol-fbsd.c delete mode 100644 stdlib/strtol.3 delete mode 100644 stdlib/strtoll-fbsd.c delete mode 100644 stdlib/strtoq-fbsd.c delete mode 100644 stdlib/strtoul-fbsd.c delete mode 100644 stdlib/strtoul.3 delete mode 100644 stdlib/strtoull-fbsd.c delete mode 100644 stdlib/strtoumax-fbsd.c delete mode 100644 stdlib/strtouq-fbsd.c delete mode 100644 stdlib/system-fbsd.c delete mode 100644 stdlib/system.3 delete mode 120000 stdlib/tdelete-fbsd.c delete mode 120000 stdlib/tfind-fbsd.c delete mode 120000 stdlib/tsearch-fbsd.c delete mode 100644 stdlib/tsearch.3 delete mode 120000 stdlib/twalk-fbsd.c delete mode 100644 stdtime/FreeBSD/asctime.c.patch delete mode 100644 stdtime/FreeBSD/ctime.3.patch delete mode 100644 stdtime/FreeBSD/ftime.3.patch delete mode 100644 stdtime/FreeBSD/localtime.c.patch delete mode 100644 stdtime/FreeBSD/strftime.3.patch delete mode 100644 stdtime/FreeBSD/strftime.c.patch delete mode 100644 stdtime/FreeBSD/strptime.3.patch delete mode 100644 stdtime/FreeBSD/strptime.c.patch delete mode 100644 stdtime/FreeBSD/timelocal.c.patch delete mode 100644 stdtime/FreeBSD/timelocal.h.patch delete mode 100644 stdtime/FreeBSD/tzfile.5.patch delete mode 100644 stdtime/FreeBSD/tzfile.h.patch delete mode 100644 stdtime/Makefile.inc delete mode 100644 stdtime/asctime-fbsd.c delete mode 100644 stdtime/ctime.3 delete mode 120000 stdtime/difftime-fbsd.c delete mode 120000 stdtime/ftime-fbsd.c delete mode 100644 stdtime/ftime.3 delete mode 100644 stdtime/localtime-fbsd.c delete mode 120000 stdtime/private.h delete mode 100644 stdtime/strftime-fbsd.c delete mode 100644 stdtime/strftime.3 delete mode 100644 stdtime/strptime-fbsd.c delete mode 100644 stdtime/strptime.3 delete mode 120000 stdtime/time2posix.3 delete mode 120000 stdtime/time32-fbsd.c delete mode 100644 stdtime/timelocal-fbsd.c delete mode 100644 stdtime/timelocal.h delete mode 100644 stdtime/tzfile.5 delete mode 100644 stdtime/tzfile.h delete mode 100644 string/FreeBSD/bcmp.3.patch delete mode 100644 string/FreeBSD/bcopy.3.patch rename stdlib/atexit.h => string/FreeBSD/bcopy.c (87%) delete mode 100644 string/FreeBSD/bstring.3.patch delete mode 100644 string/FreeBSD/bzero.3.patch rename arm/string/strlcpy.s => string/FreeBSD/bzero.c (100%) delete mode 100644 string/FreeBSD/bzero.c.patch delete mode 100644 string/FreeBSD/ffs.3.patch delete mode 100644 string/FreeBSD/index.3.patch delete mode 100644 string/FreeBSD/memccpy.3.patch delete mode 100644 string/FreeBSD/memchr.3.patch delete mode 100644 string/FreeBSD/memcmp.3.patch delete mode 100644 string/FreeBSD/memcpy.3.patch create mode 100644 string/FreeBSD/memcpy.c delete mode 100644 string/FreeBSD/memcpy.c.patch delete mode 100644 string/FreeBSD/memmove.3.patch create mode 100644 string/FreeBSD/memmove.c delete mode 100644 string/FreeBSD/memmove.c.patch delete mode 100644 string/FreeBSD/memset.3.patch delete mode 100644 string/FreeBSD/rindex.3.patch delete mode 100644 string/FreeBSD/stpcpy.c delete mode 100644 string/FreeBSD/stpncpy.c delete mode 100644 string/FreeBSD/strcasecmp.3.patch delete mode 100644 string/FreeBSD/strcasecmp.c.patch delete mode 100644 string/FreeBSD/strcasestr.c.patch delete mode 100644 string/FreeBSD/strcat.3.patch delete mode 100644 string/FreeBSD/strcat.c delete mode 100644 string/FreeBSD/strchr.3.patch delete mode 100644 string/FreeBSD/strchr.c.patch delete mode 100644 string/FreeBSD/strcmp.3.patch rename db/recno/recno.h => string/FreeBSD/strcmp.c (85%) delete mode 100644 string/FreeBSD/strcoll.3.patch delete mode 100644 string/FreeBSD/strcoll.c.patch delete mode 100644 string/FreeBSD/strcpy.3.patch delete mode 100644 string/FreeBSD/strcpy.c delete mode 100644 string/FreeBSD/strcspn.3.patch delete mode 100644 string/FreeBSD/strdup.3.patch delete mode 100644 string/FreeBSD/strerror.3.patch delete mode 100644 string/FreeBSD/strerror.c.patch delete mode 100644 string/FreeBSD/string.3.patch delete mode 100644 string/FreeBSD/strlcat.c delete mode 100644 string/FreeBSD/strlcpy.3.patch delete mode 100644 string/FreeBSD/strlcpy.c delete mode 100644 string/FreeBSD/strmode.3.patch delete mode 100644 string/FreeBSD/strncat.c delete mode 100644 string/FreeBSD/strncpy.c delete mode 100644 string/FreeBSD/strpbrk.3.patch delete mode 100644 string/FreeBSD/strrchr.3 delete mode 100644 string/FreeBSD/strrchr.3.patch delete mode 100644 string/FreeBSD/strrchr.c.patch delete mode 100644 string/FreeBSD/strsignal.c.patch delete mode 100644 string/FreeBSD/strspn.3.patch delete mode 100644 string/FreeBSD/strstr.3.patch delete mode 100644 string/FreeBSD/strtok.3.patch delete mode 100644 string/FreeBSD/strxfrm.3.patch delete mode 100644 string/FreeBSD/strxfrm.c.patch delete mode 100644 string/FreeBSD/swab.3.patch delete mode 100644 string/FreeBSD/swab.c.patch delete mode 100644 string/FreeBSD/wcscasecmp.c.patch delete mode 100644 string/FreeBSD/wcscoll.3.patch delete mode 100644 string/FreeBSD/wcscoll.c.patch delete mode 100644 string/FreeBSD/wcsncasecmp.c.patch delete mode 100644 string/FreeBSD/wcstok.3.patch delete mode 100644 string/FreeBSD/wcswidth.3.patch delete mode 100644 string/FreeBSD/wcswidth.c.patch delete mode 100644 string/FreeBSD/wcsxfrm.3.patch delete mode 100644 string/FreeBSD/wcsxfrm.c.patch delete mode 100644 string/FreeBSD/wmemchr.3.patch delete mode 100644 string/Makefile.inc delete mode 120000 string/bcmp-fbsd.c delete mode 100644 string/bcmp.3 delete mode 100644 string/bcopy.3 delete mode 100644 string/bstring.3 delete mode 100644 string/bzero.3 delete mode 100644 string/ffs.3 delete mode 120000 string/index-fbsd.c delete mode 100644 string/index.3 delete mode 120000 string/memccpy-fbsd.c delete mode 100644 string/memccpy.3 delete mode 120000 string/memchr-fbsd.c delete mode 100644 string/memchr.3 delete mode 120000 string/memcmp-fbsd.c delete mode 100644 string/memcmp.3 delete mode 100644 string/memcpy.3 delete mode 120000 string/memmem-fbsd.c delete mode 120000 string/memmem.3 delete mode 100644 string/memmove.3 delete mode 120000 string/memset-fbsd.c delete mode 100644 string/memset.3 create mode 100644 string/memset_pattern.c delete mode 120000 string/rindex-fbsd.c delete mode 100644 string/rindex.3 delete mode 120000 string/stpcpy-fbsd.c rename internat/NXIsAscii.c => string/stpcpy.c (66%) delete mode 120000 string/stpncpy-fbsd.c create mode 100644 string/stpncpy.c delete mode 100644 string/strcasecmp-fbsd.c delete mode 100644 string/strcasecmp.3 delete mode 100644 string/strcasestr-fbsd.c delete mode 120000 string/strcat-fbsd.c delete mode 100644 string/strcat.3 create mode 100644 string/strcat.c delete mode 100644 string/strchr-fbsd.c delete mode 100644 string/strchr.3 delete mode 100644 string/strcmp.3 delete mode 100644 string/strcoll-fbsd.c delete mode 100644 string/strcoll.3 delete mode 120000 string/strcpy-fbsd.c delete mode 100644 string/strcpy.3 rename internat/NXIsAlpha.c => string/strcpy.c (69%) delete mode 120000 string/strcspn-fbsd.c delete mode 100644 string/strcspn.3 delete mode 120000 string/strdup-fbsd.c delete mode 100644 string/strdup.3 delete mode 100644 string/strerror-fbsd.c delete mode 100644 string/strerror.3 delete mode 100644 string/string.3 delete mode 120000 string/strlcat-fbsd.c rename internat/NXIsCntrl.c => string/strlcat.c (64%) delete mode 120000 string/strlcpy-fbsd.c delete mode 100644 string/strlcpy.3 rename internat/NXIsAlNum.c => string/strlcpy.c (70%) delete mode 120000 string/strlen-fbsd.c delete mode 120000 string/strlen.3 delete mode 120000 string/strmode-fbsd.c delete mode 100644 string/strmode.3 delete mode 120000 string/strncat-fbsd.c create mode 100644 string/strncat.c delete mode 120000 string/strncmp-fbsd.c delete mode 120000 string/strncpy-fbsd.c create mode 100644 string/strncpy.c delete mode 120000 string/strndup-fbsd.c delete mode 120000 string/strnlen-fbsd.c delete mode 120000 string/strnstr-fbsd.c delete mode 120000 string/strpbrk-fbsd.c delete mode 100644 string/strpbrk.3 delete mode 100644 string/strrchr-fbsd.c delete mode 100644 string/strrchr.3 delete mode 120000 string/strsep-fbsd.c delete mode 120000 string/strsep.3 delete mode 100644 string/strsignal-fbsd.c delete mode 120000 string/strspn-fbsd.c delete mode 100644 string/strspn.3 delete mode 120000 string/strstr-fbsd.c delete mode 100644 string/strstr.3 delete mode 120000 string/strtok-fbsd.c delete mode 100644 string/strtok.3 delete mode 100644 string/strxfrm-fbsd.c delete mode 100644 string/strxfrm.3 delete mode 100644 string/swab-fbsd.c delete mode 100644 string/swab.3 delete mode 120000 string/wcpcpy-fbsd.c delete mode 120000 string/wcpncpy-fbsd.c delete mode 100644 string/wcscasecmp-fbsd.c delete mode 120000 string/wcscat-fbsd.c delete mode 120000 string/wcschr-fbsd.c delete mode 120000 string/wcscmp-fbsd.c delete mode 100644 string/wcscoll-fbsd.c delete mode 100644 string/wcscoll.3 delete mode 120000 string/wcscpy-fbsd.c delete mode 120000 string/wcscspn-fbsd.c delete mode 120000 string/wcsdup-fbsd.c delete mode 120000 string/wcslcat-fbsd.c delete mode 120000 string/wcslcpy-fbsd.c delete mode 120000 string/wcslen-fbsd.c delete mode 100644 string/wcsncasecmp-fbsd.c delete mode 120000 string/wcsncat-fbsd.c delete mode 120000 string/wcsncmp-fbsd.c delete mode 120000 string/wcsncpy-fbsd.c delete mode 120000 string/wcsnlen-fbsd.c delete mode 120000 string/wcspbrk-fbsd.c delete mode 120000 string/wcsrchr-fbsd.c delete mode 120000 string/wcsspn-fbsd.c delete mode 120000 string/wcsstr-fbsd.c delete mode 120000 string/wcstok-fbsd.c delete mode 100644 string/wcstok.3 delete mode 100644 string/wcswidth-fbsd.c delete mode 100644 string/wcswidth.3 delete mode 100644 string/wcsxfrm-fbsd.c delete mode 100644 string/wcsxfrm.3 delete mode 120000 string/wmemchr-fbsd.c delete mode 100644 string/wmemchr.3 delete mode 120000 string/wmemcmp-fbsd.c delete mode 120000 string/wmemcpy-fbsd.c delete mode 120000 string/wmemmove-fbsd.c delete mode 120000 string/wmemset-fbsd.c delete mode 100644 sys/Makefile.inc delete mode 100644 sys/OpenBSD/stack_protector.c.patch delete mode 100644 sys/stack_protector-obsd.c delete mode 100644 threads/Makefile.inc delete mode 100644 util/Makefile.inc create mode 100644 util/mkpath_np.3 create mode 100644 util/mkpath_np.c delete mode 100644 uuid/Makefile.inc delete mode 120000 uuid/clear-uuid.c delete mode 120000 uuid/compare-uuid.c delete mode 120000 uuid/copy-uuid.c delete mode 100644 uuid/gen_uuid-uuid.c delete mode 120000 uuid/isnull-uuid.c delete mode 120000 uuid/pack-uuid.c delete mode 120000 uuid/parse-uuid.c delete mode 120000 uuid/unpack-uuid.c delete mode 100644 uuid/unparse-uuid.c delete mode 100644 uuid/uuid.3 delete mode 120000 uuid/uuid.3-uuid.in delete mode 100644 uuid/uuidP.h delete mode 100644 uuid/uuid_clear.3 delete mode 120000 uuid/uuid_clear.3-uuid.in delete mode 100644 uuid/uuid_compare.3 delete mode 120000 uuid/uuid_compare.3-uuid.in delete mode 100644 uuid/uuid_copy.3 delete mode 120000 uuid/uuid_copy.3-uuid.in delete mode 100644 uuid/uuid_generate.3 delete mode 120000 uuid/uuid_generate.3-uuid.in delete mode 100644 uuid/uuid_is_null.3 delete mode 120000 uuid/uuid_is_null.3-uuid.in delete mode 100644 uuid/uuid_parse.3 delete mode 120000 uuid/uuid_parse.3-uuid.in delete mode 100644 uuid/uuid_unparse.3 delete mode 100644 uuid/uuid_unparse.3-uuid.in delete mode 100644 uuid/uuidsrc/gen_uuid.c.patch delete mode 100644 uuid/uuidsrc/unparse.c.patch delete mode 100644 uuid/uuidsrc/uuidP.h.patch delete mode 100644 uuid/uuidsrc/uuid_unparse.3.in.patch delete mode 100644 x86_64/gen/Makefile.inc rename {ppc => x86_64}/gen/setjmperr.c (58%) delete mode 100644 x86_64/pthreads/Makefile.inc delete mode 100644 x86_64/pthreads/get_cpu_capabilities.s delete mode 100644 x86_64/stdlib/gdtoa.mk delete mode 100644 x86_64/string/Makefile.inc delete mode 100644 x86_64/sys/Makefile.inc create mode 100755 xcodescripts/build_linklists.sh create mode 100644 xcodescripts/clean_simulator.sh create mode 100644 xcodescripts/force_libc_to_build.sh create mode 100755 xcodescripts/generate_features.pl create mode 100644 xcodescripts/headers.sh create mode 100644 xcodescripts/libc.xcconfig create mode 100644 xcodescripts/manpages.sh create mode 100644 xcodescripts/mig_headers.sh rename patchHeaders => xcodescripts/patch_headers_variants.pl (66%) mode change 100755 => 100644 create mode 100644 xcodescripts/sanitise_headers.sh rename strip-header.ed => xcodescripts/strip-header.ed (100%) create mode 100644 xcodescripts/variants.xcconfig diff --git a/BSDmakefile b/BSDmakefile deleted file mode 100644 index f787db5..0000000 --- a/BSDmakefile +++ /dev/null @@ -1,289 +0,0 @@ -.include -.include - -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 index cc5dc9a..0000000 --- a/GNUmakefile +++ /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 index 2b4e967..0000000 --- a/Info.plist +++ /dev/null @@ -1 +0,0 @@ -{NSExecutable = net; NSExtensions = {}; } diff --git a/Libc.xcodeproj/project.pbxproj b/Libc.xcodeproj/project.pbxproj new file mode 100644 index 0000000..987a2e0 --- /dev/null +++ b/Libc.xcodeproj/project.pbxproj @@ -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 = ""; }; + 3F89F3DC13E9194C00F6856C /* mkpath_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mkpath_np.3; sourceTree = ""; }; + 3F89F3DD13E9194C00F6856C /* mkpath_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mkpath_np.c; sourceTree = ""; }; + 3FB7E1B4146EF2E000843438 /* dirfd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirfd.c; sourceTree = ""; }; + 6310518613D4D966004F7BA8 /* strcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcpy.c; sourceTree = ""; }; + 6310518B13D4DABD004F7BA8 /* strlcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcpy.c; sourceTree = ""; }; + 6310518E13D4DAEA004F7BA8 /* strncpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strncpy.c; sourceTree = ""; }; + 634C4C3713BCEADC008CA66D /* memset_pattern_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = memset_pattern_Swift.s; sourceTree = ""; }; + 6358199013B53DD800CDF61C /* bzero_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bzero_Swift.s; sourceTree = ""; }; + 6358199213B53ECB00CDF61C /* bcopy_Swift.s */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.asm; path = bcopy_Swift.s; sourceTree = ""; }; + 63D4060513DDEDF10094DD56 /* stpcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stpcpy.c; sourceTree = ""; }; + 63D4060913DDEEA10094DD56 /* stpncpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stpncpy.c; sourceTree = ""; }; + 63D4060C13DDF26A0094DD56 /* strcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcat.c; sourceTree = ""; }; + 63D4060F13DDF4340094DD56 /* strncat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strncat.c; sourceTree = ""; }; + 63D4061213DDF6A20094DD56 /* strlcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcat.c; sourceTree = ""; }; + 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 = ""; }; + B122F2B11432B95B00AF95D0 /* regcomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regcomp.c; sourceTree = ""; }; + B122F2B21432B95B00AF95D0 /* regexec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regexec.c; sourceTree = ""; }; + B122F2B31432B95B00AF95D0 /* tre-ast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-ast.c"; sourceTree = ""; }; + B122F2B41432B95B00AF95D0 /* tre-ast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-ast.h"; sourceTree = ""; }; + B122F2B51432B95B00AF95D0 /* tre-compile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-compile.c"; sourceTree = ""; }; + B122F2B61432B95B00AF95D0 /* tre-compile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-compile.h"; sourceTree = ""; }; + B122F2B71432B95B00AF95D0 /* tre-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-internal.h"; sourceTree = ""; }; + B122F2B81432B95B00AF95D0 /* tre-match-backtrack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-match-backtrack.c"; sourceTree = ""; }; + B122F2B91432B95B00AF95D0 /* tre-match-parallel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-match-parallel.c"; sourceTree = ""; }; + B122F2BA1432B95B00AF95D0 /* tre-match-utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-match-utils.h"; sourceTree = ""; }; + B122F2BB1432B95B00AF95D0 /* tre-mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-mem.c"; sourceTree = ""; }; + B122F2BC1432B95B00AF95D0 /* tre-mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-mem.h"; sourceTree = ""; }; + B122F2BD1432B95B00AF95D0 /* tre-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-parse.c"; sourceTree = ""; }; + B122F2BE1432B95B00AF95D0 /* tre-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-parse.h"; sourceTree = ""; }; + B122F2BF1432B95B00AF95D0 /* tre-stack.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = "tre-stack.c"; sourceTree = ""; }; + B122F2C01432B95B00AF95D0 /* tre-stack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-stack.h"; sourceTree = ""; }; + B122F2C11432B95B00AF95D0 /* tre.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tre.h; sourceTree = ""; }; + B122F2C21432B95B00AF95D0 /* xmalloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xmalloc.h; sourceTree = ""; }; + B122F2C31432B95B00AF95D0 /* tre-0.8.0.tar.bz2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "tre-0.8.0.tar.bz2"; sourceTree = ""; }; + B122F2C41432B95B00AF95D0 /* tre-config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-config.h"; sourceTree = ""; }; + B122F2C51432B95B00AF95D0 /* tre-last-matched.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "tre-last-matched.h"; sourceTree = ""; }; + B19C64591450F8B900032373 /* sync_volume_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sync_volume_np.3; sourceTree = ""; }; + B19C645B1450F90200032373 /* sync_volume_np.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sync_volume_np.c; sourceTree = ""; }; + 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 = ""; }; + 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 = ""; }; + C932C2CF13AB1C73004EDA12 /* SpinlocksWFE.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SpinlocksWFE.c; sourceTree = ""; }; + C93D6150143D31E300EB9023 /* sanitise_headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = sanitise_headers.sh; sourceTree = ""; }; + 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 = ""; }; + C942135913904CBC004BA536 /* manpages.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = manpages.sh; sourceTree = ""; }; + C942135A13905D1C004BA536 /* manpages.lst */ = {isa = PBXFileReference; explicitFileType = text; path = manpages.lst; sourceTree = ""; }; + C95B7ED8138F3C11004311DA /* rune32.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rune32.h; sourceTree = ""; }; + 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 = ""; }; + C9766150138EC9D400741512 /* patch_headers_variants.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = patch_headers_variants.pl; sourceTree = ""; }; + C9766153138ECF0000741512 /* variants.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = variants.xcconfig; sourceTree = ""; }; + C976616B138EF14100741512 /* generate_features.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = generate_features.pl; sourceTree = ""; }; + C97C344013AB0E1B00713550 /* Spinlocks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Spinlocks.c; sourceTree = ""; }; + C980F8EB13AB168D0069AB06 /* SpinlocksUP.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SpinlocksUP.c; sourceTree = ""; }; + C9950E6A1390D2CA009863B6 /* headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = headers.sh; sourceTree = ""; }; + C995462713AAA25000A531B4 /* OSAtomicUP.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OSAtomicUP.c; sourceTree = ""; }; + C9B4E3D513BBBF060008A9BB /* OSAtomicLoadStoreEx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSAtomicLoadStoreEx.c; sourceTree = ""; }; + C9B4E3D713BBBF2D0008A9BB /* OSAtomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OSAtomic.c; sourceTree = ""; }; + C9B4E3D913BBC24E0008A9BB /* SpinlocksLoadStoreEx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = SpinlocksLoadStoreEx.c; sourceTree = ""; }; + C9B535AE138D9E980028D27C /* APPLE_LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = ""; }; + C9B535B1138D9E980028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = ""; }; + C9B535B2138D9E980028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = ""; }; + C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init_cpu_capabilities.c; sourceTree = ""; }; + C9B535B8138D9E980028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = ""; }; + C9B535B9138D9E980028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = ""; }; + C9B535BA138D9E980028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = ""; }; + C9B535BB138D9E980028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = ""; }; + C9B535BC138D9E980028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = ""; }; + C9B535C0138D9E980028D27C /* bcopy_CortexA8.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_CortexA8.s; sourceTree = ""; }; + C9B535C1138D9E980028D27C /* bcopy_CortexA9.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_CortexA9.s; sourceTree = ""; }; + C9B535C2138D9E980028D27C /* bcopy_Generic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_Generic.s; sourceTree = ""; }; + C9B535C3138D9E980028D27C /* bzero_CortexA8.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_CortexA8.s; sourceTree = ""; }; + C9B535C4138D9E980028D27C /* bzero_CortexA9.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_CortexA9.s; sourceTree = ""; }; + C9B535C5138D9E980028D27C /* bzero_Generic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_Generic.s; sourceTree = ""; }; + C9B535C6138D9E980028D27C /* dyld_resolvers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dyld_resolvers.c; sourceTree = ""; }; + C9B535C7138D9E980028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = ""; }; + C9B535C9138D9E980028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = ""; }; + C9B535CA138D9E980028D27C /* memset_pattern.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset_pattern.s; sourceTree = ""; }; + C9B535CB138D9E980028D27C /* strchr.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strchr.s; sourceTree = ""; }; + C9B535CC138D9E980028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = ""; }; + C9B535CF138D9E980028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = ""; }; + C9B535D0138D9E980028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = ""; }; + C9B535D2138D9E980028D27C /* strnlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strnlen.s; sourceTree = ""; }; + C9B535D3138D9E980028D27C /* strstr.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strstr.s; sourceTree = ""; }; + C9B535D5138D9E980028D27C /* _longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _longjmp.s; sourceTree = ""; }; + C9B535D6138D9E980028D27C /* _setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _setjmp.h; sourceTree = ""; }; + C9B535D7138D9E980028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; + C9B535D8138D9E980028D27C /* arm_commpage_gettimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arm_commpage_gettimeofday.c; sourceTree = ""; }; + C9B535D9138D9E980028D27C /* gcc_atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gcc_atomic.c; sourceTree = ""; }; + C9B535DA138D9E980028D27C /* longjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longjmp.s; sourceTree = ""; }; + C9B535DB138D9E980028D27C /* mach_absolute_time.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mach_absolute_time.s; sourceTree = ""; }; + C9B535DD138D9E980028D27C /* OSAtomic-v4.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "OSAtomic-v4.c"; sourceTree = ""; }; + C9B535DF138D9E980028D27C /* OSAtomic_resolvers.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSAtomic_resolvers.c; sourceTree = ""; }; + C9B535E0138D9E980028D27C /* OSAtomic_resolvers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic_resolvers.h; sourceTree = ""; }; + C9B535E1138D9E980028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; + C9B535F7138D9E980028D27C /* creat.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = creat.2; sourceTree = ""; }; + C9B535F8138D9E980028D27C /* creat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = creat.c; sourceTree = ""; }; + C9B535FA138D9E980028D27C /* gethostid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostid.3; sourceTree = ""; }; + C9B535FC138D9E980028D27C /* gethostid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gethostid.c; sourceTree = ""; }; + C9B535FE138D9E980028D27C /* getwd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwd.c; sourceTree = ""; }; + C9B535FF138D9E980028D27C /* killpg.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = killpg.2; sourceTree = ""; }; + C9B53601138D9E980028D27C /* killpg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = killpg.c; sourceTree = ""; }; + C9B53603138D9E980028D27C /* sethostid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sethostid.c; sourceTree = ""; }; + C9B53604138D9E980028D27C /* setpgrp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setpgrp.c; sourceTree = ""; }; + C9B53606138D9E980028D27C /* setrgid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setrgid.c; sourceTree = ""; }; + C9B53607138D9E980028D27C /* setruid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setruid.3; sourceTree = ""; }; + C9B53608138D9E980028D27C /* setruid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setruid.c; sourceTree = ""; }; + C9B5360A138D9E980028D27C /* setregid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setregid.c; sourceTree = ""; }; + C9B5360B138D9E980028D27C /* setreuid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setreuid.c; sourceTree = ""; }; + C9B5360C138D9E980028D27C /* sigaltstk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigaltstk.c; sourceTree = ""; }; + C9B5360D138D9E980028D27C /* sigblock.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigblock.2; sourceTree = ""; }; + C9B5360E138D9E980028D27C /* sigcompat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigcompat.c; sourceTree = ""; }; + C9B5360F138D9E980028D27C /* sigpause.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigpause.2; sourceTree = ""; }; + C9B53610138D9E980028D27C /* sigsetmask.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigsetmask.2; sourceTree = ""; }; + C9B53611138D9E980028D27C /* sigvec.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigvec.2; sourceTree = ""; }; + C9B53613138D9E980028D27C /* _dirhelper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _dirhelper.c; sourceTree = ""; }; + C9B53614138D9E980028D27C /* dirhelper.defs */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.mig; path = dirhelper.defs; sourceTree = ""; }; + C9B53615138D9E980028D27C /* dirhelper_priv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dirhelper_priv.h; sourceTree = ""; }; + C9B53616138D9E980028D27C /* kvm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = kvm.c; sourceTree = ""; }; + C9B53617138D9E980028D27C /* libproc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = libproc.c; sourceTree = ""; }; + C9B53618138D9E980028D27C /* libproc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libproc.h; sourceTree = ""; }; + C9B53619138D9E980028D27C /* libproc_internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libproc_internal.h; sourceTree = ""; }; + C9B5361B138D9E980028D27C /* MKGetTimeBaseInfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = MKGetTimeBaseInfo.c; sourceTree = ""; }; + C9B5361C138D9E980028D27C /* proc_listpidspath.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = proc_listpidspath.c; sourceTree = ""; }; + C9B53620138D9E980028D27C /* bt_close.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_close.c; sourceTree = ""; }; + C9B53621138D9E980028D27C /* bt_conv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_conv.c; sourceTree = ""; }; + C9B53622138D9E980028D27C /* bt_debug.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_debug.c; sourceTree = ""; }; + C9B53623138D9E980028D27C /* bt_delete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_delete.c; sourceTree = ""; }; + C9B53624138D9E980028D27C /* bt_get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_get.c; sourceTree = ""; }; + C9B53625138D9E980028D27C /* bt_open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_open.c; sourceTree = ""; }; + C9B53626138D9E980028D27C /* bt_overflow.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_overflow.c; sourceTree = ""; }; + C9B53628138D9E980028D27C /* bt_page.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_page.c; sourceTree = ""; }; + C9B53629138D9E980028D27C /* bt_put.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_put.c; sourceTree = ""; }; + C9B5362A138D9E980028D27C /* bt_search.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_search.c; sourceTree = ""; }; + C9B5362B138D9E980028D27C /* bt_seq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_seq.c; sourceTree = ""; }; + C9B5362D138D9E980028D27C /* bt_split.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_split.c; sourceTree = ""; }; + C9B5362F138D9E980028D27C /* bt_utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bt_utils.c; sourceTree = ""; }; + C9B53630138D9E980028D27C /* btree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = btree.h; sourceTree = ""; }; + C9B53632138D9E980028D27C /* bt_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bt_extern.h; sourceTree = ""; }; + C9B53636138D9E980028D27C /* db.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = db.c; sourceTree = ""; }; + C9B5363A138D9E980028D27C /* hash_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hash_extern.h; sourceTree = ""; }; + C9B5363B138D9E980028D27C /* hash.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash.c; sourceTree = ""; }; + C9B5363D138D9E980028D27C /* hash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = ""; }; + C9B5363F138D9E980028D27C /* hash_bigkey.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_bigkey.c; sourceTree = ""; }; + C9B53641138D9E980028D27C /* hash_buf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_buf.c; sourceTree = ""; }; + C9B53643138D9E980028D27C /* hash_func.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_func.c; sourceTree = ""; }; + C9B53645138D9E980028D27C /* hash_log2.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_log2.c; sourceTree = ""; }; + C9B53647138D9E980028D27C /* hash_page.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hash_page.c; sourceTree = ""; }; + C9B53649138D9E980028D27C /* ndbm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ndbm.c; sourceTree = ""; }; + C9B5364B138D9E980028D27C /* page.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = page.h; sourceTree = ""; }; + C9B53650138D9E980028D27C /* btree.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = btree.3; sourceTree = ""; }; + C9B53651138D9E980028D27C /* dbm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dbm.3; sourceTree = ""; }; + C9B53653138D9E980028D27C /* dbopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dbopen.3; sourceTree = ""; }; + C9B53654138D9E980028D27C /* hash.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = hash.3; sourceTree = ""; }; + C9B53655138D9E980028D27C /* mpool.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mpool.3; sourceTree = ""; }; + C9B53656138D9E980028D27C /* recno.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = recno.3; sourceTree = ""; }; + C9B5365A138D9E980028D27C /* mpool.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mpool.c; sourceTree = ""; }; + C9B5365F138D9E980028D27C /* rec_extern.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rec_extern.h; sourceTree = ""; }; + C9B53661138D9E980028D27C /* rec_close.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_close.c; sourceTree = ""; }; + C9B53662138D9E980028D27C /* rec_delete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_delete.c; sourceTree = ""; }; + C9B53663138D9E980028D27C /* rec_get.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_get.c; sourceTree = ""; }; + C9B53664138D9E980028D27C /* rec_open.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_open.c; sourceTree = ""; }; + C9B53665138D9E980028D27C /* rec_put.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_put.c; sourceTree = ""; }; + C9B53666138D9E980028D27C /* rec_search.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_search.c; sourceTree = ""; }; + C9B53667138D9E980028D27C /* rec_seq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_seq.c; sourceTree = ""; }; + C9B53668138D9E980028D27C /* rec_utils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rec_utils.c; sourceTree = ""; }; + C9B53669138D9E980028D27C /* recno.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = recno.h; sourceTree = ""; }; + C9B5366D138D9E980028D27C /* brk.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = brk.2; sourceTree = ""; }; + C9B5366E138D9E980028D27C /* brk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = brk.c; sourceTree = ""; }; + C9B5366F138D9E980028D27C /* bsd_signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bsd_signal.3; sourceTree = ""; }; + C9B53670138D9E980028D27C /* bsd_signal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bsd_signal.c; sourceTree = ""; }; + C9B53671138D9E980028D27C /* lchflags.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lchflags.3; sourceTree = ""; }; + C9B53672138D9E980028D27C /* lchflags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lchflags.c; sourceTree = ""; }; + C9B53673138D9E980028D27C /* lchmod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lchmod.3; sourceTree = ""; }; + C9B53674138D9E980028D27C /* lchmod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lchmod.c; sourceTree = ""; }; + C9B53675138D9E980028D27C /* lutimes.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lutimes.3; sourceTree = ""; }; + C9B53676138D9E980028D27C /* lutimes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lutimes.c; sourceTree = ""; }; + C9B53678138D9E980028D27C /* statvfs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = statvfs.3; sourceTree = ""; }; + C9B53679138D9E980028D27C /* statvfs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = statvfs.c; sourceTree = ""; }; + C9B5367A138D9E980028D27C /* tcgetsid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcgetsid.3; sourceTree = ""; }; + C9B5367B138D9E980028D27C /* tcgetsid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tcgetsid.c; sourceTree = ""; }; + C9B5367D138D9E980028D27C /* _fbsd_compat_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fbsd_compat_.h; sourceTree = ""; }; + C9B5367E138D9E980028D27C /* _fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _fpmath.h; sourceTree = ""; }; + C9B5367F138D9E980028D27C /* fpmath.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fpmath.h; sourceTree = ""; }; + C9B53680138D9E980028D27C /* libc_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc_private.h; sourceTree = ""; }; + C9B53682138D9E980028D27C /* atomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atomic.h; sourceTree = ""; }; + C9B53683138D9E980028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = ""; }; + C9B53684138D9E980028D27C /* port_after.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = port_after.h; sourceTree = ""; }; + C9B53685138D9E980028D27C /* port_before.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = port_before.h; sourceTree = ""; }; + C9B53686138D9E980028D27C /* reentrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = reentrant.h; sourceTree = ""; }; + C9B53687138D9E980028D27C /* spinlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spinlock.h; sourceTree = ""; }; + C9B53689138D9E980028D27C /* cdefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cdefs.h; sourceTree = ""; }; + C9B5368A138D9E980028D27C /* endian.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = endian.h; sourceTree = ""; }; + C9B5368B138D9E980028D27C /* un-namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "un-namespace.h"; sourceTree = ""; }; + C9B5368E138D9E980028D27C /* _ldbl_util.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _ldbl_util.c; sourceTree = ""; }; + C9B5368F138D9E980028D27C /* arith.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = arith.h; sourceTree = ""; }; + C9B53691138D9E980028D27C /* _hdtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _hdtoa.c; sourceTree = ""; }; + C9B53693138D9E980028D27C /* _ldtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _ldtoa.c; sourceTree = ""; }; + C9B53695138D9E980028D27C /* gdtoa-dmisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-dmisc.c"; sourceTree = ""; }; + C9B53696138D9E980028D27C /* gdtoa-dtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-dtoa.c"; sourceTree = ""; }; + C9B53697138D9E980028D27C /* gdtoa-gdtoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gdtoa.c"; sourceTree = ""; }; + C9B53698138D9E980028D27C /* gdtoa-gethex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gethex.c"; sourceTree = ""; }; + C9B5369A138D9E980028D27C /* gdtoa-gmisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-gmisc.c"; sourceTree = ""; }; + C9B5369B138D9E980028D27C /* gdtoa-hd_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-hd_init.c"; sourceTree = ""; }; + C9B5369C138D9E980028D27C /* gdtoa-hexnan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-hexnan.c"; sourceTree = ""; }; + C9B5369E138D9E980028D27C /* gdtoa-misc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-misc.c"; sourceTree = ""; }; + C9B536A0138D9E980028D27C /* gdtoa-smisc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-smisc.c"; sourceTree = ""; }; + C9B536A1138D9E980028D27C /* gdtoa-strtod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtod.c"; sourceTree = ""; }; + C9B536A3138D9E980028D27C /* gdtoa-strtodg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtodg.c"; sourceTree = ""; }; + C9B536A5138D9E980028D27C /* gdtoa-strtof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtof.c"; sourceTree = ""; }; + C9B536A7138D9E980028D27C /* gdtoa-strtoIg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtoIg.c"; sourceTree = ""; }; + C9B536A8138D9E980028D27C /* gdtoa-strtopdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtopdd.c"; sourceTree = ""; }; + C9B536AA138D9E980028D27C /* gdtoa-strtopx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtopx.c"; sourceTree = ""; }; + C9B536AC138D9E980028D27C /* gdtoa-strtord.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-strtord.c"; sourceTree = ""; }; + C9B536AE138D9E980028D27C /* gdtoa-sum.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-sum.c"; sourceTree = ""; }; + C9B536AF138D9E980028D27C /* gdtoa-ulp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "gdtoa-ulp.c"; sourceTree = ""; }; + C9B536B0138D9E980028D27C /* gdtoa.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoa.h; sourceTree = ""; }; + C9B536B2138D9E980028D27C /* gdtoa_fltrnds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoa_fltrnds.h; sourceTree = ""; }; + C9B536B3138D9E980028D27C /* gdtoaimp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gdtoaimp.h; sourceTree = ""; }; + C9B536B5138D9E980028D27C /* glue.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = glue.c; sourceTree = ""; }; + C9B536B6138D9E980028D27C /* machdep_ldisd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisd.c; sourceTree = ""; }; + C9B536B8138D9E980028D27C /* machdep_ldisdd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisdd.c; sourceTree = ""; }; + C9B536BA138D9E980028D27C /* machdep_ldisQ.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisQ.c; sourceTree = ""; }; + C9B536BB138D9E980028D27C /* machdep_ldisx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = machdep_ldisx.c; sourceTree = ""; }; + C9B536BD138D9E980028D27C /* gd_qnan.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = gd_qnan.h; sourceTree = ""; }; + C9B536BE138D9E980028D27C /* gdtoa.tgz */ = {isa = PBXFileReference; lastKnownFileType = file; path = gdtoa.tgz; sourceTree = ""; }; + C9B536C1138D9E990028D27C /* __dirent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = __dirent.h; sourceTree = ""; }; + C9B536C2138D9E990028D27C /* _simple.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _simple.c; sourceTree = ""; }; + C9B536C3138D9E990028D27C /* _simple.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _simple.h; sourceTree = ""; }; + C9B536C4138D9E990028D27C /* asl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = asl.3; sourceTree = ""; }; + C9B536C5138D9E990028D27C /* asl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl.c; sourceTree = ""; }; + C9B536C6138D9E990028D27C /* asl_core.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_core.c; sourceTree = ""; }; + C9B536C7138D9E990028D27C /* asl_core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_core.h; sourceTree = ""; }; + C9B536C8138D9E990028D27C /* asl_file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_file.c; sourceTree = ""; }; + C9B536C9138D9E990028D27C /* asl_file.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_file.h; sourceTree = ""; }; + C9B536CA138D9E990028D27C /* asl_ipc.defs */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.mig; path = asl_ipc.defs; sourceTree = ""; }; + C9B536CB138D9E990028D27C /* asl_legacy1.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_legacy1.c; sourceTree = ""; }; + C9B536CC138D9E990028D27C /* asl_legacy1.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_legacy1.h; sourceTree = ""; }; + C9B536CD138D9E990028D27C /* asl_msg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_msg.c; sourceTree = ""; }; + C9B536CE138D9E990028D27C /* asl_msg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_msg.h; sourceTree = ""; }; + C9B536CF138D9E990028D27C /* asl_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_private.h; sourceTree = ""; }; + C9B536D0138D9E990028D27C /* asl_store.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_store.c; sourceTree = ""; }; + C9B536D1138D9E990028D27C /* asl_store.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl_store.h; sourceTree = ""; }; + C9B536D2138D9E990028D27C /* asl_util.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asl_util.c; sourceTree = ""; }; + C9B536D3138D9E990028D27C /* assumes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = assumes.c; sourceTree = ""; }; + C9B536D4138D9E990028D27C /* assumes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = assumes.h; sourceTree = ""; }; + C9B536D5138D9E990028D27C /* authentication.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = authentication.c; sourceTree = ""; }; + C9B536D6138D9E990028D27C /* backtrace.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = backtrace.3; sourceTree = ""; }; + C9B536D7138D9E990028D27C /* backtrace.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = backtrace.c; sourceTree = ""; }; + C9B536D8138D9E990028D27C /* cache.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cache.c; sourceTree = ""; }; + C9B536D9138D9E990028D27C /* compat.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = compat.5; sourceTree = ""; }; + C9B536DA138D9E990028D27C /* confstr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = confstr.3; sourceTree = ""; }; + C9B536DB138D9E990028D27C /* confstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = confstr.c; sourceTree = ""; }; + C9B536DC138D9E990028D27C /* crypt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = crypt.3; sourceTree = ""; }; + C9B536DD138D9E990028D27C /* crypt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crypt.c; sourceTree = ""; }; + C9B536DE138D9E990028D27C /* devname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = devname.3; sourceTree = ""; }; + C9B536DF138D9E990028D27C /* devname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = devname.c; sourceTree = ""; }; + C9B536E0138D9E990028D27C /* directory.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = directory.3; sourceTree = ""; }; + C9B536E1138D9E990028D27C /* disklabel.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = disklabel.c; sourceTree = ""; }; + C9B536E2138D9E990028D27C /* errlst.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = errlst.c; sourceTree = ""; }; + C9B536E3138D9E990028D27C /* execinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = execinfo.h; sourceTree = ""; }; + C9B536E4138D9E990028D27C /* filesec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = filesec.c; sourceTree = ""; }; + C9B536E6138D9E990028D27C /* _rand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _rand48.c; sourceTree = ""; }; + C9B536E8138D9E990028D27C /* alarm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = alarm.3; sourceTree = ""; }; + C9B536EA138D9E990028D27C /* alarm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = alarm.c; sourceTree = ""; }; + C9B536EB138D9E990028D27C /* arc4random.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = arc4random.3; sourceTree = ""; }; + C9B536EC138D9E990028D27C /* arc4random.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = arc4random.c; sourceTree = ""; }; + C9B536EE138D9E990028D27C /* assert.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = assert.c; sourceTree = ""; }; + C9B536F0138D9E990028D27C /* basename.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = basename.3; sourceTree = ""; }; + C9B536F2138D9E990028D27C /* basename.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = basename.c; sourceTree = ""; }; + C9B536F4138D9E990028D27C /* clock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = clock.3; sourceTree = ""; }; + C9B536F5138D9E990028D27C /* clock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clock.c; sourceTree = ""; }; + C9B536F6138D9E990028D27C /* closedir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = closedir.c; sourceTree = ""; }; + C9B536F8138D9E990028D27C /* ctermid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctermid.3; sourceTree = ""; }; + C9B536FA138D9E990028D27C /* ctermid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ctermid.c; sourceTree = ""; }; + C9B536FB138D9E990028D27C /* daemon.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = daemon.3; sourceTree = ""; }; + C9B536FD138D9E990028D27C /* daemon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = daemon.c; sourceTree = ""; }; + C9B536FF138D9E990028D27C /* dirname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = dirname.3; sourceTree = ""; }; + C9B53701138D9E990028D27C /* dirname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dirname.c; sourceTree = ""; }; + C9B53703138D9E990028D27C /* drand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = drand48.c; sourceTree = ""; }; + C9B53705138D9E990028D27C /* erand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = erand48.c; sourceTree = ""; }; + C9B53707138D9E990028D27C /* err.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = err.3; sourceTree = ""; }; + C9B53709138D9E990028D27C /* err.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = err.c; sourceTree = ""; }; + C9B5370B138D9E990028D27C /* exec.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = exec.3; sourceTree = ""; }; + C9B5370D138D9E990028D27C /* exec.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exec.c; sourceTree = ""; }; + C9B5370F138D9E990028D27C /* fmtcheck.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fmtcheck.3; sourceTree = ""; }; + C9B53710138D9E990028D27C /* fmtcheck.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fmtcheck.c; sourceTree = ""; }; + C9B53711138D9E990028D27C /* fmtmsg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fmtmsg.3; sourceTree = ""; }; + C9B53712138D9E990028D27C /* fmtmsg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fmtmsg.c; sourceTree = ""; }; + C9B53714138D9E990028D27C /* fnmatch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fnmatch.3; sourceTree = ""; }; + C9B53716138D9E990028D27C /* fnmatch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fnmatch.c; sourceTree = ""; }; + C9B53718138D9E990028D27C /* ftok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftok.3; sourceTree = ""; }; + C9B5371A138D9E990028D27C /* ftok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftok.c; sourceTree = ""; }; + C9B5371B138D9E990028D27C /* getbsize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getbsize.3; sourceTree = ""; }; + C9B5371C138D9E990028D27C /* getbsize.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getbsize.c; sourceTree = ""; }; + C9B5371D138D9E990028D27C /* getcap.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcap.3; sourceTree = ""; }; + C9B5371E138D9E990028D27C /* getcap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getcap.c; sourceTree = ""; }; + C9B53720138D9E990028D27C /* getcontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcontext.3; sourceTree = ""; }; + C9B53721138D9E990028D27C /* getcwd.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getcwd.3; sourceTree = ""; }; + C9B53722138D9E990028D27C /* getcwd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getcwd.c; sourceTree = ""; }; + C9B53724138D9E990028D27C /* gethostname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostname.3; sourceTree = ""; }; + C9B53726138D9E990028D27C /* gethostname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gethostname.c; sourceTree = ""; }; + C9B53728138D9E990028D27C /* getlogin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getlogin.c; sourceTree = ""; }; + C9B5372A138D9E990028D27C /* getmntinfo.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getmntinfo.3; sourceTree = ""; }; + C9B5372C138D9E990028D27C /* getmntinfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmntinfo.c; sourceTree = ""; }; + C9B5372E138D9E990028D27C /* getpagesize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpagesize.3; sourceTree = ""; }; + C9B5372F138D9E990028D27C /* getpagesize.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getpagesize.c; sourceTree = ""; }; + C9B53730138D9E990028D27C /* getpass.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpass.3; sourceTree = ""; }; + C9B53731138D9E990028D27C /* getpeereid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getpeereid.3; sourceTree = ""; }; + C9B53732138D9E990028D27C /* getpeereid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getpeereid.c; sourceTree = ""; }; + C9B53733138D9E990028D27C /* getprogname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getprogname.3; sourceTree = ""; }; + C9B53735138D9E990028D27C /* getprogname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getprogname.c; sourceTree = ""; }; + C9B53737138D9E990028D27C /* glob.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = glob.3; sourceTree = ""; }; + C9B53739138D9E990028D27C /* glob.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = glob.c; sourceTree = ""; }; + C9B5373B138D9E990028D27C /* isatty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isatty.c; sourceTree = ""; }; + C9B5373D138D9E990028D27C /* jrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = jrand48.c; sourceTree = ""; }; + C9B5373F138D9E990028D27C /* lcong48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lcong48.c; sourceTree = ""; }; + C9B53741138D9E990028D27C /* lockf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lockf.3; sourceTree = ""; }; + C9B53743138D9E990028D27C /* lockf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lockf.c; sourceTree = ""; }; + C9B53745138D9E990028D27C /* lrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lrand48.c; sourceTree = ""; }; + C9B53747138D9E990028D27C /* makecontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = makecontext.3; sourceTree = ""; }; + C9B53749138D9E990028D27C /* mrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mrand48.c; sourceTree = ""; }; + C9B5374B138D9E990028D27C /* nice.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nice.3; sourceTree = ""; }; + C9B5374C138D9E990028D27C /* nice.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nice.c; sourceTree = ""; }; + C9B5374E138D9E990028D27C /* nrand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nrand48.c; sourceTree = ""; }; + C9B53750138D9E990028D27C /* opendir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = opendir.c; sourceTree = ""; }; + C9B53752138D9E990028D27C /* pause.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pause.3; sourceTree = ""; }; + C9B53753138D9E990028D27C /* pause.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pause.c; sourceTree = ""; }; + C9B53755138D9E990028D27C /* popen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = popen.3; sourceTree = ""; }; + C9B53757138D9E990028D27C /* popen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = popen.c; sourceTree = ""; }; + C9B53759138D9E990028D27C /* pselect.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pselect.3; sourceTree = ""; }; + C9B5375B138D9E990028D27C /* pselect.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pselect.c; sourceTree = ""; }; + C9B5375D138D9E990028D27C /* psignal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = psignal.3; sourceTree = ""; }; + C9B5375F138D9E990028D27C /* psignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = psignal.c; sourceTree = ""; }; + C9B53760138D9E990028D27C /* raise.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = raise.3; sourceTree = ""; }; + C9B53761138D9E990028D27C /* raise.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = raise.c; sourceTree = ""; }; + C9B53762138D9E990028D27C /* rand48.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rand48.3; sourceTree = ""; }; + C9B53764138D9E990028D27C /* rand48.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rand48.h; sourceTree = ""; }; + C9B53766138D9E990028D27C /* readdir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = readdir.c; sourceTree = ""; }; + C9B53768138D9E990028D27C /* readpassphrase.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = readpassphrase.3; sourceTree = ""; }; + C9B53769138D9E990028D27C /* readpassphrase.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = readpassphrase.c; sourceTree = ""; }; + C9B5376B138D9E990028D27C /* rewinddir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rewinddir.c; sourceTree = ""; }; + C9B5376C138D9E990028D27C /* scandir.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scandir.3; sourceTree = ""; }; + C9B5376E138D9E990028D27C /* scandir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scandir.c; sourceTree = ""; }; + C9B53771138D9E990028D27C /* seed48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = seed48.c; sourceTree = ""; }; + C9B53773138D9E990028D27C /* seekdir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = seekdir.c; sourceTree = ""; }; + C9B53774138D9E990028D27C /* sethostname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sethostname.c; sourceTree = ""; }; + C9B53775138D9E990028D27C /* setmode.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setmode.3; sourceTree = ""; }; + C9B53776138D9E990028D27C /* setmode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setmode.c; sourceTree = ""; }; + C9B53778138D9E990028D27C /* setprogname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setprogname.c; sourceTree = ""; }; + C9B5377A138D9E990028D27C /* siginterrupt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = siginterrupt.3; sourceTree = ""; }; + C9B5377C138D9E990028D27C /* siginterrupt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = siginterrupt.c; sourceTree = ""; }; + C9B5377D138D9E990028D27C /* siglist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = siglist.c; sourceTree = ""; }; + C9B5377F138D9E990028D27C /* signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = signal.3; sourceTree = ""; }; + C9B53781138D9E990028D27C /* signal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = signal.c; sourceTree = ""; }; + C9B53783138D9E990028D27C /* signbit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = signbit.3; sourceTree = ""; }; + C9B53785138D9E990028D27C /* sleep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sleep.3; sourceTree = ""; }; + C9B53787138D9E990028D27C /* sleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sleep.c; sourceTree = ""; }; + C9B53789138D9E990028D27C /* srand48.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = srand48.c; sourceTree = ""; }; + C9B5378B138D9E990028D27C /* stringlist.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stringlist.3; sourceTree = ""; }; + C9B5378C138D9E990028D27C /* stringlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stringlist.c; sourceTree = ""; }; + C9B5378D138D9E990028D27C /* sysconf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysconf.3; sourceTree = ""; }; + C9B5378E138D9E990028D27C /* sysconf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysconf.c; sourceTree = ""; }; + C9B53790138D9E990028D27C /* sysctl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysctl.3; sourceTree = ""; }; + C9B53792138D9E990028D27C /* sysctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctl.c; sourceTree = ""; }; + C9B53794138D9E990028D27C /* sysctlbyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctlbyname.c; sourceTree = ""; }; + C9B53795138D9E990028D27C /* sysctlnametomib.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sysctlnametomib.c; sourceTree = ""; }; + C9B53796138D9E990028D27C /* telldir.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = telldir.c; sourceTree = ""; }; + C9B53798138D9E990028D27C /* telldir.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = telldir.h; sourceTree = ""; }; + C9B5379A138D9E990028D27C /* termios.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = termios.c; sourceTree = ""; }; + C9B5379C138D9E990028D27C /* time.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = time.3; sourceTree = ""; }; + C9B5379E138D9E990028D27C /* time.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = time.c; sourceTree = ""; }; + C9B537A0138D9E990028D27C /* times.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = times.3; sourceTree = ""; }; + C9B537A2138D9E990028D27C /* times.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = times.c; sourceTree = ""; }; + C9B537A3138D9E990028D27C /* timezone.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = timezone.3; sourceTree = ""; }; + C9B537A4138D9E990028D27C /* timezone.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timezone.c; sourceTree = ""; }; + C9B537A5138D9E990028D27C /* ttyname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ttyname.3; sourceTree = ""; }; + C9B537A7138D9E990028D27C /* ttyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ttyname.c; sourceTree = ""; }; + C9B537A9138D9E990028D27C /* ttyslot.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ttyslot.c; sourceTree = ""; }; + C9B537AA138D9E990028D27C /* ualarm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ualarm.3; sourceTree = ""; }; + C9B537AC138D9E990028D27C /* ualarm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ualarm.c; sourceTree = ""; }; + C9B537AD138D9E990028D27C /* ucontext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ucontext.3; sourceTree = ""; }; + C9B537AE138D9E990028D27C /* ulimit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ulimit.3; sourceTree = ""; }; + C9B537B0138D9E990028D27C /* ulimit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ulimit.c; sourceTree = ""; }; + C9B537B1138D9E990028D27C /* unvis.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = unvis.3; sourceTree = ""; }; + C9B537B2138D9E990028D27C /* unvis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unvis.c; sourceTree = ""; }; + C9B537B4138D9E990028D27C /* usleep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = usleep.3; sourceTree = ""; }; + C9B537B6138D9E990028D27C /* usleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = usleep.c; sourceTree = ""; }; + C9B537B8138D9E990028D27C /* utime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utime.3; sourceTree = ""; }; + C9B537BA138D9E990028D27C /* utime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utime.c; sourceTree = ""; }; + C9B537BB138D9E990028D27C /* vis.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = vis.3; sourceTree = ""; }; + C9B537BC138D9E990028D27C /* vis.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vis.c; sourceTree = ""; }; + C9B537BE138D9E990028D27C /* wait.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wait.c; sourceTree = ""; }; + C9B537C0138D9E990028D27C /* wait3.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wait3.c; sourceTree = ""; }; + C9B537C1138D9E990028D27C /* waitpid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = waitpid.c; sourceTree = ""; }; + C9B537C3138D9E990028D27C /* fts.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fts.3; sourceTree = ""; }; + C9B537C4138D9E990028D27C /* fts.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fts.c; sourceTree = ""; }; + C9B537C5138D9E990028D27C /* ftw.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftw.3; sourceTree = ""; }; + C9B537C6138D9E990028D27C /* get_compat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = get_compat.c; sourceTree = ""; }; + C9B537C7138D9E990028D27C /* get_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = get_compat.h; sourceTree = ""; }; + C9B537C8138D9E990028D27C /* getdomainname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getdomainname.3; sourceTree = ""; }; + C9B537C9138D9E990028D27C /* getloadavg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getloadavg.3; sourceTree = ""; }; + C9B537CA138D9E990028D27C /* getloadavg.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getloadavg.c; sourceTree = ""; }; + C9B537CB138D9E990028D27C /* getttyent.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getttyent.3; sourceTree = ""; }; + C9B537CC138D9E990028D27C /* getttyent.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getttyent.c; sourceTree = ""; }; + C9B537CD138D9E990028D27C /* getusershell.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getusershell.3; sourceTree = ""; }; + C9B537CE138D9E990028D27C /* getusershell.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getusershell.c; sourceTree = ""; }; + C9B537CF138D9E990028D27C /* getvfsbyname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getvfsbyname.3; sourceTree = ""; }; + C9B537D0138D9E990028D27C /* getvfsbyname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getvfsbyname.c; sourceTree = ""; }; + C9B537D1138D9E990028D27C /* intro.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = intro.3; sourceTree = ""; }; + C9B537D2138D9E990028D27C /* isinf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isinf.c; sourceTree = ""; }; + C9B537D3138D9E990028D27C /* isnan.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isnan.c; sourceTree = ""; }; + C9B537D4138D9E990028D27C /* magazine_malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = magazine_malloc.c; sourceTree = ""; }; + C9B537D5138D9E990028D27C /* magmallocProvider.d */ = {isa = PBXFileReference; explicitFileType = sourcecode.dtrace; path = magmallocProvider.d; sourceTree = ""; }; + C9B537D7138D9E990028D27C /* malloc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc.3; sourceTree = ""; }; + C9B537D8138D9E990028D27C /* malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = malloc.c; sourceTree = ""; }; + C9B537D9138D9E990028D27C /* malloc_printf.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = malloc_printf.h; sourceTree = ""; }; + C9B537DA138D9E990028D27C /* malloc_size.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc_size.3; sourceTree = ""; }; + C9B537DB138D9E990028D27C /* malloc_zone_malloc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = malloc_zone_malloc.3; sourceTree = ""; }; + C9B537DC138D9E990028D27C /* nanosleep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nanosleep.c; sourceTree = ""; }; + C9B537DE138D9E990028D27C /* endutxent.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = endutxent.3; sourceTree = ""; }; + C9B537E0138D9E990028D27C /* getlastlogx.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getlastlogx.3; sourceTree = ""; }; + C9B537E2138D9E990028D27C /* utmpx.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utmpx.5; sourceTree = ""; }; + C9B537E4138D9E990028D27C /* utmpx.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utmpx.c; sourceTree = ""; }; + C9B537E6138D9E990028D27C /* nftw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nftw.c; sourceTree = ""; }; + C9B537E7138D9E990028D27C /* nlist.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nlist.3; sourceTree = ""; }; + C9B537E8138D9E990028D27C /* nlist.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nlist.c; sourceTree = ""; }; + C9B537E9138D9E990028D27C /* NSSystemDirectories.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = NSSystemDirectories.c; sourceTree = ""; }; + C9B537EA138D9E990028D27C /* oldsyslog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = oldsyslog.c; sourceTree = ""; }; + C9B537EB138D9E990028D27C /* platfunc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = platfunc.c; sourceTree = ""; }; + C9B537EC138D9E990028D27C /* platfunc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = platfunc.h; sourceTree = ""; }; + C9B537ED138D9E990028D27C /* posix_memalign.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = posix_memalign.3; sourceTree = ""; }; + C9B537EE138D9E990028D27C /* pwcache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pwcache.3; sourceTree = ""; }; + C9B537EF138D9E990028D27C /* scalable_malloc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scalable_malloc.c; sourceTree = ""; }; + C9B537F0138D9E990028D27C /* scalable_malloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = scalable_malloc.h; sourceTree = ""; }; + C9B537F1138D9E990028D27C /* setjmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setjmp.3; sourceTree = ""; }; + C9B537F2138D9E990028D27C /* setlogin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setlogin.c; sourceTree = ""; }; + C9B537F3138D9E990028D27C /* sigsetops.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigsetops.3; sourceTree = ""; }; + C9B537F4138D9E990028D27C /* sigsetops.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigsetops.c; sourceTree = ""; }; + C9B537F5138D9E990028D27C /* stack_logging.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_logging.c; sourceTree = ""; }; + C9B537F6138D9E990028D27C /* stack_logging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stack_logging.h; sourceTree = ""; }; + C9B537F7138D9E990028D27C /* stack_logging_disk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_logging_disk.c; sourceTree = ""; }; + C9B537F8138D9E990028D27C /* strtofflags.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtofflags.3; sourceTree = ""; }; + C9B537F9138D9E990028D27C /* strtofflags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtofflags.c; sourceTree = ""; }; + C9B537FA138D9E990028D27C /* syslog.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = syslog.3; sourceTree = ""; }; + C9B537FB138D9E990028D27C /* syslog.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = syslog.c; sourceTree = ""; }; + C9B537FC138D9E990028D27C /* tcgetpgrp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcgetpgrp.3; sourceTree = ""; }; + C9B537FD138D9E990028D27C /* tcsendbreak.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsendbreak.3; sourceTree = ""; }; + C9B537FE138D9E990028D27C /* tcsetattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsetattr.3; sourceTree = ""; }; + C9B537FF138D9E990028D27C /* tcsetpgrp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tcsetpgrp.3; sourceTree = ""; }; + C9B53800138D9E990028D27C /* thread_stack_pcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = thread_stack_pcs.c; sourceTree = ""; }; + C9B53801138D9E990028D27C /* tzset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tzset.3; sourceTree = ""; }; + C9B53802138D9E990028D27C /* uname.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = uname.3; sourceTree = ""; }; + C9B53803138D9E990028D27C /* uname.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = uname.c; sourceTree = ""; }; + C9B53804138D9E990028D27C /* utmpx-darwin.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "utmpx-darwin.c"; sourceTree = ""; }; + C9B53805138D9E990028D27C /* utmpx-darwin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "utmpx-darwin.h"; sourceTree = ""; }; + C9B53806138D9E990028D27C /* utmpx_thread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmpx_thread.h; sourceTree = ""; }; + C9B53807138D9E990028D27C /* wordexp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wordexp.3; sourceTree = ""; }; + C9B53808138D9E990028D27C /* wordexp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wordexp.c; sourceTree = ""; }; + C9B5380B138D9E990028D27C /* gmon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gmon.c; sourceTree = ""; }; + C9B5380D138D9E990028D27C /* moncontrol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = moncontrol.3; sourceTree = ""; }; + C9B53811138D9E990028D27C /* _ctx_start.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.S; sourceTree = ""; }; + C9B53812138D9E990028D27C /* _setcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.S; sourceTree = ""; }; + C9B53813138D9E990028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = ""; }; + C9B53814138D9E990028D27C /* getcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.S; sourceTree = ""; }; + C9B53815138D9E990028D27C /* getmcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmcontext.c; sourceTree = ""; }; + C9B53816138D9E990028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = ""; }; + C9B53817138D9E990028D27C /* makecontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makecontext.c; sourceTree = ""; }; + C9B53819138D9E990028D27C /* mcount.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mcount.s; sourceTree = ""; }; + C9B5381A138D9E990028D27C /* setcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setcontext.c; sourceTree = ""; }; + C9B5381B138D9E990028D27C /* setjmperr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setjmperr.c; sourceTree = ""; }; + C9B5381C138D9E990028D27C /* swapcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swapcontext.c; sourceTree = ""; }; + C9B5381E138D9E990028D27C /* init_cpu_capabilities.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init_cpu_capabilities.c; sourceTree = ""; }; + C9B53820138D9E990028D27C /* preempt.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = preempt.s; sourceTree = ""; }; + C9B53821138D9E990028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = ""; }; + C9B53822138D9E990028D27C /* pthread_mutex_lock.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_mutex_lock.s; sourceTree = ""; }; + C9B53823138D9E990028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = ""; }; + C9B53824138D9E990028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = ""; }; + C9B53825138D9E990028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = ""; }; + C9B53826138D9E990028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = ""; }; + C9B5382A138D9E990028D27C /* __bzero.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = __bzero.s; sourceTree = ""; }; + C9B5382B138D9E990028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = ""; }; + C9B5382C138D9E990028D27C /* bcopy_scalar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_scalar.s; sourceTree = ""; }; + C9B5382D138D9E990028D27C /* bcopy_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse2.s; sourceTree = ""; }; + C9B5382E138D9E990028D27C /* bcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse3x.s; sourceTree = ""; }; + C9B5382F138D9E990028D27C /* bcopy_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse42.s; sourceTree = ""; }; + C9B53830138D9E990028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = ""; }; + C9B53831138D9E990028D27C /* bzero_scalar.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_scalar.s; sourceTree = ""; }; + C9B53832138D9E990028D27C /* bzero_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse2.s; sourceTree = ""; }; + C9B53833138D9E990028D27C /* bzero_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse42.s; sourceTree = ""; }; + C9B53834138D9E990028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = ""; }; + C9B53835138D9E990028D27C /* longcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longcopy_sse3x.s; sourceTree = ""; }; + C9B53837138D9E990028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = ""; }; + C9B53838138D9E990028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = ""; }; + C9B53839138D9E990028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = ""; }; + C9B5383A138D9E990028D27C /* memset.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset.s; sourceTree = ""; }; + C9B5383B138D9E990028D27C /* memset_pattern_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset_pattern_sse2.s; sourceTree = ""; }; + C9B5383C138D9E990028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = ""; }; + C9B5383D138D9E990028D27C /* strcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcpy.s; sourceTree = ""; }; + C9B5383E138D9E990028D27C /* strlcat.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcat.s; sourceTree = ""; }; + C9B5383F138D9E990028D27C /* strlcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcpy.s; sourceTree = ""; }; + C9B53840138D9E990028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = ""; }; + C9B53841138D9E990028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = ""; }; + C9B53842138D9E990028D27C /* strncpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncpy.s; sourceTree = ""; }; + C9B53844138D9E990028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; + C9B53845138D9E990028D27C /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = ""; }; + C9B53846138D9E990028D27C /* atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = ""; }; + C9B53847138D9E990028D27C /* i386_gettimeofday_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = i386_gettimeofday_asm.s; sourceTree = ""; }; + C9B53848138D9E990028D27C /* mach_absolute_time.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mach_absolute_time.c; sourceTree = ""; }; + C9B53849138D9E990028D27C /* mach_absolute_time_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mach_absolute_time_asm.s; sourceTree = ""; }; + C9B5384B138D9E990028D27C /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = ""; }; + C9B5384C138D9E990028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; + C9B5384D138D9E990028D27C /* spinlocks.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spinlocks.c; sourceTree = ""; }; + C9B5384E138D9E990028D27C /* spinlocks_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spinlocks_asm.s; sourceTree = ""; }; + C9B53850138D9E990028D27C /* _locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _locale.h; sourceTree = ""; }; + C9B53851138D9E990028D27C /* _structs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _structs.h; sourceTree = ""; }; + C9B53852138D9E990028D27C /* _types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _types.h; sourceTree = ""; }; + C9B53853138D9E990028D27C /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = ""; }; + C9B53854138D9E990028D27C /* _xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _xlocale.h; sourceTree = ""; }; + C9B53855138D9E990028D27C /* aio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aio.h; sourceTree = ""; }; + C9B53856138D9E990028D27C /* alloca.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = alloca.h; sourceTree = ""; }; + C9B53857138D9E990028D27C /* ar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ar.h; sourceTree = ""; }; + C9B53859138D9E990028D27C /* ftp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ftp.h; sourceTree = ""; }; + C9B5385B138D9E990028D27C /* nameser_compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nameser_compat.h; sourceTree = ""; }; + C9B5385C138D9E990028D27C /* telnet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = telnet.h; sourceTree = ""; }; + C9B5385D138D9E990028D27C /* tftp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tftp.h; sourceTree = ""; }; + C9B5385E138D9E990028D27C /* asl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asl.h; sourceTree = ""; }; + C9B5385F138D9E990028D27C /* asm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = asm.h; sourceTree = ""; }; + C9B53860138D9E990028D27C /* assert.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = assert.h; sourceTree = ""; }; + C9B53861138D9E990028D27C /* authentication.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = authentication.h; sourceTree = ""; }; + C9B53862138D9E990028D27C /* bitstring.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = bitstring.h; sourceTree = ""; }; + C9B53863138D9E990028D27C /* cpio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cpio.h; sourceTree = ""; }; + C9B53864138D9E990028D27C /* CrashReporterClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CrashReporterClient.h; sourceTree = ""; }; + C9B53865138D9E990028D27C /* crt_externs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = crt_externs.h; sourceTree = ""; }; + C9B53866138D9E990028D27C /* ctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ctype.h; sourceTree = ""; }; + C9B53867138D9E990028D27C /* db.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = db.h; sourceTree = ""; }; + C9B53868138D9E990028D27C /* dirent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = dirent.h; sourceTree = ""; }; + C9B53869138D9E990028D27C /* disktab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = disktab.h; sourceTree = ""; }; + C9B5386A138D9E990028D27C /* err.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = err.h; sourceTree = ""; }; + C9B5386B138D9E990028D27C /* errno.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = errno.h; sourceTree = ""; }; + C9B5386C138D9E990028D27C /* fcntl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fcntl.h; sourceTree = ""; }; + C9B5386D138D9E990028D27C /* fmtmsg.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fmtmsg.h; sourceTree = ""; }; + C9B5386E138D9E990028D27C /* fnmatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fnmatch.h; sourceTree = ""; }; + C9B53870138D9E990028D27C /* nl_types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nl_types.h; sourceTree = ""; }; + C9B53872138D9E990028D27C /* fsproperties.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fsproperties.h; sourceTree = ""; }; + C9B53873138D9E990028D27C /* fstab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fstab.h; sourceTree = ""; }; + C9B53874138D9E990028D27C /* fts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fts.h; sourceTree = ""; }; + C9B53875138D9E990028D27C /* ftw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ftw.h; sourceTree = ""; }; + C9B53876138D9E990028D27C /* getopt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = getopt.h; sourceTree = ""; }; + C9B53877138D9E990028D27C /* glob.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glob.h; sourceTree = ""; }; + C9B53879138D9E990028D27C /* inttypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = inttypes.h; sourceTree = ""; }; + C9B5387A138D9E990028D27C /* iso646.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iso646.h; sourceTree = ""; }; + C9B5387B138D9E990028D27C /* kvm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = kvm.h; sourceTree = ""; }; + C9B5387C138D9E990028D27C /* langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = langinfo.h; sourceTree = ""; }; + C9B5387D138D9E990028D27C /* libc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libc.h; sourceTree = ""; }; + C9B5387E138D9E990028D27C /* libgen.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libgen.h; sourceTree = ""; }; + C9B53881138D9E990028D27C /* OSAtomic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSAtomic.h; sourceTree = ""; }; + C9B53882138D9E990028D27C /* OSCacheControl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSCacheControl.h; sourceTree = ""; }; + C9B53883138D9E990028D27C /* OSMemoryNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSMemoryNotification.h; sourceTree = ""; }; + C9B53884138D9E990028D27C /* OSThermalNotification.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSThermalNotification.h; sourceTree = ""; }; + C9B53885138D9E990028D27C /* limits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = limits.h; sourceTree = ""; }; + C9B53886138D9E990028D27C /* locale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = locale.h; sourceTree = ""; }; + C9B5388A138D9E990028D27C /* malloc.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = malloc.h; sourceTree = ""; }; + C9B5388B138D9E990028D27C /* memory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = memory.h; sourceTree = ""; }; + C9B5388C138D9E990028D27C /* monetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = monetary.h; sourceTree = ""; }; + C9B5388D138D9E990028D27C /* monitor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = monitor.h; sourceTree = ""; }; + C9B5388E138D9E990028D27C /* mpool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpool.h; sourceTree = ""; }; + C9B5388F138D9E990028D27C /* ndbm.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ndbm.h; sourceTree = ""; }; + C9B53891138D9E990028D27C /* utmpx.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmpx.h; sourceTree = ""; }; + C9B53893138D9E990028D27C /* nlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = nlist.h; sourceTree = ""; }; + C9B53894138D9E990028D27C /* NSSystemDirectories.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSSystemDirectories.h; sourceTree = ""; }; + C9B53899138D9E990028D27C /* paths.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = paths.h; sourceTree = ""; }; + C9B5389A138D9E990028D27C /* poll.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = poll.h; sourceTree = ""; }; + C9B5389D138D9E990028D27C /* routed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = routed.h; sourceTree = ""; }; + C9B5389E138D9E990028D27C /* rwhod.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rwhod.h; sourceTree = ""; }; + C9B5389F138D9E990028D27C /* talkd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = talkd.h; sourceTree = ""; }; + C9B538A0138D9E990028D27C /* timed.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timed.h; sourceTree = ""; }; + C9B538A2138D9E990028D27C /* ranlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ranlib.h; sourceTree = ""; }; + C9B538A3138D9E990028D27C /* readpassphrase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = readpassphrase.h; sourceTree = ""; }; + C9B538A4138D9E990028D27C /* regex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = regex.h; sourceTree = ""; }; + C9B538A5138D9E990028D27C /* rune.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rune.h; sourceTree = ""; }; + C9B538A6138D9E990028D27C /* runetype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = runetype.h; sourceTree = ""; }; + C9B538A7138D9E990028D27C /* search.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = search.h; sourceTree = ""; }; + C9B538A9138D9E990028D27C /* _common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _common.h; sourceTree = ""; }; + C9B538AA138D9E990028D27C /* _stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdio.h; sourceTree = ""; }; + C9B538AB138D9E990028D27C /* _string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _string.h; sourceTree = ""; }; + C9B538AD138D9E990028D27C /* semaphore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = semaphore.h; sourceTree = ""; }; + C9B538AE138D9E990028D27C /* setjmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setjmp.h; sourceTree = ""; }; + C9B538AF138D9E990028D27C /* sgtty.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sgtty.h; sourceTree = ""; }; + C9B538B0138D9E990028D27C /* signal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = signal.h; sourceTree = ""; }; + C9B538B1138D9E990028D27C /* spawn.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spawn.h; sourceTree = ""; }; + C9B538B2138D9E990028D27C /* spawn_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spawn_private.h; sourceTree = ""; }; + C9B538B3138D9E990028D27C /* stab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stab.h; sourceTree = ""; }; + C9B538B4138D9E990028D27C /* standards.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = standards.h; sourceTree = ""; }; + C9B538B5138D9E990028D27C /* stdbool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdbool.h; sourceTree = ""; }; + C9B538B6138D9E990028D27C /* stddef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stddef.h; sourceTree = ""; }; + C9B538B7138D9E990028D27C /* stdint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdint.h; sourceTree = ""; }; + C9B538B8138D9E990028D27C /* stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdio.h; sourceTree = ""; }; + C9B538B9138D9E990028D27C /* stdlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdlib.h; sourceTree = ""; }; + C9B538BA138D9E990028D27C /* strhash.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = strhash.h; sourceTree = ""; }; + C9B538BB138D9E990028D27C /* string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = string.h; sourceTree = ""; }; + C9B538BC138D9E990028D27C /* stringlist.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stringlist.h; sourceTree = ""; }; + C9B538BD138D9E990028D27C /* strings.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = strings.h; sourceTree = ""; }; + C9B538BE138D9E990028D27C /* struct.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = struct.h; sourceTree = ""; }; + C9B538C0138D9E990028D27C /* acl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = acl.h; sourceTree = ""; }; + C9B538C1138D9E990028D27C /* cdefs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cdefs.h; sourceTree = ""; }; + C9B538C3138D9E990028D27C /* statvfs.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = statvfs.h; sourceTree = ""; }; + C9B538C4138D9E990028D27C /* sysexits.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sysexits.3; sourceTree = ""; }; + C9B538C5138D9E990028D27C /* sysexits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sysexits.h; sourceTree = ""; }; + C9B538C6138D9E990028D27C /* syslog.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = syslog.h; sourceTree = ""; }; + C9B538C7138D9E990028D27C /* tar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tar.h; sourceTree = ""; }; + C9B538C8138D9E990028D27C /* termios.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = termios.h; sourceTree = ""; }; + C9B538C9138D9E990028D27C /* time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = time.h; sourceTree = ""; }; + C9B538CA138D9E990028D27C /* timeconv.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timeconv.h; sourceTree = ""; }; + C9B538CB138D9E990028D27C /* ttyent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ttyent.h; sourceTree = ""; }; + C9B538CC138D9E990028D27C /* ucontext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ucontext.h; sourceTree = ""; }; + C9B538CD138D9E990028D27C /* ulimit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ulimit.h; sourceTree = ""; }; + C9B538CE138D9E990028D27C /* unistd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = unistd.h; sourceTree = ""; }; + C9B538CF138D9E990028D27C /* util.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; + C9B538D0138D9E990028D27C /* utime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utime.h; sourceTree = ""; }; + C9B538D1138D9E990028D27C /* utmp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utmp.h; sourceTree = ""; }; + C9B538D2138D9E990028D27C /* vis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = vis.h; sourceTree = ""; }; + C9B538D3138D9E990028D27C /* wchar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wchar.h; sourceTree = ""; }; + C9B538D4138D9E990028D27C /* wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wctype.h; sourceTree = ""; }; + C9B538D5138D9E990028D27C /* wordexp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = wordexp.h; sourceTree = ""; }; + C9B538D7138D9E990028D27C /* __wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = __wctype.h; sourceTree = ""; }; + C9B538D8138D9E990028D27C /* _ctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _ctype.h; sourceTree = ""; }; + C9B538D9138D9E990028D27C /* _inttypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _inttypes.h; sourceTree = ""; }; + C9B538DA138D9E990028D27C /* _langinfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _langinfo.h; sourceTree = ""; }; + C9B538DB138D9E990028D27C /* _monetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _monetary.h; sourceTree = ""; }; + C9B538DC138D9E990028D27C /* _stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdio.h; sourceTree = ""; }; + C9B538DD138D9E990028D27C /* _stdlib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _stdlib.h; sourceTree = ""; }; + C9B538DE138D9E990028D27C /* _string.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _string.h; sourceTree = ""; }; + C9B538DF138D9E990028D27C /* _time.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _time.h; sourceTree = ""; }; + C9B538E0138D9E990028D27C /* _wchar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wchar.h; sourceTree = ""; }; + C9B538E1138D9E990028D27C /* _wctype.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _wctype.h; sourceTree = ""; }; + C9B538E3138D9E990028D27C /* xlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xlocale.h; sourceTree = ""; }; + C9B538FF138D9E990028D27C /* ctype_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctype_l.3; sourceTree = ""; }; + C9B53900138D9E990028D27C /* duplocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = duplocale.3; sourceTree = ""; }; + C9B53902138D9E990028D27C /* ascii.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ascii.c; sourceTree = ""; }; + C9B53904138D9E990028D27C /* big5.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = big5.5; sourceTree = ""; }; + C9B53905138D9E990028D27C /* big5.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = big5.c; sourceTree = ""; }; + C9B53907138D9E990028D27C /* btowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = btowc.3; sourceTree = ""; }; + C9B53909138D9E990028D27C /* btowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = btowc.c; sourceTree = ""; }; + C9B5390B138D9E990028D27C /* collate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = collate.c; sourceTree = ""; }; + C9B5390D138D9E990028D27C /* collate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = collate.h; sourceTree = ""; }; + C9B5390F138D9E990028D27C /* collcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = collcmp.c; sourceTree = ""; }; + C9B53911138D9E990028D27C /* ctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctype.3; sourceTree = ""; }; + C9B53913138D9E990028D27C /* digittoint.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = digittoint.3; sourceTree = ""; }; + C9B53915138D9E990028D27C /* euc.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = euc.5; sourceTree = ""; }; + C9B53916138D9E990028D27C /* euc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = euc.c; sourceTree = ""; }; + C9B53918138D9E990028D27C /* fix_grouping.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fix_grouping.c; sourceTree = ""; }; + C9B5391A138D9E990028D27C /* gb18030.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gb18030.5; sourceTree = ""; }; + C9B5391B138D9E990028D27C /* gb18030.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gb18030.c; sourceTree = ""; }; + C9B5391D138D9E990028D27C /* gb2312.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gb2312.5; sourceTree = ""; }; + C9B5391E138D9E990028D27C /* gb2312.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gb2312.c; sourceTree = ""; }; + C9B53920138D9E990028D27C /* gbk.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gbk.5; sourceTree = ""; }; + C9B53921138D9E990028D27C /* gbk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gbk.c; sourceTree = ""; }; + C9B53923138D9E990028D27C /* isalnum.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalnum.3; sourceTree = ""; }; + C9B53925138D9E990028D27C /* isalpha.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalpha.3; sourceTree = ""; }; + C9B53927138D9E990028D27C /* isascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isascii.3; sourceTree = ""; }; + C9B53928138D9E990028D27C /* isblank.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isblank.3; sourceTree = ""; }; + C9B5392A138D9E990028D27C /* iscntrl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iscntrl.3; sourceTree = ""; }; + C9B5392C138D9E990028D27C /* isdigit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isdigit.3; sourceTree = ""; }; + C9B5392E138D9E990028D27C /* isgraph.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isgraph.3; sourceTree = ""; }; + C9B53930138D9E990028D27C /* isideogram.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isideogram.3; sourceTree = ""; }; + C9B53932138D9E990028D27C /* islower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = islower.3; sourceTree = ""; }; + C9B53934138D9E990028D27C /* isphonogram.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isphonogram.3; sourceTree = ""; }; + C9B53936138D9E990028D27C /* isprint.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isprint.3; sourceTree = ""; }; + C9B53938138D9E990028D27C /* ispunct.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ispunct.3; sourceTree = ""; }; + C9B5393A138D9E990028D27C /* isrune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isrune.3; sourceTree = ""; }; + C9B5393C138D9E990028D27C /* isspace.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isspace.3; sourceTree = ""; }; + C9B5393E138D9E990028D27C /* isspecial.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isspecial.3; sourceTree = ""; }; + C9B53940138D9E990028D27C /* isupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isupper.3; sourceTree = ""; }; + C9B53942138D9E990028D27C /* iswalnum.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iswalnum.3; sourceTree = ""; }; + C9B53944138D9E990028D27C /* isxdigit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isxdigit.3; sourceTree = ""; }; + C9B53946138D9E990028D27C /* ldpart.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ldpart.c; sourceTree = ""; }; + C9B53948138D9E990028D27C /* ldpart.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ldpart.h; sourceTree = ""; }; + C9B5394A138D9E990028D27C /* lmessages.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lmessages.c; sourceTree = ""; }; + C9B5394C138D9E990028D27C /* lmessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lmessages.h; sourceTree = ""; }; + C9B5394E138D9E990028D27C /* lmonetary.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lmonetary.c; sourceTree = ""; }; + C9B53950138D9E990028D27C /* lmonetary.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lmonetary.h; sourceTree = ""; }; + C9B53952138D9E990028D27C /* lnumeric.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lnumeric.c; sourceTree = ""; }; + C9B53954138D9E990028D27C /* lnumeric.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = lnumeric.h; sourceTree = ""; }; + C9B53956138D9E990028D27C /* localeconv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = localeconv.3; sourceTree = ""; }; + C9B53958138D9E990028D27C /* localeconv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = localeconv.c; sourceTree = ""; }; + C9B5395A138D9E990028D27C /* mblen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mblen.3; sourceTree = ""; }; + C9B5395C138D9E990028D27C /* mblen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mblen.c; sourceTree = ""; }; + C9B5395E138D9E990028D27C /* mblocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mblocal.h; sourceTree = ""; }; + C9B53960138D9E990028D27C /* mbrlen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrlen.3; sourceTree = ""; }; + C9B53962138D9E990028D27C /* mbrlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrlen.c; sourceTree = ""; }; + C9B53964138D9E990028D27C /* mbrtowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrtowc.3; sourceTree = ""; }; + C9B53966138D9E990028D27C /* mbrtowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrtowc.c; sourceTree = ""; }; + C9B53968138D9E990028D27C /* mbsinit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbsinit.3; sourceTree = ""; }; + C9B5396A138D9E990028D27C /* mbsinit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsinit.c; sourceTree = ""; }; + C9B5396C138D9E990028D27C /* mbsnrtowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsnrtowcs.c; sourceTree = ""; }; + C9B5396E138D9E990028D27C /* mbsrtowcs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbsrtowcs.3; sourceTree = ""; }; + C9B53970138D9E990028D27C /* mbsrtowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbsrtowcs.c; sourceTree = ""; }; + C9B53972138D9E990028D27C /* mbstowcs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbstowcs.3; sourceTree = ""; }; + C9B53974138D9E990028D27C /* mbstowcs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbstowcs.c; sourceTree = ""; }; + C9B53976138D9E990028D27C /* mbtowc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbtowc.3; sourceTree = ""; }; + C9B53978138D9E990028D27C /* mbtowc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbtowc.c; sourceTree = ""; }; + C9B5397A138D9E990028D27C /* mskanji.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mskanji.5; sourceTree = ""; }; + C9B5397B138D9E990028D27C /* mskanji.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mskanji.c; sourceTree = ""; }; + C9B5397D138D9E990028D27C /* multibyte.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = multibyte.3; sourceTree = ""; }; + C9B5397E138D9E990028D27C /* nextwctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nextwctype.3; sourceTree = ""; }; + C9B53980138D9E990028D27C /* nextwctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nextwctype.c; sourceTree = ""; }; + C9B53982138D9E990028D27C /* nl_langinfo.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nl_langinfo.3; sourceTree = ""; }; + C9B53984138D9E990028D27C /* nl_langinfo.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nl_langinfo.c; sourceTree = ""; }; + C9B53986138D9E990028D27C /* nomacros.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nomacros.c; sourceTree = ""; }; + C9B53987138D9E990028D27C /* none.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = none.c; sourceTree = ""; }; + C9B53989138D9E990028D27C /* rune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rune.c; sourceTree = ""; }; + C9B5398B138D9E990028D27C /* runetype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = runetype.c; sourceTree = ""; }; + C9B5398D138D9E990028D27C /* setlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setlocale.3; sourceTree = ""; }; + C9B5398F138D9E990028D27C /* setlocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setlocale.c; sourceTree = ""; }; + C9B53991138D9E990028D27C /* setlocale.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = setlocale.h; sourceTree = ""; }; + C9B53993138D9E990028D27C /* setrunelocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setrunelocale.c; sourceTree = ""; }; + C9B53995138D9E990028D27C /* table.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = table.c; sourceTree = ""; }; + C9B53997138D9E990028D27C /* toascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = toascii.3; sourceTree = ""; }; + C9B53998138D9E990028D27C /* tolower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tolower.3; sourceTree = ""; }; + C9B5399A138D9E990028D27C /* tolower.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tolower.c; sourceTree = ""; }; + C9B5399C138D9E990028D27C /* toupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = toupper.3; sourceTree = ""; }; + C9B5399E138D9E990028D27C /* toupper.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = toupper.c; sourceTree = ""; }; + C9B539A0138D9E990028D27C /* towlower.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = towlower.3; sourceTree = ""; }; + C9B539A2138D9E990028D27C /* towupper.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = towupper.3; sourceTree = ""; }; + C9B539A5138D9E990028D27C /* utf8.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utf8.5; sourceTree = ""; }; + C9B539A6138D9E990028D27C /* utf8.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = utf8.c; sourceTree = ""; }; + C9B539A8138D9E990028D27C /* wcrtomb.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcrtomb.3; sourceTree = ""; }; + C9B539AA138D9E990028D27C /* wcrtomb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcrtomb.c; sourceTree = ""; }; + C9B539AC138D9E990028D27C /* wcsftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsftime.3; sourceTree = ""; }; + C9B539AE138D9E990028D27C /* wcsftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsftime.c; sourceTree = ""; }; + C9B539B0138D9E990028D27C /* wcsnrtombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsnrtombs.c; sourceTree = ""; }; + C9B539B2138D9E990028D27C /* wcsrtombs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsrtombs.3; sourceTree = ""; }; + C9B539B4138D9E990028D27C /* wcsrtombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsrtombs.c; sourceTree = ""; }; + C9B539B6138D9E990028D27C /* wcstod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstod.3; sourceTree = ""; }; + C9B539B8138D9E990028D27C /* wcstod.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstod.c; sourceTree = ""; }; + C9B539BA138D9E990028D27C /* wcstof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstof.c; sourceTree = ""; }; + C9B539BC138D9E990028D27C /* wcstoimax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoimax.c; sourceTree = ""; }; + C9B539BE138D9E990028D27C /* wcstol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstol.3; sourceTree = ""; }; + C9B539C0138D9E990028D27C /* wcstol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstol.c; sourceTree = ""; }; + C9B539C2138D9E990028D27C /* wcstold.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstold.c; sourceTree = ""; }; + C9B539C4138D9E990028D27C /* wcstoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoll.c; sourceTree = ""; }; + C9B539C6138D9E990028D27C /* wcstombs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstombs.3; sourceTree = ""; }; + C9B539C8138D9E990028D27C /* wcstombs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstombs.c; sourceTree = ""; }; + C9B539CA138D9E990028D27C /* wcstoul.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoul.c; sourceTree = ""; }; + C9B539CC138D9E990028D27C /* wcstoull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoull.c; sourceTree = ""; }; + C9B539CE138D9E990028D27C /* wcstoumax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstoumax.c; sourceTree = ""; }; + C9B539D0138D9E990028D27C /* wctob.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctob.c; sourceTree = ""; }; + C9B539D2138D9E990028D27C /* wctomb.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctomb.3; sourceTree = ""; }; + C9B539D4138D9E990028D27C /* wctomb.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctomb.c; sourceTree = ""; }; + C9B539D6138D9E990028D27C /* wctrans.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctrans.3; sourceTree = ""; }; + C9B539D8138D9E990028D27C /* wctrans.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctrans.c; sourceTree = ""; }; + C9B539DA138D9E990028D27C /* wctype.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wctype.3; sourceTree = ""; }; + C9B539DC138D9E990028D27C /* wctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wctype.c; sourceTree = ""; }; + C9B539DE138D9E990028D27C /* wcwidth.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcwidth.3; sourceTree = ""; }; + C9B539E0138D9E990028D27C /* wcwidth.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcwidth.c; sourceTree = ""; }; + C9B539E2138D9E990028D27C /* freelocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = freelocale.3; sourceTree = ""; }; + C9B539E3138D9E990028D27C /* frune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = frune.c; sourceTree = ""; }; + C9B539E4138D9E990028D27C /* isalnum_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = isalnum_l.3; sourceTree = ""; }; + C9B539E5138D9E990028D27C /* isctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isctype.c; sourceTree = ""; }; + C9B539E6138D9E990028D27C /* iswalnum_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = iswalnum_l.3; sourceTree = ""; }; + C9B539E7138D9E990028D27C /* iswctype.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = iswctype.c; sourceTree = ""; }; + C9B539E8138D9E990028D27C /* lconv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lconv.c; sourceTree = ""; }; + C9B539EA138D9E990028D27C /* mbrune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mbrune.3; sourceTree = ""; }; + C9B539EB138D9E990028D27C /* mbrune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mbrune.c; sourceTree = ""; }; + C9B539EC138D9E990028D27C /* newlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = newlocale.3; sourceTree = ""; }; + C9B539ED138D9E990028D27C /* querylocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = querylocale.3; sourceTree = ""; }; + C9B539EE138D9E990028D27C /* rune.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rune.3; sourceTree = ""; }; + C9B539EF138D9E990028D27C /* runedepreciated.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = runedepreciated.c; sourceTree = ""; }; + C9B539F0138D9E990028D27C /* runedepreciated.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = runedepreciated.h; sourceTree = ""; }; + C9B539F1138D9E990028D27C /* setinvalidrune.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setinvalidrune.c; sourceTree = ""; }; + C9B539F2138D9E990028D27C /* uselocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = uselocale.3; sourceTree = ""; }; + C9B539F3138D9E990028D27C /* utf2.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utf2.5; sourceTree = ""; }; + C9B539F4138D9E990028D27C /* wcstod_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstod_l.3; sourceTree = ""; }; + C9B539F5138D9E990028D27C /* wcstol_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstol_l.3; sourceTree = ""; }; + C9B539F6138D9E990028D27C /* xlocale.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = xlocale.3; sourceTree = ""; }; + C9B539F7138D9E990028D27C /* xlocale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xlocale.c; sourceTree = ""; }; + C9B539F8138D9E990028D27C /* xlocale_private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = xlocale_private.h; sourceTree = ""; }; + C9B53A05138D9E990028D27C /* assert.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = assert.3; sourceTree = ""; }; + C9B53A06138D9E990028D27C /* bitstring.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bitstring.3; sourceTree = ""; }; + C9B53A07138D9E990028D27C /* environ.7 */ = {isa = PBXFileReference; lastKnownFileType = text; path = environ.7; sourceTree = ""; }; + C9B53A09138D9E990028D27C /* stdarg.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stdarg.3; sourceTree = ""; }; + C9B53A0B138D9E990028D27C /* gethostuuid.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = gethostuuid.2; sourceTree = ""; }; + C9B53A0D138D9E990028D27C /* utmp.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = utmp.5; sourceTree = ""; }; + C9B53A0F138D9E990028D27C /* _nbsd_compat_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _nbsd_compat_.h; sourceTree = ""; }; + C9B53A10138D9E990028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = ""; }; + C9B53A12138D9E990028D27C /* byteorder.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = byteorder.3; sourceTree = ""; }; + C9B53A13138D9E990028D27C /* ethers.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ethers.3; sourceTree = ""; }; + C9B53A15138D9E990028D27C /* addr2ascii.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = addr2ascii.3; sourceTree = ""; }; + C9B53A16138D9E990028D27C /* addr2ascii.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = addr2ascii.c; sourceTree = ""; }; + C9B53A17138D9E990028D27C /* ascii2addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ascii2addr.c; sourceTree = ""; }; + C9B53A18138D9E990028D27C /* inet.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = inet.3; sourceTree = ""; }; + C9B53A1A138D9E990028D27C /* inet_addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_addr.c; sourceTree = ""; }; + C9B53A1C138D9E990028D27C /* inet_lnaof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_lnaof.c; sourceTree = ""; }; + C9B53A1D138D9E990028D27C /* inet_makeaddr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_makeaddr.c; sourceTree = ""; }; + C9B53A1E138D9E990028D27C /* inet_net.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = inet_net.3; sourceTree = ""; }; + C9B53A20138D9E990028D27C /* inet_net_ntop.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_net_ntop.c; sourceTree = ""; }; + C9B53A21138D9E990028D27C /* inet_net_pton.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_net_pton.c; sourceTree = ""; }; + C9B53A23138D9E990028D27C /* inet_neta.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_neta.c; sourceTree = ""; }; + C9B53A24138D9E990028D27C /* inet_netof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_netof.c; sourceTree = ""; }; + C9B53A25138D9E990028D27C /* inet_network.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_network.c; sourceTree = ""; }; + C9B53A27138D9E990028D27C /* inet_ntoa.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = inet_ntoa.c; sourceTree = ""; }; + C9B53A29138D9E990028D27C /* linkaddr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = linkaddr.3; sourceTree = ""; }; + C9B53A2A138D9E990028D27C /* linkaddr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = linkaddr.c; sourceTree = ""; }; + C9B53A2B138D9E990028D27C /* nsap_addr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = nsap_addr.c; sourceTree = ""; }; + C9B53A2D138D9E990028D27C /* recv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = recv.c; sourceTree = ""; }; + C9B53A2F138D9E990028D27C /* send.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = send.c; sourceTree = ""; }; + C9B53A31138D9E990028D27C /* sockatmark.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sockatmark.3; sourceTree = ""; }; + C9B53A33138D9E990028D27C /* sockatmark.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sockatmark.c; sourceTree = ""; }; + C9B53A34138D9E990028D27C /* sourcefilter.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sourcefilter.3; sourceTree = ""; }; + C9B53A36138D9E990028D27C /* sourcefilter.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sourcefilter.c; sourceTree = ""; }; + C9B53A39138D9E990028D27C /* rcmdsh.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rcmdsh.3; sourceTree = ""; }; + C9B53A3C138D9E990028D27C /* catclose.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catclose.3; sourceTree = ""; }; + C9B53A3D138D9E990028D27C /* catgets.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catgets.3; sourceTree = ""; }; + C9B53A3E138D9E990028D27C /* catopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = catopen.3; sourceTree = ""; }; + C9B53A3F138D9E990028D27C /* msgcat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msgcat.c; sourceTree = ""; }; + C9B53A41138D9E990028D27C /* msgcat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = msgcat.h; sourceTree = ""; }; + C9B53A47138D9E990028D27C /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; path = Makefile.inc; sourceTree = ""; }; + C9B53A49138D9E990028D27C /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; path = Makefile.inc; sourceTree = ""; }; + C9B53A4B138D9E990028D27C /* acl.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl.3; sourceTree = ""; }; + C9B53A4C138D9E990028D27C /* acl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl.c; sourceTree = ""; }; + C9B53A4D138D9E990028D27C /* acl_add_flag_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_add_flag_np.3; sourceTree = ""; }; + C9B53A4E138D9E990028D27C /* acl_add_perm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_add_perm.3; sourceTree = ""; }; + C9B53A4F138D9E990028D27C /* acl_clear_flags_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_clear_flags_np.3; sourceTree = ""; }; + C9B53A50138D9E990028D27C /* acl_clear_perms.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_clear_perms.3; sourceTree = ""; }; + C9B53A51138D9E990028D27C /* acl_copy_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_copy_entry.3; sourceTree = ""; }; + C9B53A52138D9E990028D27C /* acl_copy_ext.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_copy_ext.3; sourceTree = ""; }; + C9B53A53138D9E990028D27C /* acl_create_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_create_entry.3; sourceTree = ""; }; + C9B53A54138D9E990028D27C /* acl_delete.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete.3; sourceTree = ""; }; + C9B53A55138D9E990028D27C /* acl_delete_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_entry.3; sourceTree = ""; }; + C9B53A56138D9E990028D27C /* acl_delete_flag_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_flag_np.3; sourceTree = ""; }; + C9B53A57138D9E990028D27C /* acl_delete_perm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_delete_perm.3; sourceTree = ""; }; + C9B53A58138D9E990028D27C /* acl_dup.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_dup.3; sourceTree = ""; }; + C9B53A59138D9E990028D27C /* acl_entry.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_entry.c; sourceTree = ""; }; + C9B53A5A138D9E990028D27C /* acl_file.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_file.c; sourceTree = ""; }; + C9B53A5B138D9E990028D27C /* acl_flag.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_flag.c; sourceTree = ""; }; + C9B53A5C138D9E990028D27C /* acl_free.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_free.3; sourceTree = ""; }; + C9B53A5D138D9E990028D27C /* acl_from_text.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_from_text.3; sourceTree = ""; }; + C9B53A5E138D9E990028D27C /* acl_get.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get.3; sourceTree = ""; }; + C9B53A5F138D9E990028D27C /* acl_get_entry.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_entry.3; sourceTree = ""; }; + C9B53A60138D9E990028D27C /* acl_get_fd.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_fd.3; sourceTree = ""; }; + C9B53A61138D9E990028D27C /* acl_get_flagset_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_flagset_np.3; sourceTree = ""; }; + C9B53A62138D9E990028D27C /* acl_get_perm_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_perm_np.3; sourceTree = ""; }; + C9B53A63138D9E990028D27C /* acl_get_permset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_permset.3; sourceTree = ""; }; + C9B53A64138D9E990028D27C /* acl_get_permset_mask_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_permset_mask_np.3; sourceTree = ""; }; + C9B53A65138D9E990028D27C /* acl_get_qualifier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_qualifier.3; sourceTree = ""; }; + C9B53A66138D9E990028D27C /* acl_get_tag_type.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_get_tag_type.3; sourceTree = ""; }; + C9B53A67138D9E990028D27C /* acl_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_init.3; sourceTree = ""; }; + C9B53A68138D9E990028D27C /* acl_perm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_perm.c; sourceTree = ""; }; + C9B53A69138D9E990028D27C /* acl_set.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set.3; sourceTree = ""; }; + C9B53A6A138D9E990028D27C /* acl_set_flagset_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_flagset_np.3; sourceTree = ""; }; + C9B53A6B138D9E990028D27C /* acl_set_permset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_permset.3; sourceTree = ""; }; + C9B53A6C138D9E990028D27C /* acl_set_qualifier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_qualifier.3; sourceTree = ""; }; + C9B53A6D138D9E990028D27C /* acl_set_tag_type.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_set_tag_type.3; sourceTree = ""; }; + C9B53A6E138D9E990028D27C /* acl_to_text.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_to_text.3; sourceTree = ""; }; + C9B53A6F138D9E990028D27C /* acl_translate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = acl_translate.c; sourceTree = ""; }; + C9B53A70138D9E990028D27C /* acl_valid.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = acl_valid.3; sourceTree = ""; }; + C9B53A71138D9E990028D27C /* aclvar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = aclvar.h; sourceTree = ""; }; + C9B53ABC138D9E990028D27C /* mk_pthread_impl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mk_pthread_impl.c; sourceTree = ""; }; + C9B53ABD138D9E990028D27C /* plockstat.d */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.dtrace; path = plockstat.d; sourceTree = ""; }; + C9B53ABE138D9E990028D27C /* posix_sched.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = posix_sched.h; sourceTree = ""; }; + C9B53ABF138D9E990028D27C /* pthread.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread.3; sourceTree = ""; }; + C9B53AC0138D9E990028D27C /* pthread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread.c; sourceTree = ""; }; + C9B53AC1138D9E990028D27C /* pthread.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread.h; sourceTree = ""; }; + C9B53AC2138D9E990028D27C /* pthread_atfork.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_atfork.3; sourceTree = ""; }; + C9B53AC3138D9E990028D27C /* pthread_attr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr.3; sourceTree = ""; }; + C9B53AC4138D9E990028D27C /* pthread_attr_init_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_init_destroy.3; sourceTree = ""; }; + C9B53AC5138D9E990028D27C /* pthread_attr_set_getdetachstate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getdetachstate.3; sourceTree = ""; }; + C9B53AC6138D9E990028D27C /* pthread_attr_set_getinheritsched.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getinheritsched.3; sourceTree = ""; }; + C9B53AC7138D9E990028D27C /* pthread_attr_set_getschedparam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getschedparam.3; sourceTree = ""; }; + C9B53AC8138D9E990028D27C /* pthread_attr_set_getschedpolicy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getschedpolicy.3; sourceTree = ""; }; + C9B53AC9138D9E990028D27C /* pthread_attr_set_getscope.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getscope.3; sourceTree = ""; }; + C9B53ACA138D9E990028D27C /* pthread_attr_set_getstackaddr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getstackaddr.3; sourceTree = ""; }; + C9B53ACB138D9E990028D27C /* pthread_attr_set_getstacksize.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_attr_set_getstacksize.3; sourceTree = ""; }; + C9B53ACC138D9E990028D27C /* pthread_cancel.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cancel.3; sourceTree = ""; }; + C9B53ACD138D9E990028D27C /* pthread_cancelable.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_cancelable.c; sourceTree = ""; }; + C9B53ACE138D9E990028D27C /* pthread_cleanup_pop.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cleanup_pop.3; sourceTree = ""; }; + C9B53ACF138D9E990028D27C /* pthread_cleanup_push.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cleanup_push.3; sourceTree = ""; }; + C9B53AD0138D9E990028D27C /* pthread_cond.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_cond.c; sourceTree = ""; }; + C9B53AD1138D9E990028D27C /* pthread_cond_broadcast.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_broadcast.3; sourceTree = ""; }; + C9B53AD2138D9E990028D27C /* pthread_cond_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_destroy.3; sourceTree = ""; }; + C9B53AD3138D9E990028D27C /* pthread_cond_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_init.3; sourceTree = ""; }; + C9B53AD4138D9E990028D27C /* pthread_cond_signal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_signal.3; sourceTree = ""; }; + C9B53AD5138D9E990028D27C /* pthread_cond_timedwait.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_timedwait.3; sourceTree = ""; }; + C9B53AD6138D9E990028D27C /* pthread_cond_wait.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_cond_wait.3; sourceTree = ""; }; + C9B53AD7138D9E990028D27C /* pthread_condattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_condattr.3; sourceTree = ""; }; + C9B53AD8138D9E990028D27C /* pthread_create.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_create.3; sourceTree = ""; }; + C9B53AD9138D9E990028D27C /* pthread_detach.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_detach.3; sourceTree = ""; }; + C9B53ADA138D9E990028D27C /* pthread_equal.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_equal.3; sourceTree = ""; }; + C9B53ADB138D9E990028D27C /* pthread_exit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_exit.3; sourceTree = ""; }; + C9B53ADC138D9E990028D27C /* pthread_getschedparam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_getschedparam.3; sourceTree = ""; }; + C9B53ADD138D9E990028D27C /* pthread_getspecific.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_getspecific.3; sourceTree = ""; }; + C9B53ADE138D9E990028D27C /* pthread_impl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_impl.h; sourceTree = ""; }; + C9B53ADF138D9E990028D27C /* pthread_internals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_internals.h; sourceTree = ""; }; + C9B53AE0138D9E990028D27C /* pthread_join.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_join.3; sourceTree = ""; }; + C9B53AE1138D9E990028D27C /* pthread_key_create.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_key_create.3; sourceTree = ""; }; + C9B53AE2138D9E990028D27C /* pthread_key_delete.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_key_delete.3; sourceTree = ""; }; + C9B53AE3138D9E990028D27C /* pthread_machdep.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_machdep.h; sourceTree = ""; }; + C9B53AE4138D9E990028D27C /* pthread_mutex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_mutex.c; sourceTree = ""; }; + C9B53AE5138D9E990028D27C /* pthread_mutex_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_destroy.3; sourceTree = ""; }; + C9B53AE6138D9E990028D27C /* pthread_mutex_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_init.3; sourceTree = ""; }; + C9B53AE7138D9E990028D27C /* pthread_mutex_lock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_lock.3; sourceTree = ""; }; + C9B53AE8138D9E990028D27C /* pthread_mutex_trylock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_trylock.3; sourceTree = ""; }; + C9B53AE9138D9E990028D27C /* pthread_mutex_unlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutex_unlock.3; sourceTree = ""; }; + C9B53AEA138D9E990028D27C /* pthread_mutexattr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_mutexattr.3; sourceTree = ""; }; + C9B53AEB138D9E990028D27C /* pthread_once.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_once.3; sourceTree = ""; }; + C9B53AEC138D9E990028D27C /* pthread_rwlock.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_rwlock.c; sourceTree = ""; }; + C9B53AED138D9E990028D27C /* pthread_rwlock_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_destroy.3; sourceTree = ""; }; + C9B53AEE138D9E990028D27C /* pthread_rwlock_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_init.3; sourceTree = ""; }; + C9B53AEF138D9E990028D27C /* pthread_rwlock_rdlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_rdlock.3; sourceTree = ""; }; + C9B53AF0138D9E990028D27C /* pthread_rwlock_unlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_unlock.3; sourceTree = ""; }; + C9B53AF1138D9E990028D27C /* pthread_rwlock_wrlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlock_wrlock.3; sourceTree = ""; }; + C9B53AF2138D9E990028D27C /* pthread_rwlockattr_destroy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_destroy.3; sourceTree = ""; }; + C9B53AF3138D9E990028D27C /* pthread_rwlockattr_getpshared.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_getpshared.3; sourceTree = ""; }; + C9B53AF4138D9E990028D27C /* pthread_rwlockattr_init.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_init.3; sourceTree = ""; }; + C9B53AF5138D9E990028D27C /* pthread_rwlockattr_setpshared.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_rwlockattr_setpshared.3; sourceTree = ""; }; + C9B53AF6138D9E990028D27C /* pthread_self.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_self.3; sourceTree = ""; }; + C9B53AF7138D9E990028D27C /* pthread_setcancelstate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_setcancelstate.3; sourceTree = ""; }; + C9B53AF8138D9E990028D27C /* pthread_setspecific.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_setspecific.3; sourceTree = ""; }; + C9B53AF9138D9E990028D27C /* pthread_spinlock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_spinlock.h; sourceTree = ""; }; + C9B53AFA138D9E990028D27C /* pthread_spis.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_spis.h; sourceTree = ""; }; + C9B53AFB138D9E990028D27C /* pthread_tsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_tsd.c; sourceTree = ""; }; + C9B53AFC138D9E990028D27C /* pthread_workqueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pthread_workqueue.h; sourceTree = ""; }; + C9B53AFD138D9E990028D27C /* sched.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sched.h; sourceTree = ""; }; + C9B53AFE138D9E990028D27C /* stack.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = stack.s; sourceTree = ""; }; + C9B53B00138D9E990028D27C /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + C9B53B01138D9E990028D27C /* pthread_atfork_test.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pthread_atfork_test.c; sourceTree = ""; }; + C9B53B02138D9E990028D27C /* thread_setup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = thread_setup.c; sourceTree = ""; }; + C9B53B06138D9E990028D27C /* cname.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cname.h; sourceTree = ""; }; + C9B53B08138D9E990028D27C /* COPYRIGHT */ = {isa = PBXFileReference; lastKnownFileType = text; path = COPYRIGHT; sourceTree = ""; }; + C9B53B0B138D9E990028D27C /* re_format.7 */ = {isa = PBXFileReference; lastKnownFileType = text; path = re_format.7; sourceTree = ""; }; + C9B53B0E138D9E990028D27C /* regerror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = regerror.c; sourceTree = ""; }; + C9B53B10138D9E990028D27C /* regex.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = regex.3; sourceTree = ""; }; + C9B53B18138D9E990028D27C /* utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; }; + C9B53B19138D9E990028D27C /* WHATSNEW */ = {isa = PBXFileReference; lastKnownFileType = text; path = WHATSNEW; sourceTree = ""; }; + C9B53B1E138D9E990028D27C /* chk_fail.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = chk_fail.c; sourceTree = ""; }; + C9B53B20138D9E990028D27C /* memcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy_chk.c; sourceTree = ""; }; + C9B53B21138D9E990028D27C /* memmove_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove_chk.c; sourceTree = ""; }; + C9B53B22138D9E990028D27C /* memset_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memset_chk.c; sourceTree = ""; }; + C9B53B23138D9E990028D27C /* snprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = snprintf_chk.c; sourceTree = ""; }; + C9B53B24138D9E990028D27C /* sprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sprintf_chk.c; sourceTree = ""; }; + C9B53B25138D9E990028D27C /* stpcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stpcpy_chk.c; sourceTree = ""; }; + C9B53B26138D9E990028D27C /* stpncpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stpncpy_chk.c; sourceTree = ""; }; + C9B53B27138D9E990028D27C /* strcat_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcat_chk.c; sourceTree = ""; }; + C9B53B28138D9E990028D27C /* strcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcpy_chk.c; sourceTree = ""; }; + C9B53B29138D9E990028D27C /* strncat_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncat_chk.c; sourceTree = ""; }; + C9B53B2A138D9E990028D27C /* strncpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncpy_chk.c; sourceTree = ""; }; + C9B53B2B138D9E990028D27C /* vsnprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsnprintf_chk.c; sourceTree = ""; }; + C9B53B2C138D9E990028D27C /* vsprintf_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsprintf_chk.c; sourceTree = ""; }; + C9B53B2F138D9E990028D27C /* _flock_stub.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _flock_stub.c; sourceTree = ""; }; + C9B53B30138D9E990028D27C /* asprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asprintf.c; sourceTree = ""; }; + C9B53B32138D9E990028D27C /* clrerr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clrerr.c; sourceTree = ""; }; + C9B53B33138D9E990028D27C /* dprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = dprintf.c; sourceTree = ""; }; + C9B53B35138D9E990028D27C /* fclose.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fclose.3; sourceTree = ""; }; + C9B53B36138D9E990028D27C /* fclose.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fclose.c; sourceTree = ""; }; + C9B53B38138D9E990028D27C /* fdopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fdopen.c; sourceTree = ""; }; + C9B53B3A138D9E990028D27C /* feof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = feof.c; sourceTree = ""; }; + C9B53B3B138D9E990028D27C /* ferror.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ferror.3; sourceTree = ""; }; + C9B53B3C138D9E990028D27C /* ferror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ferror.c; sourceTree = ""; }; + C9B53B3D138D9E990028D27C /* fflush.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fflush.3; sourceTree = ""; }; + C9B53B3E138D9E990028D27C /* fflush.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fflush.c; sourceTree = ""; }; + C9B53B40138D9E990028D27C /* fgetc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetc.c; sourceTree = ""; }; + C9B53B41138D9E990028D27C /* fgetln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetln.3; sourceTree = ""; }; + C9B53B43138D9E990028D27C /* fgetln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetln.c; sourceTree = ""; }; + C9B53B45138D9E990028D27C /* fgetpos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetpos.c; sourceTree = ""; }; + C9B53B46138D9E990028D27C /* fgets.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgets.3; sourceTree = ""; }; + C9B53B47138D9E990028D27C /* fgets.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgets.c; sourceTree = ""; }; + C9B53B48138D9E990028D27C /* fgetwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetwc.c; sourceTree = ""; }; + C9B53B4A138D9E990028D27C /* fgetwln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetwln.3; sourceTree = ""; }; + C9B53B4C138D9E990028D27C /* fgetwln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetwln.c; sourceTree = ""; }; + C9B53B4E138D9E990028D27C /* fgetws.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fgetws.3; sourceTree = ""; }; + C9B53B50138D9E990028D27C /* fgetws.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fgetws.c; sourceTree = ""; }; + C9B53B52138D9E990028D27C /* fileno.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fileno.c; sourceTree = ""; }; + C9B53B53138D9E990028D27C /* findfp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = findfp.c; sourceTree = ""; }; + C9B53B55138D9E990028D27C /* flags.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = flags.c; sourceTree = ""; }; + C9B53B57138D9E990028D27C /* floatio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = floatio.h; sourceTree = ""; }; + C9B53B58138D9E990028D27C /* flockfile.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = flockfile.3; sourceTree = ""; }; + C9B53B5A138D9E990028D27C /* fopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fopen.3; sourceTree = ""; }; + C9B53B5C138D9E990028D27C /* fopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fopen.c; sourceTree = ""; }; + C9B53B5E138D9E990028D27C /* fprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fprintf.c; sourceTree = ""; }; + C9B53B60138D9E990028D27C /* fpurge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fpurge.c; sourceTree = ""; }; + C9B53B61138D9E990028D27C /* fputc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputc.c; sourceTree = ""; }; + C9B53B62138D9E990028D27C /* fputs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fputs.3; sourceTree = ""; }; + C9B53B64138D9E990028D27C /* fputs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputs.c; sourceTree = ""; }; + C9B53B66138D9E990028D27C /* fputwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputwc.c; sourceTree = ""; }; + C9B53B68138D9E990028D27C /* fputws.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fputws.3; sourceTree = ""; }; + C9B53B6A138D9E990028D27C /* fputws.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fputws.c; sourceTree = ""; }; + C9B53B6C138D9E990028D27C /* fread.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fread.3; sourceTree = ""; }; + C9B53B6E138D9E990028D27C /* fread.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fread.c; sourceTree = ""; }; + C9B53B70138D9E990028D27C /* freopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = freopen.c; sourceTree = ""; }; + C9B53B72138D9E990028D27C /* fscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fscanf.c; sourceTree = ""; }; + C9B53B74138D9E990028D27C /* fseek.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fseek.3; sourceTree = ""; }; + C9B53B76138D9E990028D27C /* fseek.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fseek.c; sourceTree = ""; }; + C9B53B77138D9E990028D27C /* fsetpos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fsetpos.c; sourceTree = ""; }; + C9B53B78138D9E990028D27C /* ftell.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftell.c; sourceTree = ""; }; + C9B53B7A138D9E990028D27C /* funopen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = funopen.3; sourceTree = ""; }; + C9B53B7B138D9E990028D27C /* funopen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = funopen.c; sourceTree = ""; }; + C9B53B7D138D9E990028D27C /* fvwrite.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fvwrite.c; sourceTree = ""; }; + C9B53B7E138D9E990028D27C /* fvwrite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = fvwrite.h; sourceTree = ""; }; + C9B53B7F138D9E990028D27C /* fwalk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwalk.c; sourceTree = ""; }; + C9B53B80138D9E990028D27C /* fwide.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fwide.3; sourceTree = ""; }; + C9B53B82138D9E990028D27C /* fwide.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwide.c; sourceTree = ""; }; + C9B53B83138D9E990028D27C /* fwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwprintf.c; sourceTree = ""; }; + C9B53B85138D9E990028D27C /* fwrite.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwrite.c; sourceTree = ""; }; + C9B53B87138D9E990028D27C /* fwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fwscanf.c; sourceTree = ""; }; + C9B53B89138D9E990028D27C /* getc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getc.3; sourceTree = ""; }; + C9B53B8B138D9E990028D27C /* getc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getc.c; sourceTree = ""; }; + C9B53B8C138D9E990028D27C /* getchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getchar.c; sourceTree = ""; }; + C9B53B8D138D9E990028D27C /* getdelim.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getdelim.c; sourceTree = ""; }; + C9B53B8E138D9E990028D27C /* getline.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getline.3; sourceTree = ""; }; + C9B53B90138D9E990028D27C /* getline.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getline.c; sourceTree = ""; }; + C9B53B91138D9E990028D27C /* gets.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gets.c; sourceTree = ""; }; + C9B53B92138D9E990028D27C /* getw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getw.c; sourceTree = ""; }; + C9B53B93138D9E990028D27C /* getwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getwc.3; sourceTree = ""; }; + C9B53B95138D9E990028D27C /* getwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwc.c; sourceTree = ""; }; + C9B53B97138D9E990028D27C /* getwchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getwchar.c; sourceTree = ""; }; + C9B53B99138D9E990028D27C /* glue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = glue.h; sourceTree = ""; }; + C9B53B9A138D9E990028D27C /* local.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = local.h; sourceTree = ""; }; + C9B53B9C138D9E990028D27C /* makebuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makebuf.c; sourceTree = ""; }; + C9B53B9E138D9E990028D27C /* mktemp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mktemp.3; sourceTree = ""; }; + C9B53BA0138D9E990028D27C /* mktemp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mktemp.c; sourceTree = ""; }; + C9B53BA2138D9E990028D27C /* perror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = perror.c; sourceTree = ""; }; + C9B53BA3138D9E990028D27C /* printf-pos.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "printf-pos.c"; sourceTree = ""; }; + C9B53BA5138D9E990028D27C /* printf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = printf.3; sourceTree = ""; }; + C9B53BA7138D9E990028D27C /* printf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = printf.c; sourceTree = ""; }; + C9B53BA9138D9E990028D27C /* printfcommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = printfcommon.h; sourceTree = ""; }; + C9B53BAB138D9E990028D27C /* printflocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = printflocal.h; sourceTree = ""; }; + C9B53BAD138D9E990028D27C /* putc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putc.3; sourceTree = ""; }; + C9B53BAF138D9E990028D27C /* putc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putc.c; sourceTree = ""; }; + C9B53BB0138D9E990028D27C /* putchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putchar.c; sourceTree = ""; }; + C9B53BB1138D9E990028D27C /* puts.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = puts.c; sourceTree = ""; }; + C9B53BB3138D9E990028D27C /* putw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putw.c; sourceTree = ""; }; + C9B53BB4138D9E990028D27C /* putwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putwc.3; sourceTree = ""; }; + C9B53BB6138D9E990028D27C /* putwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putwc.c; sourceTree = ""; }; + C9B53BB8138D9E990028D27C /* putwchar.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putwchar.c; sourceTree = ""; }; + C9B53BBA138D9E990028D27C /* refill.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = refill.c; sourceTree = ""; }; + C9B53BBC138D9E990028D27C /* remove.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = remove.3; sourceTree = ""; }; + C9B53BBE138D9E990028D27C /* remove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = remove.c; sourceTree = ""; }; + C9B53BBF138D9E990028D27C /* rewind.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rewind.c; sourceTree = ""; }; + C9B53BC1138D9E990028D27C /* rget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rget.c; sourceTree = ""; }; + C9B53BC2138D9E990028D27C /* scanf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scanf.3; sourceTree = ""; }; + C9B53BC4138D9E990028D27C /* scanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = scanf.c; sourceTree = ""; }; + C9B53BC6138D9E990028D27C /* setbuf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = setbuf.3; sourceTree = ""; }; + C9B53BC8138D9E990028D27C /* setbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setbuf.c; sourceTree = ""; }; + C9B53BC9138D9E990028D27C /* setbuffer.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setbuffer.c; sourceTree = ""; }; + C9B53BCA138D9E990028D27C /* setvbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setvbuf.c; sourceTree = ""; }; + C9B53BCB138D9E990028D27C /* snprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = snprintf.c; sourceTree = ""; }; + C9B53BCD138D9E990028D27C /* sprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sprintf.c; sourceTree = ""; }; + C9B53BCF138D9E990028D27C /* sscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sscanf.c; sourceTree = ""; }; + C9B53BD1138D9E990028D27C /* stdio.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = stdio.3; sourceTree = ""; }; + C9B53BD3138D9E990028D27C /* stdio.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stdio.c; sourceTree = ""; }; + C9B53BD4138D9E990028D27C /* swprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swprintf.c; sourceTree = ""; }; + C9B53BD6138D9E990028D27C /* swscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swscanf.c; sourceTree = ""; }; + C9B53BD8138D9E990028D27C /* tempnam.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tempnam.c; sourceTree = ""; }; + C9B53BDA138D9E990028D27C /* tmpfile.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tmpfile.c; sourceTree = ""; }; + C9B53BDB138D9E990028D27C /* tmpnam.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tmpnam.3; sourceTree = ""; }; + C9B53BDD138D9E990028D27C /* tmpnam.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tmpnam.c; sourceTree = ""; }; + C9B53BDF138D9E990028D27C /* ungetc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ungetc.3; sourceTree = ""; }; + C9B53BE1138D9E990028D27C /* ungetc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ungetc.c; sourceTree = ""; }; + C9B53BE2138D9E990028D27C /* ungetwc.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ungetwc.3; sourceTree = ""; }; + C9B53BE4138D9E990028D27C /* ungetwc.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ungetwc.c; sourceTree = ""; }; + C9B53BE6138D9E990028D27C /* vasprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vasprintf.c; sourceTree = ""; }; + C9B53BE8138D9E990028D27C /* vdprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vdprintf.c; sourceTree = ""; }; + C9B53BEA138D9E990028D27C /* vfprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfprintf.c; sourceTree = ""; }; + C9B53BEC138D9E990028D27C /* vfscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfscanf.c; sourceTree = ""; }; + C9B53BEE138D9E9A0028D27C /* vfwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfwprintf.c; sourceTree = ""; }; + C9B53BF0138D9E9A0028D27C /* vfwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vfwscanf.c; sourceTree = ""; }; + C9B53BF2138D9E9A0028D27C /* vprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vprintf.c; sourceTree = ""; }; + C9B53BF4138D9E9A0028D27C /* vscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vscanf.c; sourceTree = ""; }; + C9B53BF6138D9E9A0028D27C /* vsnprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsnprintf.c; sourceTree = ""; }; + C9B53BF8138D9E9A0028D27C /* vsprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsprintf.c; sourceTree = ""; }; + C9B53BFA138D9E9A0028D27C /* vsscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vsscanf.c; sourceTree = ""; }; + C9B53BFC138D9E9A0028D27C /* vswprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vswprintf.c; sourceTree = ""; }; + C9B53BFE138D9E9A0028D27C /* vswscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vswscanf.c; sourceTree = ""; }; + C9B53C00138D9E9A0028D27C /* vwprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vwprintf.c; sourceTree = ""; }; + C9B53C02138D9E9A0028D27C /* vwscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = vwscanf.c; sourceTree = ""; }; + C9B53C04138D9E9A0028D27C /* wbuf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wbuf.c; sourceTree = ""; }; + C9B53C06138D9E9A0028D27C /* wprintf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wprintf.3; sourceTree = ""; }; + C9B53C08138D9E9A0028D27C /* wprintf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wprintf.c; sourceTree = ""; }; + C9B53C0A138D9E9A0028D27C /* wscanf.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wscanf.3; sourceTree = ""; }; + C9B53C0C138D9E9A0028D27C /* wscanf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wscanf.c; sourceTree = ""; }; + C9B53C0E138D9E9A0028D27C /* wsetup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wsetup.c; sourceTree = ""; }; + C9B53C0F138D9E9A0028D27C /* getwc_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getwc_l.3; sourceTree = ""; }; + C9B53C11138D9E9A0028D27C /* printf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = printf_l.3; sourceTree = ""; }; + C9B53C12138D9E9A0028D27C /* putwc_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = putwc_l.3; sourceTree = ""; }; + C9B53C13138D9E9A0028D27C /* scanf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = scanf_l.3; sourceTree = ""; }; + C9B53C14138D9E9A0028D27C /* wprintf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wprintf_l.3; sourceTree = ""; }; + C9B53C15138D9E9A0028D27C /* wscanf_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wscanf_l.3; sourceTree = ""; }; + C9B53C17138D9E9A0028D27C /* a64l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = a64l.3; sourceTree = ""; }; + C9B53C18138D9E9A0028D27C /* a64l.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = a64l.c; sourceTree = ""; }; + C9B53C1A138D9E9A0028D27C /* _Exit_.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _Exit_.c; sourceTree = ""; }; + C9B53C1B138D9E9A0028D27C /* abort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = abort.3; sourceTree = ""; }; + C9B53C1D138D9E9A0028D27C /* abort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = abort.c; sourceTree = ""; }; + C9B53C1F138D9E9A0028D27C /* abs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = abs.3; sourceTree = ""; }; + C9B53C21138D9E9A0028D27C /* abs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = abs.c; sourceTree = ""; }; + C9B53C22138D9E9A0028D27C /* alloca.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = alloca.3; sourceTree = ""; }; + C9B53C24138D9E9A0028D27C /* atexit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atexit.3; sourceTree = ""; }; + C9B53C26138D9E9A0028D27C /* atexit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atexit.c; sourceTree = ""; }; + C9B53C28138D9E9A0028D27C /* atexit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = atexit.h; sourceTree = ""; }; + C9B53C2A138D9E9A0028D27C /* atof.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atof.3; sourceTree = ""; }; + C9B53C2C138D9E9A0028D27C /* atof.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atof.c; sourceTree = ""; }; + C9B53C2E138D9E9A0028D27C /* atoi.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atoi.3; sourceTree = ""; }; + C9B53C30138D9E9A0028D27C /* atoi.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atoi.c; sourceTree = ""; }; + C9B53C32138D9E9A0028D27C /* atol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atol.3; sourceTree = ""; }; + C9B53C34138D9E9A0028D27C /* atol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atol.c; sourceTree = ""; }; + C9B53C36138D9E9A0028D27C /* atoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atoll.c; sourceTree = ""; }; + C9B53C38138D9E9A0028D27C /* bsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bsearch.3; sourceTree = ""; }; + C9B53C3A138D9E9A0028D27C /* bsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bsearch.c; sourceTree = ""; }; + C9B53C3C138D9E9A0028D27C /* div.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = div.3; sourceTree = ""; }; + C9B53C3E138D9E9A0028D27C /* div.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = div.c; sourceTree = ""; }; + C9B53C3F138D9E9A0028D27C /* exit.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = exit.3; sourceTree = ""; }; + C9B53C40138D9E9A0028D27C /* exit.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = exit.c; sourceTree = ""; }; + C9B53C42138D9E9A0028D27C /* getenv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getenv.3; sourceTree = ""; }; + C9B53C44138D9E9A0028D27C /* getenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getenv.c; sourceTree = ""; }; + C9B53C46138D9E9A0028D27C /* getopt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getopt.3; sourceTree = ""; }; + C9B53C47138D9E9A0028D27C /* getopt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getopt.c; sourceTree = ""; }; + C9B53C49138D9E9A0028D27C /* getopt_long.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getopt_long.3; sourceTree = ""; }; + C9B53C4A138D9E9A0028D27C /* getopt_long.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getopt_long.c; sourceTree = ""; }; + C9B53C4B138D9E9A0028D27C /* getsubopt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getsubopt.3; sourceTree = ""; }; + C9B53C4D138D9E9A0028D27C /* getsubopt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getsubopt.c; sourceTree = ""; }; + C9B53C4E138D9E9A0028D27C /* hcreate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = hcreate.3; sourceTree = ""; }; + C9B53C4F138D9E9A0028D27C /* hcreate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = hcreate.c; sourceTree = ""; }; + C9B53C50138D9E9A0028D27C /* heapsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = heapsort.c; sourceTree = ""; }; + C9B53C53138D9E9A0028D27C /* imaxabs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = imaxabs.3; sourceTree = ""; }; + C9B53C54138D9E9A0028D27C /* imaxabs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = imaxabs.c; sourceTree = ""; }; + C9B53C55138D9E9A0028D27C /* imaxdiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = imaxdiv.3; sourceTree = ""; }; + C9B53C57138D9E9A0028D27C /* imaxdiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = imaxdiv.c; sourceTree = ""; }; + C9B53C58138D9E9A0028D27C /* insque.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = insque.3; sourceTree = ""; }; + C9B53C5A138D9E9A0028D27C /* insque.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = insque.c; sourceTree = ""; }; + C9B53C5B138D9E9A0028D27C /* labs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = labs.3; sourceTree = ""; }; + C9B53C5D138D9E9A0028D27C /* labs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = labs.c; sourceTree = ""; }; + C9B53C5E138D9E9A0028D27C /* ldiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ldiv.3; sourceTree = ""; }; + C9B53C60138D9E9A0028D27C /* ldiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ldiv.c; sourceTree = ""; }; + C9B53C61138D9E9A0028D27C /* llabs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = llabs.3; sourceTree = ""; }; + C9B53C63138D9E9A0028D27C /* llabs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = llabs.c; sourceTree = ""; }; + C9B53C64138D9E9A0028D27C /* lldiv.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lldiv.3; sourceTree = ""; }; + C9B53C66138D9E9A0028D27C /* lldiv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lldiv.c; sourceTree = ""; }; + C9B53C67138D9E9A0028D27C /* lsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = lsearch.3; sourceTree = ""; }; + C9B53C69138D9E9A0028D27C /* lsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = lsearch.c; sourceTree = ""; }; + C9B53C6A138D9E9A0028D27C /* memory.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memory.3; sourceTree = ""; }; + C9B53C6C138D9E9A0028D27C /* merge.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = merge.c; sourceTree = ""; }; + C9B53C6F138D9E9A0028D27C /* putenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = putenv.c; sourceTree = ""; }; + C9B53C71138D9E9A0028D27C /* qsort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = qsort.3; sourceTree = ""; }; + C9B53C73138D9E9A0028D27C /* qsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = qsort.c; sourceTree = ""; }; + C9B53C75138D9E9A0028D27C /* qsort_r.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = qsort_r.c; sourceTree = ""; }; + C9B53C77138D9E9A0028D27C /* radixsort.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = radixsort.3; sourceTree = ""; }; + C9B53C78138D9E9A0028D27C /* radixsort.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = radixsort.c; sourceTree = ""; }; + C9B53C7A138D9E9A0028D27C /* rand.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rand.3; sourceTree = ""; }; + C9B53C7C138D9E9A0028D27C /* rand.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rand.c; sourceTree = ""; }; + C9B53C7D138D9E9A0028D27C /* random.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = random.3; sourceTree = ""; }; + C9B53C7F138D9E9A0028D27C /* random.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = random.c; sourceTree = ""; }; + C9B53C81138D9E9A0028D27C /* reallocf.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = reallocf.c; sourceTree = ""; }; + C9B53C82138D9E9A0028D27C /* realpath.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = realpath.3; sourceTree = ""; }; + C9B53C84138D9E9A0028D27C /* realpath.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = realpath.c; sourceTree = ""; }; + C9B53C86138D9E9A0028D27C /* remque.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = remque.c; sourceTree = ""; }; + C9B53C87138D9E9A0028D27C /* setenv.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setenv.c; sourceTree = ""; }; + C9B53C89138D9E9A0028D27C /* strhash.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strhash.c; sourceTree = ""; }; + C9B53C8B138D9E9A0028D27C /* strtod.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtod.3; sourceTree = ""; }; + C9B53C8D138D9E9A0028D27C /* strtoimax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoimax.c; sourceTree = ""; }; + C9B53C8F138D9E9A0028D27C /* strtol.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtol.3; sourceTree = ""; }; + C9B53C91138D9E9A0028D27C /* strtol.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtol.c; sourceTree = ""; }; + C9B53C93138D9E9A0028D27C /* strtoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoll.c; sourceTree = ""; }; + C9B53C95138D9E9A0028D27C /* strtoq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoq.c; sourceTree = ""; }; + C9B53C97138D9E9A0028D27C /* strtoul.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtoul.3; sourceTree = ""; }; + C9B53C99138D9E9A0028D27C /* strtoul.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoul.c; sourceTree = ""; }; + C9B53C9B138D9E9A0028D27C /* strtoull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoull.c; sourceTree = ""; }; + C9B53C9D138D9E9A0028D27C /* strtoumax.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtoumax.c; sourceTree = ""; }; + C9B53C9F138D9E9A0028D27C /* strtouq.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtouq.c; sourceTree = ""; }; + C9B53CA1138D9E9A0028D27C /* system.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = system.3; sourceTree = ""; }; + C9B53CA3138D9E9A0028D27C /* system.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = system.c; sourceTree = ""; }; + C9B53CA5138D9E9A0028D27C /* tdelete.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tdelete.c; sourceTree = ""; }; + C9B53CA6138D9E9A0028D27C /* tfind.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tfind.c; sourceTree = ""; }; + C9B53CA7138D9E9A0028D27C /* tsearch.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tsearch.3; sourceTree = ""; }; + C9B53CA9138D9E9A0028D27C /* tsearch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = tsearch.c; sourceTree = ""; }; + C9B53CAA138D9E9A0028D27C /* twalk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = twalk.c; sourceTree = ""; }; + C9B53CAB138D9E9A0028D27C /* grantpt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = grantpt.3; sourceTree = ""; }; + C9B53CAC138D9E9A0028D27C /* grantpt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = grantpt.c; sourceTree = ""; }; + C9B53CAD138D9E9A0028D27C /* l64a.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = l64a.c; sourceTree = ""; }; + C9B53CB0138D9E9A0028D27C /* strfmon.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strfmon.3; sourceTree = ""; }; + C9B53CB2138D9E9A0028D27C /* strfmon.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strfmon.c; sourceTree = ""; }; + C9B53CB5138D9E9A0028D27C /* ecvt.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ecvt.3; sourceTree = ""; }; + C9B53CB7138D9E9A0028D27C /* ecvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ecvt.c; sourceTree = ""; }; + C9B53CB9138D9E9A0028D27C /* gcvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gcvt.c; sourceTree = ""; }; + C9B53CBD138D9E9A0028D27C /* qsort_b-fbsd.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "qsort_b-fbsd.c"; sourceTree = ""; }; + C9B53CBE138D9E9A0028D27C /* strtod_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtod_l.3; sourceTree = ""; }; + C9B53CBF138D9E9A0028D27C /* strtol_l.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtol_l.3; sourceTree = ""; }; + C9B53CC2138D9E9A0028D27C /* asctime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = asctime.c; sourceTree = ""; }; + C9B53CC4138D9E9A0028D27C /* ctime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ctime.3; sourceTree = ""; }; + C9B53CC6138D9E9A0028D27C /* difftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = difftime.c; sourceTree = ""; }; + C9B53CC7138D9E9A0028D27C /* ftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ftime.3; sourceTree = ""; }; + C9B53CC9138D9E9A0028D27C /* ftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ftime.c; sourceTree = ""; }; + C9B53CCA138D9E9A0028D27C /* localtime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = localtime.c; sourceTree = ""; }; + C9B53CCC138D9E9A0028D27C /* private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = private.h; sourceTree = ""; }; + C9B53CCD138D9E9A0028D27C /* strftime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strftime.3; sourceTree = ""; }; + C9B53CCF138D9E9A0028D27C /* strftime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strftime.c; sourceTree = ""; }; + C9B53CD1138D9E9A0028D27C /* strptime.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strptime.3; sourceTree = ""; }; + C9B53CD3138D9E9A0028D27C /* strptime.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strptime.c; sourceTree = ""; }; + C9B53CD5138D9E9A0028D27C /* time2posix.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = time2posix.3; sourceTree = ""; }; + C9B53CD6138D9E9A0028D27C /* time32.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = time32.c; sourceTree = ""; }; + C9B53CD7138D9E9A0028D27C /* timelocal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timelocal.c; sourceTree = ""; }; + C9B53CD9138D9E9A0028D27C /* timelocal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = timelocal.h; sourceTree = ""; }; + C9B53CDB138D9E9A0028D27C /* tzfile.5 */ = {isa = PBXFileReference; lastKnownFileType = text; path = tzfile.5; sourceTree = ""; }; + C9B53CDD138D9E9A0028D27C /* tzfile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = tzfile.h; sourceTree = ""; }; + C9B53CDF138D9E9A0028D27C /* getdate.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getdate.3; sourceTree = ""; }; + C9B53CE0138D9E9A0028D27C /* getdate.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getdate.c; sourceTree = ""; }; + C9B53CE2138D9E9A0028D27C /* timegm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = timegm.3; sourceTree = ""; }; + C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = timezone_unix03.c; sourceTree = ""; }; + C9B53CE6138D9E9A0028D27C /* bcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bcmp.3; sourceTree = ""; }; + C9B53CE8138D9E9A0028D27C /* bcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcmp.c; sourceTree = ""; }; + C9B53CE9138D9E9A0028D27C /* bcopy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bcopy.3; sourceTree = ""; }; + C9B53CEB138D9E9A0028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = ""; }; + C9B53CED138D9E9A0028D27C /* bstring.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bstring.3; sourceTree = ""; }; + C9B53CEF138D9E9A0028D27C /* bzero.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = bzero.3; sourceTree = ""; }; + C9B53CF1138D9E9A0028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = ""; }; + C9B53CF3138D9E9A0028D27C /* ffs.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = ffs.3; sourceTree = ""; }; + C9B53CF5138D9E9A0028D27C /* index.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = index.3; sourceTree = ""; }; + C9B53CF7138D9E9A0028D27C /* index.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = index.c; sourceTree = ""; }; + C9B53CF8138D9E9A0028D27C /* memccpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memccpy.3; sourceTree = ""; }; + C9B53CFA138D9E9A0028D27C /* memccpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memccpy.c; sourceTree = ""; }; + C9B53CFB138D9E9A0028D27C /* memchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memchr.3; sourceTree = ""; }; + C9B53CFD138D9E9A0028D27C /* memchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memchr.c; sourceTree = ""; }; + C9B53CFE138D9E9A0028D27C /* memcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memcmp.3; sourceTree = ""; }; + C9B53D00138D9E9A0028D27C /* memcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcmp.c; sourceTree = ""; }; + C9B53D01138D9E9A0028D27C /* memcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memcpy.3; sourceTree = ""; }; + C9B53D03138D9E9A0028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = ""; }; + C9B53D05138D9E9A0028D27C /* memmem.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memmem.3; sourceTree = ""; }; + C9B53D06138D9E9A0028D27C /* memmem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmem.c; sourceTree = ""; }; + C9B53D07138D9E9A0028D27C /* memmove.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memmove.3; sourceTree = ""; }; + C9B53D09138D9E9A0028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = ""; }; + C9B53D0B138D9E9A0028D27C /* memset.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memset.3; sourceTree = ""; }; + C9B53D0D138D9E9A0028D27C /* memset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memset.c; sourceTree = ""; }; + C9B53D0E138D9E9A0028D27C /* rindex.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = rindex.3; sourceTree = ""; }; + C9B53D10138D9E9A0028D27C /* rindex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = rindex.c; sourceTree = ""; }; + C9B53D13138D9E9A0028D27C /* strcasecmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcasecmp.3; sourceTree = ""; }; + C9B53D15138D9E9A0028D27C /* strcasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcasecmp.c; sourceTree = ""; }; + C9B53D17138D9E9A0028D27C /* strcasestr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcasestr.c; sourceTree = ""; }; + C9B53D19138D9E9A0028D27C /* strcat.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcat.3; sourceTree = ""; }; + C9B53D1C138D9E9A0028D27C /* strchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strchr.3; sourceTree = ""; }; + C9B53D1E138D9E9A0028D27C /* strchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strchr.c; sourceTree = ""; }; + C9B53D20138D9E9A0028D27C /* strcmp.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcmp.3; sourceTree = ""; }; + C9B53D22138D9E9A0028D27C /* strcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcmp.c; sourceTree = ""; }; + C9B53D24138D9E9A0028D27C /* strcoll.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcoll.3; sourceTree = ""; }; + C9B53D26138D9E9A0028D27C /* strcoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcoll.c; sourceTree = ""; }; + C9B53D28138D9E9A0028D27C /* strcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcpy.3; sourceTree = ""; }; + C9B53D2B138D9E9A0028D27C /* strcspn.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strcspn.3; sourceTree = ""; }; + C9B53D2D138D9E9A0028D27C /* strcspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strcspn.c; sourceTree = ""; }; + C9B53D2E138D9E9A0028D27C /* strdup.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strdup.3; sourceTree = ""; }; + C9B53D30138D9E9A0028D27C /* strdup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strdup.c; sourceTree = ""; }; + C9B53D31138D9E9A0028D27C /* strerror.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strerror.3; sourceTree = ""; }; + C9B53D33138D9E9A0028D27C /* strerror.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strerror.c; sourceTree = ""; }; + C9B53D35138D9E9A0028D27C /* string.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = string.3; sourceTree = ""; }; + C9B53D38138D9E9A0028D27C /* strlcpy.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strlcpy.3; sourceTree = ""; }; + C9B53D3B138D9E9A0028D27C /* strlen.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strlen.3; sourceTree = ""; }; + C9B53D3C138D9E9A0028D27C /* strlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strlen.c; sourceTree = ""; }; + C9B53D3E138D9E9A0028D27C /* strmode.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strmode.3; sourceTree = ""; }; + C9B53D40138D9E9A0028D27C /* strmode.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strmode.c; sourceTree = ""; }; + C9B53D42138D9E9A0028D27C /* strncmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strncmp.c; sourceTree = ""; }; + C9B53D44138D9E9A0028D27C /* strndup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strndup.c; sourceTree = ""; }; + C9B53D45138D9E9A0028D27C /* strnlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strnlen.c; sourceTree = ""; }; + C9B53D46138D9E9A0028D27C /* strnstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strnstr.c; sourceTree = ""; }; + C9B53D47138D9E9A0028D27C /* strpbrk.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strpbrk.3; sourceTree = ""; }; + C9B53D49138D9E9A0028D27C /* strpbrk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strpbrk.c; sourceTree = ""; }; + C9B53D4A138D9E9A0028D27C /* strrchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strrchr.3; sourceTree = ""; }; + C9B53D4C138D9E9A0028D27C /* strrchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strrchr.c; sourceTree = ""; }; + C9B53D4E138D9E9A0028D27C /* strsep.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strsep.3; sourceTree = ""; }; + C9B53D4F138D9E9A0028D27C /* strsep.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strsep.c; sourceTree = ""; }; + C9B53D50138D9E9A0028D27C /* strsignal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strsignal.c; sourceTree = ""; }; + C9B53D52138D9E9A0028D27C /* strspn.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strspn.3; sourceTree = ""; }; + C9B53D54138D9E9A0028D27C /* strspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strspn.c; sourceTree = ""; }; + C9B53D55138D9E9A0028D27C /* strstr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strstr.3; sourceTree = ""; }; + C9B53D57138D9E9A0028D27C /* strstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strstr.c; sourceTree = ""; }; + C9B53D58138D9E9A0028D27C /* strtok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strtok.3; sourceTree = ""; }; + C9B53D5A138D9E9A0028D27C /* strtok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strtok.c; sourceTree = ""; }; + C9B53D5B138D9E9A0028D27C /* strxfrm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = strxfrm.3; sourceTree = ""; }; + C9B53D5D138D9E9A0028D27C /* strxfrm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strxfrm.c; sourceTree = ""; }; + C9B53D5F138D9E9A0028D27C /* swab.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = swab.3; sourceTree = ""; }; + C9B53D61138D9E9A0028D27C /* swab.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swab.c; sourceTree = ""; }; + C9B53D63138D9E9A0028D27C /* wcpcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcpcpy.c; sourceTree = ""; }; + C9B53D64138D9E9A0028D27C /* wcpncpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcpncpy.c; sourceTree = ""; }; + C9B53D65138D9E9A0028D27C /* wcscasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscasecmp.c; sourceTree = ""; }; + C9B53D67138D9E9A0028D27C /* wcscat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscat.c; sourceTree = ""; }; + C9B53D68138D9E9A0028D27C /* wcschr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcschr.c; sourceTree = ""; }; + C9B53D69138D9E9A0028D27C /* wcscmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscmp.c; sourceTree = ""; }; + C9B53D6A138D9E9A0028D27C /* wcscoll.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcscoll.3; sourceTree = ""; }; + C9B53D6C138D9E9A0028D27C /* wcscoll.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscoll.c; sourceTree = ""; }; + C9B53D6E138D9E9A0028D27C /* wcscpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscpy.c; sourceTree = ""; }; + C9B53D6F138D9E9A0028D27C /* wcscspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcscspn.c; sourceTree = ""; }; + C9B53D70138D9E9A0028D27C /* wcsdup.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsdup.c; sourceTree = ""; }; + C9B53D71138D9E9A0028D27C /* wcslcat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslcat.c; sourceTree = ""; }; + C9B53D72138D9E9A0028D27C /* wcslcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslcpy.c; sourceTree = ""; }; + C9B53D73138D9E9A0028D27C /* wcslen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcslen.c; sourceTree = ""; }; + C9B53D74138D9E9A0028D27C /* wcsncasecmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncasecmp.c; sourceTree = ""; }; + C9B53D76138D9E9A0028D27C /* wcsncat.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncat.c; sourceTree = ""; }; + C9B53D77138D9E9A0028D27C /* wcsncmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncmp.c; sourceTree = ""; }; + C9B53D78138D9E9A0028D27C /* wcsncpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsncpy.c; sourceTree = ""; }; + C9B53D79138D9E9A0028D27C /* wcsnlen.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsnlen.c; sourceTree = ""; }; + C9B53D7A138D9E9A0028D27C /* wcspbrk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcspbrk.c; sourceTree = ""; }; + C9B53D7B138D9E9A0028D27C /* wcsrchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsrchr.c; sourceTree = ""; }; + C9B53D7C138D9E9A0028D27C /* wcsspn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsspn.c; sourceTree = ""; }; + C9B53D7D138D9E9A0028D27C /* wcsstr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsstr.c; sourceTree = ""; }; + C9B53D7E138D9E9A0028D27C /* wcstok.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcstok.3; sourceTree = ""; }; + C9B53D80138D9E9A0028D27C /* wcstok.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcstok.c; sourceTree = ""; }; + C9B53D81138D9E9A0028D27C /* wcswidth.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcswidth.3; sourceTree = ""; }; + C9B53D83138D9E9A0028D27C /* wcswidth.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcswidth.c; sourceTree = ""; }; + C9B53D85138D9E9A0028D27C /* wcsxfrm.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wcsxfrm.3; sourceTree = ""; }; + C9B53D87138D9E9A0028D27C /* wcsxfrm.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wcsxfrm.c; sourceTree = ""; }; + C9B53D89138D9E9A0028D27C /* wmemchr.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = wmemchr.3; sourceTree = ""; }; + C9B53D8B138D9E9A0028D27C /* wmemchr.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemchr.c; sourceTree = ""; }; + C9B53D8C138D9E9A0028D27C /* wmemcmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemcmp.c; sourceTree = ""; }; + C9B53D8D138D9E9A0028D27C /* wmemcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemcpy.c; sourceTree = ""; }; + C9B53D8E138D9E9A0028D27C /* wmemmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemmove.c; sourceTree = ""; }; + C9B53D8F138D9E9A0028D27C /* wmemset.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = wmemset.c; sourceTree = ""; }; + C9B53D91138D9E9A0028D27C /* memset_pattern.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = memset_pattern.3; sourceTree = ""; }; + C9B53D92138D9E9A0028D27C /* strip-header.ed */ = {isa = PBXFileReference; lastKnownFileType = text; path = "strip-header.ed"; sourceTree = ""; }; + C9B53D94138D9E9A0028D27C /* __libc_init.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = __libc_init.c; sourceTree = ""; }; + C9B53D95138D9E9A0028D27C /* _libc_fork_child.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = _libc_fork_child.c; sourceTree = ""; }; + C9B53D96138D9E9A0028D27C /* atomic.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = atomic.3; sourceTree = ""; }; + C9B53D97138D9E9A0028D27C /* barrier.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = barrier.3; sourceTree = ""; }; + C9B53D98138D9E9A0028D27C /* cache.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = cache.3; sourceTree = ""; }; + C9B53D99138D9E9A0028D27C /* chmodx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = chmodx_np.c; sourceTree = ""; }; + C9B53D9A138D9E9A0028D27C /* CLIB-LIST */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CLIB-LIST"; sourceTree = ""; }; + C9B53D9B138D9E9A0028D27C /* context-stubs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = "context-stubs.c"; sourceTree = ""; }; + C9B53D9C138D9E9A0028D27C /* crt_externs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = crt_externs.c; sourceTree = ""; }; + C9B53D9D138D9E9A0028D27C /* errno.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = errno.c; sourceTree = ""; }; + C9B53D9E138D9E9A0028D27C /* fork.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fork.c; sourceTree = ""; }; + C9B53D9F138D9E9A0028D27C /* getgroups.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getgroups.c; sourceTree = ""; }; + C9B53DA0138D9E9A0028D27C /* getiopolicy_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = getiopolicy_np.3; sourceTree = ""; }; + C9B53DA1138D9E9A0028D27C /* getiopolicy_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getiopolicy_np.c; sourceTree = ""; }; + C9B53DA2138D9E9A0028D27C /* gettimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gettimeofday.c; sourceTree = ""; }; + C9B53DA4138D9E9A0028D27C /* MISSING-MANPAGE */ = {isa = PBXFileReference; lastKnownFileType = text; path = "MISSING-MANPAGE"; sourceTree = ""; }; + C9B53DA5138D9E9A0028D27C /* MISSING_SYSCALLS */ = {isa = PBXFileReference; lastKnownFileType = text; path = MISSING_SYSCALLS; sourceTree = ""; }; + C9B53DA6138D9E9A0028D27C /* msgctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = msgctl.c; sourceTree = ""; }; + C9B53DA7138D9E9A0028D27C /* nanosleep.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = nanosleep.2; sourceTree = ""; }; + C9B53DA9138D9E9A0028D27C /* stack_protector.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = stack_protector.c; sourceTree = ""; }; + C9B53DAB138D9E9A0028D27C /* openx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = openx_np.c; sourceTree = ""; }; + C9B53DAC138D9E9A0028D27C /* OSMemoryNotification.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSMemoryNotification.c; sourceTree = ""; }; + C9B53DAD138D9E9A0028D27C /* OSThermalNotification.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = OSThermalNotification.c; sourceTree = ""; }; + C9B53DAE138D9E9A0028D27C /* posix_spawn.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = posix_spawn.c; sourceTree = ""; }; + C9B53DAF138D9E9A0028D27C /* pthread_kill.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_kill.2; sourceTree = ""; }; + C9B53DB0138D9E9A0028D27C /* pthread_sigmask.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = pthread_sigmask.2; sourceTree = ""; }; + C9B53DB1138D9E9A0028D27C /* REQUIRED-MACROS */ = {isa = PBXFileReference; lastKnownFileType = text; path = "REQUIRED-MACROS"; sourceTree = ""; }; + C9B53DB2138D9E9A0028D27C /* semctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = semctl.c; sourceTree = ""; }; + C9B53DB3138D9E9A0028D27C /* settimeofday.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = settimeofday.c; sourceTree = ""; }; + C9B53DB4138D9E9A0028D27C /* shmctl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = shmctl.c; sourceTree = ""; }; + C9B53DB5138D9E9A0028D27C /* sigaction.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigaction.c; sourceTree = ""; }; + C9B53DB6138D9E9A0028D27C /* sigcatch.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigcatch.c; sourceTree = ""; }; + C9B53DB7138D9E9A0028D27C /* sigcatch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = sigcatch.h; sourceTree = ""; }; + C9B53DB8138D9E9A0028D27C /* sigtramp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = sigtramp.c; sourceTree = ""; }; + C9B53DB9138D9E9A0028D27C /* sigwait.2 */ = {isa = PBXFileReference; lastKnownFileType = text; path = sigwait.2; sourceTree = ""; }; + C9B53DBA138D9E9A0028D27C /* slot_name.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = slot_name.c; sourceTree = ""; }; + C9B53DBB138D9E9A0028D27C /* spinlock.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = spinlock.3; sourceTree = ""; }; + C9B53DBC138D9E9A0028D27C /* statx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = statx_np.c; sourceTree = ""; }; + C9B53DBD138D9E9A0028D27C /* SYSCALL-LIST */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SYSCALL-LIST"; sourceTree = ""; }; + C9B53DBE138D9E9A0028D27C /* umaskx_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = umaskx_np.c; sourceTree = ""; }; + C9B53DC0138D9E9A0028D27C /* cprocs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cprocs.c; sourceTree = ""; }; + C9B53DC1138D9E9A0028D27C /* cthread_internals.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cthread_internals.h; sourceTree = ""; }; + C9B53DC2138D9E9A0028D27C /* cthreads.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = cthreads.c; sourceTree = ""; }; + C9B53DC3138D9E9A0028D27C /* cthreads.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = cthreads.h; sourceTree = ""; }; + C9B53DC5138D9E9A0028D27C /* mig_support.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mig_support.c; sourceTree = ""; }; + C9B53DC7138D9E9A0028D27C /* fparseln.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = fparseln.3; sourceTree = ""; }; + C9B53DC8138D9E9A0028D27C /* fparseln.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = fparseln.c; sourceTree = ""; }; + C9B53DC9138D9E9A0028D27C /* login.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = login.3; sourceTree = ""; }; + C9B53DCA138D9E9A0028D27C /* login.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = login.c; sourceTree = ""; }; + C9B53DCB138D9E9A0028D27C /* login_tty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = login_tty.c; sourceTree = ""; }; + C9B53DCC138D9E9A0028D27C /* logout.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = logout.c; sourceTree = ""; }; + C9B53DCD138D9E9A0028D27C /* logwtmp.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = logwtmp.c; sourceTree = ""; }; + C9B53DCF138D9E9A0028D27C /* opendev.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = opendev.3; sourceTree = ""; }; + C9B53DD0138D9E9A0028D27C /* opendev.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = opendev.c; sourceTree = ""; }; + C9B53DD1138D9E9A0028D27C /* openpty.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = openpty.3; sourceTree = ""; }; + C9B53DD2138D9E9A0028D27C /* pty.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pty.c; sourceTree = ""; }; + C9B53DD5138D9E9A0028D27C /* namespace.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = namespace.h; sourceTree = ""; }; + C9B53DD6138D9E9A0028D27C /* uuid-config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "uuid-config.h"; sourceTree = ""; }; + C9B53DD7138D9E9A0028D27C /* uuidman.sed */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuidman.sed; sourceTree = ""; }; + C9B53DD9138D9E9A0028D27C /* clear.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = clear.c; sourceTree = ""; }; + C9B53DDA138D9E9A0028D27C /* compare.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = compare.c; sourceTree = ""; }; + C9B53DDB138D9E9A0028D27C /* copy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = copy.c; sourceTree = ""; }; + C9B53DDC138D9E9A0028D27C /* gen_uuid.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = gen_uuid.c; sourceTree = ""; }; + C9B53DDE138D9E9A0028D27C /* isnull.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = isnull.c; sourceTree = ""; }; + C9B53DDF138D9E9A0028D27C /* libuuid.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = libuuid.3.in; sourceTree = ""; }; + C9B53DE0138D9E9A0028D27C /* pack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = pack.c; sourceTree = ""; }; + C9B53DE1138D9E9A0028D27C /* parse.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = parse.c; sourceTree = ""; }; + C9B53DE2138D9E9A0028D27C /* unpack.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unpack.c; sourceTree = ""; }; + C9B53DE3138D9E9A0028D27C /* unparse.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = unparse.c; sourceTree = ""; }; + C9B53DE5138D9E9A0028D27C /* uuid_clear.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_clear.3.in; sourceTree = ""; }; + C9B53DE6138D9E9A0028D27C /* uuid_compare.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_compare.3.in; sourceTree = ""; }; + C9B53DE7138D9E9A0028D27C /* uuid_copy.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_copy.3.in; sourceTree = ""; }; + C9B53DE8138D9E9A0028D27C /* uuid_generate.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_generate.3.in; sourceTree = ""; }; + C9B53DE9138D9E9A0028D27C /* uuid_is_null.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_is_null.3.in; sourceTree = ""; }; + C9B53DEA138D9E9A0028D27C /* uuid_parse.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_parse.3.in; sourceTree = ""; }; + C9B53DEB138D9E9A0028D27C /* uuid_unparse.3.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = uuid_unparse.3.in; sourceTree = ""; }; + C9B53DED138D9E9A0028D27C /* uuidP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = uuidP.h; sourceTree = ""; }; + C9B53DF1138D9E9A0028D27C /* _ctx_start.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _ctx_start.S; sourceTree = ""; }; + C9B53DF2138D9E9A0028D27C /* _setcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setcontext.S; sourceTree = ""; }; + C9B53DF3138D9E9A0028D27C /* cpu_number.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = cpu_number.s; sourceTree = ""; }; + C9B53DF4138D9E9A0028D27C /* getcontext.S */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = getcontext.S; sourceTree = ""; }; + C9B53DF5138D9E9A0028D27C /* getmcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = getmcontext.c; sourceTree = ""; }; + C9B53DF6138D9E9A0028D27C /* icacheinval.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = icacheinval.s; sourceTree = ""; }; + C9B53DF7138D9E9A0028D27C /* makecontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = makecontext.c; sourceTree = ""; }; + C9B53DF9138D9E9A0028D27C /* mcount.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = mcount.s; sourceTree = ""; }; + C9B53DFA138D9E9A0028D27C /* setcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = setcontext.c; sourceTree = ""; }; + C9B53DFB138D9E9A0028D27C /* swapcontext.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = swapcontext.c; sourceTree = ""; }; + C9B53DFE138D9E9A0028D27C /* preempt.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = preempt.s; sourceTree = ""; }; + C9B53DFF138D9E9A0028D27C /* pthread_getspecific.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_getspecific.s; sourceTree = ""; }; + C9B53E00138D9E9A0028D27C /* pthread_mutex_lock.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_mutex_lock.s; sourceTree = ""; }; + C9B53E01138D9E9A0028D27C /* pthread_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_self.s; sourceTree = ""; }; + C9B53E02138D9E9A0028D27C /* pthread_set_self.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = pthread_set_self.s; sourceTree = ""; }; + C9B53E03138D9E9A0028D27C /* start_wqthread.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = start_wqthread.s; sourceTree = ""; }; + C9B53E04138D9E9A0028D27C /* thread_start.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = thread_start.s; sourceTree = ""; }; + C9B53E08138D9E9A0028D27C /* __bzero.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = __bzero.s; sourceTree = ""; }; + C9B53E09138D9E9A0028D27C /* bcopy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = ""; }; + C9B53E0A138D9E9A0028D27C /* bcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse3x.s; sourceTree = ""; }; + C9B53E0B138D9E9A0028D27C /* bcopy_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bcopy_sse42.s; sourceTree = ""; }; + C9B53E0C138D9E9A0028D27C /* bzero.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = bzero.c; sourceTree = ""; }; + C9B53E0D138D9E9A0028D27C /* bzero_sse2.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse2.s; sourceTree = ""; }; + C9B53E0E138D9E9A0028D27C /* bzero_sse42.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = bzero_sse42.s; sourceTree = ""; }; + C9B53E0F138D9E9A0028D27C /* ffs.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = ffs.s; sourceTree = ""; }; + C9B53E10138D9E9A0028D27C /* longcopy_sse3x.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = longcopy_sse3x.s; sourceTree = ""; }; + C9B53E12138D9E9A0028D27C /* memcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memcmp.s; sourceTree = ""; }; + C9B53E13138D9E9A0028D27C /* memcpy.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memcpy.c; sourceTree = ""; }; + C9B53E14138D9E9A0028D27C /* memmove.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = memmove.c; sourceTree = ""; }; + C9B53E15138D9E9A0028D27C /* memset.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = memset.s; sourceTree = ""; }; + C9B53E16138D9E9A0028D27C /* strcmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcmp.s; sourceTree = ""; }; + C9B53E17138D9E9A0028D27C /* strcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strcpy.s; sourceTree = ""; }; + C9B53E18138D9E9A0028D27C /* strlcat.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcat.s; sourceTree = ""; }; + C9B53E19138D9E9A0028D27C /* strlcpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlcpy.s; sourceTree = ""; }; + C9B53E1A138D9E9A0028D27C /* strlen.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strlen.s; sourceTree = ""; }; + C9B53E1B138D9E9A0028D27C /* strncmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncmp.s; sourceTree = ""; }; + C9B53E1C138D9E9A0028D27C /* strncpy.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = strncpy.s; sourceTree = ""; }; + C9B53E1E138D9E9A0028D27C /* _setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _setjmp.s; sourceTree = ""; }; + C9B53E1F138D9E9A0028D27C /* _sigtramp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = _sigtramp.s; sourceTree = ""; }; + C9B53E20138D9E9A0028D27C /* atomic.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = ""; }; + C9B53E21138D9E9A0028D27C /* i386_gettimeofday_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = i386_gettimeofday_asm.s; sourceTree = ""; }; + C9B53E23138D9E9A0028D27C /* nanotime.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = nanotime.s; sourceTree = ""; }; + C9B53E24138D9E9A0028D27C /* OSAtomic.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = OSAtomic.s; sourceTree = ""; }; + C9B53E25138D9E9A0028D27C /* setjmp.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = setjmp.s; sourceTree = ""; }; + C9B53E26138D9E9A0028D27C /* spinlocks.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = spinlocks.c; sourceTree = ""; }; + C9B53E27138D9E9A0028D27C /* spinlocks_asm.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = spinlocks_asm.s; sourceTree = ""; }; + 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 = ""; }; + 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 = ""; }; + C9CF595913CD0B9600674871 /* memset_pattern.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = memset_pattern.c; sourceTree = ""; }; + C9D9432A138DB72000FB7ACC /* forceLibcToBuild.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = forceLibcToBuild.c; sourceTree = ""; }; + 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 = ""; }; + C9D94358138EC0C600FB7ACC /* heapsort_r.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = heapsort_r.c; sourceTree = ""; }; + 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 = ""; }; + C9EB2FC3138F6C5C0075BB52 /* psort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort.c; sourceTree = ""; }; + C9EB2FC5138F6CE10075BB52 /* psort_b.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort_b.c; sourceTree = ""; }; + C9EB2FC6138F6CE10075BB52 /* psort_r.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort_r.c; sourceTree = ""; }; + 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 = ""; }; + C9EB354F138F7EA50075BB52 /* getmntinfo64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getmntinfo64.c; sourceTree = ""; }; + C9EB3555138F7F6A0075BB52 /* setjmperr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = setjmperr.c; sourceTree = ""; }; + C9FA32F8138E4A5C0089A94B /* utf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf2.c; sourceTree = ""; }; +/* 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + 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 = ""; + }; + C9B535AF138D9E980028D27C /* arm */ = { + isa = PBXGroup; + children = ( + C9B535B0138D9E980028D27C /* gen */, + C9B535B5138D9E980028D27C /* pthreads */, + C9B535BF138D9E980028D27C /* string */, + C9B535D4138D9E980028D27C /* sys */, + ); + path = arm; + sourceTree = ""; + }; + C9B535B0138D9E980028D27C /* gen */ = { + isa = PBXGroup; + children = ( + C9B535B1138D9E980028D27C /* cpu_number.s */, + C9B535B2138D9E980028D27C /* icacheinval.s */, + ); + path = gen; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B5361D138D9E980028D27C /* db */ = { + isa = PBXGroup; + children = ( + C9B5361E138D9E980028D27C /* btree */, + C9B53634138D9E980028D27C /* db */, + C9B53638138D9E980028D27C /* hash */, + C9B5364E138D9E980028D27C /* man */, + C9B53658138D9E980028D27C /* mpool */, + C9B5365D138D9E980028D27C /* recno */, + ); + path = db; + sourceTree = ""; + }; + C9B5361E138D9E980028D27C /* btree */ = { + isa = PBXGroup; + children = ( + C9B5361F138D9E980028D27C /* FreeBSD */, + ); + path = btree; + sourceTree = ""; + }; + 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 = ""; + }; + C9B53634138D9E980028D27C /* db */ = { + isa = PBXGroup; + children = ( + C9B53635138D9E980028D27C /* FreeBSD */, + ); + path = db; + sourceTree = ""; + }; + C9B53635138D9E980028D27C /* FreeBSD */ = { + isa = PBXGroup; + children = ( + C9B53636138D9E980028D27C /* db.c */, + ); + path = FreeBSD; + sourceTree = ""; + }; + C9B53638138D9E980028D27C /* hash */ = { + isa = PBXGroup; + children = ( + C9B53639138D9E980028D27C /* FreeBSD */, + ); + path = hash; + sourceTree = ""; + }; + 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 = ""; + }; + C9B5364E138D9E980028D27C /* man */ = { + isa = PBXGroup; + children = ( + C9B5364F138D9E980028D27C /* FreeBSD */, + ); + path = man; + sourceTree = ""; + }; + 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 = ""; + }; + C9B53658138D9E980028D27C /* mpool */ = { + isa = PBXGroup; + children = ( + C9B53659138D9E980028D27C /* FreeBSD */, + ); + path = mpool; + sourceTree = ""; + }; + C9B53659138D9E980028D27C /* FreeBSD */ = { + isa = PBXGroup; + children = ( + C9B5365A138D9E980028D27C /* mpool.c */, + ); + path = FreeBSD; + sourceTree = ""; + }; + C9B5365D138D9E980028D27C /* recno */ = { + isa = PBXGroup; + children = ( + C9B5365E138D9E980028D27C /* FreeBSD */, + ); + path = recno; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53681138D9E980028D27C /* machine */ = { + isa = PBXGroup; + children = ( + C9B53682138D9E980028D27C /* atomic.h */, + ); + path = machine; + sourceTree = ""; + }; + C9B53688138D9E980028D27C /* sys */ = { + isa = PBXGroup; + children = ( + C9B53689138D9E980028D27C /* cdefs.h */, + C9B5368A138D9E980028D27C /* endian.h */, + ); + path = sys; + sourceTree = ""; + }; + C9B5368D138D9E980028D27C /* gdtoa */ = { + isa = PBXGroup; + children = ( + C9B5368E138D9E980028D27C /* _ldbl_util.c */, + C9B5368F138D9E980028D27C /* arith.h */, + C9B53690138D9E980028D27C /* FreeBSD */, + C9B536BD138D9E980028D27C /* gd_qnan.h */, + C9B536BE138D9E980028D27C /* gdtoa.tgz */, + ); + path = gdtoa; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B537DD138D9E990028D27C /* NetBSD */ = { + isa = PBXGroup; + children = ( + C9B537DE138D9E990028D27C /* endutxent.3 */, + C9B537E0138D9E990028D27C /* getlastlogx.3 */, + C9B537E2138D9E990028D27C /* utmpx.5 */, + C9B537E4138D9E990028D27C /* utmpx.c */, + ); + path = NetBSD; + sourceTree = ""; + }; + C9B5380A138D9E990028D27C /* gmon */ = { + isa = PBXGroup; + children = ( + C9B5380B138D9E990028D27C /* gmon.c */, + C9B5380D138D9E990028D27C /* moncontrol.3 */, + ); + path = gmon; + sourceTree = ""; + }; + C9B5380F138D9E990028D27C /* i386 */ = { + isa = PBXGroup; + children = ( + C9B53810138D9E990028D27C /* gen */, + C9B5381D138D9E990028D27C /* pthreads */, + C9B53829138D9E990028D27C /* string */, + C9B53843138D9E990028D27C /* sys */, + ); + path = i386; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53858138D9E990028D27C /* arpa */ = { + isa = PBXGroup; + children = ( + C9B53859138D9E990028D27C /* ftp.h */, + C9B5385B138D9E990028D27C /* nameser_compat.h */, + C9B5385C138D9E990028D27C /* telnet.h */, + C9B5385D138D9E990028D27C /* tftp.h */, + ); + path = arpa; + sourceTree = ""; + }; + C9B5386F138D9E990028D27C /* FreeBSD */ = { + isa = PBXGroup; + children = ( + C9B53870138D9E990028D27C /* nl_types.h */, + ); + path = FreeBSD; + sourceTree = ""; + }; + C9B5387F138D9E990028D27C /* libkern */ = { + isa = PBXGroup; + children = ( + C9B53881138D9E990028D27C /* OSAtomic.h */, + C9B53882138D9E990028D27C /* OSCacheControl.h */, + C9B53883138D9E990028D27C /* OSMemoryNotification.h */, + C9B53884138D9E990028D27C /* OSThermalNotification.h */, + ); + path = libkern; + sourceTree = ""; + }; + C9B53888138D9E990028D27C /* malloc */ = { + isa = PBXGroup; + children = ( + C9B5388A138D9E990028D27C /* malloc.h */, + ); + path = malloc; + sourceTree = ""; + }; + C9B53890138D9E990028D27C /* NetBSD */ = { + isa = PBXGroup; + children = ( + C9B53891138D9E990028D27C /* utmpx.h */, + ); + path = NetBSD; + sourceTree = ""; + }; + C9B5389B138D9E990028D27C /* protocols */ = { + isa = PBXGroup; + children = ( + C9B5389D138D9E990028D27C /* routed.h */, + C9B5389E138D9E990028D27C /* rwhod.h */, + C9B5389F138D9E990028D27C /* talkd.h */, + C9B538A0138D9E990028D27C /* timed.h */, + ); + path = protocols; + sourceTree = ""; + }; + C9B538A8138D9E990028D27C /* secure */ = { + isa = PBXGroup; + children = ( + C9B538A9138D9E990028D27C /* _common.h */, + C9B538AA138D9E990028D27C /* _stdio.h */, + C9B538AB138D9E990028D27C /* _string.h */, + ); + path = secure; + sourceTree = ""; + }; + C9B538BF138D9E990028D27C /* sys */ = { + isa = PBXGroup; + children = ( + C9B538C0138D9E990028D27C /* acl.h */, + C9B538C1138D9E990028D27C /* cdefs.h */, + C9B538C3138D9E990028D27C /* statvfs.h */, + ); + path = sys; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53A08138D9E990028D27C /* FreeBSD */ = { + isa = PBXGroup; + children = ( + C9B53A09138D9E990028D27C /* stdarg.3 */, + ); + path = FreeBSD; + sourceTree = ""; + }; + C9B53A0E138D9E990028D27C /* nbsdcompat */ = { + isa = PBXGroup; + children = ( + C9B53A0F138D9E990028D27C /* _nbsd_compat_.h */, + C9B53A10138D9E990028D27C /* namespace.h */, + ); + path = nbsdcompat; + sourceTree = ""; + }; + C9B53A11138D9E990028D27C /* net */ = { + isa = PBXGroup; + children = ( + C9B53A12138D9E990028D27C /* byteorder.3 */, + C9B53A13138D9E990028D27C /* ethers.3 */, + C9B53A14138D9E990028D27C /* FreeBSD */, + C9B53A39138D9E990028D27C /* rcmdsh.3 */, + ); + path = net; + sourceTree = ""; + }; + 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 = ""; + }; + C9B53A3A138D9E990028D27C /* nls */ = { + isa = PBXGroup; + children = ( + C9B53A3B138D9E990028D27C /* FreeBSD */, + ); + path = nls; + sourceTree = ""; + }; + C9B53A3B138D9E990028D27C /* FreeBSD */ = { + isa = PBXGroup; + children = ( + C9B53A3C138D9E990028D27C /* catclose.3 */, + C9B53A3D138D9E990028D27C /* catgets.3 */, + C9B53A3E138D9E990028D27C /* catopen.3 */, + C9B53A3F138D9E990028D27C /* msgcat.c */, + C9B53A41138D9E990028D27C /* msgcat.h */, + ); + path = FreeBSD; + sourceTree = ""; + }; + C9B53A45138D9E990028D27C /* Platforms */ = { + isa = PBXGroup; + children = ( + C9B53A46138D9E990028D27C /* iphoneos */, + C9B53A48138D9E990028D27C /* macosx */, + ); + path = Platforms; + sourceTree = ""; + }; + C9B53A46138D9E990028D27C /* iphoneos */ = { + isa = PBXGroup; + children = ( + C9B53A47138D9E990028D27C /* Makefile.inc */, + ); + path = iphoneos; + sourceTree = ""; + }; + C9B53A48138D9E990028D27C /* macosx */ = { + isa = PBXGroup; + children = ( + C9B53A49138D9E990028D27C /* Makefile.inc */, + ); + path = macosx; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53AFF138D9E990028D27C /* tests */ = { + isa = PBXGroup; + children = ( + C9B53B00138D9E990028D27C /* Makefile */, + C9B53B01138D9E990028D27C /* pthread_atfork_test.c */, + ); + path = tests; + sourceTree = ""; + }; + C9B53B03138D9E990028D27C /* regex */ = { + isa = PBXGroup; + children = ( + C9B53B04138D9E990028D27C /* FreeBSD */, + B122F2AE1432B95B00AF95D0 /* TRE */, + ); + path = regex; + sourceTree = ""; + }; + 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 = ""; + }; + C9B53B1B138D9E990028D27C /* rpc */ = { + isa = PBXGroup; + children = ( + ); + path = rpc; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53CAF138D9E9A0028D27C /* NetBSD */ = { + isa = PBXGroup; + children = ( + C9B53CB0138D9E9A0028D27C /* strfmon.3 */, + C9B53CB2138D9E9A0028D27C /* strfmon.c */, + ); + path = NetBSD; + sourceTree = ""; + }; + C9B53CB4138D9E9A0028D27C /* OpenBSD */ = { + isa = PBXGroup; + children = ( + C9B53CB5138D9E9A0028D27C /* ecvt.3 */, + C9B53CB7138D9E9A0028D27C /* ecvt.c */, + C9B53CB9138D9E9A0028D27C /* gcvt.c */, + ); + path = OpenBSD; + sourceTree = ""; + }; + C9B53CC0138D9E9A0028D27C /* stdtime */ = { + isa = PBXGroup; + children = ( + C9B53CC1138D9E9A0028D27C /* FreeBSD */, + C9B53CDF138D9E9A0028D27C /* getdate.3 */, + C9B53CE0138D9E9A0028D27C /* getdate.c */, + C9B53CE2138D9E9A0028D27C /* timegm.3 */, + C9B53CE3138D9E9A0028D27C /* timezone_unix03.c */, + ); + path = stdtime; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53DA8138D9E9A0028D27C /* OpenBSD */ = { + isa = PBXGroup; + children = ( + C9B53DA9138D9E9A0028D27C /* stack_protector.c */, + ); + path = OpenBSD; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + C9B53DD3138D9E9A0028D27C /* uuid */ = { + isa = PBXGroup; + children = ( + C9B53DD5138D9E9A0028D27C /* namespace.h */, + C9B53DD6138D9E9A0028D27C /* uuid-config.h */, + C9B53DD7138D9E9A0028D27C /* uuidman.sed */, + C9B53DD8138D9E9A0028D27C /* uuidsrc */, + ); + path = uuid; + sourceTree = ""; + }; + 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 = ""; + }; + C9B53DEF138D9E9A0028D27C /* x86_64 */ = { + isa = PBXGroup; + children = ( + C9B53DF0138D9E9A0028D27C /* gen */, + C9B53DFC138D9E9A0028D27C /* pthreads */, + C9B53E07138D9E9A0028D27C /* string */, + C9B53E1D138D9E9A0028D27C /* sys */, + ); + path = x86_64; + sourceTree = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; + 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 = ""; + }; +/* 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 index 0000000..77138ed --- /dev/null +++ b/Libc.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Makefile b/Makefile deleted file mode 100644 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 -.include - -.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 -.include diff --git a/Makefile.fbsd_begin b/Makefile.fbsd_begin deleted file mode 100644 index 2bc1c24..0000000 --- a/Makefile.fbsd_begin +++ /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 index 6275b05..0000000 --- a/Makefile.fbsd_end +++ /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 index 56906a2..0000000 --- a/Makefile.features +++ /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 index 6642b38..0000000 --- a/Makefile.inc +++ /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 index 1a7b778..0000000 --- a/Makefile.nbsd_begin +++ /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 index 63a8a85..0000000 --- a/Makefile.nbsd_end +++ /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 index fc75f15..0000000 --- a/Makefile.obsd_begin +++ /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 index 9b3ef1a..0000000 --- a/Makefile.obsd_end +++ /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 index 6191453..0000000 --- a/Makefile.xbs +++ /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/iPhone/Makefile.inc b/Platforms/iphoneos/Makefile.inc similarity index 75% rename from Platforms/iPhone/Makefile.inc rename to Platforms/iphoneos/Makefile.inc index f9ac61c..4708e55 100644 --- a/Platforms/iPhone/Makefile.inc +++ b/Platforms/iphoneos/Makefile.inc @@ -8,12 +8,6 @@ # 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 @@ -24,13 +18,10 @@ FEATURE_LEGACY_NXZONE_APIS = 1 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 +.if RC_ProjectName _Sim$ +FEATURE_MOVE_LOCALTIME = 0 .endif # No pre-1050 variants (should match sys/cdefs.h) @@ -56,3 +47,6 @@ FEATURE_PATCH_5243343 = 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 similarity index 77% rename from Platforms/MacOSX/Makefile.inc rename to Platforms/macosx/Makefile.inc index 97d5f07..ff3617f 100644 --- a/Platforms/MacOSX/Makefile.inc +++ b/Platforms/macosx/Makefile.inc @@ -8,12 +8,6 @@ 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 @@ -26,16 +20,11 @@ FEATURE_LEGACY_UTMP_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) +.if CURRENT_ARCH 64$ FEATURE_ONLY_UNIX_CONFORMANCE = 1 .endif @@ -56,3 +45,6 @@ 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 index 2597b5b..0000000 --- a/arm/Makefile.inc +++ /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 index 4796738..0000000 --- a/arm/gen/Makefile.inc +++ /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 index a37d6ea..0000000 --- a/arm/pthreads/Makefile.inc +++ /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 index e4b5f20..0000000 --- a/arm/pthreads/get_cpu_capabilities.s +++ /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 -#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 diff --git a/arm/pthreads/start_wqthread.s b/arm/pthreads/start_wqthread.s index 3cf471e..79bb28e 100644 --- a/arm/pthreads/start_wqthread.s +++ b/arm/pthreads/start_wqthread.s @@ -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@ * @@ -36,5 +36,10 @@ .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 diff --git a/arm/pthreads/thread_start.s b/arm/pthreads/thread_start.s index e7574d6..5bf4bf6 100644 --- a/arm/pthreads/thread_start.s +++ b/arm/pthreads/thread_start.s @@ -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 index c8477d4..0000000 --- a/arm/stdlib/gdtoa.mk +++ /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 index 8125ca7..0000000 --- a/arm/string/Makefile.inc +++ /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 - diff --git a/arm/string/bcopy_CortexA8.s b/arm/string/bcopy_CortexA8.s index d7fb7c4..89ae1a7 100644 --- a/arm/string/bcopy_CortexA8.s +++ b/arm/string/bcopy_CortexA8.s @@ -21,3 +21,843 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include +#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 diff --git a/arm/string/bcopy_CortexA9.s b/arm/string/bcopy_CortexA9.s index 9b2664f..45f0e2b 100644 --- a/arm/string/bcopy_CortexA9.s +++ b/arm/string/bcopy_CortexA9.s @@ -43,3 +43,402 @@ * this function on OS X and iOS). */ +#include +#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 diff --git a/arm/string/bcopy_Generic.s b/arm/string/bcopy_Generic.s index 711b91d..4d5fc22 100644 --- a/arm/string/bcopy_Generic.s +++ b/arm/string/bcopy_Generic.s @@ -21,3 +21,387 @@ * @APPLE_LICENSE_HEADER_END@ */ +/***************************************************************************** + * ARMv5 and ARMv6 implementation, also used in dyld on later archs * + *****************************************************************************/ + +#include +#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 index 0000000..e5188b1 --- /dev/null +++ b/arm/string/bcopy_Swift.s @@ -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 +#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 diff --git a/arm/string/bzero_CortexA8.s b/arm/string/bzero_CortexA8.s index eb6e59c..bcbfea0 100644 --- a/arm/string/bzero_CortexA8.s +++ b/arm/string/bzero_CortexA8.s @@ -20,3 +20,158 @@ * * @APPLE_LICENSE_HEADER_END@ */ + +#include +#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 + diff --git a/arm/string/bzero_CortexA9.s b/arm/string/bzero_CortexA9.s index fc3198c..9ab178b 100644 --- a/arm/string/bzero_CortexA9.s +++ b/arm/string/bzero_CortexA9.s @@ -37,3 +37,109 @@ * writes value converted to an unsigned char to n successive bytes, beginning * at destination. */ + +#include +#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 diff --git a/arm/string/bzero_Generic.s b/arm/string/bzero_Generic.s index 1c9efb5..c3c2458 100644 --- a/arm/string/bzero_Generic.s +++ b/arm/string/bzero_Generic.s @@ -20,3 +20,148 @@ * * @APPLE_LICENSE_HEADER_END@ */ + +#include +#if !defined _ARM_ARCH_7 || defined VARIANT_DYLD + +#include +#include + +/* + * 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 index 0000000..9c0d1af --- /dev/null +++ b/arm/string/bzero_Swift.s @@ -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 +#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 diff --git a/arm/string/dyld_resolvers.c b/arm/string/dyld_resolvers.c index e69de29..1c53fff 100644 --- a/arm/string/dyld_resolvers.c +++ b/arm/string/dyld_resolvers.c @@ -0,0 +1,98 @@ +// This file implements resolvers to assist dyld in choosing the correct +// implementation of 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 +#if defined _ARM_ARCH_7 && !defined VARIANT_DYLD + +#include +#include +#include + +// 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 diff --git a/arm/string/ffs.s b/arm/string/ffs.s index a462a6b..62e492a 100644 --- a/arm/string/ffs.s +++ b/arm/string/ffs.s @@ -21,3 +21,30 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include + +#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 diff --git a/arm/string/memcmp.s b/arm/string/memcmp.s index d7fb7c4..2cdd5a3 100644 --- a/arm/string/memcmp.s +++ b/arm/string/memcmp.s @@ -21,3 +21,97 @@ * @APPLE_LICENSE_HEADER_END@ */ +// ARM Assembly implementation of memcmp( ) from +// 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 + +#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 diff --git a/arm/string/memset_pattern.s b/arm/string/memset_pattern.s index ffdc454..b569484 100755 --- a/arm/string/memset_pattern.s +++ b/arm/string/memset_pattern.s @@ -21,3 +21,316 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include + +// 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 + +/* + * 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 index 0000000..2f843a0 --- /dev/null +++ b/arm/string/memset_pattern_Swift.s @@ -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 +#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 diff --git a/arm/string/strchr.s b/arm/string/strchr.s index 58981cb..229db7b 100644 --- a/arm/string/strchr.s +++ b/arm/string/strchr.s @@ -20,4 +20,42 @@ * * @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} diff --git a/arm/string/strcmp.s b/arm/string/strcmp.s index 08becae..e214c3f 100644 --- a/arm/string/strcmp.s +++ b/arm/string/strcmp.s @@ -1,31 +1,135 @@ -/* $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/strlen.s b/arm/string/strlen.s index ffdc454..d7b261d 100644 --- a/arm/string/strlen.s +++ b/arm/string/strlen.s @@ -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@ * @@ -21,3 +21,95 @@ * @APPLE_LICENSE_HEADER_END@ */ +#include +.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} + diff --git a/arm/string/strncmp.s b/arm/string/strncmp.s index e69de29..450aa44 100644 --- a/arm/string/strncmp.s +++ b/arm/string/strncmp.s @@ -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 index e69de29..0000000 diff --git a/arm/string/strnlen.s b/arm/string/strnlen.s index e69de29..33535fd 100644 --- a/arm/string/strnlen.s +++ b/arm/string/strnlen.s @@ -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 +.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} diff --git a/arm/string/strstr.s b/arm/string/strstr.s index fc9f350..a44087e 100644 --- a/arm/string/strstr.s +++ b/arm/string/strstr.s @@ -21,3 +21,129 @@ * @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 index 7991b41..0000000 --- a/arm/sys/Makefile.inc +++ /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/ppc/string/fls.s b/arm/sys/OSAtomic.c similarity index 87% rename from ppc/string/fls.s rename to arm/sys/OSAtomic.c index e37c085..41c328b 100644 --- a/ppc/string/fls.s +++ b/arm/sys/OSAtomic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -21,10 +21,5 @@ * @APPLE_LICENSE_HEADER_END@ */ -.text -.align 2 -.globl _fls -_fls: - cntlzw r3,r3 - subfic r3,r3,32 - blr +#include "OSAtomic.h" +#include "../../darwin/OSAtomicLoadStoreEx.c" diff --git a/arm/sys/OSAtomic.h b/arm/sys/OSAtomic.h new file mode 100644 index 0000000..7745403 --- /dev/null +++ b/arm/sys/OSAtomic.h @@ -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 +#include +#include +#include +#include + +#define fastpath(x) ((typeof(x))__builtin_expect((long)(x), ~0l)) +#define slowpath(x) ((typeof(x))__builtin_expect((long)(x), 0l)) + +#if defined(__arm__) +#include + +#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 index 6bcf8d1..0000000 --- a/arm/sys/OSAtomic.s +++ /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 -#include -#include - -.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/string/strcpy.s b/arm/sys/OSAtomicUP.c similarity index 88% rename from arm/string/strcpy.s rename to arm/sys/OSAtomicUP.c index 58981cb..d9a24a1 100644 --- a/arm/string/strcpy.s +++ b/arm/sys/OSAtomicUP.c @@ -1,15 +1,15 @@ /* - * Copyright (c) 2010 Apple, Inc. All rights reserved. + * 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, @@ -17,7 +17,9 @@ * 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" diff --git a/arm/sys/OSAtomic_resolvers.c b/arm/sys/OSAtomic_resolvers.c index 6b26d30..28ad04f 100644 --- a/arm/sys/OSAtomic_resolvers.c +++ b/arm/sys/OSAtomic_resolvers.c @@ -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@ */ @@ -27,12 +27,36 @@ */ #include -#if defined(_ARM_ARCH_7) && !defined(VARIANT_DYLD) +#if defined(_ARM_ARCH_7) #include #include #include +#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; \ @@ -64,10 +88,12 @@ } \ 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/include/objc/malloc.h b/arm/sys/Spinlocks.c similarity index 84% rename from include/objc/malloc.h rename to arm/sys/Spinlocks.c index bccba72..c428e13 100644 --- a/include/objc/malloc.h +++ b/arm/sys/Spinlocks.c @@ -1,15 +1,15 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * 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, @@ -17,9 +17,9 @@ * 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 instead of " -#include +#include "OSAtomic.h" +#include "../../darwin/SpinlocksLoadStoreEx.c" diff --git a/arm/sys/SpinlocksUP.c b/arm/sys/SpinlocksUP.c new file mode 100644 index 0000000..aa09ea5 --- /dev/null +++ b/arm/sys/SpinlocksUP.c @@ -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 + +// 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/ppc64/pthreads/pthread_set_self_64.s b/arm/sys/SpinlocksWFE.c similarity index 82% rename from ppc64/pthreads/pthread_set_self_64.s rename to arm/sys/SpinlocksWFE.c index a93cec0..2107670 100644 --- a/ppc64/pthreads/pthread_set_self_64.s +++ b/arm/sys/SpinlocksWFE.c @@ -1,15 +1,15 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * 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, @@ -17,12 +17,15 @@ * 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 + +#include + +#if defined(_ARM_ARCH_7) + +#define _OSATOMIC_WFE +#include "Spinlocks.c" + +#endif diff --git a/arm/sys/_longjmp.s b/arm/sys/_longjmp.s index d371d95..0bd11ab 100644 --- a/arm/sys/_longjmp.s +++ b/arm/sys/_longjmp.s @@ -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 diff --git a/arm/sys/_setjmp.s b/arm/sys/_setjmp.s index b0b2dad..433f8c9 100644 --- a/arm/sys/_setjmp.s +++ b/arm/sys/_setjmp.s @@ -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 diff --git a/arm/sys/gcc_atomic.c b/arm/sys/gcc_atomic.c index 4fc25d2..c96820a 100644 --- a/arm/sys/gcc_atomic.c +++ b/arm/sys/gcc_atomic.c @@ -33,69 +33,69 @@ * 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 diff --git a/compat-43/FreeBSD/creat.c b/compat-43/FreeBSD/creat.c index 2ee5dd4..f913d4a 100644 --- a/compat-43/FreeBSD/creat.c +++ b/compat-43/FreeBSD/creat.c @@ -33,14 +33,26 @@ static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93"; #include __FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $"); + #include "namespace.h" #include #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 index c3bad77..0000000 --- a/compat-43/FreeBSD/creat.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $"); - -+ - #include "namespace.h" - #include - #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/gethostid.3 b/compat-43/FreeBSD/gethostid.3 index 472dca6..e938320 100644 --- a/compat-43/FreeBSD/gethostid.3 +++ b/compat-43/FreeBSD/gethostid.3 @@ -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 diff --git a/compat-43/FreeBSD/gethostid.3.patch b/compat-43/FreeBSD/gethostid.3.patch deleted file mode 100644 index 184729b..0000000 --- a/compat-43/FreeBSD/gethostid.3.patch +++ /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 diff --git a/compat-43/FreeBSD/gethostid.c b/compat-43/FreeBSD/gethostid.c index 3a7da22..5f77a9b 100644 --- a/compat-43/FreeBSD/gethostid.c +++ b/compat-43/FreeBSD/gethostid.c @@ -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 index 29aa613..0000000 --- a/compat-43/FreeBSD/gethostid.c.patch +++ /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; diff --git a/compat-43/FreeBSD/killpg.2 b/compat-43/FreeBSD/killpg.2 index 97bc9b1..2518ab9 100644 --- a/compat-43/FreeBSD/killpg.2 +++ b/compat-43/FreeBSD/killpg.2 @@ -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 +.Fd #include +.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 index 8a00461..0000000 --- a/compat-43/FreeBSD/killpg.2.patch +++ /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 -+.Fd #include -+.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.c b/compat-43/FreeBSD/killpg.c index ca8097e..d66425b 100644 --- a/compat-43/FreeBSD/killpg.c +++ b/compat-43/FreeBSD/killpg.c @@ -37,6 +37,16 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-43/killpg.c,v 1.5 2007/01/09 00:27:49 im #include #include +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 index 6c18982..0000000 --- a/compat-43/FreeBSD/killpg.c.patch +++ /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 - #include - -+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/setpgrp.c b/compat-43/FreeBSD/setpgrp.c index 011f7bc..ebed79a 100644 --- a/compat-43/FreeBSD/setpgrp.c +++ b/compat-43/FreeBSD/setpgrp.c @@ -36,8 +36,13 @@ __FBSDID("$FreeBSD: src/lib/libc/compat-43/setpgrp.c,v 1.5 2007/01/09 00:27:49 i #include #include -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 index 3b8c176..0000000 --- a/compat-43/FreeBSD/setpgrp.c.patch +++ /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 - #include - --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 index f1bf890..0000000 --- a/compat-43/Makefile.inc +++ /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 index f913d4a..0000000 --- a/compat-43/creat-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/compat-43/creat.c,v 1.8 2007/01/09 00:27:49 imp Exp $"); - - -#include "namespace.h" -#include -#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 index 3904d0d..0000000 --- a/compat-43/creat.2 +++ /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 index 5f77a9b..0000000 --- a/compat-43/gethostid-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/compat-43/gethostid.c,v 1.5 2007/01/09 00:27:49 imp Exp $"); - -#include -#include - -#include - -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 index e938320..0000000 --- a/compat-43/gethostid.3 +++ /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 index cee67a2..0000000 --- a/compat-43/getwd-fbsd.c +++ /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 index d66425b..0000000 --- a/compat-43/killpg-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/compat-43/killpg.c,v 1.5 2007/01/09 00:27:49 imp Exp $"); - -#include -#include -#include - -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 index 2518ab9..0000000 --- a/compat-43/killpg.2 +++ /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 -.Fd #include -.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 index 4754530..0000000 --- a/compat-43/sethostid-fbsd.c +++ /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 index ebed79a..0000000 --- a/compat-43/setpgrp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/compat-43/setpgrp.c,v 1.5 2007/01/09 00:27:49 imp Exp $"); - -#include -#include - -/* 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 index 5734593..0000000 --- a/compat-43/setrgid-fbsd.c +++ /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 index b76fe9c..0000000 --- a/compat-43/setruid-fbsd.c +++ /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 index dde144b..0000000 --- a/compat-43/setruid.3 +++ /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 index b83c1fe..0000000 --- a/darwin/Makefile.inc +++ /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 index 0000000..75d008b --- /dev/null +++ b/darwin/OSAtomicLoadStoreEx.c @@ -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 index 0000000..a991ba0 --- /dev/null +++ b/darwin/SpinlocksLoadStoreEx.c @@ -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 + +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 diff --git a/darwin/_dirhelper.c b/darwin/_dirhelper.c index bfd9959..04749f6 100644 --- a/darwin/_dirhelper.c +++ b/darwin/_dirhelper.c @@ -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 diff --git a/darwin/dirhelper_priv.h b/darwin/dirhelper_priv.h index cf2ae3c..bbb7aec 100644 --- a/darwin/dirhelper_priv.h +++ b/darwin/dirhelper_priv.h @@ -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 index 0000000..9b0b97c --- /dev/null +++ b/darwin/forceLibcToBuild.c @@ -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; diff --git a/darwin/libproc.c b/darwin/libproc.c index 0b6eb47..9879aaa 100644 --- a/darwin/libproc.c +++ b/darwin/libproc.c @@ -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) diff --git a/darwin/libproc.h b/darwin/libproc.h index 7692f85..cbc72d2 100644 --- a/darwin/libproc.h +++ b/darwin/libproc.h @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -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_ */ diff --git a/darwin/libproc_internal.h b/darwin/libproc_internal.h index 20feee7..6bf4acc 100644 --- a/darwin/libproc_internal.h +++ b/darwin/libproc_internal.h @@ -27,7 +27,6 @@ #include #include -#include __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 index 39357c7..0000000 --- a/db/Makefile.inc +++ /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/extern.h b/db/btree/FreeBSD/bt_extern.h similarity index 100% rename from db/btree/FreeBSD/extern.h rename to db/btree/FreeBSD/bt_extern.h diff --git a/db/btree/FreeBSD/bt_overflow.c b/db/btree/FreeBSD/bt_overflow.c index 344b7c1..25e3000 100644 --- a/db/btree/FreeBSD/bt_overflow.c +++ b/db/btree/FreeBSD/bt_overflow.c @@ -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 index d2bf3b5..0000000 --- a/db/btree/FreeBSD/bt_overflow.c.patch +++ /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); diff --git a/db/btree/FreeBSD/bt_seq.c b/db/btree/FreeBSD/bt_seq.c index 2ffe71f..b0b8b04 100644 --- a/db/btree/FreeBSD/bt_seq.c +++ b/db/btree/FreeBSD/bt_seq.c @@ -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 index afdfbea..0000000 --- a/db/btree/FreeBSD/bt_seq.c.patch +++ /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; diff --git a/db/btree/FreeBSD/bt_split.c b/db/btree/FreeBSD/bt_split.c index 2f34975..3e93e20 100644 --- a/db/btree/FreeBSD/bt_split.c +++ b/db/btree/FreeBSD/bt_split.c @@ -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 index a180794..0000000 --- a/db/btree/FreeBSD/bt_split.c.patch +++ /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; diff --git a/db/btree/FreeBSD/btree.h b/db/btree/FreeBSD/btree.h index 02001b3..c7c1f0f 100644 --- a/db/btree/FreeBSD/btree.h +++ b/db/btree/FreeBSD/btree.h @@ -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 index ee96ee7..0000000 --- a/db/btree/FreeBSD/btree.h.patch +++ /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/Makefile.inc b/db/btree/Makefile.inc deleted file mode 100644 index adcfc03..0000000 --- a/db/btree/Makefile.inc +++ /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 index 445d433..0000000 --- a/db/btree/bt_close-fbsd.c +++ /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 index 4ecb6ae..0000000 --- a/db/btree/bt_conv-fbsd.c +++ /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 index e240289..0000000 --- a/db/btree/bt_delete-fbsd.c +++ /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 index 70017bf..0000000 --- a/db/btree/bt_extern.h +++ /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 index fb8f834..0000000 --- a/db/btree/bt_get-fbsd.c +++ /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 index 628e50e..0000000 --- a/db/btree/bt_open-fbsd.c +++ /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 index 25e3000..0000000 --- a/db/btree/bt_overflow-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_overflow.c,v 1.6 2009/03/05 00:57:01 delphij Exp $"); - -#include - -#include -#include -#include - -#include -#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 index f41e3f7..0000000 --- a/db/btree/bt_page-fbsd.c +++ /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 index 0ac099f..0000000 --- a/db/btree/bt_put-fbsd.c +++ /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 index 06a108b..0000000 --- a/db/btree/bt_search-fbsd.c +++ /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 index b0b8b04..0000000 --- a/db/btree/bt_seq-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_seq.c,v 1.7 2009/03/04 00:58:04 delphij Exp $"); - -#include - -#include -#include -#include -#include - -#include -#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 index 3e93e20..0000000 --- a/db/btree/bt_split-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/btree/bt_split.c,v 1.12 2009/03/28 05:45:29 delphij Exp $"); - -#include - -#include -#include -#include -#include - -#include -#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 index aa281da..0000000 --- a/db/btree/bt_utils-fbsd.c +++ /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 index c7c1f0f..0000000 --- a/db/btree/btree.h +++ /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 - -#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 index c5739d4..0000000 --- a/db/db/Makefile.inc +++ /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 index 0f977fb..0000000 --- a/db/db/db-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./db.c \ No newline at end of file diff --git a/db/hash/FreeBSD/hash.c b/db/hash/FreeBSD/hash.c index 8e41d8f..8c9a0c4 100644 --- a/db/hash/FreeBSD/hash.c +++ b/db/hash/FreeBSD/hash.c @@ -54,7 +54,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delph #include #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 index 9533941..0000000 --- a/db/hash/FreeBSD/hash.c.patch +++ /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 - #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); diff --git a/db/hash/FreeBSD/hash.h b/db/hash/FreeBSD/hash.h index f8ea5ca..e4f77c2 100644 --- a/db/hash/FreeBSD/hash.h +++ b/db/hash/FreeBSD/hash.h @@ -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 index efe6e7d..0000000 --- a/db/hash/FreeBSD/hash.h.patch +++ /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; - - /* diff --git a/db/hash/FreeBSD/hash_bigkey.c b/db/hash/FreeBSD/hash_bigkey.c index de8180e..d325105 100644 --- a/db/hash/FreeBSD/hash_bigkey.c +++ b/db/hash/FreeBSD/hash_bigkey.c @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_bigkey.c,v 1.10 2009/03/28 06:47:0 #include #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 index 54a30d8..0000000 --- a/db/hash/FreeBSD/hash_bigkey.c.patch +++ /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 - #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_buf.c b/db/hash/FreeBSD/hash_buf.c index 62117c9..e19beda 100644 --- a/db/hash/FreeBSD/hash_buf.c +++ b/db/hash/FreeBSD/hash_buf.c @@ -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 #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 index 11e5799..0000000 --- a/db/hash/FreeBSD/hash_buf.c.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- hash_buf.c (revision 61187) -+++ hash_buf.c (working copy) -@@ -66,7 +66,7 @@ - #include - #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/extern.h b/db/hash/FreeBSD/hash_extern.h similarity index 100% rename from db/hash/FreeBSD/extern.h rename to db/hash/FreeBSD/hash_extern.h diff --git a/db/hash/FreeBSD/hash_func.c b/db/hash/FreeBSD/hash_func.c index 88d21f7..a402e49 100644 --- a/db/hash/FreeBSD/hash_func.c +++ b/db/hash/FreeBSD/hash_func.c @@ -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 #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 index db68d77..0000000 --- a/db/hash/FreeBSD/hash_func.c.patch +++ /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 - #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_log2.c b/db/hash/FreeBSD/hash_log2.c index 6f8b522..56714a1 100644 --- a/db/hash/FreeBSD/hash_log2.c +++ b/db/hash/FreeBSD/hash_log2.c @@ -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 #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 index 056340a..0000000 --- a/db/hash/FreeBSD/hash_log2.c.patch +++ /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 - #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_page.c b/db/hash/FreeBSD/hash_page.c index 1f44bde..809a3b9 100644 --- a/db/hash/FreeBSD/hash_page.c +++ b/db/hash/FreeBSD/hash_page.c @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_page.c,v 1.16 2009/03/28 06:30:43 #include #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 index 904c9a0..0000000 --- a/db/hash/FreeBSD/hash_page.c.patch +++ /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 - #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); - } - diff --git a/db/hash/FreeBSD/ndbm.c b/db/hash/FreeBSD/ndbm.c index 8c23b79..c589af8 100644 --- a/db/hash/FreeBSD/ndbm.c +++ b/db/hash/FreeBSD/ndbm.c @@ -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 #include +#include +#define _DBM +typedef DB DBM; #include #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 index 6292cd6..0000000 --- a/db/hash/FreeBSD/ndbm.c.patch +++ /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 - #include - -+#include -+#define _DBM -+typedef DB DBM; - #include - #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 index 7efd016..0000000 --- a/db/hash/Makefile.inc +++ /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 index 8c9a0c4..0000000 --- a/db/hash/hash-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delphij Exp $"); - -#include "namespace.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef DEBUG -#include -#endif -#include "un-namespace.h" - -#include -#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 index 8e41d8f..0000000 --- a/db/hash/hash-fbsd.c.orig +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash.c,v 1.21 2009/03/28 07:20:39 delphij Exp $"); - -#include "namespace.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#ifdef DEBUG -#include -#endif -#include "un-namespace.h" - -#include -#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 index e4f77c2..0000000 --- a/db/hash/hash.h +++ /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 - * - * 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 index d325105..0000000 --- a/db/hash/hash_bigkey-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include - -#ifdef DEBUG -#include -#endif - -#include -#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 index e19beda..0000000 --- a/db/hash/hash_buf-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include - -#ifdef DEBUG -#include -#endif - -#include -#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 index 70017bf..0000000 --- a/db/hash/hash_extern.h +++ /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 index a402e49..0000000 --- a/db/hash/hash_func-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_func.c,v 1.6 2007/01/09 00:27:50 imp Exp $"); - -#include - -#include -#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 index 56714a1..0000000 --- a/db/hash/hash_log2-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/hash/hash_log2.c,v 1.5 2009/03/28 05:45:29 delphij Exp $"); - -#include -#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 index 809a3b9..0000000 --- a/db/hash/hash_page-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include -#include -#include -#include -#ifdef DEBUG -#include -#endif -#include "un-namespace.h" - -#include -#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 index c589af8..0000000 --- a/db/hash/ndbm-fbsd.c +++ /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 -__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 - -#include -#include -#include - -#include -#define _DBM -typedef DB DBM; -#include -#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 index 0fb054f..0000000 --- a/db/hash/page.h +++ /dev/null @@ -1 +0,0 @@ -./page.h \ No newline at end of file diff --git a/db/man/FreeBSD/dbm.3 b/db/man/FreeBSD/dbm.3 index e04bc20..6258f1c 100644 --- a/db/man/FreeBSD/dbm.3 +++ b/db/man/FreeBSD/dbm.3 @@ -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 +.Fd #include +.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 index c0f8688..0000000 --- a/db/man/FreeBSD/dbm.3.patch +++ /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 -+.Fd #include -+.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 index 86b03ff..0000000 --- a/db/man/Makefile.inc +++ /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 index caa7263..0000000 --- a/db/man/btree.3 +++ /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 index 6258f1c..0000000 --- a/db/man/dbm.3 +++ /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 -.Fd #include -.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 index 25b88f0..0000000 --- a/db/man/dbopen.3 +++ /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 index 4158259..0000000 --- a/db/man/hash.3 +++ /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 index b15f332..0000000 --- a/db/man/mpool.3 +++ /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 index 346f3e2..0000000 --- a/db/man/recno.3 +++ /dev/null @@ -1 +0,0 @@ -./recno.3 \ No newline at end of file diff --git a/db/mpool/FreeBSD/mpool.c b/db/mpool/FreeBSD/mpool.c index 6938194..36fb30b 100644 --- a/db/mpool/FreeBSD/mpool.c +++ b/db/mpool/FreeBSD/mpool.c @@ -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 index 2193284..0000000 --- a/db/mpool/FreeBSD/mpool.c.patch +++ /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 index 9b5775e..0000000 --- a/db/mpool/Makefile.inc +++ /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 index 36fb30b..0000000 --- a/db/mpool/mpool-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/db/mpool/mpool.c,v 1.16 2009/03/28 04:00:46 delphij Exp $"); - -#include "namespace.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#include - -#define __MPOOLINTERFACE_PRIVATE -#include - -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 index ad00805..0000000 --- a/db/recno/FreeBSD/extern.h +++ /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 index e5ff9e2..0000000 --- a/db/recno/FreeBSD/extern.h.patch +++ /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/rec_extern.h b/db/recno/FreeBSD/rec_extern.h similarity index 98% rename from db/recno/rec_extern.h rename to db/recno/FreeBSD/rec_extern.h index 179a612..514170c 100644 --- a/db/recno/rec_extern.h +++ b/db/recno/FreeBSD/rec_extern.h @@ -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/bt_extern.h" +#include "../../btree/FreeBSD/bt_extern.h" int __rec_close(DB *); int __rec_delete(const DB *, const DBT *, u_int); diff --git a/db/recno/FreeBSD/recno.h b/db/recno/FreeBSD/recno.h index d5e10f0..438a56c 100644 --- a/db/recno/FreeBSD/recno.h +++ b/db/recno/FreeBSD/recno.h @@ -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 index 4b968d4..0000000 --- a/db/recno/FreeBSD/recno.h.patch +++ /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 index 04c3681..0000000 --- a/db/recno/Makefile.inc +++ /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 index 31b4ea9..0000000 --- a/db/recno/rec_close-fbsd.c +++ /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 index 99b089d..0000000 --- a/db/recno/rec_delete-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./rec_delete.c \ No newline at end of file diff --git a/db/recno/rec_get-fbsd.c b/db/recno/rec_get-fbsd.c deleted file mode 120000 index 5d7c157..0000000 --- a/db/recno/rec_get-fbsd.c +++ /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 index 84a4acb..0000000 --- a/db/recno/rec_open-fbsd.c +++ /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 index 73a5bdc..0000000 --- a/db/recno/rec_put-fbsd.c +++ /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 index b4a722a..0000000 --- a/db/recno/rec_search-fbsd.c +++ /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 index 3274e31..0000000 --- a/db/recno/rec_seq-fbsd.c +++ /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 index eb044fb..0000000 --- a/db/recno/rec_utils-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./rec_utils.c \ No newline at end of file diff --git a/emulated/Makefile.inc b/emulated/Makefile.inc deleted file mode 100644 index 1d8399b..0000000 --- a/emulated/Makefile.inc +++ /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 diff --git a/fbsdcompat/_fpmath.h b/fbsdcompat/_fpmath.h index cf40a68..fcd5aa3 100644 --- a/fbsdcompat/_fpmath.h +++ b/fbsdcompat/_fpmath.h @@ -48,34 +48,7 @@ * $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; diff --git a/fbsdcompat/sys/cdefs.h b/fbsdcompat/sys/cdefs.h index b80b990..a56be2c 100644 --- a/fbsdcompat/sys/cdefs.h +++ b/fbsdcompat/sys/cdefs.h @@ -53,19 +53,12 @@ #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 @@ -75,62 +68,10 @@ */ #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 @@ -140,22 +81,6 @@ #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 index 009f6d9..0000000 --- a/fixdups.ed +++ /dev/null @@ -1,2 +0,0 @@ -//;.+1,$g//d -w diff --git a/gdtoa/FreeBSD/_hdtoa.c b/gdtoa/FreeBSD/_hdtoa.c index 77e99ac..10d4ab5 100644 --- a/gdtoa/FreeBSD/_hdtoa.c +++ b/gdtoa/FreeBSD/_hdtoa.c @@ -25,7 +25,7 @@ */ #include -__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 #include @@ -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 index 69173cd..0000000 --- a/gdtoa/FreeBSD/_hdtoa.c.patch +++ /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 */ diff --git a/gdtoa/FreeBSD/_ldtoa.c b/gdtoa/FreeBSD/_ldtoa.c index ededc68..903ce10 100644 --- a/gdtoa/FreeBSD/_ldtoa.c +++ b/gdtoa/FreeBSD/_ldtoa.c @@ -25,7 +25,7 @@ */ #include -__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 #include @@ -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 index 3e57e86..0000000 --- a/gdtoa/FreeBSD/_ldtoa.c.patch +++ /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; - } diff --git a/gdtoa/FreeBSD/gdtoa-gethex.c b/gdtoa/FreeBSD/gdtoa-gethex.c index a9982c9..855726a 100644 --- a/gdtoa/FreeBSD/gdtoa-gethex.c +++ b/gdtoa/FreeBSD/gdtoa-gethex.c @@ -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 + #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 index 655851b..0000000 --- a/gdtoa/FreeBSD/gdtoa-gethex.c.patch +++ /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 -+ - #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++; diff --git a/gdtoa/FreeBSD/gdtoa-hexnan.c b/gdtoa/FreeBSD/gdtoa-hexnan.c index a443721..bc1b4bd 100644 --- a/gdtoa/FreeBSD/gdtoa-hexnan.c +++ b/gdtoa/FreeBSD/gdtoa-hexnan.c @@ -30,7 +30,9 @@ THIS SOFTWARE. * with " at " changed at "@" and " dot " changed to "."). */ #include "gdtoaimp.h" +#include +#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 index ac98f17..0000000 --- a/gdtoa/FreeBSD/gdtoa-hexnan.c.patch +++ /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 - -+#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; - } diff --git a/gdtoa/FreeBSD/gdtoa-misc.c b/gdtoa/FreeBSD/gdtoa-misc.c index e5f7b04..84fe199 100644 --- a/gdtoa/FreeBSD/gdtoa-misc.c +++ b/gdtoa/FreeBSD/gdtoa-misc.c @@ -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 +#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 index ec8c295..0000000 --- a/gdtoa/FreeBSD/gdtoa-misc.c.patch +++ /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 -+#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-strtod.c b/gdtoa/FreeBSD/gdtoa-strtod.c index fdc933a..3186f25 100644 --- a/gdtoa/FreeBSD/gdtoa-strtod.c +++ b/gdtoa/FreeBSD/gdtoa-strtod.c @@ -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 @@ -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 index 9134046..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtod.c.patch +++ /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 -@@ -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()); -+} diff --git a/gdtoa/FreeBSD/gdtoa-strtodg.c b/gdtoa/FreeBSD/gdtoa-strtodg.c index 5059869..e1acc54 100644 --- a/gdtoa/FreeBSD/gdtoa-strtodg.c +++ b/gdtoa/FreeBSD/gdtoa-strtodg.c @@ -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 index 4c233cd..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtodg.c.patch +++ /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; - } diff --git a/gdtoa/FreeBSD/gdtoa-strtof.c b/gdtoa/FreeBSD/gdtoa-strtof.c index a8beb35..fc29f59 100644 --- a/gdtoa/FreeBSD/gdtoa-strtof.c +++ b/gdtoa/FreeBSD/gdtoa-strtof.c @@ -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 index 6e31620..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtof.c.patch +++ /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()); -+} diff --git a/gdtoa/FreeBSD/gdtoa-strtopdd.c b/gdtoa/FreeBSD/gdtoa-strtopdd.c index 738372d..2695746 100644 --- a/gdtoa/FreeBSD/gdtoa-strtopdd.c +++ b/gdtoa/FreeBSD/gdtoa-strtopdd.c @@ -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 index 63a7ee2..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtopdd.c.patch +++ /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; - } diff --git a/gdtoa/FreeBSD/gdtoa-strtopx.c b/gdtoa/FreeBSD/gdtoa-strtopx.c index f7a25ff..b8e8a34 100644 --- a/gdtoa/FreeBSD/gdtoa-strtopx.c +++ b/gdtoa/FreeBSD/gdtoa-strtopx.c @@ -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 index d251fb4..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtopx.c.patch +++ /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; diff --git a/gdtoa/FreeBSD/gdtoa-strtord.c b/gdtoa/FreeBSD/gdtoa-strtord.c index 709af4c..2500488 100644 --- a/gdtoa/FreeBSD/gdtoa-strtord.c +++ b/gdtoa/FreeBSD/gdtoa-strtord.c @@ -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 index 6ac0191..0000000 --- a/gdtoa/FreeBSD/gdtoa-strtord.c.patch +++ /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; -- } diff --git a/gdtoa/FreeBSD/gdtoa.h b/gdtoa/FreeBSD/gdtoa.h index e59ebf6..8bdcd4d 100644 --- a/gdtoa/FreeBSD/gdtoa.h +++ b/gdtoa/FreeBSD/gdtoa.h @@ -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 index 5db0731..0000000 --- a/gdtoa/FreeBSD/gdtoa.h.patch +++ /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) diff --git a/gdtoa/FreeBSD/gdtoaimp.h b/gdtoa/FreeBSD/gdtoaimp.h index 2c188d6..39012aa 100644 --- a/gdtoa/FreeBSD/gdtoaimp.h +++ b/gdtoa/FreeBSD/gdtoaimp.h @@ -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 #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 index 3d10bf4..0000000 --- a/gdtoa/FreeBSD/gdtoaimp.h.patch +++ /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 - #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 */ diff --git a/gdtoa/FreeBSD/machdep_ldisd.c b/gdtoa/FreeBSD/machdep_ldisd.c index 2e20e17..f674ebc 100644 --- a/gdtoa/FreeBSD/machdep_ldisd.c +++ b/gdtoa/FreeBSD/machdep_ldisd.c @@ -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 index e6605cd..0000000 --- a/gdtoa/FreeBSD/machdep_ldisd.c.patch +++ /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); -+} -+ diff --git a/gdtoa/FreeBSD/machdep_ldisdd.c b/gdtoa/FreeBSD/machdep_ldisdd.c index 8da0144..a07a21b 100644 --- a/gdtoa/FreeBSD/machdep_ldisdd.c +++ b/gdtoa/FreeBSD/machdep_ldisdd.c @@ -32,6 +32,8 @@ #include +#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 index ead0850..0000000 --- a/gdtoa/FreeBSD/machdep_ldisdd.c.patch +++ /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 - -+#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 */ - } diff --git a/gdtoa/FreeBSD/machdep_ldisx.c b/gdtoa/FreeBSD/machdep_ldisx.c index 0ceea1b..64b14d4 100644 --- a/gdtoa/FreeBSD/machdep_ldisx.c +++ b/gdtoa/FreeBSD/machdep_ldisx.c @@ -33,6 +33,8 @@ #include __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 index d2d5eb2..0000000 --- a/gdtoa/FreeBSD/machdep_ldisx.c.patch +++ /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 - __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 index 9941267..0000000 --- a/gdtoa/Makefile.inc +++ /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 index 04a2888..0000000 --- a/gdtoa/_hdtoa-fbsd.c +++ /dev/null @@ -1,344 +0,0 @@ -/*- - * Copyright (c) 2004, 2005 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_hdtoa.c,v 1.3 2005/01/18 18:44:07 das Exp $"); - -#include -#include -#include -#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 index 72f2b7f..0000000 --- a/gdtoa/_ldtoa-fbsd.c +++ /dev/null @@ -1,140 +0,0 @@ -/*- - * Copyright (c) 2003 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/gdtoa/_ldtoa.c,v 1.2 2004/01/18 07:53:49 das Exp $"); - -#include -#include -#include -#include -#include -#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; -} diff --git a/gdtoa/arith.h b/gdtoa/arith.h index 688a121..f60614a 100644 --- a/gdtoa/arith.h +++ b/gdtoa/arith.h @@ -25,28 +25,23 @@ * 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 diff --git a/gdtoa/gd_qnan.h b/gdtoa/gd_qnan.h index dd5d787..601fff6 100644 --- a/gdtoa/gd_qnan.h +++ b/gdtoa/gd_qnan.h @@ -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 index 5d57ae1..0000000 --- a/gdtoa/gdtoa-dmisc-fbsd.c +++ /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 index 82ff421..0000000 --- a/gdtoa/gdtoa-dtoa-fbsd.c +++ /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 index ac880d6..0000000 --- a/gdtoa/gdtoa-gdtoa-fbsd.c +++ /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 index 855726a..0000000 --- a/gdtoa/gdtoa-gethex-fbsd.c +++ /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 - -#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 index d7a4165..0000000 --- a/gdtoa/gdtoa-gmisc-fbsd.c +++ /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 index 795e2b0..0000000 --- a/gdtoa/gdtoa-hd_init-fbsd.c +++ /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 index 2e0089e..0000000 --- a/gdtoa/gdtoa-hexnan-fbsd.c +++ /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 - -#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 index 84fe199..0000000 --- a/gdtoa/gdtoa-misc-fbsd.c +++ /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 -#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 index e467f82..0000000 --- a/gdtoa/gdtoa-smisc-fbsd.c +++ /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 index 3186f25..0000000 --- a/gdtoa/gdtoa-strtod-fbsd.c +++ /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 -#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 index e1acc54..0000000 --- a/gdtoa/gdtoa-strtodg-fbsd.c +++ /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 index fc29f59..0000000 --- a/gdtoa/gdtoa-strtof-fbsd.c +++ /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 index 2695746..0000000 --- a/gdtoa/gdtoa-strtopdd-fbsd.c +++ /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 index b8e8a34..0000000 --- a/gdtoa/gdtoa-strtopx-fbsd.c +++ /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 index 2500488..0000000 --- a/gdtoa/gdtoa-strtord-fbsd.c +++ /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 index d7692e4..0000000 --- a/gdtoa/gdtoa-sum-fbsd.c +++ /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 index 5e1ddd4..0000000 --- a/gdtoa/gdtoa-ulp-fbsd.c +++ /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 index 8bdcd4d..0000000 --- a/gdtoa/gdtoa.h +++ /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 /* 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 index de739da..0000000 --- a/gdtoa/gdtoa_fltrnds.h +++ /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 index 39012aa..0000000 --- a/gdtoa/gdtoaimp.h +++ /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 -#include "gdtoa.h" -#include "gd_qnan.h" -#ifdef Honor_FLT_ROUNDS -#include -#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 index 1f7982a..0000000 --- a/gdtoa/glue-fbsd.c +++ /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 index f674ebc..0000000 --- a/gdtoa/machdep_ldisd-fbsd.c +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2003 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 index 130559a..0000000 --- a/gdtoa/machdep_ldisdd-fbsd.c +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 2003 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 - -#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 index 64b14d4..0000000 --- a/gdtoa/machdep_ldisx-fbsd.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2003 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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; -} diff --git a/gen/FreeBSD/_rand48.c b/gen/FreeBSD/_rand48.c index 4dbf0d7..da4d69e 100644 --- a/gen/FreeBSD/_rand48.c +++ b/gen/FreeBSD/_rand48.c @@ -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 index 893fa6b..0000000 --- a/gen/FreeBSD/_rand48.c.patch +++ /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; diff --git a/gen/FreeBSD/alarm.3 b/gen/FreeBSD/alarm.3 index 0139e0c..9826ce1 100644 --- a/gen/FreeBSD/alarm.3 +++ b/gen/FreeBSD/alarm.3 @@ -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 index 2678eea..0000000 --- a/gen/FreeBSD/alarm.3.patch +++ /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 index e69de29..0000000 diff --git a/gen/FreeBSD/assert.c b/gen/FreeBSD/assert.c index 3e380c3..2e1c0b1 100644 --- a/gen/FreeBSD/assert.c +++ b/gen/FreeBSD/assert.c @@ -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 -#include #include +#include +#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 index 4297577..0000000 --- a/gen/FreeBSD/assert.c.patch +++ /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 --#include - #include -+#include -+#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/basename.3 b/gen/FreeBSD/basename.3 index d8dfd75..a9300b3 100644 --- a/gen/FreeBSD/basename.3 +++ b/gen/FreeBSD/basename.3 @@ -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 +.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 index e365028..0000000 --- a/gen/FreeBSD/basename.3.patch +++ /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 -+.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.c b/gen/FreeBSD/basename.c index c5da463..3de44fb 100644 --- a/gen/FreeBSD/basename.c +++ b/gen/FreeBSD/basename.c @@ -39,6 +39,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel #include #include +#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 index 6b39a01..0000000 --- a/gen/FreeBSD/basename.c.patch +++ /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 - #include - -+#if __DARWIN_UNIX03 -+#define const /**/ -+#endif -+ - char * - basename(path) - const char *path; diff --git a/gen/FreeBSD/closedir.c b/gen/FreeBSD/closedir.c index e268572..10bfe5e 100644 --- a/gen/FreeBSD/closedir.c +++ b/gen/FreeBSD/closedir.c @@ -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 index 2c46432..0000000 --- a/gen/FreeBSD/closedir.c.patch +++ /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; diff --git a/gen/FreeBSD/ctermid.3 b/gen/FreeBSD/ctermid.3 index dfc28c3..2085245 100644 --- a/gen/FreeBSD/ctermid.3 +++ b/gen/FreeBSD/ctermid.3 @@ -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, diff --git a/gen/FreeBSD/ctermid.3.patch b/gen/FreeBSD/ctermid.3.patch deleted file mode 100644 index 8f3f177..0000000 --- a/gen/FreeBSD/ctermid.3.patch +++ /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, diff --git a/gen/FreeBSD/daemon.3 b/gen/FreeBSD/daemon.3 index 4d0b5b7..a2d9f2b 100644 --- a/gen/FreeBSD/daemon.3 +++ b/gen/FreeBSD/daemon.3 @@ -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 index afe6ae2..0000000 --- a/gen/FreeBSD/daemon.3.patch +++ /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 diff --git a/gen/FreeBSD/daemon.c b/gen/FreeBSD/daemon.c index 451bcb8..ea9a15f 100644 --- a/gen/FreeBSD/daemon.c +++ b/gen/FreeBSD/daemon.c @@ -33,6 +33,10 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $"); +#ifndef VARIANT_PRE1050 +#include +#include +#endif /* !VARIANT_PRE1050 */ #include "namespace.h" #include #include @@ -42,6 +46,33 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp #include #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 index 2a5cb49..0000000 --- a/gen/FreeBSD/daemon.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $"); - -+#ifndef VARIANT_PRE1050 -+#include -+#include -+#endif /* !VARIANT_PRE1050 */ - #include "namespace.h" - #include - #include -@@ -42,6 +46,33 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dae - #include - #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/dirname.3 b/gen/FreeBSD/dirname.3 index 43a1853..330b426 100644 --- a/gen/FreeBSD/dirname.3 +++ b/gen/FreeBSD/dirname.3 @@ -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 +.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 index 9fb8483..0000000 --- a/gen/FreeBSD/dirname.3.patch +++ /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 -+.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 diff --git a/gen/FreeBSD/dirname.c b/gen/FreeBSD/dirname.c index 551d068..5164e18 100644 --- a/gen/FreeBSD/dirname.c +++ b/gen/FreeBSD/dirname.c @@ -25,6 +25,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.8 2008/11/03 05:19:45 delphij #include #include +#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 index b4e5b77..0000000 --- a/gen/FreeBSD/dirname.c.patch +++ /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 - #include - -+#if __DARWIN_UNIX03 -+#define const /**/ -+#endif -+ - char * - dirname(const char *path) - { diff --git a/gen/FreeBSD/drand48.c b/gen/FreeBSD/drand48.c index 92aeb80..52e9693 100644 --- a/gen/FreeBSD/drand48.c +++ b/gen/FreeBSD/drand48.c @@ -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 index ce1dfeb..0000000 --- a/gen/FreeBSD/drand48.c.patch +++ /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); - } diff --git a/gen/FreeBSD/erand48.c b/gen/FreeBSD/erand48.c index 4b0c1df..9887547 100644 --- a/gen/FreeBSD/erand48.c +++ b/gen/FreeBSD/erand48.c @@ -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 index 8abfe80..0000000 --- a/gen/FreeBSD/erand48.c.patch +++ /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); - } diff --git a/gen/FreeBSD/err.3 b/gen/FreeBSD/err.3 index 4243e84..a4c953f 100644 --- a/gen/FreeBSD/err.3 +++ b/gen/FreeBSD/err.3 @@ -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 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 index d62bfe7..0000000 --- a/gen/FreeBSD/err.3.patch +++ /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 diff --git a/gen/FreeBSD/err.c b/gen/FreeBSD/err.c index 196c90c..e6e03f6 100644 --- a/gen/FreeBSD/err.c +++ b/gen/FreeBSD/err.c @@ -40,12 +40,107 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $" #include #include #include +#include #include "un-namespace.h" +#ifdef __BLOCKS__ +#include +#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 index d2e3159..0000000 --- a/gen/FreeBSD/err.c.patch +++ /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 - #include - #include -+#include - #include "un-namespace.h" - -+#ifdef __BLOCKS__ -+#include -+#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/exec.3 b/gen/FreeBSD/exec.3 index bf5164e..2f49ef3 100644 --- a/gen/FreeBSD/exec.3 +++ b/gen/FreeBSD/exec.3 @@ -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 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 index 7a46542..0000000 --- a/gen/FreeBSD/exec.3.patch +++ /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 diff --git a/gen/FreeBSD/exec.c b/gen/FreeBSD/exec.c index 811b425..86cf335 100644 --- a/gen/FreeBSD/exec.c +++ b/gen/FreeBSD/exec.c @@ -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 +#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 index e1303a4..0000000 --- a/gen/FreeBSD/exec.c.patch +++ /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 -+#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; diff --git a/gen/FreeBSD/fmtmsg.c b/gen/FreeBSD/fmtmsg.c index f40efb6..e912693 100644 --- a/gen/FreeBSD/fmtmsg.c +++ b/gen/FreeBSD/fmtmsg.c @@ -31,6 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/fmtmsg.c,v 1.6 2009/11/08 14:02:54 brueffer #include #include #include +#include +#include /* 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 index 6bbcea4..0000000 --- a/gen/FreeBSD/fmtmsg.c.patch +++ /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 - #include - #include -+#include -+#include - - /* 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 \ diff --git a/gen/FreeBSD/fnmatch.3 b/gen/FreeBSD/fnmatch.3 index 0ff709b..f3aa885 100644 --- a/gen/FreeBSD/fnmatch.3 +++ b/gen/FreeBSD/fnmatch.3 @@ -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 index 0a45f2b..0000000 --- a/gen/FreeBSD/fnmatch.3.patch +++ /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 diff --git a/gen/FreeBSD/fnmatch.c b/gen/FreeBSD/fnmatch.c index 0799e34..51a1f97 100644 --- a/gen/FreeBSD/fnmatch.c +++ b/gen/FreeBSD/fnmatch.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; #include __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 index b45f0ea..0000000 --- a/gen/FreeBSD/fnmatch.c.patch +++ /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 - __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 */ diff --git a/gen/FreeBSD/ftok.3 b/gen/FreeBSD/ftok.3 index e904beb..88a3a23 100644 --- a/gen/FreeBSD/ftok.3 +++ b/gen/FreeBSD/ftok.3 @@ -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 +.Fd #include +.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 index 2b3cdf2..0000000 --- a/gen/FreeBSD/ftok.3.patch +++ /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 -+.Fd #include -+.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/getcap.c b/gen/FreeBSD/getcap.c index 649a9f4..ea8425f 100644 --- a/gen/FreeBSD/getcap.c +++ b/gen/FreeBSD/getcap.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; #include __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 @@ -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 index d400e40..0000000 --- a/gen/FreeBSD/getcap.c.patch +++ /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 - __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 - -@@ -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(); - diff --git a/gen/FreeBSD/getcwd.c b/gen/FreeBSD/getcwd.c index d06210b..512b88c 100644 --- a/gen/FreeBSD/getcwd.c +++ b/gen/FreeBSD/getcwd.c @@ -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 index bd22ed8..0000000 --- a/gen/FreeBSD/getcwd.c.patch +++ /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); -+} diff --git a/gen/FreeBSD/gethostname.3 b/gen/FreeBSD/gethostname.3 index d48103b..eed2346 100644 --- a/gen/FreeBSD/gethostname.3 +++ b/gen/FreeBSD/gethostname.3 @@ -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 index e114453..0000000 --- a/gen/FreeBSD/gethostname.3.patch +++ /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 diff --git a/gen/FreeBSD/gethostname.c b/gen/FreeBSD/gethostname.c index 65af716..031e2c8 100644 --- a/gen/FreeBSD/gethostname.c +++ b/gen/FreeBSD/gethostname.c @@ -33,8 +33,10 @@ static char sccsid[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $"); +#include #include #include +#include #include #include @@ -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 index 803bd60..0000000 --- a/gen/FreeBSD/gethostname.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $"); - -+#include - #include - #include -+#include - - #include - #include -@@ -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/getlogin.c b/gen/FreeBSD/getlogin.c index 823d520..f60de8d 100644 --- a/gen/FreeBSD/getlogin.c +++ b/gen/FreeBSD/getlogin.c @@ -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 index 3e8de44..0000000 --- a/gen/FreeBSD/getlogin.c.patch +++ /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; diff --git a/gen/FreeBSD/getmntinfo.3 b/gen/FreeBSD/getmntinfo.3 index e5b6f17..0c8283b 100644 --- a/gen/FreeBSD/getmntinfo.3 +++ b/gen/FreeBSD/getmntinfo.3 @@ -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/getmntinfo.3.patch b/gen/FreeBSD/getmntinfo.3.patch deleted file mode 100644 index 2a3e504..0000000 --- a/gen/FreeBSD/getmntinfo.3.patch +++ /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/getmntinfo64-fbsd.c b/gen/FreeBSD/getmntinfo64.c similarity index 100% rename from gen/getmntinfo64-fbsd.c rename to gen/FreeBSD/getmntinfo64.c diff --git a/gen/FreeBSD/getmntinfo64.c.patch b/gen/FreeBSD/getmntinfo64.c.patch deleted file mode 100644 index 4663c82..0000000 --- a/gen/FreeBSD/getmntinfo64.c.patch +++ /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; diff --git a/gen/FreeBSD/getprogname.3 b/gen/FreeBSD/getprogname.3 index 5ea703e..b7b9c99 100644 --- a/gen/FreeBSD/getprogname.3 +++ b/gen/FreeBSD/getprogname.3 @@ -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 index a3fff66..0000000 --- a/gen/FreeBSD/getprogname.3.patch +++ /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 , diff --git a/gen/FreeBSD/getprogname.c b/gen/FreeBSD/getprogname.c index 4be82e3..a736f65 100644 --- a/gen/FreeBSD/getprogname.c +++ b/gen/FreeBSD/getprogname.c @@ -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 +#include +#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 index 274026c..0000000 --- a/gen/FreeBSD/getprogname.c.patch +++ /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 -+#include -+#define __progname (*_NSGetProgname()) - #include "un-namespace.h" - - #include "libc_private.h" diff --git a/gen/FreeBSD/glob.3 b/gen/FreeBSD/glob.3 index 4473427..a71c96b 100644 --- a/gen/FreeBSD/glob.3 +++ b/gen/FreeBSD/glob.3 @@ -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 @@ 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 index d0099be..0000000 --- a/gen/FreeBSD/glob.3.patch +++ /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 , diff --git a/gen/FreeBSD/glob.c b/gen/FreeBSD/glob.c index a289d90..e519cc6 100644 --- a/gen/FreeBSD/glob.c +++ b/gen/FreeBSD/glob.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; #include __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 index 9a05ae4..0000000 --- a/gen/FreeBSD/glob.c.patch +++ /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 - __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 */ diff --git a/gen/FreeBSD/isatty.c b/gen/FreeBSD/isatty.c index e6153ac..54a0fa0 100644 --- a/gen/FreeBSD/isatty.c +++ b/gen/FreeBSD/isatty.c @@ -35,14 +35,22 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.6 2007/01/09 00:27:54 imp Exp #include #include +#include +#include +#include +#include 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 index aba10e1..0000000 --- a/gen/FreeBSD/isatty.c.patch +++ /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 - #include -+#include -+#include -+#include -+#include - - 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/jrand48.c b/gen/FreeBSD/jrand48.c index f47bf2a..40d6a6f 100644 --- a/gen/FreeBSD/jrand48.c +++ b/gen/FreeBSD/jrand48.c @@ -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 index bb0ec7c..0000000 --- a/gen/FreeBSD/jrand48.c.patch +++ /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); - } diff --git a/gen/FreeBSD/lcong48.c b/gen/FreeBSD/lcong48.c index 8b11e08..8a13d64 100644 --- a/gen/FreeBSD/lcong48.c +++ b/gen/FreeBSD/lcong48.c @@ -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 index 91ad712..0000000 --- a/gen/FreeBSD/lcong48.c.patch +++ /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]; - } diff --git a/gen/FreeBSD/lockf.3 b/gen/FreeBSD/lockf.3 index cad5fa7..fc48307 100644 --- a/gen/FreeBSD/lockf.3 +++ b/gen/FreeBSD/lockf.3 @@ -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 index 51a735f..0000000 --- a/gen/FreeBSD/lockf.3.patch +++ /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 , diff --git a/gen/FreeBSD/lockf.c b/gen/FreeBSD/lockf.c index 3581270..bc8de89 100644 --- a/gen/FreeBSD/lockf.c +++ b/gen/FreeBSD/lockf.c @@ -31,6 +31,13 @@ #include __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 #include @@ -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 index ff083eb..0000000 --- a/gen/FreeBSD/lockf.c.patch +++ /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 - __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 - #include -@@ -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 */ - } -+ diff --git a/gen/FreeBSD/lrand48.c b/gen/FreeBSD/lrand48.c index 948b923..3b01e85 100644 --- a/gen/FreeBSD/lrand48.c +++ b/gen/FreeBSD/lrand48.c @@ -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 index 90798d9..0000000 --- a/gen/FreeBSD/lrand48.c.patch +++ /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; - } diff --git a/gen/FreeBSD/makecontext.3 b/gen/FreeBSD/makecontext.3 index 36e3ce8..d60038b 100644 --- a/gen/FreeBSD/makecontext.3 +++ b/gen/FreeBSD/makecontext.3 @@ -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 index 40520a8..0000000 --- a/gen/FreeBSD/makecontext.3.patch +++ /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 diff --git a/gen/FreeBSD/mrand48.c b/gen/FreeBSD/mrand48.c index f65ed77..5453ceb 100644 --- a/gen/FreeBSD/mrand48.c +++ b/gen/FreeBSD/mrand48.c @@ -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 index 23149dd..0000000 --- a/gen/FreeBSD/mrand48.c.patch +++ /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); - } diff --git a/gen/FreeBSD/nice.c b/gen/FreeBSD/nice.c index f24d12d..962eee1 100644 --- a/gen/FreeBSD/nice.c +++ b/gen/FreeBSD/nice.c @@ -38,7 +38,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.4 2007/01/09 00:27:54 imp Exp $" #include #include #include - +#if __DARWIN_UNIX03 +#include +#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 index f1a3fec..0000000 --- a/gen/FreeBSD/nice.c.patch +++ /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 - #include - #include -- -+#if __DARWIN_UNIX03 -+#include -+#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/nrand48.c b/gen/FreeBSD/nrand48.c index 3a21c3f..1790b23 100644 --- a/gen/FreeBSD/nrand48.c +++ b/gen/FreeBSD/nrand48.c @@ -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 index 101d6ef..0000000 --- a/gen/FreeBSD/nrand48.c.patch +++ /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; - } diff --git a/gen/FreeBSD/opendir.c b/gen/FreeBSD/opendir.c index 1892c36..b2c49df 100644 --- a/gen/FreeBSD/opendir.c +++ b/gen/FreeBSD/opendir.c @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphi #include #include #include +#include #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 index 5453b80..0000000 --- a/gen/FreeBSD/opendir.c.patch +++ /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 - #include - #include -+#include - #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. diff --git a/gen/FreeBSD/pause.c b/gen/FreeBSD/pause.c index 6f78fe9..99576fd 100644 --- a/gen/FreeBSD/pause.c +++ b/gen/FreeBSD/pause.c @@ -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 __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 index 5b78b5e..0000000 --- a/gen/FreeBSD/pause.c.patch +++ /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 - __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); diff --git a/gen/FreeBSD/popen.3 b/gen/FreeBSD/popen.3 index 12974b7..5f4a8c6 100644 --- a/gen/FreeBSD/popen.3 +++ b/gen/FreeBSD/popen.3 @@ -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 @@ 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 index c495449..0000000 --- a/gen/FreeBSD/popen.3.patch +++ /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 diff --git a/gen/FreeBSD/popen.c b/gen/FreeBSD/popen.c index 3432686..d4aea86 100644 --- a/gen/FreeBSD/popen.c +++ b/gen/FreeBSD/popen.c @@ -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/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $ #include #include #include - +#include +#include /* fwide() */ #include #include #include @@ -49,18 +54,39 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $ #include #include #include +#include #include "un-namespace.h" #include "libc_private.h" -extern char **environ; +#include +#define environ (*_NSGetEnviron()) + +/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet + * 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 index e58f314..0000000 --- a/gen/FreeBSD/popen.c.patch +++ /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 - #include - #include -- -+#include -+#include /* fwide() */ - #include - #include - #include -@@ -49,18 +54,39 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/pop - #include - #include - #include -+#include - #include "un-namespace.h" - #include "libc_private.h" - --extern char **environ; -+#include -+#define environ (*_NSGetEnviron()) -+ -+/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet -+ * 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/pselect.3 b/gen/FreeBSD/pselect.3 index 4b12fb7..615a399 100644 --- a/gen/FreeBSD/pselect.3 +++ b/gen/FreeBSD/pselect.3 @@ -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 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 index a1099cd..0000000 --- a/gen/FreeBSD/pselect.3.patch +++ /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 diff --git a/gen/FreeBSD/pselect.c b/gen/FreeBSD/pselect.c index 13b2553..4bc62fc 100644 --- a/gen/FreeBSD/pselect.c +++ b/gen/FreeBSD/pselect.c @@ -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 __FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $"); #include "namespace.h" +#include #include #include +#include #include #include diff --git a/gen/FreeBSD/pselect.c.patch b/gen/FreeBSD/pselect.c.patch deleted file mode 100644 index 26ecf91..0000000 --- a/gen/FreeBSD/pselect.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $"); - - #include "namespace.h" -+#include - #include - #include -+#include - - #include - #include diff --git a/gen/FreeBSD/psignal.3 b/gen/FreeBSD/psignal.3 index c59d79e..84976af 100644 --- a/gen/FreeBSD/psignal.3 +++ b/gen/FreeBSD/psignal.3 @@ -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 index fd4a161..0000000 --- a/gen/FreeBSD/psignal.3.patch +++ /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 , diff --git a/gen/FreeBSD/rand48.3 b/gen/FreeBSD/rand48.3 index d67f163..6bc96d6 100644 --- a/gen/FreeBSD/rand48.3 +++ b/gen/FreeBSD/rand48.3 @@ -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 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 index 362ce14..0000000 --- a/gen/FreeBSD/rand48.3.patch +++ /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 diff --git a/gen/FreeBSD/rand48.h b/gen/FreeBSD/rand48.h index 0a3d83d..e799eba 100644 --- a/gen/FreeBSD/rand48.h +++ b/gen/FreeBSD/rand48.h @@ -19,8 +19,6 @@ #include #include -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 index 404c774..0000000 --- a/gen/FreeBSD/rand48.h.patch +++ /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 - #include - --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/readdir.c b/gen/FreeBSD/readdir.c index a78c8b1..3875cef 100644 --- a/gen/FreeBSD/readdir.c +++ b/gen/FreeBSD/readdir.c @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.15 2008/05/05 14:05:23 kib Ex #include #include #include +#include #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 index 8d7058d..0000000 --- a/gen/FreeBSD/readdir.c.patch +++ /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 - #include - #include -+#include - #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/readpassphrase.c b/gen/FreeBSD/readpassphrase.c index d100be4..45ac15f 100644 --- a/gen/FreeBSD/readpassphrase.c +++ b/gen/FreeBSD/readpassphrase.c @@ -33,6 +33,8 @@ static const char rcsid[] = "$OpenBSD: readpassphrase.c,v 1.12 2001/12/15 05:41: #include __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 #include @@ -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 index ea6527a..0000000 --- a/gen/FreeBSD/readpassphrase.c.patch +++ /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 - __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 - #include -@@ -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; - } diff --git a/gen/FreeBSD/scandir.3 b/gen/FreeBSD/scandir.3 index 507fbde..d8b81f3 100644 --- a/gen/FreeBSD/scandir.3 +++ b/gen/FreeBSD/scandir.3 @@ -28,22 +28,27 @@ .\" @(#)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 index 2152839..0000000 --- a/gen/FreeBSD/scandir.3.patch +++ /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 diff --git a/gen/FreeBSD/scandir.c b/gen/FreeBSD/scandir.c index e21bd09..814f996 100644 --- a/gen/FreeBSD/scandir.c +++ b/gen/FreeBSD/scandir.c @@ -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 */ 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 index 860cdc7..0000000 --- a/gen/FreeBSD/scandir.c.patch +++ /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/scandir_b-fbsd.c b/gen/FreeBSD/scandir_b.c similarity index 94% rename from gen/scandir_b-fbsd.c rename to gen/FreeBSD/scandir_b.c index 7cdea7b..e13b917 100644 --- a/gen/scandir_b-fbsd.c +++ b/gen/FreeBSD/scandir_b.c @@ -54,16 +54,17 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/scandir.c,v 1.9 2008/03/16 19:08:53 das Exp */ int -scandir_b(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)(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 */ if ((dirp = opendir(dirname)) == NULL) return(-1); diff --git a/gen/FreeBSD/scandir_b.c.patch b/gen/FreeBSD/scandir_b.c.patch deleted file mode 100644 index f243dae..0000000 --- a/gen/FreeBSD/scandir_b.c.patch +++ /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)); --} diff --git a/gen/FreeBSD/seed48.c b/gen/FreeBSD/seed48.c index 94167a7..73d63ff 100644 --- a/gen/FreeBSD/seed48.c +++ b/gen/FreeBSD/seed48.c @@ -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 index 7efb4f1..0000000 --- a/gen/FreeBSD/seed48.c.patch +++ /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; - } diff --git a/gen/FreeBSD/setmode.c b/gen/FreeBSD/setmode.c index 4c1e5a0..53b79d2 100644 --- a/gen/FreeBSD/setmode.c +++ b/gen/FreeBSD/setmode.c @@ -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 index 03dda3b..0000000 --- a/gen/FreeBSD/setmode.c.patch +++ /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 */ diff --git a/gen/FreeBSD/setprogname.c b/gen/FreeBSD/setprogname.c index 654bef4..2392a66 100644 --- a/gen/FreeBSD/setprogname.c +++ b/gen/FreeBSD/setprogname.c @@ -3,6 +3,10 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 mar #include #include +#include +#include +#include +#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 index dafccfd..0000000 --- a/gen/FreeBSD/setprogname.c.patch +++ /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 - #include -+#include -+#include -+#include -+#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/siginterrupt.3 b/gen/FreeBSD/siginterrupt.3 index aae9120..6e2fd5f 100644 --- a/gen/FreeBSD/siginterrupt.3 +++ b/gen/FreeBSD/siginterrupt.3 @@ -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 index 8b6d16b..0000000 --- a/gen/FreeBSD/siginterrupt.3.patch +++ /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 diff --git a/gen/FreeBSD/siglist.c b/gen/FreeBSD/siglist.c index d3de563..a222989 100644 --- a/gen/FreeBSD/siglist.c +++ b/gen/FreeBSD/siglist.c @@ -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 index 24677f1..0000000 --- a/gen/FreeBSD/siglist.c.patch +++ /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]); diff --git a/gen/FreeBSD/signal.3 b/gen/FreeBSD/signal.3 index 7d68346..f18d1cf 100644 --- a/gen/FreeBSD/signal.3 +++ b/gen/FreeBSD/signal.3 @@ -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 index 49cdecf..0000000 --- a/gen/FreeBSD/signal.3.patch +++ /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 diff --git a/gen/FreeBSD/signal.c b/gen/FreeBSD/signal.c index 6407da3..a496863 100644 --- a/gen/FreeBSD/signal.c +++ b/gen/FreeBSD/signal.c @@ -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 index 9064ec8..0000000 --- a/gen/FreeBSD/signal.c.patch +++ /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__ */ diff --git a/gen/FreeBSD/signbit.3 b/gen/FreeBSD/signbit.3 index 42d810d..7d9c8d8 100644 --- a/gen/FreeBSD/signbit.3 +++ b/gen/FreeBSD/signbit.3 @@ -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 index a0dba44..0000000 --- a/gen/FreeBSD/signbit.3.patch +++ /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 . diff --git a/gen/FreeBSD/sleep.3 b/gen/FreeBSD/sleep.3 index a3c42fc..f540a15 100644 --- a/gen/FreeBSD/sleep.3 +++ b/gen/FreeBSD/sleep.3 @@ -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 diff --git a/gen/FreeBSD/sleep.3.patch b/gen/FreeBSD/sleep.3.patch deleted file mode 100644 index 0a27b75..0000000 --- a/gen/FreeBSD/sleep.3.patch +++ /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 diff --git a/gen/FreeBSD/sleep.c b/gen/FreeBSD/sleep.c index badd7c7..9d2095e 100644 --- a/gen/FreeBSD/sleep.c +++ b/gen/FreeBSD/sleep.c @@ -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 */ diff --git a/gen/FreeBSD/sleep.c.patch b/gen/FreeBSD/sleep.c.patch deleted file mode 100644 index 291c010..0000000 --- a/gen/FreeBSD/sleep.c.patch +++ /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 */ diff --git a/gen/FreeBSD/srand48.c b/gen/FreeBSD/srand48.c index fd369a0..c9f8426 100644 --- a/gen/FreeBSD/srand48.c +++ b/gen/FreeBSD/srand48.c @@ -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; } diff --git a/gen/FreeBSD/srand48.c.patch b/gen/FreeBSD/srand48.c.patch deleted file mode 100644 index 89f6b7f..0000000 --- a/gen/FreeBSD/srand48.c.patch +++ /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; - } diff --git a/gen/FreeBSD/sysconf.c b/gen/FreeBSD/sysconf.c index 309e163..2b9dc6c 100644 --- a/gen/FreeBSD/sysconf.c +++ b/gen/FreeBSD/sysconf.c @@ -45,6 +45,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb #include #include #include +#include +#include #include #include @@ -53,8 +55,8 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb #include #include -#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 index a392a42..0000000 --- a/gen/FreeBSD/sysconf.c.patch +++ /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 - #include - #include -+#include -+#include - - #include - #include -@@ -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; diff --git a/gen/FreeBSD/sysctl.3 b/gen/FreeBSD/sysctl.3 index 2598715..8c8e4bc 100644 --- a/gen/FreeBSD/sysctl.3 +++ b/gen/FreeBSD/sysctl.3 @@ -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 index 876b362..0000000 --- a/gen/FreeBSD/sysctl.3.patch +++ /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 diff --git a/gen/FreeBSD/sysctl.c b/gen/FreeBSD/sysctl.c index 66d82d0..7205820 100644 --- a/gen/FreeBSD/sysctl.c +++ b/gen/FreeBSD/sysctl.c @@ -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 index 7fa1c90..0000000 --- a/gen/FreeBSD/sysctl.c.patch +++ /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; diff --git a/gen/FreeBSD/telldir.c b/gen/FreeBSD/telldir.c index 9ed3413..355ed50 100644 --- a/gen/FreeBSD/telldir.c +++ b/gen/FreeBSD/telldir.c @@ -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 index f73f1f2..0000000 --- a/gen/FreeBSD/telldir.c.patch +++ /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 */ diff --git a/gen/FreeBSD/telldir.h b/gen/FreeBSD/telldir.h index 93b1893..c1f0ad0 100644 --- a/gen/FreeBSD/telldir.h +++ b/gen/FreeBSD/telldir.h @@ -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 diff --git a/gen/FreeBSD/telldir.h.patch b/gen/FreeBSD/telldir.h.patch deleted file mode 100644 index ca64554..0000000 --- a/gen/FreeBSD/telldir.h.patch +++ /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 diff --git a/gen/FreeBSD/termios.c b/gen/FreeBSD/termios.c index b79489a..ab540d6 100644 --- a/gen/FreeBSD/termios.c +++ b/gen/FreeBSD/termios.c @@ -33,6 +33,14 @@ static char sccsid[] = "@(#)termios.c 8.2 (Berkeley) 2/21/94"; #include __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 + +extern void _pthread_testcancel(pthread_t thread, int isconforming); +#endif /* VARIANT_CANCELABLE */ +#endif /* __DARWIN_UNIX03 */ + #include "namespace.h" #include #include @@ -44,6 +52,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/termios.c,v 1.16 2009/05/07 13:49:48 ed Exp #include #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 index 880c37d..0000000 --- a/gen/FreeBSD/termios.c.patch +++ /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 - __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 -+ -+extern void _pthread_testcancel(pthread_t thread, int isconforming); -+#endif /* VARIANT_CANCELABLE */ -+#endif /* __DARWIN_UNIX03 */ -+ - #include "namespace.h" - #include - #include -@@ -44,6 +52,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ter - #include - #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/time.3 b/gen/FreeBSD/time.3 index 6b63883..e694537 100644 --- a/gen/FreeBSD/time.3 +++ b/gen/FreeBSD/time.3 @@ -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 index f8e5d2e..0000000 --- a/gen/FreeBSD/time.3.patch +++ /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 diff --git a/gen/FreeBSD/time.c b/gen/FreeBSD/time.c index 4ab4238..d77e38a 100644 --- a/gen/FreeBSD/time.c +++ b/gen/FreeBSD/time.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.5 2007/01/09 00:27:55 imp Exp $" #include #include +#include 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 index 0e5a6e6..0000000 --- a/gen/FreeBSD/time.c.patch +++ /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 - #include -+#include - - 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/times.3 b/gen/FreeBSD/times.3 index 6aa58c3..f8e5f01 100644 --- a/gen/FreeBSD/times.3 +++ b/gen/FreeBSD/times.3 @@ -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 index 619223e..0000000 --- a/gen/FreeBSD/times.3.patch +++ /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 diff --git a/gen/FreeBSD/ttyname.3 b/gen/FreeBSD/ttyname.3 index c1d1b4f..0012549 100644 --- a/gen/FreeBSD/ttyname.3 +++ b/gen/FreeBSD/ttyname.3 @@ -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 @@ 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 index 16e368b..0000000 --- a/gen/FreeBSD/ttyname.3.patch +++ /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/\(** diff --git a/gen/FreeBSD/ttyname.c b/gen/FreeBSD/ttyname.c index b4e52f7..aa5483a 100644 --- a/gen/FreeBSD/ttyname.c +++ b/gen/FreeBSD/ttyname.c @@ -48,11 +48,14 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.16 2004/01/06 18:26:14 nectar #include #include #include +#include #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 index 7871bc3..0000000 --- a/gen/FreeBSD/ttyname.c.patch +++ /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 - #include - #include -+#include - #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 */ diff --git a/gen/FreeBSD/ualarm.3 b/gen/FreeBSD/ualarm.3 index 4b02cd9..01a681f 100644 --- a/gen/FreeBSD/ualarm.3 +++ b/gen/FreeBSD/ualarm.3 @@ -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, diff --git a/gen/FreeBSD/ualarm.3.patch b/gen/FreeBSD/ualarm.3.patch deleted file mode 100644 index 40f2ccb..0000000 --- a/gen/FreeBSD/ualarm.3.patch +++ /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, diff --git a/gen/FreeBSD/ulimit.3 b/gen/FreeBSD/ulimit.3 index 3dc745f..f19e152 100644 --- a/gen/FreeBSD/ulimit.3 +++ b/gen/FreeBSD/ulimit.3 @@ -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 diff --git a/gen/FreeBSD/ulimit.3.patch b/gen/FreeBSD/ulimit.3.patch deleted file mode 100644 index d81c748..0000000 --- a/gen/FreeBSD/ulimit.3.patch +++ /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 diff --git a/gen/FreeBSD/unvis.c b/gen/FreeBSD/unvis.c index e9c045f..da2efbf 100644 --- a/gen/FreeBSD/unvis.c +++ b/gen/FreeBSD/unvis.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 5f139ef..0000000 --- a/gen/FreeBSD/unvis.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/gen/FreeBSD/usleep.3 b/gen/FreeBSD/usleep.3 index dc61096..e99b773 100644 --- a/gen/FreeBSD/usleep.3 +++ b/gen/FreeBSD/usleep.3 @@ -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 diff --git a/gen/FreeBSD/usleep.3.patch b/gen/FreeBSD/usleep.3.patch deleted file mode 100644 index 2a695e9..0000000 --- a/gen/FreeBSD/usleep.3.patch +++ /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 diff --git a/gen/FreeBSD/usleep.c b/gen/FreeBSD/usleep.c index a4aa59c..fc8054b 100644 --- a/gen/FreeBSD/usleep.c +++ b/gen/FreeBSD/usleep.c @@ -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/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 index 338b4ca..0000000 --- a/gen/FreeBSD/usleep.c.patch +++ /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); diff --git a/gen/FreeBSD/utime.3 b/gen/FreeBSD/utime.3 index 875fc83..c96ab2e 100644 --- a/gen/FreeBSD/utime.3 +++ b/gen/FreeBSD/utime.3 @@ -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 diff --git a/gen/FreeBSD/utime.3.patch b/gen/FreeBSD/utime.3.patch deleted file mode 100644 index 6e88ffe..0000000 --- a/gen/FreeBSD/utime.3.patch +++ /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 diff --git a/gen/FreeBSD/vis.c b/gen/FreeBSD/vis.c index 94d1b22..3a4b67c 100644 --- a/gen/FreeBSD/vis.c +++ b/gen/FreeBSD/vis.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)vis.c 8.1 (Berkeley) 7/19/93"; #include __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index faf9578..0000000 --- a/gen/FreeBSD/vis.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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/wait.c b/gen/FreeBSD/wait.c index 46e7f72..8bf2b1e 100644 --- a/gen/FreeBSD/wait.c +++ b/gen/FreeBSD/wait.c @@ -40,10 +40,20 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.7 2007/01/09 00:27:56 imp Exp $" #include #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 index 459adb3..0000000 --- a/gen/FreeBSD/wait.c.patch +++ /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 - #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/waitpid.c b/gen/FreeBSD/waitpid.c index 47a06e8..d81530f 100644 --- a/gen/FreeBSD/waitpid.c +++ b/gen/FreeBSD/waitpid.c @@ -40,10 +40,31 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.7 2007/01/09 00:27:56 imp Exp #include #include "un-namespace.h" +#if __DARWIN_UNIX03 +#include +#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 index 13ebf93..0000000 --- a/gen/FreeBSD/waitpid.c.patch +++ /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 - #include "un-namespace.h" - -+#if __DARWIN_UNIX03 -+#include -+#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 index 2edd5c1..0000000 --- a/gen/Makefile.inc +++ /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 diff --git a/gen/NetBSD/endutxent.3 b/gen/NetBSD/endutxent.3 index 06a4433..719b98f 100644 --- a/gen/NetBSD/endutxent.3 +++ b/gen/NetBSD/endutxent.3 @@ -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 @@ -47,11 +47,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 @@ -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 index 3b04979..0000000 --- a/gen/NetBSD/endutxent.3.patch +++ /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 diff --git a/gen/NetBSD/getlastlogx.3 b/gen/NetBSD/getlastlogx.3 index cb7404c..8a70bcf 100644 --- a/gen/NetBSD/getlastlogx.3 +++ b/gen/NetBSD/getlastlogx.3 @@ -27,42 +27,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 @@ -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 index 0f1b420..0000000 --- a/gen/NetBSD/getlastlogx.3.patch +++ /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 . diff --git a/gen/NetBSD/utmpx.5 b/gen/NetBSD/utmpx.5 index 25a803d..6068b09 100644 --- a/gen/NetBSD/utmpx.5 +++ b/gen/NetBSD/utmpx.5 @@ -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 index 49f9b47..0000000 --- a/gen/NetBSD/utmpx.5.patch +++ /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 diff --git a/gen/NetBSD/utmpx.c b/gen/NetBSD/utmpx.c index b7497eb..0eda3d4 100644 --- a/gen/NetBSD/utmpx.c +++ b/gen/NetBSD/utmpx.c @@ -42,111 +42,240 @@ __RCSID("$NetBSD: utmpx.c,v 1.25 2008/04/28 20:22:59 martin Exp $"); #include #include -#include -#include -#include #include #include #include #include #include +#ifdef UNIFDEF_LEGACY_UTMP_APIS #include +#endif /* UNIFDEF_LEGACY_UTMP_APIS */ #include +#include +#include #include +#include + +/* 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 index a0da286..0000000 --- a/gen/NetBSD/utmpx.c.patch +++ /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 - #include - --#include --#include --#include - #include - #include - #include - #include - #include -+#ifdef UNIFDEF_LEGACY_UTMP_APIS - #include -+#endif /* UNIFDEF_LEGACY_UTMP_APIS */ - #include -+#include -+#include - #include -+#include - --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 index da4d69e..0000000 --- a/gen/_rand48-fbsd.c +++ /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 -__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; diff --git a/gen/_simple.h b/gen/_simple.h index db547df..7f2d49a 100644 --- a/gen/_simple.h +++ b/gen/_simple.h @@ -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 index ca8f1f2..0000000 --- a/gen/alarm-fbsd.c +++ /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 index 9826ce1..0000000 --- a/gen/alarm.3 +++ /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 index 869effa..0000000 --- a/gen/arc4random-fbsd.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * Copyright (c) 1996, David Mazieres - * Copyright (c) 2008, Damien Miller - * - * 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 -__FBSDID("$FreeBSD: src/lib/libc/gen/arc4random.c,v 1.25 2008/09/09 09:46:36 ache Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include - -#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 -#include -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 index c4c8a0f..0000000 --- a/gen/arc4random.3 +++ /dev/null @@ -1 +0,0 @@ -./arc4random.3 \ No newline at end of file diff --git a/gen/asl.3 b/gen/asl.3 index e3b9943..2f7f876 100644 --- 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 @@ -67,14 +68,14 @@ .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 @@ -105,6 +106,14 @@ .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" @@ -117,14 +126,14 @@ .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 diff --git a/gen/asl.c b/gen/asl.c index 9da9315..1948c92 100644 --- 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 #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include #include #include "asl_core.h" #include "asl_msg.h" @@ -59,19 +61,26 @@ #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; diff --git a/gen/asl_core.c b/gen/asl_core.c index ec2c4ac..29e132d 100644 --- a/gen/asl_core.c +++ b/gen/asl_core.c @@ -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 +#include #include -#include +#include #include #include #include +#include + +#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, "&"); + } + else if (x == '<') + { + asl_string_append_no_encoding(str, "<"); + } + else if (x == '>') + { + asl_string_append_no_encoding(str, ">"); + } + else if (x == '"') + { + asl_string_append_no_encoding(str, """); + } + else if (x == '\'') + { + asl_string_append_no_encoding(str, "'"); + } + 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, "\n"); + return str; +} diff --git a/gen/asl_core.h b/gen/asl_core.h index 10292fb..fdd5edb 100644 --- a/gen/asl_core.h +++ b/gen/asl_core.h @@ -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 #include #include -#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 @@ -75,6 +82,16 @@ #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 index 0000000..74e3838 --- /dev/null +++ b/gen/asl_fd.c @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* 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]); +} diff --git a/gen/asl_file.c b/gen/asl_file.c index 6c7c63a..7a8c4cb 100644 --- a/gen/asl_file.c +++ b/gen/asl_file.c @@ -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 #include #include +#include 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 diff --git a/gen/asl_file.h b/gen/asl_file.h index 491cca1..d550d8d 100644 --- a/gen/asl_file.h +++ b/gen/asl_file.h @@ -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__ */ diff --git a/gen/asl_ipc.defs b/gen/asl_ipc.defs index c7ef1d3..537bbe2 100644 --- a/gen/asl_ipc.defs +++ b/gen/asl_ipc.defs @@ -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@ * diff --git a/gen/asl_legacy1.c b/gen/asl_legacy1.c index 5a7a000..8bd9ba1 100644 --- a/gen/asl_legacy1.c +++ b/gen/asl_legacy1.c @@ -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 #include @@ -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; diff --git a/gen/asl_legacy1.h b/gen/asl_legacy1.h index eff42d9..a2efcde 100644 --- a/gen/asl_legacy1.h +++ b/gen/asl_legacy1.h @@ -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) diff --git a/gen/asl_msg.c b/gen/asl_msg.c index d824209..5c611b9 100644 --- a/gen/asl_msg.c +++ b/gen/asl_msg.c @@ -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@ * @@ -54,13 +54,7 @@ #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(;;) @@ -90,17 +84,6 @@ #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 & < > " and ' - * 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 & < > " and ' - * 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, "&", 5); - p += 5; - *cursor = *cursor + 5; - } - else if (c == '<') - { - memcpy(p, "<", 4); - p += 4; - *cursor = *cursor + 4; - } - else if (c == '>') - { - memcpy(p, ">", 4); - p += 4; - *cursor = *cursor + 4; - } - else if (c == '"') - { - memcpy(p, """, 6); - p += 6; - *cursor = *cursor + 6; - } - else if (c == '\'') - { - memcpy(p, "'", 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" + "\n" */ - len += _asl_append_xml_string_length(s); - } - else if (tag == XML_TAG_STRING) - { - len += 20; /* "\t\t" + "\n" */ - len += _asl_append_xml_string_length(s); - } - else if (tag == XML_TAG_DATA) - { - len += 16; /* "\t\t" + "\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", ASL_ENCODE_NONE, 0); - _asl_append_xml_string(buf, bufsize, cursor, s); - _asl_append_string(buf, bufsize, cursor, "\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", ASL_ENCODE_NONE, 0); - _asl_append_xml_string(buf, bufsize, cursor, s); - _asl_append_string(buf, bufsize, cursor, "\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", 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, "\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] : message */ - /* STD: Mth dd hh:mm:ss host sender[pid] (refproc[refpid]) : message */ + /* COMMON: Mth dd hh:mm:ss host sender[pid] (refproc[refpid])*/ + /* BSD: : message */ + /* STD: : 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\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\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\n", ASL_ENCODE_NONE, 0); + asl_string_append_char_no_encoding(str, '\t'); + asl_string_append(str, ""); + 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\n", ASL_ENCODE_NONE, 0); - - buf[cursor] = '\0'; + asl_string_append_char_no_encoding(str, '\t'); + asl_string_append(str, ""); + 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; } /* diff --git a/gen/asl_msg.h b/gen/asl_msg.h index c1876b2..dc9a9dc 100644 --- a/gen/asl_msg.h +++ b/gen/asl_msg.h @@ -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 +#include #define IndexNull ((uint32_t)-1) @@ -78,42 +79,12 @@ #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__ */ diff --git a/gen/asl_private.h b/gen/asl_private.h index a10cc64..be092c7 100644 --- a/gen/asl_private.h +++ b/gen/asl_private.h @@ -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@ * @@ -51,11 +51,6 @@ #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); diff --git a/gen/asl_store.c b/gen/asl_store.c index d8a0499..a4d0fca 100644 --- a/gen/asl_store.c +++ b/gen/asl_store.c @@ -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@ * diff --git a/gen/asl_store.h b/gen/asl_store.h index b24a586..d56d152 100644 --- a/gen/asl_store.h +++ b/gen/asl_store.h @@ -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__ */ diff --git a/gen/asl_util.c b/gen/asl_util.c index 6f7d706..108fa17 100644 --- a/gen/asl_util.c +++ b/gen/asl_util.c @@ -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 index 2e1c0b1..0000000 --- a/gen/assert-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/assert.c,v 1.8 2007/01/09 00:27:53 imp Exp $"); - -#include -#include -#include -#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 */ -} diff --git a/gen/assumes.c b/gen/assumes.c index 076e59c..444c629 100644 --- a/gen/assumes.c +++ b/gen/assumes.c @@ -3,162 +3,303 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include #include #include +#include #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 diff --git a/gen/assumes.h b/gen/assumes.h index 4f266c4..70eb97d 100644 --- a/gen/assumes.h +++ b/gen/assumes.h @@ -6,6 +6,7 @@ __BEGIN_DECLS #include +#include #include #include #include @@ -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 +#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 index 3de44fb..0000000 --- a/gen/basename-fbsd.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1997 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel Exp $"); - -#include -#include -#include -#include -#include - -#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 index a9300b3..0000000 --- a/gen/basename.3 +++ /dev/null @@ -1,120 +0,0 @@ -.\" -.\" Copyright (c) 1997 Todd C. Miller -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 -.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 index 7a89aae..0000000 --- a/gen/clock-fbsd.c +++ /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 index 8eb0ebf..0000000 --- a/gen/clock.3 +++ /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 index 10bfe5e..0000000 --- a/gen/closedir-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/closedir.c,v 1.13 2007/12/03 14:33:50 des Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#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)); -} diff --git a/gen/confstr.3 b/gen/confstr.3 index b207ecf..e5fff63 100644 --- a/gen/confstr.3 +++ b/gen/confstr.3 @@ -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 diff --git a/gen/confstr.c b/gen/confstr.c index 419571b..196d195 100644 --- a/gen/confstr.c +++ b/gen/confstr.c @@ -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 index 0300f3c..0000000 --- a/gen/ctermid-fbsd.c +++ /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 index 2085245..0000000 --- a/gen/ctermid.3 +++ /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 index ea9a15f..0000000 --- a/gen/daemon-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/daemon.c,v 1.8 2007/01/09 00:27:53 imp Exp $"); - -#ifndef VARIANT_PRE1050 -#include -#include -#endif /* !VARIANT_PRE1050 */ -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#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 index a2d9f2b..0000000 --- a/gen/daemon.3 +++ /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. diff --git a/gen/directory.3 b/gen/directory.3 index df63d69..4faf967 100644 --- a/gen/directory.3 +++ b/gen/directory.3 @@ -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/ppc64/pthreads/pthread_self_64.s b/gen/dirfd.c similarity index 77% rename from ppc64/pthreads/pthread_self_64.s rename to gen/dirfd.c index a493e3f..15ab391 100644 --- a/ppc64/pthreads/pthread_self_64.s +++ b/gen/dirfd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,13 +20,16 @@ * * @APPLE_LICENSE_HEADER_END@ */ -#define __APPLE_API_PRIVATE -#include -#undef __APPLE_API_PRIVATE - .text - .align 2 - .globl _pthread_self -_pthread_self: - mr r3, r13 - blr +#include +#include +#include + +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 index 5164e18..0000000 --- a/gen/dirname-fbsd.c +++ /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 - * - * 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 -__FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.8 2008/11/03 05:19:45 delphij Exp $"); - -#include -#include -#include -#include -#include - -#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 index 330b426..0000000 --- a/gen/dirname.3 +++ /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 -.\" -.\" 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 -.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 index 52e9693..0000000 --- a/gen/drand48-fbsd.c +++ /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 -__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 index 719b98f..0000000 --- a/gen/endutxent.3 +++ /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 index 06a4433..0000000 --- a/gen/endutxent.3.orig +++ /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 index 9887547..0000000 --- a/gen/erand48-fbsd.c +++ /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 -__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 index e6e03f6..0000000 --- a/gen/err-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/err.c,v 1.15 2008/04/03 20:36:44 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#ifdef __BLOCKS__ -#include -#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 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 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 */ -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 diff --git a/gen/errlst.c b/gen/errlst.c index d0c2cd6..bde5422 100644 --- a/gen/errlst.c +++ b/gen/errlst.c @@ -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 index 86cf335..0000000 --- a/gen/exec-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/exec.c,v 1.27 2009/12/05 18:55:16 ed Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "un-namespace.h" -#include "libc_private.h" - -#include -#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 index 2f49ef3..0000000 --- a/gen/exec.3 +++ /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 index b7c0fe8..0000000 --- a/gen/fmtcheck-fbsd.c +++ /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 index a1e1fc6..0000000 --- a/gen/fmtcheck.3 +++ /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 index e912693..0000000 --- a/gen/fmtmsg-fbsd.c +++ /dev/null @@ -1,271 +0,0 @@ -/*- - * Copyright (c) 2002 Mike Barcroft - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/gen/fmtmsg.c,v 1.6 2009/11/08 14:02:54 brueffer Exp $"); - -#include -#include -#include -#include -#include -#include - -/* 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 index a22c44c..0000000 --- a/gen/fmtmsg.3 +++ /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 index 51a1f97..0000000 --- a/gen/fnmatch-fbsd.c +++ /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 -__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 -#include -#include -#include -#include - -#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 index f3aa885..0000000 --- a/gen/fnmatch.3 +++ /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 index 19e8277..0000000 --- a/gen/ftok-fbsd.c +++ /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 index 88a3a23..0000000 --- a/gen/ftok.3 +++ /dev/null @@ -1,88 +0,0 @@ -.\" Copyright (c) 1994 SigmaSoft, Th. Lockert -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 -.Fd #include -.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 index e8f2107..0000000 --- a/gen/getbsize-fbsd.c +++ /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 index 387ed66..0000000 --- a/gen/getbsize.3 +++ /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 index ea8425f..0000000 --- a/gen/getcap-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#include - -#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 index 649a9f4..0000000 --- a/gen/getcap-fbsd.c.orig +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/getcap.c,v 1.23 2009/11/25 04:45:45 wollman Exp $"); - -#include "namespace.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#include - -#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 index ef16ef7..0000000 --- a/gen/getcap.3 +++ /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 index 178b6ef..0000000 --- a/gen/getcontext.3 +++ /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 index 512b88c..0000000 --- a/gen/getcwd-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/getcwd.c,v 1.29 2007/01/09 00:27:53 imp Exp $"); - -#include "namespace.h" -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#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 index 063912c..0000000 --- a/gen/getcwd.3 +++ /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 index 031e2c8..0000000 --- a/gen/gethostname-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/gethostname.c,v 1.8 2007/01/09 00:27:54 imp Exp $"); - -#include -#include -#include -#include - -#include -#include - -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 index eed2346..0000000 --- a/gen/gethostname.3 +++ /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 index 8a70bcf..0000000 --- a/gen/getlastlogx.3 +++ /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 index cb7404c..0000000 --- a/gen/getlastlogx.3.orig +++ /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 index f60de8d..0000000 --- a/gen/getlogin-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/getlogin.c,v 1.11 2009/12/05 19:04:21 ed Exp $"); - -#include -#include -#include -#include -#include -#include -#include "namespace.h" -#include -#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 index abe4b01..0000000 --- a/gen/getmntinfo-fbsd.c +++ /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 index 0c8283b..0000000 --- a/gen/getmntinfo.3 +++ /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.orig b/gen/getmntinfo64-fbsd.c.orig deleted file mode 100644 index 24b7886..0000000 --- a/gen/getmntinfo64-fbsd.c.orig +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/getmntinfo.c,v 1.5 2007/01/09 00:27:54 imp Exp $"); - -#include -#include -#include -#include - -/* - * 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 index 4b61652..0000000 --- a/gen/getpagesize-fbsd.c +++ /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 index fbeaba6..0000000 --- a/gen/getpagesize.3 +++ /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 index c9ce40a..0000000 --- a/gen/getpass.3 +++ /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 index 843d1f4..0000000 --- a/gen/getpeereid-fbsd.c +++ /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 index 222f1b4..0000000 --- a/gen/getpeereid.3 +++ /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 index a736f65..0000000 --- a/gen/getprogname-fbsd.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -__FBSDID("$FreeBSD: src/lib/libc/gen/getprogname.c,v 1.4 2002/03/29 22:43:41 markm Exp $"); - -#include "namespace.h" -#include -#include -#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 index b7b9c99..0000000 --- a/gen/getprogname.3 +++ /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 index cc80496..0000000 --- a/gen/glob-fbsd.c +++ /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 -__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 -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 index a71c96b..0000000 --- a/gen/glob.3 +++ /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 index 54a0fa0..0000000 --- a/gen/isatty-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/isatty.c,v 1.6 2007/01/09 00:27:54 imp Exp $"); - -#include -#include -#include -#include -#include -#include - -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 index 40d6a6f..0000000 --- a/gen/jrand48-fbsd.c +++ /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 -__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 index 8a13d64..0000000 --- a/gen/lcong48-fbsd.c +++ /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 -__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 index bc8de89..0000000 --- a/gen/lockf-fbsd.c +++ /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 -__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 -#include -#include -#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 index fc48307..0000000 --- a/gen/lockf.3 +++ /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 index 3b01e85..0000000 --- a/gen/lrand48-fbsd.c +++ /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 -__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; -} diff --git a/gen/magazine_malloc.c b/gen/magazine_malloc.c index e6b6998..6290df5 100644 --- a/gen/magazine_malloc.c +++ b/gen/magazine_malloc.c @@ -81,6 +81,9 @@ #define DEBUG_MADVISE 0 +// +#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 index d60038b..0000000 --- a/gen/makecontext.3 +++ /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 diff --git a/gen/malloc.c b/gen/malloc.c index 92e44dc..09a047a 100644 --- a/gen/malloc.c +++ b/gen/malloc.c @@ -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 index 5453ceb..0000000 --- a/gen/mrand48-fbsd.c +++ /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 -__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 index 962eee1..0000000 --- a/gen/nice-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/nice.c,v 1.4 2007/01/09 00:27:54 imp Exp $"); - -#include -#include -#include -#include -#include -#if __DARWIN_UNIX03 -#include -#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 index 79148b9..0000000 --- a/gen/nice.3 +++ /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 index 1790b23..0000000 --- a/gen/nrand48-fbsd.c +++ /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 -__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 index 86c2e40..0000000 --- a/gen/opendir-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/opendir.c,v 1.24 2008/04/16 18:40:52 delphij Exp $"); - -#include "namespace.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#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 index 99576fd..0000000 --- a/gen/pause-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $"); - -#include -#include - -/* - * 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 index 6f78fe9..0000000 --- a/gen/pause-fbsd.c.orig +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/pause.c,v 1.8 2009/12/05 19:31:38 ed Exp $"); - -#include -#include - -/* - * 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 index bf777f1..0000000 --- a/gen/pause.3 +++ /dev/null @@ -1 +0,0 @@ -./pause.3 \ No newline at end of file diff --git a/gen/platfunc.c b/gen/platfunc.c index 0bb3bb1..07730c1 100644 --- a/gen/platfunc.c +++ b/gen/platfunc.c @@ -24,18 +24,22 @@ #if defined(__i386__) || defined(__x86_64__) #include -#include #include +#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 index d4aea86..0000000 --- a/gen/popen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.21 2009/05/27 19:28:04 ed Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include /* fwide() */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" -#include "libc_private.h" - -#include -#define environ (*_NSGetEnviron()) - -/* Our queue.h doesn't have SLIST_REMOVE_AFTER in it yet - * 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 index 5f4a8c6..0000000 --- a/gen/popen.3 +++ /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 index 4bc62fc..0000000 --- a/gen/pselect-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/pselect.c,v 1.6 2002/10/12 16:13:37 mike Exp $"); - -#include "namespace.h" -#include -#include -#include -#include - -#include -#include -#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 index 615a399..0000000 --- a/gen/pselect.3 +++ /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 index 993ff39..0000000 --- a/gen/psignal-fbsd.c +++ /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 index 84976af..0000000 --- a/gen/psignal.3 +++ /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 index 9229902..0000000 --- a/gen/raise-fbsd.c +++ /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 index 87dfefd..0000000 --- a/gen/raise.3 +++ /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 index 6bc96d6..0000000 --- a/gen/rand48.3 +++ /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 index e799eba..0000000 --- a/gen/rand48.h +++ /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 -#include - -#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 index 3875cef..0000000 --- a/gen/readdir-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/readdir.c,v 1.15 2008/05/05 14:05:23 kib Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#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 index 45ac15f..0000000 --- a/gen/readpassphrase-fbsd.c +++ /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 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index ce01f5d..0000000 --- a/gen/readpassphrase.3 +++ /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 index e39837e..0000000 --- a/gen/rewinddir-fbsd.c +++ /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 index 7f2b13d..0000000 --- a/gen/scandir-fbsd.c +++ /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 -__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 -#include -#include -#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 index 7998581..0000000 --- a/gen/scandir.3 +++ /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/seed48-fbsd.c b/gen/seed48-fbsd.c deleted file mode 100644 index 73d63ff..0000000 --- a/gen/seed48-fbsd.c +++ /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 -__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 index d04fec6..0000000 --- a/gen/seekdir-fbsd.c +++ /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 index 2501195..0000000 --- a/gen/sethostname-fbsd.c +++ /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 index 53b79d2..0000000 --- a/gen/setmode-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/setmode.c,v 1.11 2007/01/09 00:27:55 imp Exp $"); - -#include "namespace.h" -#include -#include - -#include -#include -#include -#include -#include - -#ifdef SETMODE_DEBUG -#include -#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 index cbe4269..0000000 --- a/gen/setmode.3 +++ /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 index 2392a66..0000000 --- a/gen/setprogname-fbsd.c +++ /dev/null @@ -1,33 +0,0 @@ -#include -__FBSDID("$FreeBSD: src/lib/libc/gen/setprogname.c,v 1.8 2002/03/29 22:43:41 markm Exp $"); - -#include -#include -#include -#include -#include -#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 index 73b87a5..0000000 --- a/gen/siginterrupt-fbsd.c +++ /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 index 6e2fd5f..0000000 --- a/gen/siginterrupt.3 +++ /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 index a222989..0000000 --- a/gen/siglist-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/siglist.c,v 1.6 2007/01/20 08:24:01 maxim Exp $"); - -#include - -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 index a496863..0000000 --- a/gen/signal-fbsd.c +++ /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 -__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 -#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 index f18d1cf..0000000 --- a/gen/signal.3 +++ /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 index 7d9c8d8..0000000 --- a/gen/signbit.3 +++ /dev/null @@ -1,53 +0,0 @@ -.\" Copyright (c) 2003 Mike Barcroft -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index 9d2095e..0000000 --- a/gen/sleep-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/sleep.c,v 1.33 2009/12/05 19:31:38 ed Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#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 index f540a15..0000000 --- a/gen/sleep.3 +++ /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 index c9f8426..0000000 --- a/gen/srand48-fbsd.c +++ /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; -} diff --git a/gen/stack_logging.c b/gen/stack_logging.c index 42953c8..6fcc0b5 100644 --- a/gen/stack_logging.c +++ b/gen/stack_logging.c @@ -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; diff --git a/gen/stack_logging.h b/gen/stack_logging.h index ff7079d..5f0137a 100644 --- a/gen/stack_logging.h +++ b/gen/stack_logging.h @@ -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); diff --git a/gen/stack_logging_disk.c b/gen/stack_logging_disk.c index 5a48ca3..00a0cae 100644 --- a/gen/stack_logging_disk.c +++ b/gen/stack_logging_disk.c @@ -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) } } +/* + * 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 { + /* 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 index 8dfffde..0000000 --- a/gen/stringlist-fbsd.c +++ /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 index 7a75e09..0000000 --- a/gen/stringlist.3 +++ /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 index 0000000..87934af --- /dev/null +++ b/gen/sync_volume_np.3 @@ -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 index 0000000..a87e257 --- /dev/null +++ b/gen/sync_volume_np.c @@ -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 +#include +#include + +/* + * 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 index 7f84622..0000000 --- a/gen/sysconf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include /* we just need the limits */ -#include -#include - -#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 index c7e48c6..0000000 --- a/gen/sysconf.3 +++ /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 index 7205820..0000000 --- a/gen/sysctl-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/sysctl.c,v 1.6 2007/01/09 00:27:55 imp Exp $"); - -#include -#include - -#include -#include -#include -#include -#include -#include - -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 index 8c8e4bc..0000000 --- a/gen/sysctl.3 +++ /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 -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 index b04c734..0000000 --- a/gen/sysctlbyname-fbsd.c +++ /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 index 47688f8..0000000 --- a/gen/sysctlnametomib-fbsd.c +++ /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 index 355ed50..0000000 --- a/gen/telldir-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/telldir.c,v 1.11 2008/05/05 14:05:23 kib Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#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 index c1f0ad0..0000000 --- a/gen/telldir.h +++ /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 - -/* - * 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 index ab540d6..0000000 --- a/gen/termios-fbsd.c +++ /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 -__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 - -extern void _pthread_testcancel(pthread_t thread, int isconforming); -#endif /* VARIANT_CANCELABLE */ -#endif /* __DARWIN_UNIX03 */ - -#include "namespace.h" -#include -#include -#include -#include - -#include -#include -#include -#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 */ diff --git a/gen/thread_stack_pcs.c b/gen/thread_stack_pcs.c index 3004f5f..a145831 100644 --- a/gen/thread_stack_pcs.c +++ b/gen/thread_stack_pcs.c @@ -28,7 +28,7 @@ #include #include -#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 index d77e38a..0000000 --- a/gen/time-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/time.c,v 1.5 2007/01/09 00:27:55 imp Exp $"); - -#include -#include -#include - -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 index e694537..0000000 --- a/gen/time.3 +++ /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 index 4391258..0000000 --- a/gen/times-fbsd.c +++ /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 index f8e5f01..0000000 --- a/gen/times.3 +++ /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 index acd447d..0000000 --- a/gen/timezone-fbsd.c +++ /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 index 39479a8..0000000 --- a/gen/timezone.3 +++ /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 index aa5483a..0000000 --- a/gen/ttyname-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/ttyname.c,v 1.16 2004/01/06 18:26:14 nectar Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 0012549..0000000 --- a/gen/ttyname.3 +++ /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 index 7e772b8..0000000 --- a/gen/ttyslot-fbsd.c +++ /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 index a1e562f..0000000 --- a/gen/ualarm-fbsd.c +++ /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 index 01a681f..0000000 --- a/gen/ualarm.3 +++ /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 index 2defc9a..0000000 --- a/gen/ucontext.3 +++ /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 index 30722f8..0000000 --- a/gen/ulimit-fbsd.c +++ /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 index f19e152..0000000 --- a/gen/ulimit.3 +++ /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 index da2efbf..0000000 --- a/gen/unvis-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -/* - * 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 index 7571719..0000000 --- a/gen/unvis.3 +++ /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 index fc8054b..0000000 --- a/gen/usleep-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/usleep.c,v 1.31 2009/12/05 19:31:38 ed Exp $"); - -#include "namespace.h" -#include -#include -#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 index e99b773..0000000 --- a/gen/usleep.3 +++ /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 index ad13533..0000000 --- a/gen/utime-fbsd.c +++ /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 index c96ab2e..0000000 --- a/gen/utime.3 +++ /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 index 0eda3d4..0000000 --- a/gen/utmpx-nbsd.c +++ /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 - -#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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#ifdef UNIFDEF_LEGACY_UTMP_APIS -#include -#endif /* UNIFDEF_LEGACY_UTMP_APIS */ -#include -#include -#include -#include -#include - -/* 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 index 6068b09..0000000 --- a/gen/utmpx.5 +++ /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 index 3a4b67c..0000000 --- a/gen/vis-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/vis.c,v 1.14 2007/01/09 00:27:56 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include - -#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 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 index 8bf2b1e..0000000 --- a/gen/wait-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/wait.c,v 1.7 2007/01/09 00:27:56 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#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 index 5852191..0000000 --- a/gen/wait3-fbsd.c +++ /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 index d81530f..0000000 --- a/gen/waitpid-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/gen/waitpid.c,v 1.7 2007/01/09 00:27:56 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include "un-namespace.h" - -#if __DARWIN_UNIX03 -#include -#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 index 51824f8..0000000 --- a/gen/zone.c +++ /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 -#import -#import -#import -#import -#import - -#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 index bc42757..0000000 --- a/gmon/Makefile.inc +++ /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 diff --git a/gmon/gmon.c b/gmon/gmon.c index 20ce855..ff2f4ed 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -76,6 +76,13 @@ * 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 index f759c80..0000000 --- a/i386/gen/Makefile.inc +++ /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 index 7fd652c..0000000 --- a/i386/pthreads/Makefile.inc +++ /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 index 51cd899..0000000 --- a/i386/pthreads/get_cpu_capabilities.s +++ /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 -#undef __APPLE_API_PRIVATE - -.text -.align 2, 0x90 -.private_extern __get_cpu_capabilities -__get_cpu_capabilities: - movl _COMM_PAGE_CPU_CAPABILITIES, %eax - ret diff --git a/i386/pthreads/pthread_mutex_lock.s b/i386/pthreads/pthread_mutex_lock.s index d9684aa..c0ac801 100644 --- a/i386/pthreads/pthread_mutex_lock.s +++ b/i386/pthreads/pthread_mutex_lock.s @@ -22,7 +22,7 @@ */ #include - +#include .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 index 383aebe..0000000 --- a/i386/stdlib/gdtoa.mk +++ /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 index 36d022d..0000000 --- a/i386/string/Makefile.inc +++ /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 index 7a83351..0000000 --- a/i386/sys/Makefile.inc +++ /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 diff --git a/i386/sys/OSAtomic.s b/i386/sys/OSAtomic.s index 49834ce..138e5c0 100644 --- a/i386/sys/OSAtomic.s +++ b/i386/sys/OSAtomic.s @@ -24,6 +24,7 @@ #include #include +#include #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 diff --git a/include/FreeBSD/nl_types.h b/include/FreeBSD/nl_types.h index 100d570..db74be9 100644 --- a/include/FreeBSD/nl_types.h +++ b/include/FreeBSD/nl_types.h @@ -43,6 +43,7 @@ #include #include +#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 index c411b64..0000000 --- a/include/FreeBSD/nl_types.h.patch +++ /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 - #include -+#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 index 83d8b47..0000000 --- a/include/Makefile.inc +++ /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" - diff --git a/include/NetBSD/utmpx.h b/include/NetBSD/utmpx.h index a68db01..616b4c0 100644 --- a/include/NetBSD/utmpx.h +++ b/include/NetBSD/utmpx.h @@ -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 -#include -#include +#include <_types.h> #include +#include +#include + +#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,74 +98,87 @@ #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 index 3006f1c..0000000 --- a/include/NetBSD/utmpx.h.patch +++ /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 - #include --#include --#include --#include -+#include - -+#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 index a4fb7b4..0000000 --- a/include/arpa/Makefile.inc +++ /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\//} diff --git a/include/asl.h b/include/asl.h index 1761e9b..ec4799e 100644 --- a/include/asl.h +++ b/include/asl.h @@ -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__ */ diff --git a/include/dirent.h b/include/dirent.h index 0d76134..b52baae 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -63,6 +63,7 @@ */ #include <_types.h> #include +#include #include 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 - __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 +#include +#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 */ diff --git a/include/err.h b/include/err.h index 4383e2d..ee4eae9 100644 --- a/include/err.h +++ b/include/err.h @@ -70,18 +70,18 @@ #include __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 index 10f230e..0000000 --- a/include/grp.h +++ /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 - -__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_ */ diff --git a/include/inttypes.h b/include/inttypes.h index 1beb2c0..1f9738c 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -31,23 +31,9 @@ #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" @@ -150,19 +136,11 @@ # 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 index bf3bf18..0000000 --- a/include/libkern/Makefile.inc +++ /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\//} diff --git a/include/libkern/OSAtomic.h b/include/libkern/OSAtomic.h index 6a62bd3..7cb7d63 100644 --- a/include/libkern/OSAtomic.h +++ b/include/libkern/OSAtomic.h @@ -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 __theAmount 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 uint64_t values. @discussion This function compares the value in __oldValue 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)). diff --git a/include/libkern/OSMemoryNotification.h b/include/libkern/OSMemoryNotification.h index ee6714b..d4e450b 100644 --- a/include/libkern/OSMemoryNotification.h +++ b/include/libkern/OSMemoryNotification.h @@ -25,6 +25,7 @@ #define _OSMEMORYNOTIFICATION_H_ #include +#include /* ** 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 diff --git a/include/libkern/OSThermalNotification.h b/include/libkern/OSThermalNotification.h index 02b2823..ad19e7e 100644 --- a/include/libkern/OSThermalNotification.h +++ b/include/libkern/OSThermalNotification.h @@ -57,6 +57,7 @@ enum { kOSThermalMitigationDisableMapsHalo, kOSThermalMitigationAppTerminate, kOSThermalMitigationDeviceRestart, + kOSThermalMitigationThermalTableReady, kOSThermalMitigationCount }; diff --git a/include/limits.h b/include/limits.h index 968de19..2f9385d 100644 --- a/include/limits.h +++ b/include/limits.h @@ -106,6 +106,10 @@ #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 @@ -125,12 +129,6 @@ #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 index 47a51ee..0000000 --- a/include/malloc/Makefile.inc +++ /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 index db74be9..0000000 --- a/include/nl_types.h +++ /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 -#include -#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 index a4f8fad..0000000 --- a/include/objc/Makefile.inc +++ /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/zone.h b/include/objc/zone.h deleted file mode 100644 index 2a84ce0..0000000 --- a/include/objc/zone.h +++ /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 - -typedef malloc_zone_t NXZone; - -#define NX_NOZONE ((NXZone *)0) - -/********* Interface to zone based malloc ************/ - -#include - -#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 index 5158f77..0000000 --- a/include/protocols/Makefile.inc +++ /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 index 30ce226..0000000 --- a/include/pwd.h +++ /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 - -__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_ */ diff --git a/include/regex.h b/include/regex.h index f348c9a..d362ab4 100644 --- a/include/regex.h +++ b/include/regex.h @@ -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@ * @@ -20,6 +20,33 @@ * * @APPLE_LICENSE_HEADER_END@ */ +/* + * Copyright (c) 2001-2009 Ville Laurikari + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must 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 @@ -63,8 +90,20 @@ #define _REGEX_H_ #include <_types.h> +#include +/*********/ /* 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 +#endif /* _USE_EXTENDED_LOCALES_ */ + #endif /* !_REGEX_H_ */ diff --git a/include/secure/Makefile.inc b/include/secure/Makefile.inc deleted file mode 100644 index d355e87..0000000 --- a/include/secure/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -SECURE_INSTHDRS += _common.h \ - _string.h \ - _stdio.h - -SECURE_INSTHDRS := ${SECURE_INSTHDRS:S/^/${.CURDIR}\/include\/secure\//} diff --git a/include/secure/_stdio.h b/include/secure/_stdio.h index e04c9c5..49caf72 100644 --- a/include/secure/_stdio.h +++ b/include/secure/_stdio.h @@ -43,30 +43,26 @@ /* 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) diff --git a/include/setjmp.h b/include/setjmp.h index 4fced23..8e6b4a8 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -23,6 +23,66 @@ #ifndef _BSD_SETJMP_H #define _BSD_SETJMP_H -#include +#include + +#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 + +/* + * _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 */ diff --git a/include/spawn_private.h b/include/spawn_private.h index 174b595..a034698 100644 --- a/include/spawn_private.h +++ b/include/spawn_private.h @@ -27,8 +27,20 @@ #include #include #include +#include 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_*/ diff --git a/include/stdio.h b/include/stdio.h index 3608903..b2860ed 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -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); diff --git a/include/stdlib.h b/include/stdlib.h index 2405804..e4aa81b 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -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 index 253cb16..0000000 --- a/include/sys/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -SYS_INSTHDRS += acl.h statvfs.h - -SYS_INSTHDRS := ${SYS_INSTHDRS:S/^/${.CURDIR}\/include\/sys\//} diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h index 9e59b1c..c0badcc 100644 --- a/include/sys/cdefs.h +++ b/include/sys/cdefs.h @@ -34,16 +34,8 @@ */ #include_next #ifndef _LIBC_NO_FEATURE_VERIFICATION -#if defined(__arm__) -# include -#elif defined(__i386__) -# include -#elif defined(__ppc__) -# include -#elif defined(__ppc64__) -# include -#elif defined(__x86_64__) -# include +#if defined(__arm__) || defined(__i386__) || defined(__x86_64__) +# include "libc-features.h" #else # error "Unknown architecture." #endif diff --git a/include/unistd.h b/include/unistd.h index 1cd221c..3f582da 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -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 index 616b4c0..0000000 --- a/include/utmpx.h +++ /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 -#include -#include - -#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_ */ diff --git a/include/wchar.h b/include/wchar.h index fe527fd..fdb80ad 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -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); diff --git a/include/xlocale.h b/include/xlocale.h index ccb0a43..7772f6c 100644 --- a/include/xlocale.h +++ b/include/xlocale.h @@ -91,6 +91,9 @@ __END_DECLS #ifdef _MONETARY_H_ #include #endif /* _MONETARY_H_ */ +#ifdef _REGEX_H_ +#include +#endif /* _REGEX_H_ */ #ifdef _STDIO_H_ #include #endif /* _STDIO_H_ */ diff --git a/include/xlocale/Makefile.inc b/include/xlocale/Makefile.inc deleted file mode 100644 index 03bc781..0000000 --- a/include/xlocale/Makefile.inc +++ /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 index 0000000..8321764 --- /dev/null +++ b/include/xlocale/_regex.h @@ -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_ */ diff --git a/include/xlocale/_stdio.h b/include/xlocale/_stdio.h index f9fdf86..64ff86f 100644 --- a/include/xlocale/_stdio.h +++ b/include/xlocale/_stdio.h @@ -27,50 +27,50 @@ __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 diff --git a/include/xlocale/_stdlib.h b/include/xlocale/_stdlib.h index 494a917..e5076d6 100644 --- a/include/xlocale/_stdlib.h +++ b/include/xlocale/_stdlib.h @@ -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 diff --git a/include/xlocale/_wchar.h b/include/xlocale/_wchar.h index c3c8974..fbfb2f7 100644 --- a/include/xlocale/_wchar.h +++ b/include/xlocale/_wchar.h @@ -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 index b9a0457..0000000 --- a/internat/Makefile.inc +++ /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 index b54ee1d..0000000 --- a/internat/NXCType.c +++ /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 index 5b379f0..0000000 --- a/internat/NXCType.h +++ /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 - -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/NXIsDigit.c b/internat/NXIsDigit.c deleted file mode 100644 index 7e62966..0000000 --- a/internat/NXIsDigit.c +++ /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 index af5c690..0000000 --- a/internat/NXIsGraph.c +++ /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 index dda9d4c..0000000 --- a/internat/NXIsLower.c +++ /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 index 0ef9eeb..0000000 --- a/internat/NXIsPrint.c +++ /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 index 67206b7..0000000 --- a/internat/NXIsPunct.c +++ /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 index 24b0919..0000000 --- a/internat/NXIsSpace.c +++ /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 index df31408..0000000 --- a/internat/NXIsUpper.c +++ /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 index 3099b31..0000000 --- a/internat/NXIsXDigit.c +++ /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 index 8dc50e9..0000000 --- a/internat/NXToAscii.c +++ /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 index 9b5939a..0000000 --- a/internat/NXToLower.c +++ /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 index 49955e5..0000000 --- a/internat/NXToUpper.c +++ /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 index 70b2d08..0000000 --- a/internat/_NXToLower.c +++ /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 index f1f5f7a..0000000 --- a/internat/_NXToUpper.c +++ /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 index f9ec86a..0000000 --- a/interposable.list +++ /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 diff --git a/locale/FreeBSD/ascii.c b/locale/FreeBSD/ascii.c index 7006e01..e2b2b83 100644 --- a/locale/FreeBSD/ascii.c +++ b/locale/FreeBSD/ascii.c @@ -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 index aa45979..0000000 --- a/locale/FreeBSD/ascii.c.patch +++ /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; diff --git a/locale/FreeBSD/big5.c b/locale/FreeBSD/big5.c index ef2fd4e..12c88ba 100644 --- a/locale/FreeBSD/big5.c +++ b/locale/FreeBSD/big5.c @@ -41,6 +41,8 @@ static char sccsid[] = "@(#)big5.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -49,33 +51,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache E #include #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 index 96c1988..0000000 --- a/locale/FreeBSD/big5.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -49,33 +51,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; - diff --git a/locale/FreeBSD/btowc.3 b/locale/FreeBSD/btowc.3 index da9d1e5..39447a2 100644 --- a/locale/FreeBSD/btowc.3 +++ b/locale/FreeBSD/btowc.3 @@ -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 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 index 039e86e..0000000 --- a/locale/FreeBSD/btowc.3.patch +++ /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 diff --git a/locale/FreeBSD/btowc.c b/locale/FreeBSD/btowc.c index 44b501e..38122e7 100644 --- a/locale/FreeBSD/btowc.c +++ b/locale/FreeBSD/btowc.c @@ -27,18 +27,21 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); +#include "xlocale_private.h" + #include #include #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 index b9a02cd..0000000 --- a/locale/FreeBSD/btowc.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/collate.c b/locale/FreeBSD/collate.c index 184fac6..268db3f 100644 --- a/locale/FreeBSD/collate.c +++ b/locale/FreeBSD/collate.c @@ -28,14 +28,26 @@ #include __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 #include #include +#include #include +#include #include #include #include +#include #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 index 8a08e16..0000000 --- a/locale/FreeBSD/collate.c.patch +++ /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 - __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 - #include - #include -+#include - #include -+#include - #include - #include - #include -+#include - #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 diff --git a/locale/FreeBSD/collate.h b/locale/FreeBSD/collate.h index a8d2176..f50baba 100644 --- a/locale/FreeBSD/collate.h +++ b/locale/FreeBSD/collate.h @@ -31,36 +31,90 @@ #define _COLLATE_H_ #include +#ifndef __LIBC__ #include +#endif /* !__LIBC__ */ #include #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 index 342a518..0000000 --- a/locale/FreeBSD/collate.h.patch +++ /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 -+#ifndef __LIBC__ - #include -+#endif /* !__LIBC__ */ - #include - - #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/collcmp.c b/locale/FreeBSD/collcmp.c index dde67a4..7f135bc 100644 --- a/locale/FreeBSD/collcmp.c +++ b/locale/FreeBSD/collcmp.c @@ -27,18 +27,20 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $"); -#include +#include +#include #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 index d985e29..0000000 --- a/locale/FreeBSD/collcmp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $"); - --#include -+#include -+#include - #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/ctype.3 b/locale/FreeBSD/ctype.3 index f3bbaa1..aa91313 100644 --- a/locale/FreeBSD/ctype.3 +++ b/locale/FreeBSD/ctype.3 @@ -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 index d43340c..0000000 --- a/locale/FreeBSD/ctype.3.patch +++ /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 , diff --git a/locale/FreeBSD/digittoint.3 b/locale/FreeBSD/digittoint.3 index e3a71dd..3e86f72 100644 --- a/locale/FreeBSD/digittoint.3 +++ b/locale/FreeBSD/digittoint.3 @@ -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 diff --git a/locale/FreeBSD/digittoint.3.patch b/locale/FreeBSD/digittoint.3.patch deleted file mode 100644 index 3bb6a14..0000000 --- a/locale/FreeBSD/digittoint.3.patch +++ /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 diff --git a/locale/FreeBSD/euc.c b/locale/FreeBSD/euc.c index 6ae525a..1b60aa3 100644 --- a/locale/FreeBSD/euc.c +++ b/locale/FreeBSD/euc.c @@ -41,6 +41,8 @@ static char sccsid[] = "@(#)euc.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -49,13 +51,11 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Ex #include #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 index 816b75b..0000000 --- a/locale/FreeBSD/euc.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -49,13 +51,11 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; - diff --git a/locale/FreeBSD/fix_grouping.c b/locale/FreeBSD/fix_grouping.c index ab08f3f..180c800 100644 --- a/locale/FreeBSD/fix_grouping.c +++ b/locale/FreeBSD/fix_grouping.c @@ -31,7 +31,8 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.8 2003/06/26 10:46:16 #include #include -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 index 43adfce..0000000 --- a/locale/FreeBSD/fix_grouping.c.patch +++ /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 - #include - --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); -+} diff --git a/locale/FreeBSD/gb18030.c b/locale/FreeBSD/gb18030.c index 67f2b0e..c63d050 100644 --- a/locale/FreeBSD/gb18030.c +++ b/locale/FreeBSD/gb18030.c @@ -32,6 +32,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -39,35 +41,34 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache #include #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 index 10f81f8..0000000 --- a/locale/FreeBSD/gb18030.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -39,35 +41,34 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; diff --git a/locale/FreeBSD/gb2312.c b/locale/FreeBSD/gb2312.c index 5f47bd0..a84b1cf 100644 --- a/locale/FreeBSD/gb2312.c +++ b/locale/FreeBSD/gb2312.c @@ -28,6 +28,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -35,34 +37,32 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache #include #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 index 7912ed0..0000000 --- a/locale/FreeBSD/gb2312.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -35,34 +37,32 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; - diff --git a/locale/FreeBSD/gbk.c b/locale/FreeBSD/gbk.c index 3b30f10..c38338b 100644 --- a/locale/FreeBSD/gbk.c +++ b/locale/FreeBSD/gbk.c @@ -34,6 +34,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -42,33 +44,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Ex #include #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 index df89765..0000000 --- a/locale/FreeBSD/gbk.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -42,33 +44,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; - diff --git a/locale/FreeBSD/isalnum.3 b/locale/FreeBSD/isalnum.3 index 85fb66b..961b9b3 100644 --- a/locale/FreeBSD/isalnum.3 +++ b/locale/FreeBSD/isalnum.3 @@ -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 index 0bb3f5a..0000000 --- a/locale/FreeBSD/isalnum.3.patch +++ /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 , diff --git a/locale/FreeBSD/isalpha.3 b/locale/FreeBSD/isalpha.3 index 7369cb5..3d9ad13 100644 --- a/locale/FreeBSD/isalpha.3 +++ b/locale/FreeBSD/isalpha.3 @@ -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 index 9263ce3..0000000 --- a/locale/FreeBSD/isalpha.3.patch +++ /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 , diff --git a/locale/FreeBSD/isblank.3 b/locale/FreeBSD/isblank.3 index bdba080..5a4aef2 100644 --- a/locale/FreeBSD/isblank.3 +++ b/locale/FreeBSD/isblank.3 @@ -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 index 1da0af0..0000000 --- a/locale/FreeBSD/isblank.3.patch +++ /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 diff --git a/locale/FreeBSD/iscntrl.3 b/locale/FreeBSD/iscntrl.3 index b12e912..bb7045d 100644 --- a/locale/FreeBSD/iscntrl.3 +++ b/locale/FreeBSD/iscntrl.3 @@ -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 index cbb58e0..0000000 --- a/locale/FreeBSD/iscntrl.3.patch +++ /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 diff --git a/locale/FreeBSD/isdigit.3 b/locale/FreeBSD/isdigit.3 index 587df33..0fffb88 100644 --- a/locale/FreeBSD/isdigit.3 +++ b/locale/FreeBSD/isdigit.3 @@ -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 index 0ddb02e..0000000 --- a/locale/FreeBSD/isdigit.3.patch +++ /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 diff --git a/locale/FreeBSD/isgraph.3 b/locale/FreeBSD/isgraph.3 index bc2ada6..f20973f 100644 --- a/locale/FreeBSD/isgraph.3 +++ b/locale/FreeBSD/isgraph.3 @@ -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 index 99180c0..0000000 --- a/locale/FreeBSD/isgraph.3.patch +++ /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 diff --git a/locale/FreeBSD/isideogram.3 b/locale/FreeBSD/isideogram.3 index 35d6718..9ee26b5 100644 --- a/locale/FreeBSD/isideogram.3 +++ b/locale/FreeBSD/isideogram.3 @@ -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 index 9d5ebc4..0000000 --- a/locale/FreeBSD/isideogram.3.patch +++ /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 diff --git a/locale/FreeBSD/islower.3 b/locale/FreeBSD/islower.3 index 889ece1..066d7d6 100644 --- a/locale/FreeBSD/islower.3 +++ b/locale/FreeBSD/islower.3 @@ -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 index 102cc14..0000000 --- a/locale/FreeBSD/islower.3.patch +++ /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 diff --git a/locale/FreeBSD/isphonogram.3 b/locale/FreeBSD/isphonogram.3 index 57a575a..39db048 100644 --- a/locale/FreeBSD/isphonogram.3 +++ b/locale/FreeBSD/isphonogram.3 @@ -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 index 10bff7a..0000000 --- a/locale/FreeBSD/isphonogram.3.patch +++ /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 diff --git a/locale/FreeBSD/isprint.3 b/locale/FreeBSD/isprint.3 index 70c1807..25ae0b5 100644 --- a/locale/FreeBSD/isprint.3 +++ b/locale/FreeBSD/isprint.3 @@ -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 index 4e71b97..0000000 --- a/locale/FreeBSD/isprint.3.patch +++ /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 diff --git a/locale/FreeBSD/ispunct.3 b/locale/FreeBSD/ispunct.3 index 1b47166..b4fcfa3 100644 --- a/locale/FreeBSD/ispunct.3 +++ b/locale/FreeBSD/ispunct.3 @@ -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 index d59803f..0000000 --- a/locale/FreeBSD/ispunct.3.patch +++ /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 diff --git a/locale/FreeBSD/isrune.3 b/locale/FreeBSD/isrune.3 index e474f3e..a98a159 100644 --- a/locale/FreeBSD/isrune.3 +++ b/locale/FreeBSD/isrune.3 @@ -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 index b268fac..0000000 --- a/locale/FreeBSD/isrune.3.patch +++ /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 diff --git a/locale/FreeBSD/isspace.3 b/locale/FreeBSD/isspace.3 index 46588ec..f6fa79a 100644 --- a/locale/FreeBSD/isspace.3 +++ b/locale/FreeBSD/isspace.3 @@ -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 index d1a8f9a..0000000 --- a/locale/FreeBSD/isspace.3.patch +++ /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 diff --git a/locale/FreeBSD/isspecial.3 b/locale/FreeBSD/isspecial.3 index f356b4a..0a0ab37 100644 --- a/locale/FreeBSD/isspecial.3 +++ b/locale/FreeBSD/isspecial.3 @@ -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 index d427920..0000000 --- a/locale/FreeBSD/isspecial.3.patch +++ /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 diff --git a/locale/FreeBSD/isupper.3 b/locale/FreeBSD/isupper.3 index 3d84bef..c3274c6 100644 --- a/locale/FreeBSD/isupper.3 +++ b/locale/FreeBSD/isupper.3 @@ -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 index 3cd6e29..0000000 --- a/locale/FreeBSD/isupper.3.patch +++ /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 diff --git a/locale/FreeBSD/iswalnum.3 b/locale/FreeBSD/iswalnum.3 index f50a1b5..d501ea9 100644 --- a/locale/FreeBSD/iswalnum.3 +++ b/locale/FreeBSD/iswalnum.3 @@ -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 index bedec9e..0000000 --- a/locale/FreeBSD/iswalnum.3.patch +++ /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 diff --git a/locale/FreeBSD/isxdigit.3 b/locale/FreeBSD/isxdigit.3 index 7315a65..b1c2faa 100644 --- a/locale/FreeBSD/isxdigit.3 +++ b/locale/FreeBSD/isxdigit.3 @@ -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 index 4c5e7f0..0000000 --- a/locale/FreeBSD/isxdigit.3.patch +++ /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 diff --git a/locale/FreeBSD/ldpart.c b/locale/FreeBSD/ldpart.c index 932165f..6a08e15 100644 --- a/locale/FreeBSD/ldpart.c +++ b/locale/FreeBSD/ldpart.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index ddfe6ea..0000000 --- a/locale/FreeBSD/ldpart.c.patch +++ /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 - __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 - #include -@@ -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); -+} diff --git a/locale/FreeBSD/ldpart.h b/locale/FreeBSD/ldpart.h index 02e0c95..938f735 100644 --- a/locale/FreeBSD/ldpart.h +++ b/locale/FreeBSD/ldpart.h @@ -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 index e15d894..0000000 --- a/locale/FreeBSD/ldpart.h.patch +++ /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_ */ diff --git a/locale/FreeBSD/lmessages.c b/locale/FreeBSD/lmessages.c index 488b572..2874ca6 100644 --- a/locale/FreeBSD/lmessages.c +++ b/locale/FreeBSD/lmessages.c @@ -27,7 +27,10 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $"); +#include "xlocale_private.h" + #include +#include #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 index 459c0ee..0000000 --- a/locale/FreeBSD/lmessages.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $"); - -+#include "xlocale_private.h" -+ - #include -+#include - - #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 */ diff --git a/locale/FreeBSD/lmessages.h b/locale/FreeBSD/lmessages.h index ee690ae..47f08a9 100644 --- a/locale/FreeBSD/lmessages.h +++ b/locale/FreeBSD/lmessages.h @@ -29,6 +29,8 @@ #ifndef _LMESSAGES_H_ #define _LMESSAGES_H_ +#include + 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 index 601ac82..0000000 --- a/locale/FreeBSD/lmessages.h.patch +++ /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 -+ - 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/lmonetary.c b/locale/FreeBSD/lmonetary.c index e3e7095..24091ea 100644 --- a/locale/FreeBSD/lmonetary.c +++ b/locale/FreeBSD/lmonetary.c @@ -27,14 +27,16 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $"); +#include "xlocale_private.h" + #include #include #include +#include #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 index 4014d5b..0000000 --- a/locale/FreeBSD/lmonetary.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -+#include - - #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 */ diff --git a/locale/FreeBSD/lmonetary.h b/locale/FreeBSD/lmonetary.h index e278ea5..b7c3d0f 100644 --- a/locale/FreeBSD/lmonetary.h +++ b/locale/FreeBSD/lmonetary.h @@ -29,6 +29,8 @@ #ifndef _LMONETARY_H_ #define _LMONETARY_H_ +#include + 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 index 826c1be..0000000 --- a/locale/FreeBSD/lmonetary.h.patch +++ /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 -+ - 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/lnumeric.c b/locale/FreeBSD/lnumeric.c index ff9c948..adfa25b 100644 --- a/locale/FreeBSD/lnumeric.c +++ b/locale/FreeBSD/lnumeric.c @@ -27,67 +27,103 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $"); +#include "xlocale_private.h" + #include +#include #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 index 50a02e5..0000000 --- a/locale/FreeBSD/lnumeric.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $"); - -+#include "xlocale_private.h" -+ - #include -+#include - - #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.h b/locale/FreeBSD/lnumeric.h index 9678c1f..e91835c 100644 --- a/locale/FreeBSD/lnumeric.h +++ b/locale/FreeBSD/lnumeric.h @@ -29,13 +29,15 @@ #ifndef _LNUMERIC_H_ #define _LNUMERIC_H_ +#include + 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 index 7635d21..0000000 --- a/locale/FreeBSD/lnumeric.h.patch +++ /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 -+ - 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/localeconv.3 b/locale/FreeBSD/localeconv.3 index 092f670..01df550 100644 --- a/locale/FreeBSD/localeconv.3 +++ b/locale/FreeBSD/localeconv.3 @@ -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 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 index 6a8e459..0000000 --- a/locale/FreeBSD/localeconv.3.patch +++ /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 diff --git a/locale/FreeBSD/localeconv.c b/locale/FreeBSD/localeconv.c index 919fd02..11afdb5 100644 --- a/locale/FreeBSD/localeconv.c +++ b/locale/FreeBSD/localeconv.c @@ -34,11 +34,71 @@ static char sccsid[] = "@(#)localeconv.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $"); +#include "xlocale_private.h" + +#include #include #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 index 393277f..0000000 --- a/locale/FreeBSD/localeconv.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $"); - -+#include "xlocale_private.h" -+ -+#include - #include - - #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()); - } diff --git a/locale/FreeBSD/mblen.3 b/locale/FreeBSD/mblen.3 index adfd58a..c3530e1 100644 --- a/locale/FreeBSD/mblen.3 +++ b/locale/FreeBSD/mblen.3 @@ -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 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 index 193f576..0000000 --- a/locale/FreeBSD/mblen.3.patch +++ /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 diff --git a/locale/FreeBSD/mblen.c b/locale/FreeBSD/mblen.c index 2891e90..f6bfa52 100644 --- a/locale/FreeBSD/mblen.c +++ b/locale/FreeBSD/mblen.c @@ -27,24 +27,32 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $"); +#include "xlocale_private.h" + #include #include #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 index 5d8f912..0000000 --- a/locale/FreeBSD/mblen.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/mblocal.h b/locale/FreeBSD/mblocal.h index c1a716d..f5d3fc1 100644 --- a/locale/FreeBSD/mblocal.h +++ b/locale/FreeBSD/mblocal.h @@ -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_ */ diff --git a/locale/FreeBSD/mblocal.h.patch b/locale/FreeBSD/mblocal.h.patch deleted file mode 100644 index ed7ca59..0000000 --- a/locale/FreeBSD/mblocal.h.patch +++ /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_ */ diff --git a/locale/FreeBSD/mbrlen.3 b/locale/FreeBSD/mbrlen.3 index ce33175..ca7be65 100644 --- a/locale/FreeBSD/mbrlen.3 +++ b/locale/FreeBSD/mbrlen.3 @@ -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 diff --git a/locale/FreeBSD/mbrlen.3.patch b/locale/FreeBSD/mbrlen.3.patch deleted file mode 100644 index 8bfba2d..0000000 --- a/locale/FreeBSD/mbrlen.3.patch +++ /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 diff --git a/locale/FreeBSD/mbrlen.c b/locale/FreeBSD/mbrlen.c index 33f7ea0..2f0227a 100644 --- a/locale/FreeBSD/mbrlen.c +++ b/locale/FreeBSD/mbrlen.c @@ -27,15 +27,23 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); +#include "xlocale_private.h" + #include #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 index 24365a7..0000000 --- a/locale/FreeBSD/mbrlen.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #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/mbrtowc.3 b/locale/FreeBSD/mbrtowc.3 index ab7138e..4066184 100644 --- a/locale/FreeBSD/mbrtowc.3 +++ b/locale/FreeBSD/mbrtowc.3 @@ -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 diff --git a/locale/FreeBSD/mbrtowc.3.patch b/locale/FreeBSD/mbrtowc.3.patch deleted file mode 100644 index 1b42524..0000000 --- a/locale/FreeBSD/mbrtowc.3.patch +++ /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 diff --git a/locale/FreeBSD/mbrtowc.c b/locale/FreeBSD/mbrtowc.c index 9b19d10..023c8b2 100644 --- a/locale/FreeBSD/mbrtowc.c +++ b/locale/FreeBSD/mbrtowc.c @@ -27,16 +27,24 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $"); +#include "xlocale_private.h" + #include #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 index 85053f4..0000000 --- a/locale/FreeBSD/mbrtowc.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #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/mbsinit.3 b/locale/FreeBSD/mbsinit.3 index e2a9e46..8dfa1bf 100644 --- a/locale/FreeBSD/mbsinit.3 +++ b/locale/FreeBSD/mbsinit.3 @@ -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 diff --git a/locale/FreeBSD/mbsinit.3.patch b/locale/FreeBSD/mbsinit.3.patch deleted file mode 100644 index 4d83a50..0000000 --- a/locale/FreeBSD/mbsinit.3.patch +++ /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 diff --git a/locale/FreeBSD/mbsinit.c b/locale/FreeBSD/mbsinit.c index cddb567..bbc2266 100644 --- a/locale/FreeBSD/mbsinit.c +++ b/locale/FreeBSD/mbsinit.c @@ -27,12 +27,21 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $"); +#include "xlocale_private.h" + #include #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 index 7635c85..0000000 --- a/locale/FreeBSD/mbsinit.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #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/mbsnrtowcs.c b/locale/FreeBSD/mbsnrtowcs.c index 3e65b15..41cdd86 100644 --- a/locale/FreeBSD/mbsnrtowcs.c +++ b/locale/FreeBSD/mbsnrtowcs.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 9b03c7c..0000000 --- a/locale/FreeBSD/mbsnrtowcs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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) { diff --git a/locale/FreeBSD/mbsrtowcs.3 b/locale/FreeBSD/mbsrtowcs.3 index dce9c78..ff6e699 100644 --- a/locale/FreeBSD/mbsrtowcs.3 +++ b/locale/FreeBSD/mbsrtowcs.3 @@ -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 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 index ad11bb0..0000000 --- a/locale/FreeBSD/mbsrtowcs.3.patch +++ /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 diff --git a/locale/FreeBSD/mbsrtowcs.c b/locale/FreeBSD/mbsrtowcs.c index 12feaab..da8b1e4 100644 --- a/locale/FreeBSD/mbsrtowcs.c +++ b/locale/FreeBSD/mbsrtowcs.c @@ -27,19 +27,27 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include #include #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 index 47831aa..0000000 --- a/locale/FreeBSD/mbsrtowcs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); - } diff --git a/locale/FreeBSD/mbstowcs.3 b/locale/FreeBSD/mbstowcs.3 index f710b8b..9e52e79 100644 --- a/locale/FreeBSD/mbstowcs.3 +++ b/locale/FreeBSD/mbstowcs.3 @@ -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 diff --git a/locale/FreeBSD/mbstowcs.3.patch b/locale/FreeBSD/mbstowcs.3.patch deleted file mode 100644 index 075f58b..0000000 --- a/locale/FreeBSD/mbstowcs.3.patch +++ /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 diff --git a/locale/FreeBSD/mbstowcs.c b/locale/FreeBSD/mbstowcs.c index 2de8792..80bc4fe 100644 --- a/locale/FreeBSD/mbstowcs.c +++ b/locale/FreeBSD/mbstowcs.c @@ -27,19 +27,29 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index f0834b0..0000000 --- a/locale/FreeBSD/mbstowcs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/mbtowc.3 b/locale/FreeBSD/mbtowc.3 index 9481c63..b4ec676 100644 --- a/locale/FreeBSD/mbtowc.3 +++ b/locale/FreeBSD/mbtowc.3 @@ -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 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 index 8bfdf86..0000000 --- a/locale/FreeBSD/mbtowc.3.patch +++ /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 diff --git a/locale/FreeBSD/mbtowc.c b/locale/FreeBSD/mbtowc.c index 5e3a368..aeb75b7 100644 --- a/locale/FreeBSD/mbtowc.c +++ b/locale/FreeBSD/mbtowc.c @@ -27,24 +27,33 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $"); +#include "xlocale_private.h" + #include #include #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 index daa1b84..0000000 --- a/locale/FreeBSD/mbtowc.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/mskanji.c b/locale/FreeBSD/mskanji.c index 609004d..3bf9a4d 100644 --- a/locale/FreeBSD/mskanji.c +++ b/locale/FreeBSD/mskanji.c @@ -39,6 +39,8 @@ static char sccsid[] = "@(#)mskanji.c 1.0 (Phase One) 5/5/95"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -47,33 +49,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ach #include #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 index 1399fa9..0000000 --- a/locale/FreeBSD/mskanji.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -47,33 +49,30 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; diff --git a/locale/FreeBSD/nextwctype.3 b/locale/FreeBSD/nextwctype.3 index aa6ba68..d2b959f 100644 --- a/locale/FreeBSD/nextwctype.3 +++ b/locale/FreeBSD/nextwctype.3 @@ -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 index 82fac93..0000000 --- a/locale/FreeBSD/nextwctype.3.patch +++ /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 diff --git a/locale/FreeBSD/nextwctype.c b/locale/FreeBSD/nextwctype.c index 89c63df..75e5056 100644 --- a/locale/FreeBSD/nextwctype.c +++ b/locale/FreeBSD/nextwctype.c @@ -27,28 +27,32 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include 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 index 4fb3399..0000000 --- a/locale/FreeBSD/nextwctype.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - - 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/nl_langinfo.3 b/locale/FreeBSD/nl_langinfo.3 index 1185739..3d846de 100644 --- a/locale/FreeBSD/nl_langinfo.3 +++ b/locale/FreeBSD/nl_langinfo.3 @@ -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 diff --git a/locale/FreeBSD/nl_langinfo.3.patch b/locale/FreeBSD/nl_langinfo.3.patch deleted file mode 100644 index d10c7b3..0000000 --- a/locale/FreeBSD/nl_langinfo.3.patch +++ /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 diff --git a/locale/FreeBSD/nl_langinfo.c b/locale/FreeBSD/nl_langinfo.c index 22d27a3..8a69f90 100644 --- a/locale/FreeBSD/nl_langinfo.c +++ b/locale/FreeBSD/nl_langinfo.c @@ -27,6 +27,8 @@ #include __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 #include #include @@ -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 index 7e05fb5..0000000 --- a/locale/FreeBSD/nl_langinfo.c.patch +++ /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 - __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 - #include - #include -@@ -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())); -+} diff --git a/locale/FreeBSD/none.c b/locale/FreeBSD/none.c index cc94e47..c3c75cf 100644 --- a/locale/FreeBSD/none.c +++ b/locale/FreeBSD/none.c @@ -37,6 +37,8 @@ static char sccsid[] = "@(#)none.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -47,39 +49,27 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache E #include #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 index 405e5fd..0000000 --- a/locale/FreeBSD/none.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -47,39 +49,27 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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; -- diff --git a/locale/FreeBSD/rune.c b/locale/FreeBSD/rune.c index e5ecfe8..5963761 100644 --- a/locale/FreeBSD/rune.c +++ b/locale/FreeBSD/rune.c @@ -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 __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 #include #include +#else +#include "runetype.h" +#endif /* !RUNEOFF32 */ #include +#ifndef RUNEOFF32 #include #include #include #include #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 +#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 index 402153d..0000000 --- a/locale/FreeBSD/rune.c.patch +++ /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 - __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 - #include - #include -+#else -+#include "runetype.h" -+#endif /* !RUNEOFF32 */ - #include -+#ifndef RUNEOFF32 - #include - #include - #include - #include - #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 -+#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/rune32.h b/locale/FreeBSD/rune32.h similarity index 50% rename from locale/rune32.h rename to locale/FreeBSD/rune32.h index 0a0661b..c3dfe30 100644 --- a/locale/rune32.h +++ b/locale/FreeBSD/rune32.h @@ -1,3 +1,8 @@ +/* + * 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[] = { diff --git a/locale/FreeBSD/runetype.c b/locale/FreeBSD/runetype.c index bb1bbc4..6ffcf72 100644 --- a/locale/FreeBSD/runetype.c +++ b/locale/FreeBSD/runetype.c @@ -33,20 +33,24 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $"); +#include "xlocale_private.h" + #include #include #include 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 index ef76217..0000000 --- a/locale/FreeBSD/runetype.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - - 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/setlocale.3 b/locale/FreeBSD/setlocale.3 index 1048ce9..6d3be03 100644 --- a/locale/FreeBSD/setlocale.3 +++ b/locale/FreeBSD/setlocale.3 @@ -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 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 index 195cf81..0000000 --- a/locale/FreeBSD/setlocale.3.patch +++ /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 diff --git a/locale/FreeBSD/setlocale.c b/locale/FreeBSD/setlocale.c index 9874849..9729e54 100644 --- a/locale/FreeBSD/setlocale.c +++ b/locale/FreeBSD/setlocale.c @@ -37,6 +37,8 @@ static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index b782cac..0000000 --- a/locale/FreeBSD/setlocale.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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) { diff --git a/locale/FreeBSD/setlocale.h b/locale/FreeBSD/setlocale.h index 82462ee..b21f6f7 100644 --- a/locale/FreeBSD/setlocale.h +++ b/locale/FreeBSD/setlocale.h @@ -29,12 +29,14 @@ #ifndef _SETLOCALE_H_ #define _SETLOCALE_H_ +#include + #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 index 95bb91f..0000000 --- a/locale/FreeBSD/setlocale.h.patch +++ /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 -+ - #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/setrunelocale.c b/locale/FreeBSD/setrunelocale.c index bf2b6d9..fbb2275 100644 --- a/locale/FreeBSD/setrunelocale.c +++ b/locale/FreeBSD/setrunelocale.c @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index ed607d0..0000000 --- a/locale/FreeBSD/setrunelocale.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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; diff --git a/locale/FreeBSD/table.c b/locale/FreeBSD/table.c index 874f415..667b846 100644 --- a/locale/FreeBSD/table.c +++ b/locale/FreeBSD/table.c @@ -36,13 +36,16 @@ static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93"; #include __FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index d7238e3..0000000 --- a/locale/FreeBSD/table.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/tolower.3 b/locale/FreeBSD/tolower.3 index 29515bb..0ac4aba 100644 --- a/locale/FreeBSD/tolower.3 +++ b/locale/FreeBSD/tolower.3 @@ -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 diff --git a/locale/FreeBSD/tolower.3.patch b/locale/FreeBSD/tolower.3.patch deleted file mode 100644 index b5cc733..0000000 --- a/locale/FreeBSD/tolower.3.patch +++ /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 diff --git a/locale/FreeBSD/tolower.c b/locale/FreeBSD/tolower.c index 968cb5a..298b321 100644 --- a/locale/FreeBSD/tolower.c +++ b/locale/FreeBSD/tolower.c @@ -32,22 +32,34 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); + +#include "xlocale_private.h" #include #include #include __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 index b40e942..0000000 --- a/locale/FreeBSD/tolower.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); -+ -+#include "xlocale_private.h" - - #include - #include - #include - - __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/toupper.3 b/locale/FreeBSD/toupper.3 index cf23d15..5b196a9 100644 --- a/locale/FreeBSD/toupper.3 +++ b/locale/FreeBSD/toupper.3 @@ -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 diff --git a/locale/FreeBSD/toupper.3.patch b/locale/FreeBSD/toupper.3.patch deleted file mode 100644 index c469626..0000000 --- a/locale/FreeBSD/toupper.3.patch +++ /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 diff --git a/locale/FreeBSD/toupper.c b/locale/FreeBSD/toupper.c index e160b39..d02ddd6 100644 --- a/locale/FreeBSD/toupper.c +++ b/locale/FreeBSD/toupper.c @@ -32,22 +32,34 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); + +#include "xlocale_private.h" #include #include #include __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 index aea5ad9..0000000 --- a/locale/FreeBSD/toupper.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); -+ -+#include "xlocale_private.h" - - #include - #include - #include - - __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/towlower.3 b/locale/FreeBSD/towlower.3 index b6968b7..248d5b1 100644 --- a/locale/FreeBSD/towlower.3 +++ b/locale/FreeBSD/towlower.3 @@ -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 diff --git a/locale/FreeBSD/towlower.3.patch b/locale/FreeBSD/towlower.3.patch deleted file mode 100644 index ecd8b5e..0000000 --- a/locale/FreeBSD/towlower.3.patch +++ /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 diff --git a/locale/FreeBSD/towupper.3 b/locale/FreeBSD/towupper.3 index 1d3763b..5df8bb0 100644 --- a/locale/FreeBSD/towupper.3 +++ b/locale/FreeBSD/towupper.3 @@ -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/towupper.3.patch b/locale/FreeBSD/towupper.3.patch deleted file mode 100644 index 77cbd8e..0000000 --- a/locale/FreeBSD/towupper.3.patch +++ /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/utf2-fbsd.c b/locale/FreeBSD/utf2.c similarity index 99% rename from locale/utf2-fbsd.c rename to locale/FreeBSD/utf2.c index 0e00131..d611aa8 100644 --- a/locale/utf2-fbsd.c +++ b/locale/FreeBSD/utf2.c @@ -24,6 +24,8 @@ * SUCH DAMAGE. */ +// MWW: Generated by applying utf2.c.patch to utf8.c in the FreeBSD patch sets. + #include __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $"); diff --git a/locale/FreeBSD/utf2.c.patch b/locale/FreeBSD/utf2.c.patch deleted file mode 100644 index ab2535e..0000000 --- a/locale/FreeBSD/utf2.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -35,62 +37,61 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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); - } diff --git a/locale/FreeBSD/utf8.c b/locale/FreeBSD/utf8.c index 9a9ffa9..97515df 100644 --- a/locale/FreeBSD/utf8.c +++ b/locale/FreeBSD/utf8.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -35,18 +37,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache E #include #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 index 9427108..0000000 --- a/locale/FreeBSD/utf8.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -35,18 +37,18 @@ __FBSDID("$FreeBSD: src/lib/libc/locale/ - #include - #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); - } diff --git a/locale/FreeBSD/wcrtomb.3 b/locale/FreeBSD/wcrtomb.3 index 432eddf..2b320a2 100644 --- a/locale/FreeBSD/wcrtomb.3 +++ b/locale/FreeBSD/wcrtomb.3 @@ -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 diff --git a/locale/FreeBSD/wcrtomb.3.patch b/locale/FreeBSD/wcrtomb.3.patch deleted file mode 100644 index 9042c9e..0000000 --- a/locale/FreeBSD/wcrtomb.3.patch +++ /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 diff --git a/locale/FreeBSD/wcrtomb.c b/locale/FreeBSD/wcrtomb.c index 4d7b115..81b99d4 100644 --- a/locale/FreeBSD/wcrtomb.c +++ b/locale/FreeBSD/wcrtomb.c @@ -27,15 +27,23 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $"); +#include "xlocale_private.h" + #include #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 index 0de3d6d..0000000 --- a/locale/FreeBSD/wcrtomb.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #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/wcsftime.3 b/locale/FreeBSD/wcsftime.3 index 5f29f39..b11967a 100644 --- a/locale/FreeBSD/wcsftime.3 +++ b/locale/FreeBSD/wcsftime.3 @@ -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 diff --git a/locale/FreeBSD/wcsftime.3.patch b/locale/FreeBSD/wcsftime.3.patch deleted file mode 100644 index 7a7d808..0000000 --- a/locale/FreeBSD/wcsftime.3.patch +++ /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 diff --git a/locale/FreeBSD/wcsftime.c b/locale/FreeBSD/wcsftime.c index 40f3c6c..ddf989a 100644 --- a/locale/FreeBSD/wcsftime.c +++ b/locale/FreeBSD/wcsftime.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 02c81ea..0000000 --- a/locale/FreeBSD/wcsftime.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcsnrtombs.c b/locale/FreeBSD/wcsnrtombs.c index 89cd9b7..adc29a1 100644 --- a/locale/FreeBSD/wcsnrtombs.c +++ b/locale/FreeBSD/wcsnrtombs.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index e4ba34b..0000000 --- a/locale/FreeBSD/wcsnrtombs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); - } diff --git a/locale/FreeBSD/wcsrtombs.3 b/locale/FreeBSD/wcsrtombs.3 index b38f3a4..0848655 100644 --- a/locale/FreeBSD/wcsrtombs.3 +++ b/locale/FreeBSD/wcsrtombs.3 @@ -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 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 index 6cd7335..0000000 --- a/locale/FreeBSD/wcsrtombs.3.patch +++ /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 diff --git a/locale/FreeBSD/wcsrtombs.c b/locale/FreeBSD/wcsrtombs.c index 61e5432..483b862 100644 --- a/locale/FreeBSD/wcsrtombs.c +++ b/locale/FreeBSD/wcsrtombs.c @@ -27,19 +27,27 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include #include #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 index ff0e290..0000000 --- a/locale/FreeBSD/wcsrtombs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); - } diff --git a/locale/FreeBSD/wcstod.3 b/locale/FreeBSD/wcstod.3 index e63a2c8..9595d07 100644 --- a/locale/FreeBSD/wcstod.3 +++ b/locale/FreeBSD/wcstod.3 @@ -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 diff --git a/locale/FreeBSD/wcstod.3.patch b/locale/FreeBSD/wcstod.3.patch deleted file mode 100644 index 2b7bdca..0000000 --- a/locale/FreeBSD/wcstod.3.patch +++ /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 diff --git a/locale/FreeBSD/wcstod.c b/locale/FreeBSD/wcstod.c index da90f16..3ecc75a 100644 --- a/locale/FreeBSD/wcstod.c +++ b/locale/FreeBSD/wcstod.c @@ -27,9 +27,31 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include +#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 index 9cab53b..0000000 --- a/locale/FreeBSD/wcstod.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -+#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()); -+} diff --git a/locale/FreeBSD/wcstof.c b/locale/FreeBSD/wcstof.c index a68b382..f2a6373 100644 --- a/locale/FreeBSD/wcstof.c +++ b/locale/FreeBSD/wcstof.c @@ -27,44 +27,67 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include +#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 index 5ed6b1d..0000000 --- a/locale/FreeBSD/wcstof.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -+#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/wcstoimax.c b/locale/FreeBSD/wcstoimax.c index 53d52a9..9c3dc3d 100644 --- a/locale/FreeBSD/wcstoimax.c +++ b/locale/FreeBSD/wcstoimax.c @@ -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 #include #include @@ -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 index d904bca..0000000 --- a/locale/FreeBSD/wcstoimax.c.patch +++ /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 - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcstol.3 b/locale/FreeBSD/wcstol.3 index 306f223..89936c9 100644 --- a/locale/FreeBSD/wcstol.3 +++ b/locale/FreeBSD/wcstol.3 @@ -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 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 +.Fd #include +.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 index 2bd8b79..0000000 --- a/locale/FreeBSD/wcstol.3.patch +++ /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 -+.Fd #include -+.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.c b/locale/FreeBSD/wcstol.c index 7c2afbd..2509e55 100644 --- a/locale/FreeBSD/wcstol.c +++ b/locale/FreeBSD/wcstol.c @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 57ca1e1..0000000 --- a/locale/FreeBSD/wcstol.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcstold.c b/locale/FreeBSD/wcstold.c index c50ffbd..45222d8 100644 --- a/locale/FreeBSD/wcstold.c +++ b/locale/FreeBSD/wcstold.c @@ -27,44 +27,67 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include +#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 index 36fee1e..0000000 --- a/locale/FreeBSD/wcstold.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -+#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/wcstoll.c b/locale/FreeBSD/wcstoll.c index 9a019ff..af50ca8 100644 --- a/locale/FreeBSD/wcstoll.c +++ b/locale/FreeBSD/wcstoll.c @@ -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 #include #include @@ -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 index 867219a..0000000 --- a/locale/FreeBSD/wcstoll.c.patch +++ /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 - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcstombs.3 b/locale/FreeBSD/wcstombs.3 index 2ef8f27..24c4b61 100644 --- a/locale/FreeBSD/wcstombs.3 +++ b/locale/FreeBSD/wcstombs.3 @@ -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 diff --git a/locale/FreeBSD/wcstombs.3.patch b/locale/FreeBSD/wcstombs.3.patch deleted file mode 100644 index 3a606bb..0000000 --- a/locale/FreeBSD/wcstombs.3.patch +++ /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 diff --git a/locale/FreeBSD/wcstombs.c b/locale/FreeBSD/wcstombs.c index c7d5b67..a6d9ae3 100644 --- a/locale/FreeBSD/wcstombs.c +++ b/locale/FreeBSD/wcstombs.c @@ -27,19 +27,29 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index 749f439..0000000 --- a/locale/FreeBSD/wcstombs.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/wcstoul.c b/locale/FreeBSD/wcstoul.c index 5a5d643..1cad0f6 100644 --- a/locale/FreeBSD/wcstoul.c +++ b/locale/FreeBSD/wcstoul.c @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 44bbe1d..0000000 --- a/locale/FreeBSD/wcstoul.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcstoull.c b/locale/FreeBSD/wcstoull.c index 9700cde..474480e 100644 --- a/locale/FreeBSD/wcstoull.c +++ b/locale/FreeBSD/wcstoull.c @@ -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 #include #include @@ -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 index 5ec05f8..0000000 --- a/locale/FreeBSD/wcstoull.c.patch +++ /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 - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wcstoumax.c b/locale/FreeBSD/wcstoumax.c index 765bbfb..1b447b8 100644 --- a/locale/FreeBSD/wcstoumax.c +++ b/locale/FreeBSD/wcstoumax.c @@ -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 #include #include @@ -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 index d79d57c..0000000 --- a/locale/FreeBSD/wcstoumax.c.patch +++ /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 - #include - #include -@@ -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()); -+} diff --git a/locale/FreeBSD/wctob.c b/locale/FreeBSD/wctob.c index a8f0056..130d00d 100644 --- a/locale/FreeBSD/wctob.c +++ b/locale/FreeBSD/wctob.c @@ -27,19 +27,28 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index 485409f..0000000 --- a/locale/FreeBSD/wctob.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/wctomb.3 b/locale/FreeBSD/wctomb.3 index 1ecc876..33f6e37 100644 --- a/locale/FreeBSD/wctomb.3 +++ b/locale/FreeBSD/wctomb.3 @@ -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 diff --git a/locale/FreeBSD/wctomb.3.patch b/locale/FreeBSD/wctomb.3.patch deleted file mode 100644 index e35da9f..0000000 --- a/locale/FreeBSD/wctomb.3.patch +++ /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 diff --git a/locale/FreeBSD/wctomb.c b/locale/FreeBSD/wctomb.c index 701b3ca..0df7799 100644 --- a/locale/FreeBSD/wctomb.c +++ b/locale/FreeBSD/wctomb.c @@ -27,23 +27,31 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $"); +#include "xlocale_private.h" + #include #include #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 index 425812b..0000000 --- a/locale/FreeBSD/wctomb.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/wctrans.3 b/locale/FreeBSD/wctrans.3 index 0f2bc65..7cb0da6 100644 --- a/locale/FreeBSD/wctrans.3 +++ b/locale/FreeBSD/wctrans.3 @@ -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 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 index b294abb..0000000 --- a/locale/FreeBSD/wctrans.3.patch +++ /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 diff --git a/locale/FreeBSD/wctrans.c b/locale/FreeBSD/wctrans.c index a86e5c7..30ca5b9 100644 --- a/locale/FreeBSD/wctrans.c +++ b/locale/FreeBSD/wctrans.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 90808c4..0000000 --- a/locale/FreeBSD/wctrans.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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/wctype.3 b/locale/FreeBSD/wctype.3 index 16c3de9..5175972 100644 --- a/locale/FreeBSD/wctype.3 +++ b/locale/FreeBSD/wctype.3 @@ -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 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 index 07e69d2..0000000 --- a/locale/FreeBSD/wctype.3.patch +++ /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 diff --git a/locale/FreeBSD/wctype.c b/locale/FreeBSD/wctype.c index 2db1c9b..f94c133 100644 --- a/locale/FreeBSD/wctype.c +++ b/locale/FreeBSD/wctype.c @@ -27,21 +27,17 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); +#include "xlocale_private.h" + #include #include #include - -#undef iswctype -int -iswctype(wint_t wc, wctype_t charclass) -{ - - return (__istype(wc, charclass)); -} +#include 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 index f9c75ab..0000000 --- a/locale/FreeBSD/wctype.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -- --#undef iswctype --int --iswctype(wint_t wc, wctype_t charclass) --{ -- -- return (__istype(wc, charclass)); --} -+#include - - 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/wcwidth.3 b/locale/FreeBSD/wcwidth.3 index 026813f..4c014ce 100644 --- a/locale/FreeBSD/wcwidth.3 +++ b/locale/FreeBSD/wcwidth.3 @@ -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 diff --git a/locale/FreeBSD/wcwidth.3.patch b/locale/FreeBSD/wcwidth.3.patch deleted file mode 100644 index bc9dfc2..0000000 --- a/locale/FreeBSD/wcwidth.3.patch +++ /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 diff --git a/locale/FreeBSD/wcwidth.c b/locale/FreeBSD/wcwidth.c index 587862e..ae533e7 100644 --- a/locale/FreeBSD/wcwidth.c +++ b/locale/FreeBSD/wcwidth.c @@ -38,6 +38,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $"); +#include "xlocale_private.h" + #include #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 index 4f5e296..0000000 --- a/locale/FreeBSD/wcwidth.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - #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 index 56fcfd4..0000000 --- a/locale/Makefile.inc +++ /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 index e2b2b83..0000000 --- a/locale/ascii-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/ascii.c,v 1.1 2008/01/21 23:48:12 ache Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 12c88ba..0000000 --- a/locale/big5-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/big5.c,v 1.18 2007/10/13 16:28:21 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#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 index 50603f0..0000000 --- a/locale/big5.5 +++ /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 index 38122e7..0000000 --- a/locale/btowc-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/btowc.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index 39447a2..0000000 --- a/locale/btowc.3 +++ /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 index e48d7ca..0000000 --- a/locale/collate-fbsd.c +++ /dev/null @@ -1,954 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants - * 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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index f50baba..0000000 --- a/locale/collate.h +++ /dev/null @@ -1,123 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants - * 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 -#ifndef __LIBC__ -#include -#endif /* !__LIBC__ */ -#include - -#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 index 7f135bc..0000000 --- a/locale/collcmp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/collcmp.c,v 1.18 2005/02/27 14:54:23 phantom Exp $"); - -#include -#include -#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 index aa91313..0000000 --- a/locale/ctype.3 +++ /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 index 3e86f72..0000000 --- a/locale/digittoint.3 +++ /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 index 1b60aa3..0000000 --- a/locale/euc-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/euc.c,v 1.22 2007/10/13 16:28:21 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#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 index 9e5aafd..0000000 --- a/locale/euc.5 +++ /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 index 180c800..0000000 --- a/locale/fix_grouping-fbsd.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/fix_grouping.c,v 1.8 2003/06/26 10:46:16 phantom Exp $"); - -#include -#include -#include - -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 index c63d050..0000000 --- a/locale/gb18030-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/gb18030.c,v 1.8 2007/10/13 16:28:21 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#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 index f277ba1..0000000 --- a/locale/gb18030.5 +++ /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 index a84b1cf..0000000 --- a/locale/gb2312-fbsd.c +++ /dev/null @@ -1,157 +0,0 @@ -/*- - * Copyright (c) 2004 Tim J. Robbins. All rights reserved. - * Copyright (c) 2003 David Xu - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/gb2312.c,v 1.10 2007/10/13 16:28:21 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#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 index bfc08ae..0000000 --- a/locale/gb2312.5 +++ /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 index c38338b..0000000 --- a/locale/gbk-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/gbk.c,v 1.14 2007/10/13 16:28:21 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#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 index 8cd7f55..0000000 --- a/locale/gbk.5 +++ /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 index 961b9b3..0000000 --- a/locale/isalnum.3 +++ /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 index 3d9ad13..0000000 --- a/locale/isalpha.3 +++ /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 index 5e23aeb..0000000 --- a/locale/isascii.3 +++ /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 index 5a4aef2..0000000 --- a/locale/isblank.3 +++ /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 index bb7045d..0000000 --- a/locale/iscntrl.3 +++ /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 index 0fffb88..0000000 --- a/locale/isdigit.3 +++ /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 index f20973f..0000000 --- a/locale/isgraph.3 +++ /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 index 9ee26b5..0000000 --- a/locale/isideogram.3 +++ /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 index 066d7d6..0000000 --- a/locale/islower.3 +++ /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 index 39db048..0000000 --- a/locale/isphonogram.3 +++ /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 index 25ae0b5..0000000 --- a/locale/isprint.3 +++ /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 index b4fcfa3..0000000 --- a/locale/ispunct.3 +++ /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 index a98a159..0000000 --- a/locale/isrune.3 +++ /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 index f6fa79a..0000000 --- a/locale/isspace.3 +++ /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 index 0a0ab37..0000000 --- a/locale/isspecial.3 +++ /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 index c3274c6..0000000 --- a/locale/isupper.3 +++ /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 index d501ea9..0000000 --- a/locale/iswalnum.3 +++ /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 index b1c2faa..0000000 --- a/locale/isxdigit.3 +++ /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 index 6a08e15..0000000 --- a/locale/ldpart-fbsd.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 -#include - -#include -#include -#include -#include -#include -#include -#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 index 938f735..0000000 --- a/locale/ldpart.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 index 2874ca6..0000000 --- a/locale/lmessages-fbsd.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/lmessages.c,v 1.14 2003/06/26 10:46:16 phantom Exp $"); - -#include "xlocale_private.h" - -#include -#include - -#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 index 47f08a9..0000000 --- a/locale/lmessages.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 - -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 index 24091ea..0000000 --- a/locale/lmonetary-fbsd.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/lmonetary.c,v 1.19 2003/06/26 10:46:16 phantom Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -#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 index b7c3d0f..0000000 --- a/locale/lmonetary.h +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 - -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 index adfa25b..0000000 --- a/locale/lnumeric-fbsd.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/lnumeric.c,v 1.16 2003/06/26 10:46:16 phantom Exp $"); - -#include "xlocale_private.h" - -#include -#include - -#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 index e91835c..0000000 --- a/locale/lnumeric.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2000, 2001 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 - -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 index 11afdb5..0000000 --- a/locale/localeconv-fbsd.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2001 Alexey Zelkin - * 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 -__FBSDID("$FreeBSD: src/lib/libc/locale/localeconv.c,v 1.14 2007/12/12 07:43:23 phantom Exp $"); - -#include "xlocale_private.h" - -#include -#include - -#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 index 01df550..0000000 --- a/locale/localeconv.3 +++ /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 index f6bfa52..0000000 --- a/locale/mblen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mblen.c,v 1.9 2004/07/29 06:18:40 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index c3530e1..0000000 --- a/locale/mblen.3 +++ /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 index f5d3fc1..0000000 --- a/locale/mblocal.h +++ /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 - -/* - * 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 index 2f0227a..0000000 --- a/locale/mbrlen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbrlen.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#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 index ca7be65..0000000 --- a/locale/mbrlen.3 +++ /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 index 023c8b2..0000000 --- a/locale/mbrtowc-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbrtowc.c,v 1.7 2004/05/12 14:09:04 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#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 index 4066184..0000000 --- a/locale/mbrtowc.3 +++ /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 index bbc2266..0000000 --- a/locale/mbsinit-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbsinit.c,v 1.3 2004/05/12 14:09:04 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#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 index 8dfa1bf..0000000 --- a/locale/mbsinit.3 +++ /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 index 41cdd86..0000000 --- a/locale/mbsnrtowcs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbsnrtowcs.c,v 1.1 2004/07/21 10:54:57 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index da8b1e4..0000000 --- a/locale/mbsrtowcs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbsrtowcs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index ff6e699..0000000 --- a/locale/mbsrtowcs.3 +++ /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 index 80bc4fe..0000000 --- a/locale/mbstowcs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbstowcs.c,v 1.12 2009/01/15 18:53:52 rdivacky Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 9e52e79..0000000 --- a/locale/mbstowcs.3 +++ /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 index aeb75b7..0000000 --- a/locale/mbtowc-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mbtowc.c,v 1.11 2004/07/29 06:18:40 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index b4ec676..0000000 --- a/locale/mbtowc.3 +++ /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 index 3bf9a4d..0000000 --- a/locale/mskanji-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/mskanji.c,v 1.18 2007/10/13 16:28:22 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#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 index a6df939..0000000 --- a/locale/mskanji.5 +++ /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 index 28c63d2..0000000 --- a/locale/multibyte.3 +++ /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 index 75e5056..0000000 --- a/locale/nextwctype-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/nextwctype.c,v 1.1 2004/07/08 06:43:37 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index d2b959f..0000000 --- a/locale/nextwctype.3 +++ /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 index 8a69f90..0000000 --- a/locale/nl_langinfo-fbsd.c +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 2001, 2003 Alexey Zelkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 -#include -#include -#include -#include - -#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 index 3d846de..0000000 --- a/locale/nl_langinfo.3 +++ /dev/null @@ -1,109 +0,0 @@ -.\" Copyright (c) 2001 Alexey Zelkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index d193afd..0000000 --- a/locale/nomacros-fbsd.c +++ /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 index c3c75cf..0000000 --- a/locale/none-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/none.c,v 1.15 2007/10/13 16:28:22 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 5963761..0000000 --- a/locale/rune-fbsd.c +++ /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 -__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 -#include -#include -#else -#include "runetype.h" -#endif /* !RUNEOFF32 */ -#include -#ifndef RUNEOFF32 -#include -#include -#include -#include -#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 -#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/runetype-fbsd.c b/locale/runetype-fbsd.c deleted file mode 100644 index 6ffcf72..0000000 --- a/locale/runetype-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/runetype.c,v 1.14 2007/01/09 00:28:00 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 9729e54..0000000 --- a/locale/setlocale-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/setlocale.c,v 1.51 2007/01/09 00:28:00 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include /* for _PATH_LOCALE */ -#include -#include -#include -#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 index 6d3be03..0000000 --- a/locale/setlocale.3 +++ /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 index b21f6f7..0000000 --- a/locale/setlocale.h +++ /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 - -#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 index fbb2275..0000000 --- a/locale/setrunelocale-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/setrunelocale.c,v 1.51 2008/01/23 03:05:35 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 667b846..0000000 --- a/locale/table-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/table.c,v 1.28 2007/01/09 00:28:00 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 4df4474..0000000 --- a/locale/toascii.3 +++ /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 index 298b321..0000000 --- a/locale/tolower-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/tolower.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -__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 index 0ac4aba..0000000 --- a/locale/tolower.3 +++ /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 index d02ddd6..0000000 --- a/locale/toupper-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/toupper.c,v 1.13 2007/01/09 00:28:01 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -__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 index 5b196a9..0000000 --- a/locale/toupper.3 +++ /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 index 248d5b1..0000000 --- a/locale/towlower.3 +++ /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 index 5df8bb0..0000000 --- a/locale/towupper.3 +++ /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/utf8-fbsd.c b/locale/utf8-fbsd.c deleted file mode 100644 index 97515df..0000000 --- a/locale/utf8-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/utf8.c,v 1.16 2007/10/15 09:51:30 ache Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#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 index 6992565..0000000 --- a/locale/utf8.5 +++ /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 index 81b99d4..0000000 --- a/locale/wcrtomb-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcrtomb.c,v 1.8 2004/05/12 14:09:04 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#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 index 2b320a2..0000000 --- a/locale/wcrtomb.3 +++ /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 index ddf989a..0000000 --- a/locale/wcsftime-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcsftime.c,v 1.6 2009/01/15 20:45:59 rdivacky Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include - -/* - * 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 index b11967a..0000000 --- a/locale/wcsftime.3 +++ /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 index adc29a1..0000000 --- a/locale/wcsnrtombs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcsnrtombs.c,v 1.3 2005/02/12 08:45:12 stefanf Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index 483b862..0000000 --- a/locale/wcsrtombs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcsrtombs.c,v 1.6 2004/07/21 10:54:57 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index 0848655..0000000 --- a/locale/wcsrtombs.3 +++ /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 index 3ecc75a..0000000 --- a/locale/wcstod-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstod.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 9595d07..0000000 --- a/locale/wcstod.3 +++ /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 index f2a6373..0000000 --- a/locale/wcstof-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstof.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 9c3dc3d..0000000 --- a/locale/wcstoimax-fbsd.c +++ /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 -#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 -#include -#include -#include -#include - -/* - * 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 index 2509e55..0000000 --- a/locale/wcstol-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstol.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include - -/* - * 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 index 89936c9..0000000 --- a/locale/wcstol.3 +++ /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 -.Fd #include -.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 index 45222d8..0000000 --- a/locale/wcstold-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstold.c,v 1.4 2004/04/07 09:47:56 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index af50ca8..0000000 --- a/locale/wcstoll-fbsd.c +++ /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 -#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 -#include -#include -#include -#include - -/* - * 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 index a6d9ae3..0000000 --- a/locale/wcstombs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstombs.c,v 1.11 2009/01/15 18:53:52 rdivacky Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 24c4b61..0000000 --- a/locale/wcstombs.3 +++ /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 index 1cad0f6..0000000 --- a/locale/wcstoul-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcstoul.c,v 1.2 2007/01/09 00:28:01 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include - -/* - * 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 index 474480e..0000000 --- a/locale/wcstoull-fbsd.c +++ /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 -#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 -#include -#include -#include -#include - -/* - * 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 index 1b447b8..0000000 --- a/locale/wcstoumax-fbsd.c +++ /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 -#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 -#include -#include -#include -#include - -/* - * 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 index 130d00d..0000000 --- a/locale/wctob-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wctob.c,v 1.4 2004/05/12 14:26:54 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 0df7799..0000000 --- a/locale/wctomb-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wctomb.c,v 1.8 2004/07/29 06:18:40 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index 33f6e37..0000000 --- a/locale/wctomb.3 +++ /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 index 30ca5b9..0000000 --- a/locale/wctrans-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wctrans.c,v 1.3 2003/11/01 08:20:58 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 7cb0da6..0000000 --- a/locale/wctrans.3 +++ /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 index f94c133..0000000 --- a/locale/wctype-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wctype.c,v 1.4 2008/03/17 18:22:23 antoine Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -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 index 5175972..0000000 --- a/locale/wctype.3 +++ /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 index ae533e7..0000000 --- a/locale/wcwidth-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/locale/wcwidth.c,v 1.8 2007/01/09 00:28:01 imp Exp $"); - -#include "xlocale_private.h" - -#include - -#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 index 4c014ce..0000000 --- a/locale/wcwidth.3 +++ /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 . diff --git a/locale/xlocale.c b/locale/xlocale.c index c0fa5af..e5db93f 100644 --- a/locale/xlocale.c +++ b/locale/xlocale.c @@ -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 index 70570d2..0000000 --- a/makeCombos +++ /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{$_}; -} diff --git a/man/FreeBSD/stdarg.3 b/man/FreeBSD/stdarg.3 index 775d186..f83aeb7 100644 --- a/man/FreeBSD/stdarg.3 +++ b/man/FreeBSD/stdarg.3 @@ -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 index 882936f..0000000 --- a/man/FreeBSD/stdarg.3.patch +++ /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 index a084c75..0000000 --- a/man/Makefile.inc +++ /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 index 0000000..c009e78 --- /dev/null +++ b/man/manpages.lst @@ -0,0 +1,423 @@ +# manpage tables +# [ ...] + +# 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 index f83aeb7..0000000 --- a/man/stdarg.3 +++ /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 . diff --git a/net/FreeBSD/inet.3 b/net/FreeBSD/inet.3 index 1211e53..a679b74 100644 --- a/net/FreeBSD/inet.3 +++ b/net/FreeBSD/inet.3 @@ -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 +.Fd #include +.Fd #include +.Fd #include +.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 index 8f84aa0..0000000 --- a/net/FreeBSD/inet.3.patch +++ /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 -+.Fd #include -+.Fd #include -+.Fd #include -+.Pp -+These include files are necessary for all functions. - .Sh SEE ALSO - .Xr byteorder 3 , - .Xr getaddrinfo 3 , diff --git a/net/FreeBSD/inet_addr.c b/net/FreeBSD/inet_addr.c index a4daa3a..e965417 100644 --- a/net/FreeBSD/inet_addr.c +++ b/net/FreeBSD/inet_addr.c @@ -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 __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 . diff --git a/net/FreeBSD/inet_addr.c.patch b/net/FreeBSD/inet_addr.c.patch deleted file mode 100644 index 79d1c20..0000000 --- a/net/FreeBSD/inet_addr.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/inet/inet_addr.c,v 1.4 2007/06/03 17:20:26 ume Exp $"); - diff --git a/net/FreeBSD/inet_net.3 b/net/FreeBSD/inet_net.3 index 201100c..469ebad 100644 --- a/net/FreeBSD/inet_net.3 +++ b/net/FreeBSD/inet_net.3 @@ -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 +.Fd #include +.Fd #include +.Fd #include +.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 index 775bbc3..0000000 --- a/net/FreeBSD/inet_net.3.patch +++ /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 -+.Fd #include -+.Fd #include -+.Fd #include -+.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_pton.c b/net/FreeBSD/inet_net_pton.c index 1169e1e..4493011 100644 --- a/net/FreeBSD/inet_net_pton.c +++ b/net/FreeBSD/inet_net_pton.c @@ -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 __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 index 3e4dfbb..0000000 --- a/net/FreeBSD/inet_net_pton.c.patch +++ /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 - __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_network.c b/net/FreeBSD/inet_network.c index ec8b835..081a1cf 100644 --- a/net/FreeBSD/inet_network.c +++ b/net/FreeBSD/inet_network.c @@ -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 __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 index 26bac02..0000000 --- a/net/FreeBSD/inet_network.c.patch +++ /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 - __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_ntoa.c b/net/FreeBSD/inet_ntoa.c index 0c189e5..00ee7e1 100644 --- a/net/FreeBSD/inet_ntoa.c +++ b/net/FreeBSD/inet_ntoa.c @@ -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 index 6fa50b4..0000000 --- a/net/FreeBSD/inet_ntoa.c.patch +++ /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, diff --git a/net/FreeBSD/nsap_addr.c b/net/FreeBSD/nsap_addr.c index fd34e0e..5bf73e5 100644 --- a/net/FreeBSD/nsap_addr.c +++ b/net/FreeBSD/nsap_addr.c @@ -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 __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 #include -#include +//#include #include "port_after.h" +#include + 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 index de8ca81..0000000 --- a/net/FreeBSD/nsap_addr.c.patch +++ /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 - __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 - #include --#include -+//#include - - #include "port_after.h" - -+#include -+ - 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/recv.c b/net/FreeBSD/recv.c index 8e3945c..a8c5fca 100644 --- a/net/FreeBSD/recv.c +++ b/net/FreeBSD/recv.c @@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/recv.c,v 1.4 2007/01/09 00:28:02 imp Exp $" #include #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 index 9a771dd..0000000 --- a/net/FreeBSD/recv.c.patch +++ /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 - #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/send.c b/net/FreeBSD/send.c index f6ed904..eeb3fa9 100644 --- a/net/FreeBSD/send.c +++ b/net/FreeBSD/send.c @@ -40,11 +40,21 @@ __FBSDID("$FreeBSD: src/lib/libc/net/send.c,v 1.4 2007/01/09 00:28:02 imp Exp $" #include #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 index cf534bf..0000000 --- a/net/FreeBSD/send.c.patch +++ /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 - #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/sockatmark.3 b/net/FreeBSD/sockatmark.3 index 0bb8745..0c09189 100644 --- a/net/FreeBSD/sockatmark.3 +++ b/net/FreeBSD/sockatmark.3 @@ -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 index 30d36cf..0000000 --- a/net/FreeBSD/sockatmark.3.patch +++ /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 diff --git a/net/FreeBSD/sourcefilter.3 b/net/FreeBSD/sourcefilter.3 index 1739db5..081dfa3 100644 --- a/net/FreeBSD/sourcefilter.3 +++ b/net/FreeBSD/sourcefilter.3 @@ -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 index 9afa891..0000000 --- a/net/FreeBSD/sourcefilter.3.patch +++ /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 diff --git a/net/FreeBSD/sourcefilter.c b/net/FreeBSD/sourcefilter.c index c3d07c6..a5a3cca 100644 --- a/net/FreeBSD/sourcefilter.c +++ b/net/FreeBSD/sourcefilter.c @@ -27,6 +27,9 @@ #include __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 @@ -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 index 0eeba36..0000000 --- a/net/FreeBSD/sourcefilter.c.patch +++ /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 - __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 -@@ -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 index 021f62c..0000000 --- a/net/Makefile.inc +++ /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 index 346d48e..0000000 --- a/net/addr2ascii-fbsd.c +++ /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 index 1a9716a..0000000 --- a/net/addr2ascii.3 +++ /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 index bbe3e8a..0000000 --- a/net/ascii2addr-fbsd.c +++ /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 index a679b74..0000000 --- a/net/inet.3 +++ /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 -.Fd #include -.Fd #include -.Fd #include -.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 index 6ad6f96..0000000 --- a/net/inet_addr-fbsd.c +++ /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 -__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 -#include - -#include -#include - -#include - -#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 . - */ -#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 index 63a9274..0000000 --- a/net/inet_lnaof-fbsd.c +++ /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 index d695f22..0000000 --- a/net/inet_makeaddr-fbsd.c +++ /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 index 469ebad..0000000 --- a/net/inet_net.3 +++ /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 -.Fd #include -.Fd #include -.Fd #include -.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 index 2d504f3..0000000 --- a/net/inet_net_ntop-fbsd.c +++ /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 index 4493011..0000000 --- a/net/inet_net_pton-fbsd.c +++ /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 -__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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#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 . - */ -#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 index e6bea35..0000000 --- a/net/inet_neta-fbsd.c +++ /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 index c926efc..0000000 --- a/net/inet_netof-fbsd.c +++ /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 index 081a1cf..0000000 --- a/net/inet_network-fbsd.c +++ /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 -__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 -#include -#include -#include - -#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 . - */ -#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 index 00ee7e1..0000000 --- a/net/inet_ntoa-fbsd.c +++ /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 -__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 -#include -#include -#include - -#include -#include - -#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 . - */ -#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 index 47b6dd0..0000000 --- a/net/linkaddr-fbsd.c +++ /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 index f4e564f..0000000 --- a/net/linkaddr.3 +++ /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 index 5bf73e5..0000000 --- a/net/nsap_addr-fbsd.c +++ /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 -__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 -#include -#include - -#include -#include -#include - -#include -#include -//#include - -#include "port_after.h" - -#include - -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 . - */ -#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 index a8c5fca..0000000 --- a/net/recv-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/net/recv.c,v 1.4 2007/01/09 00:28:02 imp Exp $"); - -#include "namespace.h" -#include -#include - -#include -#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 index eeb3fa9..0000000 --- a/net/send-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/net/send.c,v 1.4 2007/01/09 00:28:02 imp Exp $"); - -#include "namespace.h" -#include -#include - -#include -#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 index bcccd5c..0000000 --- a/net/sockatmark-fbsd.c +++ /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 index 0c09189..0000000 --- a/net/sockatmark.3 +++ /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 -\&... -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 index a5a3cca..0000000 --- a/net/sourcefilter-fbsd.c +++ /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 -__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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#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 index 081dfa3..0000000 --- a/net/sourcefilter.3 +++ /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 diff --git a/nls/FreeBSD/msgcat.c b/nls/FreeBSD/msgcat.c index 0ce69e0..542368e 100644 --- a/nls/FreeBSD/msgcat.c +++ b/nls/FreeBSD/msgcat.c @@ -45,16 +45,22 @@ __FBSDID("$FreeBSD: src/lib/libc/nls/msgcat.c,v 1.49 2005/02/01 16:04:55 phantom #include #include #include -#include +#include #include #include #include #include #include +#include +#include #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 index f62f2d7..0000000 --- a/nls/FreeBSD/msgcat.c.patch +++ /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 - #include - #include --#include -+#include - #include - #include - #include - #include - #include -+#include -+#include - #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); diff --git a/nls/FreeBSD/msgcat.h b/nls/FreeBSD/msgcat.h index 0a8b788..1e9f1a0 100644 --- a/nls/FreeBSD/msgcat.h +++ b/nls/FreeBSD/msgcat.h @@ -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 index 31303e4..0000000 --- a/nls/FreeBSD/msgcat.h.patch +++ /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 index 076ebc2..0000000 --- a/nls/Makefile.inc +++ /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 index 5f1c02f..0000000 --- a/nls/catclose.3 +++ /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 index 06d6838..0000000 --- a/nls/catgets.3 +++ /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 index 9c44bf2..0000000 --- a/nls/catopen.3 +++ /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 index f65dd93..0000000 --- a/nls/msgcat-fbsd.c +++ /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 -__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 -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 1e9f1a0..0000000 --- a/nls/msgcat.h +++ /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/posix1e/Makefile.inc b/posix1e/Makefile.inc deleted file mode 100644 index da2d99a..0000000 --- a/posix1e/Makefile.inc +++ /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 diff --git a/posix1e/acl_translate.c b/posix1e/acl_translate.c index 41bbe21..527f686 100644 --- a/posix1e/acl_translate.c +++ b/posix1e/acl_translate.c @@ -443,7 +443,7 @@ acl_from_text(const char *buf_p) /* field 2: */ 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 index 4c17c1c..0000000 --- a/ppc/gen/Makefile.inc +++ /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 index 76e6a0a..0000000 --- a/ppc/gen/_ctx_start.S +++ /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 - -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 index ca06fb5..0000000 --- a/ppc/gen/_setcontext.S +++ /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 - -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 index d9c94e1..0000000 --- a/ppc/gen/abs.s +++ /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 -#include - -/* 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 index 52e75f2..0000000 --- a/ppc/gen/assymdefs.c +++ /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 -#define __TARGET_ARCHITECTURE__ "ppc" -#import -#import -#import -#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 index 8464507..0000000 --- a/ppc/gen/fp.h +++ /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 index ac6afca..0000000 --- a/ppc/gen/genassym.c +++ /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 -#import -#import -#import - -#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 index 4097703..0000000 --- a/ppc/gen/genassym.h +++ /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 -#import - -#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) ¯o); \ -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 index 81a76a9..0000000 --- a/ppc/gen/getcontext.S +++ /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 - -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 index ee90fe3..0000000 --- a/ppc/gen/getmcontext.c +++ /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 -#include -#include -#include -#include -#include - -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 index d584a85..0000000 --- a/ppc/gen/icacheinval.s +++ /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 - -/* 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 index 32abbb2..0000000 --- a/ppc/gen/makecontext.c +++ /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 -#include - -#include -#include -#include -#include -#include -#include - -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 index 3b0daaa..0000000 --- a/ppc/gen/mcount.s +++ /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 - -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 index 6b9db08..0000000 --- a/ppc/gen/setcontext.c +++ /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 - -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/swapcontext.c b/ppc/gen/swapcontext.c deleted file mode 100644 index 047bef1..0000000 --- a/ppc/gen/swapcontext.c +++ /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 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the 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 -#include -#include -#include - -#include -#include - -#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 index 0b7a3fc..0000000 --- a/ppc/pthreads/Makefile.inc +++ /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 index 2152993..0000000 --- a/ppc/pthreads/get_cpu_capabilities.s +++ /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 -#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 index d94a6da..0000000 --- a/ppc/pthreads/init_cpu_capabilities.c +++ /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 -#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 index 41bb4f1..0000000 --- a/ppc/pthreads/pthread_getspecific.s +++ /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 -#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 index a0c3748..0000000 --- a/ppc/pthreads/pthread_self.s +++ /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 -#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 index 1396201..0000000 --- a/ppc/pthreads/pthread_set_self.s +++ /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 index 076c4cc..0000000 --- a/ppc/stdlib/gdtoa.mk +++ /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 index 3b336bf..0000000 --- a/ppc/string/Makefile.inc +++ /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 index df9de1a..0000000 --- a/ppc/string/bcopy.s +++ /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 -#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 index b8c2aba..0000000 --- a/ppc/string/bzero.s +++ /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 -#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 - - - .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 index ece1d15..0000000 --- a/ppc/string/ffs.s +++ /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 index 7a6eae4..0000000 --- a/ppc/string/ffsl.s +++ /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 - -.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/flsl.s b/ppc/string/flsl.s deleted file mode 100644 index 709a868..0000000 --- a/ppc/string/flsl.s +++ /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 - -.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 index b98cbf2..0000000 --- a/ppc/string/memcmp.s +++ /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 -#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 - - -// *************** *********** -// * 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 index 706167c..0000000 --- a/ppc/string/memset.s +++ /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 - -/* 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 - - - .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 index ef7c94e..0000000 --- a/ppc/string/strcat.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// *************** -// * 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 index 2cfddfa..0000000 --- a/ppc/string/strcmp.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// *************** -// * 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 index 0f73ebf..0000000 --- a/ppc/string/strcpy.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// *************** -// * 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 index 7f56026..0000000 --- a/ppc/string/strlcat.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// ***************** -// * 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 index 081a629..0000000 --- a/ppc/string/strlcpy.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// ***************** -// * 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 index e967925..0000000 --- a/ppc/string/strlen.s +++ /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 - -#include - -#define __APPLE_API_PRIVATE -#include -#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 index 04690b2..0000000 --- a/ppc/string/strncat.s +++ /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 -#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 - -#define __APPLE_API_PRIVATE -#include -#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 index 7ada490..0000000 --- a/ppc/string/strncmp.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// ***************** -// * 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 index eac7a6b..0000000 --- a/ppc/string/strncpy.s +++ /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 -#undef ASSEMBLER - -#define __APPLE_API_PRIVATE -#include -#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 - - -// ***************** -// * 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 index 48349ed..0000000 --- a/ppc/sys/Makefile.inc +++ /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 index 24858e9..0000000 --- a/ppc/sys/OSAtomic.s +++ /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 -#undef __APPLE_API_PRIVATE - -#include - - -/* These are the functions in . - * 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 index e82f09f..0000000 --- a/ppc/sys/_longjmp.s +++ /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 - -#include "_setjmp.h" - -#define __APPLE_API_PRIVATE -#include -#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 index 68fb686..0000000 --- a/ppc/sys/_setjmp.h +++ /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 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 index 66d6b0b..0000000 --- a/ppc/sys/_setjmp.s +++ /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 - -#define __APPLE_API_PRIVATE -#include -#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 index 92be538..0000000 --- a/ppc/sys/_sigtramp.s +++ /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 -#include - -#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 index b775137..0000000 --- a/ppc/sys/ldbl64.s +++ /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 - -#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 index 44ef495..0000000 --- a/ppc/sys/longjmp.s +++ /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 - -#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 index 2cd0ea9..0000000 --- a/ppc/sys/ppc_gettimeofday.s +++ /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 - -#define __APPLE_API_PRIVATE -#include -#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 index ef338db..0000000 --- a/ppc/sys/setjmp.s +++ /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 - -#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 index e2d2966..0000000 --- a/ppc64/gen/Makefile.inc +++ /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 index 4fafcf6..0000000 --- a/ppc64/pthreads/Makefile.inc +++ /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 index 45d833c..0000000 --- a/ppc64/pthreads/pthread_getspecific_64.s +++ /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 -#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/stdlib/gdtoa.mk b/ppc64/stdlib/gdtoa.mk deleted file mode 100644 index 242a70f..0000000 --- a/ppc64/stdlib/gdtoa.mk +++ /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 index 8b8fa87..0000000 --- a/ppc64/string/Makefile.inc +++ /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 index c5574a4..0000000 --- a/ppc64/sys/Makefile.inc +++ /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 index 5ba231c..0000000 --- a/pthreads/Makefile.inc +++ /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 - - diff --git a/pthreads/plockstat.d b/pthreads/plockstat.d index a0fdc84..0b6a5cc 100644 --- a/pthreads/plockstat.d +++ b/pthreads/plockstat.d @@ -1,4 +1,5 @@ -#include +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); diff --git a/pthreads/pthread.c b/pthreads/pthread.c index ef4527e..d6d116c 100644 --- a/pthreads/pthread.c +++ b/pthreads/pthread.c @@ -71,6 +71,7 @@ #if defined(__ppc__) #include #endif +#include /* 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); diff --git a/pthreads/pthread_cancelable.c b/pthreads/pthread_cancelable.c index 06d1bd1..809eb00 100644 --- a/pthreads/pthread_cancelable.c +++ b/pthreads/pthread_cancelable.c @@ -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() diff --git a/pthreads/pthread_cond.c b/pthreads/pthread_cond.c index b0e881f..055956f 100644 --- a/pthreads/pthread_cond.c +++ b/pthreads/pthread_cond.c @@ -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_ diff --git a/pthreads/pthread_internals.h b/pthreads/pthread_internals.h index a74a94c..3a8b772 100644 --- a/pthreads/pthread_internals.h +++ b/pthreads/pthread_internals.h @@ -63,6 +63,7 @@ typedef struct _pthread_attr_t pthread_attr_t; #include #include #include +#include #include #include #include @@ -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. diff --git a/pthreads/pthread_machdep.h b/pthreads/pthread_machdep.h index 4e4d71b..001a8ae 100644 --- a/pthreads/pthread_machdep.h +++ b/pthreads/pthread_machdep.h @@ -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 #endif #include +#include /* ** Define macros for inline pthread_getspecific() usage. @@ -98,27 +99,27 @@ /* 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 @@ -175,6 +176,8 @@ #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 diff --git a/pthreads/pthread_mutex.c b/pthreads/pthread_mutex.c index 53465b5..51e4605 100644 --- a/pthreads/pthread_mutex.c +++ b/pthreads/pthread_mutex.c @@ -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); diff --git a/pthreads/pthread_rwlock.c b/pthreads/pthread_rwlock.c index 3920969..75c6a39 100644 --- a/pthreads/pthread_rwlock.c +++ b/pthreads/pthread_rwlock.c @@ -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_ diff --git a/pthreads/pthread_workqueue.h b/pthreads/pthread_workqueue.h index f8c3158..20edf50 100644 --- a/pthreads/pthread_workqueue.h +++ b/pthreads/pthread_workqueue.h @@ -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 */ diff --git a/pthreads/thread_setup.c b/pthreads/thread_setup.c index 2f6c9d5..d2985df 100644 --- a/pthreads/thread_setup.c +++ b/pthreads/thread_setup.c @@ -51,7 +51,7 @@ #if defined(__ppc__) || defined(__ppc64__) #include -#elif defined(__arm__) +#elif defined(__arm__) #include #endif diff --git a/regex/FreeBSD/cclass.h b/regex/FreeBSD/cclass.h deleted file mode 100644 index 956a655..0000000 --- a/regex/FreeBSD/cclass.h +++ /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, } -}; diff --git a/regex/FreeBSD/cname.h b/regex/FreeBSD/cname.h index 19b4ddb..26355e8 100644 --- a/regex/FreeBSD/cname.h +++ b/regex/FreeBSD/cname.h @@ -35,104 +35,106 @@ */ /* 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 index 2e6b31f..0000000 --- a/regex/FreeBSD/cname.h.patch +++ /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 index feae5c5..0000000 --- a/regex/FreeBSD/engine.c +++ /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 -__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®_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®_NOSUB) - nmatch = 0; - if (eflags®_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®_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®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OEOL: - if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OBOW: - if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_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®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_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®_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 index ebf6da2..0000000 --- a/regex/FreeBSD/engine.c.patch +++ /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®_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®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_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 */ diff --git a/regex/FreeBSD/re_format.7 b/regex/FreeBSD/re_format.7 index 5109e93..cf3cbc0 100644 --- a/regex/FreeBSD/re_format.7 +++ b/regex/FreeBSD/re_format.7 @@ -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 index 6691eec..0000000 --- a/regex/FreeBSD/regcomp.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 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®_EXTENDED) && (cflags®_NOSPEC)) - return(REG_INVARG); - - if (cflags®_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®_EXTENDED) - p_ere(p, OUT); - else if (cflags®_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®_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<g->cflags®_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®_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®_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®_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<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<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 index 4dcf2cd..0000000 --- a/regex/FreeBSD/regcomp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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®_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®_ICASE) && iswalpha(ch) && othercase(ch) != ch) -+ if ((p->g->cflags®_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; - } diff --git a/regex/FreeBSD/regerror.c b/regex/FreeBSD/regerror.c index 9364bd4..a22066c 100644 --- a/regex/FreeBSD/regerror.c +++ b/regex/FreeBSD/regerror.c @@ -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 index 0b7c53b..0000000 --- a/regex/FreeBSD/regerror.c.patch +++ /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) diff --git a/regex/FreeBSD/regex.3 b/regex/FreeBSD/regex.3 index f848d66..e0a0321 100644 --- a/regex/FreeBSD/regex.3 +++ b/regex/FreeBSD/regex.3 @@ -32,35 +32,134 @@ .\" @(#)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 index ec526a2..0000000 --- a/regex/FreeBSD/regex.3.patch +++ /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 index 13bbf64..0000000 --- a/regex/FreeBSD/regex2.h +++ /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<= 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 index ec20caa..0000000 --- a/regex/FreeBSD/regex2.h.patch +++ /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 index 4bc04ae..0000000 --- a/regex/FreeBSD/regexec.c +++ /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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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®_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 index 409ee17..0000000 --- a/regex/FreeBSD/regexec.c.patch +++ /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 - __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®_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 index aa795fa..0000000 --- a/regex/FreeBSD/regfree.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regfree.c,v 1.8 2007/06/11 03:05:54 delphij Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#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 index f4744e0..0000000 --- a/regex/FreeBSD/regfree.c.patch +++ /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 index 2c5523a..0000000 --- a/regex/Makefile.inc +++ /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 index 0000000..6ea54fe --- /dev/null +++ b/regex/TRE/config.h @@ -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 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 header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the 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 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 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 header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the 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 header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the 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 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 + +/* 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 index 0000000..7860277 --- /dev/null +++ b/regex/TRE/lib/regcomp.c @@ -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 +#endif /* HAVE_CONFIG_H */ + +#include +#include +#include + +#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 index 0000000..89229fe --- /dev/null +++ b/regex/TRE/lib/regexec.c @@ -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 +#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 +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif +#endif /* TRE_USE_ALLOCA */ + +#include +#include +#include +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ +#ifdef HAVE_WCTYPE_H +#include +#endif /* HAVE_WCTYPE_H */ +#ifndef TRE_WCHAR +#include +#endif /* !TRE_WCHAR */ +#ifdef HAVE_MALLOC_H +#include +#endif /* HAVE_MALLOC_H */ +#include + +#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 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(¶ms); + 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 index 0000000..12f8cdc --- /dev/null +++ b/regex/TRE/lib/tre-ast.c @@ -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 +#endif /* HAVE_CONFIG_H */ +#include + +#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 index 0000000..3c10b0b --- /dev/null +++ b/regex/TRE/lib/tre-ast.h @@ -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 + +#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 index 0000000..f9ee7d9 --- /dev/null +++ b/regex/TRE/lib/tre-compile.c @@ -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 +#endif /* HAVE_CONFIG_H */ +#include +#include +#include +#include + +#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, ©, + &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, ©, &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, + ¶ms_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, + ¶ms_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, + ¶ms_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 index 0000000..355ec4d --- /dev/null +++ b/regex/TRE/lib/tre-compile.h @@ -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 index 0000000..86e93d2 --- /dev/null +++ b/regex/TRE/lib/tre-internal.h @@ -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 +#endif /* HAVE_WCHAR_H */ + +#ifdef HAVE_WCTYPE_H +#include +#endif /* !HAVE_WCTYPE_H */ + +#include + +#ifdef __LIBC__ +#include +#else /* !__LIBC__ */ +#include +#endif /* !__LIBC__ */ + +#include "tre.h" +#include "tre-last-matched.h" + +#ifdef TRE_DEBUG +#include +#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 index 0000000..734f088 --- /dev/null +++ b/regex/TRE/lib/tre-match-backtrack.c @@ -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: + + + POSIX.2 REs require longest match, which is really exciting to + implement since the obsolete ("basic") variant also includes + \. 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 \, 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 \ deserve very slow execution. + (Pun unintentional but very appropriate.) + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#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 +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif +#endif /* TRE_USE_ALLOCA */ + +#include +#include +#include +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ +#ifdef HAVE_WCTYPE_H +#include +#endif /* HAVE_WCTYPE_H */ +#ifndef TRE_WCHAR +#include +#endif /* !TRE_WCHAR */ +#ifdef HAVE_MALLOC_H +#include +#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 index 0000000..c6ce364 --- /dev/null +++ b/regex/TRE/lib/tre-match-parallel.c @@ -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 +#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 +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif +#endif /* TRE_USE_ALLOCA */ + +#include +#include +#include +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ +#ifdef HAVE_WCTYPE_H +#include +#endif /* HAVE_WCTYPE_H */ +#ifndef TRE_WCHAR +#include +#endif /* !TRE_WCHAR */ +#ifdef HAVE_MALLOC_H +#include +#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 index 0000000..83258e8 --- /dev/null +++ b/regex/TRE/lib/tre-match-utils.h @@ -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 +#else /* !__LIBC__ */ +#include +#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 index 0000000..b5fb276 --- /dev/null +++ b/regex/TRE/lib/tre-mem.c @@ -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 +#endif /* HAVE_CONFIG_H */ +#include +#include + +#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 index 0000000..b760394 --- /dev/null +++ b/regex/TRE/lib/tre-mem.h @@ -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 + +#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 index 0000000..ad09c26 --- /dev/null +++ b/regex/TRE/lib/tre-parse.c @@ -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 +#endif /* HAVE_CONFIG_H */ +#include +#include +#include +#include + +#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 + +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 index 0000000..431f407 --- /dev/null +++ b/regex/TRE/lib/tre-parse.h @@ -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 +#else /* !__LIBC__ */ +#include +#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 index 0000000..8ad89c8 --- /dev/null +++ b/regex/TRE/lib/tre-stack.c @@ -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 +#endif /* HAVE_CONFIG_H */ +#include +#include + +#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 index 0000000..1002a1c --- /dev/null +++ b/regex/TRE/lib/tre-stack.h @@ -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, 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 index 0000000..7827ce4 --- /dev/null +++ b/regex/TRE/lib/tre.h @@ -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 +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_LIBUTF8_H +#include +#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 +#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 + +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 index 0000000..ce310af --- /dev/null +++ b/regex/TRE/lib/xmalloc.h @@ -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 + +#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 index 0000000000000000000000000000000000000000..cfcde9e6b90a69d74c3e93414018899e352bc787 GIT binary patch literal 380714 zcmV)KK)Sy|T4*^jL0KkKSpd2xJ_d)=fB*mg|0@6g|NsC0|NsC0|Nj&mL<4_!dJSe* zqgOTn0Z3!Tdv~?>JomUBi&eb<00000000004X^{P0002_ci#04_O0w;UuUjKbkpgV z-(PpHrcDhZ``PZiH*T_tuH14;O_)SvJ*;sZ^EwsQk`El}r#)(3XkqTKdiSgkMFVyo z^M?SDHfM|nT>z#rfcgLp3&!>LW1;TnV{fKUyeDq-7GUT;Yi^eNWv+w1@x0vozyJ<_ zeLb1WIsgCw00Mvm;s5{uc)Q-<3IWgncVM6Z00M;>;-6oA)TetL-t$L&d%lO?P2BnO z?e=bpWHd+x7mxdw82_4a%3KD~3f>F=sv zH2W_G*kiZV_Vc?bzR^&s7uKr#*K(`IHmVrz`@Q#jij_)G`pEj$<&E|o*!nlmao=}+ z<~!ZPlC0lO_AjT;huiI5v3E%vCeF9FyY6%Y$kQkQJ-RvxD4_+~+LV-SOai^#zz=sF z>Cg_nz28H=VbkU6A+i1ep0f9So$9ra2$Z5BSFw?|*N0g{os3swr`z85Uu|py?!sJIumAuJIv-W^ z?qG5+fB*rnV|{=F=+aFja0}k&&>r)E008<`_tGD4ciRmHyL)rmZ658X+b)F*J#p(P zReLfu>zy9WeVpz0*40Pgrhf$sBoJ>K^P*z^qp?bG3(b3V}8;s))P!)_lyb@W@x z7kA6q^%tN|yudmHg(wJsb@k_9R_8OeufFc?x4XEx(wsY<%U!$PaxKViHd>* z9~KaR6|f$t&wMw^yl=H&7o!2^viH7iE-lw}@B^{R>jJtVJ!3n)_S<`X(DPoschTu< z-*?%*_Tqi*t|ufqdylV=b=!5qwU^i3YVI4S&>h&&_QLG?$<})Vw&_Osj+3{2_h@dg zBp!oTx67<51Fb&TgrOA|cXSFf=I9*{ryzE~XpVK4`}J_tv2V`yUy5mblu3@tm9J3&CuTWmv@`C)iWvP zVvg=U?>!#u+Y4>$U8$j~+Rm=q7hTFWRM)I{-* zDfKpKtu9;Zd#di5lCU-vf!I)QecSJHW!=%f&0Uy#wHwpWW!mn6=ev(S`>t#0t6&;p zttWlmMoZpreEZeg)qU=ZeYkt>WJ%AnOsF?&>v}zRXzur(p07K#+g$Cr(%Q)O!?&!@ zc;9=c+j>3S-n**3CFgRvo;SOI-EFtK7uUEAv)z|~`*)!4s;@W!-I>@m_0PAvMeFZx zOJ3wz$__I>X0z3%qMlY5u1ud((% z_ucnVgTX%R-i&xw^9}$V9M%9g8eZ&^Uw5nQmzA4Od%k<_kQT*lcyhk&)Rv4PLaHA3 z&hm2Fkf+z*d%fF> zCbM^T-2#A60Yx1tpsGj*Kn8&z*?pnKf*Y_h)VaCcpH zHr*#T9kEv3#7=H?00niP=eqSMZMNCF2itb=4A^v$yYF+nweIu)Us{9azUHejYb{+2 zngA54PyhfK9RQsj&G)rqwz8?wy`8hV!>^(411d-WdsdkM3hjd@TeNml?R)?M z&b>#i&$mY-oumK&w#We4?s8JQ?)%z$?{htOhWEI3N4>mxH+Js3z4r7JLh}3T&p!L! z3F~{jp0|=HeI0sc?Yq*czTW%qzT4Nk=b#LESXTP?y|`co!x7o>|g>^y8)_F^@YWK_oLqTzV)ya zQi6a6PWOuUlpU<-bmwPjopb|D0*X^hzW0w_j$KMuwX3$>z2}`>@;bgG0HM9JW_Py$ z0avovskXBl(4jk4yW3A)yY9_+^lX?l_ib#KHQw}G_ulv4dGCAgtsE;*m)(j6%_G~} zHbZjQHzzLJ?#=DT-S?hL%=eyCPmlm~6g@rBnsYT3)!OR^A-i>`A=9CiIWlgsv#HTK z%Y=04RcCYU>+Rrs?tI=gKn)~leV_}g7u~=^O90Rg%x#pQ0$z5#hqen~W@Qn0^po82 zA?luOyL`Qk8^s+@SoCXNeV+SK-PhjM@3*`iEsvdTOcgFhTo!&?&Pyi^PP-w|VSY0wJ(6bKK9F31Y!yx<2-F+Q)z1J$5 zh`lS_y`94n0ze%apb1NTp07UaP*6U%+tZ%UxG8psu2N1Ppu{xv(V_^E5T*nGjQ~{r8VP|kRX^DiRQ)AC zRQwW;^(U%tDnC^HPgFlt4eFkt(?H3f00000001BVyEd4{(f+YN)*t$Z_)Gqu_^$uO z&ECoWE;AFD_n+)d>QDQZdn(|V#}R3Y5Wnhw-~ZJ9i>0si;$}bHX&v3i7k*U9P(;VE zK|hUu7$|RbP)RUh1P)|SQo>J>B7Hc+>7ssLuHRLv_QB!5wrBfQ+QeK*Sb4@S>k*7S z#Vjmb$qGt%b1RU(K4D+4Z2)S=9IcUo^NNT=av$qI;ve_>D)5SRMFDulRj9h)3Kqzt zn2M+QNC%k`fjNUE#Q=^;SJEJR6cPjj!_6R5K|w$<0D97`S!!|7uTVc$sa!oy%UPJ* z_HGkR<)<8BOybS)O<^&C(01VKa$a`zsWpWWnI==kRMkvP%{9#4CZfljMJkspj9g$* zZ&L5ngf%E7EixNHDUkpQ-9lp$(+I6J5JJHqY8Mtjl9ixklBEPs@5d2_S_WiNDyAl7 zJfkPmDn6DPKnhhxkpy{_L7^9Lps(`EnviK!J#dMVAdhJPFohC|C^H$^VCDG6|-O>G4V7^0$v#Qshr^)aA^imnET)xlz^EotnkXb9a07$w=M5)IC^6w$#6n3?9Bt7-GLKFi)lEX?&fJ^{HQiUN=D3q+p zFi2s8k_8|{l%q*XG&C(B(3GJ-(o!WY4J5LZAxOeXY>Z%~8cG6+MuLH)|6vP~v{X|| zFFY8Upp^*-8d6CFpbAn*X-0|>iKR*ep$H)gB#4@%A{mINh-p9aNiqgWM4^Haq+%{+ zin0Hw|5gU&q@ZYEghB`?f88sPG9|+!EEyq2Q4oG|dRqUp&;4$IZ4fYi5d|esP_zp{FpVk{gFrDPLXjyI^rVA9YLAVd%ZD9l30j1Z+D1r!AWP*F-0l&uuB z&{b6m%Ml?(49d_Hi8B%tF&=!&G09MZRX;DMzv$Mr|4;jKq0xq=nxX`xnPy5FS_&Bn z7O4f8K#53_Vu~0bC`gc@N=ihk5dIl4AyT`G2nLWSQdm?eC@7jFNbkhRs?=c-O*BOU zRRt6k3=~mAK+pj}N|cnv5;VajBv4F3NfSgc5|JrT!BG=T&@xF7L<~d~6eQCz5d%dj zP%#k10ZhWm%#xG^12lw`lm#_Y15qSY#1H{0u@r?6EFjD!3`sEr`$_PPMN0(}1d&Na zB_%~N5fKeEQZ!Ws1tUOFLqQVLNVGsyA{10qGC&l>Aw|3}n3|x1LMo=JAaWd15TYt0 zmL0HYC|H7tNfaWXm}-b1q9`Sjkd`5m28Mu%CKZ-YDOr#TprT@mp=KHaniZv@sTvZA zf~W>aXbLF`0x60Lri1fIgwYTrL_-xU!bCI@OcP85lL-uz)WFe7MNw4L5JW{0QWB7e zM9CCDKm^FiF{CiY2&o{Xh@u9fNrqXWVoq}4>12 zqN!p6fSIcO|6k9&gnSuGkrYx?Ku}Nx6qGcH5Q$1OsY*l*C{)nEjHFCO5ky5PNqX=c zkZ4GX5|APPum3N@w`8$ZL{$_}6+uB$da?9zvqK;y5D-*TGYvBgEF&Q`GF$cIq>6*x z83<7*Kr{^i&_n?;(xocRQ&dz+kd(135HTyP3=yTI85vOR3S~AWD)Zf&eIKs)AT3h-3($V5X!>rcfau z)R;{)5J1cngi#R+!$c5MK}bn>AH{~Cm7xlVp@JBufk;RD=K=|cC{|Ju7AmXzi?6Wv z<-sxf!uSxl^+e*wUUkkJbVc4(6aEXqtmToejEJNpVvJ>RSP+m13~9DeL=#c1Xwn&m zdoTwh!OTI)!f2UFLXwq=sc1@}N}wzDpwT*%DH9>esb~n0)Bt2J{GiYhz%W5B1`bjP zV+2JCLc)5pIu=U=1kg(T*`22;c)tg1AcMI3eomW-hMFcsrYa()mLilqB~LA2&{0gE z>@hL`q>1i>BASS4ijbtDkxCYVqE9pw6j4=J6eonx<+*ZANMTp3U@DA`MYO0_4KX^TJs^w5AF z$FPc{<>KqNWmT*S0HXU01CBj^p;+nK=koVpno=c6C4p47D0wgGCk3J2VNlhU@M1pYuVFAu25K3_w4G|SXNsxvx zCQ2DJjRZ>4rBY0^ELjPV!jKCEQ7{A}K+>ZUK`=uEfiOuR2WSOyeQ(gqmrHC@6?lf~lmW8l?z`Awo)` zh=h^?Qaa*c0q6q*5egcqB$5HZ8OnjFiV2cNSd@x^g@2|L2N)oTm{Ne6fr^zVC@CN! zhM0hsCMA@J8YV`Dsb1+E*bV`$VI?epN&LBmK@b!p5D`qmQ4}Pnek$ONOb`ctU=)-E zAV|qcCC9oXsnERj3PTptu^y+T6>u) zHja)$U2kwjG-d(0F>;`Aj0#<(N|8nH1k0X)8v_0UgO}xK`L92hK+>akc3gbmxM-! zxWX%5PD~J%8(&7+@JNo-TX)?r*$1-g=`X?Swk0x>5D5%J#kP;Oo!3=isp5`%s)z92^-2`@hC)AT}YfyDXNltd~Z{{FXHogdQ;HCkDab z(`#0N)`xR~8l&&VVWi%no8rw)a?CZ;q-`N;) z4Q!ZR7D$h02$v9^H7BC#f0vFCDDC5pG&pqY-w!X&NX)=-supFp7_Uf`$HYs5yP~s!T~HKDO7=C?R=u&jeFMPj)prU1W^`yOd?l6-5n{trzUE4Qu7uXP%H`aMg;JGy$pGDm;LA#wF_-`bl#csa8I zQteDa8~a$hs$u&~H`+n+K2IWTqvV@REg5voma{De{*fi76-^neO(RN83VvkBjHy@qdfgr;j0lkf}3x6`|tiN`!S1 zAq>1xju#X{FE|m6-23#pA`DCxQ;#2Xg5Pc)U4C1i(YUWn8h;Tyoz|``gqew{I`P58 zHKtOmc4^#CY(vL*dOqI2 zdF(`OS81=CrG6N5)&#}6b71U%>@AKJR|*J%gfNN|P-d8@J~r{77}I`ItWbh3gQ)M= zXQ_y$Ns5!T);}U+Gz!NZY`N49_0j5mSkTu#*%c`?7TCOF4UwiVB{U`W;RqQsYtsf0 zatl?QDVz(_Q!TJ!7}G&5b(T+M-#+LuHzqp&46yt=qXKj!m8n+pjjnmDlRne`1>&xH z#C_b9)Kxd1rS{ofGz(3`3AESo`DF}IdZx97_e+;-=>(}3ok9g_XGJfxo{BQIxM;$e zXule1@!}IPl~bTRbKFn{;>k$2S?YXbKq=^5sKMBMtS8p~Tw3(}+v+O_R^GgAzV0a3 z0+s@?=f;UGvzG7sGZq8N|NZ6AZEKP0&! zK@gD#p9~3mn=)kxvefO3YQ^k9bE2t63AZDISXA%H4u5RQIl8W?uEla*W0x$=q9i1h z5wa9TWgx!N;DWdwMM}Z>Lu*9H>_R4PN(nn?ETeB%X6yLr#6O$LsRuW1zUN zGKLTWmuo14eYxn)R5ibZ5- z^bc2It&<6N?c2B6IxK$0_6iCA$gYeGkSlSLW2FdVFl6A?^uxMthdms1222NkhUxG< z$?eaXep2*(px`^YUK3=F)NZxiZD!tq^_49*rCVt8UD@P73GE11`Vl}qjhJK=ZnXklMUT_ z*~iXj`0mn_np3&~)1##F^Af*#siJdmky4Xm$rE{|L#JOl)Z(?MU zXFAl9BVYMHga&nSwc#(E!Hd|_16C&Z-tc-Rnpx*{*(dMBrL?MLTnL?Jz<|UOi-qVk z6ocU#Oz5!8t19Sxjgh78F6J_XuYNPr9P%#zFR9{5!M4_rn(ks~>HsMwOx}S6Fy=}_ z42OKtK*3sJgtwzD1vt@Fvchf}au!W`zEXNE|Sg|vtT)%V)5`oZ? z6L@!pqrHa#$vQP2DCUUDeB}6KxyBWKT$&Go;Pg-1zI*oWZQlDlTSs_~h!nN&2Xj&y z0!AxkJkX=qiCd9Yta|XrK1GxbM8cvMXPtEAY+k~W1utVZkb{|G(liVSh#f+d8@^Ys!VRyYB2Vj~jE zDcU*Xj4ydEWns<+YJ|bJfj^TEb_OC$LuX$vi;KU)NRKm9Pwb0Wx|(NKW3R0iiC-sp zMZ1rwocmi!nYg)yl`*Fy4;cG-=o{nuJ?Unnnua@8Zyu?D5=yD?wcM60KiZYGSkb|Rd^Rn3THrU%AL$`D3 z+0Y5kAGSUi$AR&p^XFeFCph~a8dPQNdp|=$8pzKpNSl5pQ2!~xGg5UpBz+z{IMpr^ zNVlMV^gf3Y(2b&d{8tvr^5QuxCwyla5;PkysOPY#p`#Zb&Q%GGiZVoMqWbZfrpLmU zX11>-d0DBLqH7{LR4TBPr^!WrK51{eP4}=ssrX@`qlnIf#_mABWZKOumc!Jdno@RT ziPN|qZ#(r{M&)!e*;`uIB~;A^vA!fE#_@j>Igd>SyBYWJRd=mP*vZFinUp4oPm3UV z?w#Yg^}g8qx!-sFv_@yQXP}N&T4U1j*|X1had>u75L1PZ>ArqX9>>u_Ms}9(hsN7& zo*`Zi1v;4aC?eE4(oBPW{P1n{8_?XSX01nKV~Le@Mg<;eYm0k3xL8FqPQ2<5Z#_3t zYV$)zKSrPXwj8p`w{CRO2VBa|5NHXYooYuUC$2D7JrpPCu6c}+{BR+V@9gJC)vifs z*W2Qn@iafl_0wK8Ja*N>O+m+HesJGz)|~N!rW}u#y%4VY4+*+kZtSPY4N%oYNK?OW z%Uu<2huPxaY{^GG@`NNti{5W2c`W#qbWd$QO?MJZ|MqPkS8)G#RCzRXjzOgKHd zP>@_%Z({*b^796WMEXSOCSjQ`Sh_rZ^H`wsLm@D5(FiwmQZkqKQz~XjL5A?6TdHEd zm)&@HsIp8Q4ph}Zo7?QPB`8u?Yy%~u*AVEFhsXN58JdHR4TnbWImM8D^$1)!%EcMQBHt-!|jLg3h%lufte+~@K+r2bCgbAwR4a)6T z9yO1O_4a+z7d7h}5FULt&hV2Y0!>u7rW(5`%p-u{rE7T}%V@@l7PNS%*H(GI(;~jY zawm)d=QM5C2YD4`E90V?D_c2p$k4|sVAz96%K+OF(@r`4v`c;06iBoRwL!-|d}^6WIv)wX;b)lF8nb9T64%$;H($zK@3QMZ~g-pH03 z8(AjaftVn`s)69!Z1V04PDB{bKCvP$>lyJCrPNH>m!~nb!;|)2sP^9Bwz2<&zh)^> zmHF2Azqh2n%Z)a{`KbKSi1fXgJE7e8D5@!{2uwmQu=T?l;{&2t+J_QT-#e!IXw;!Q zifPI4w@e`Y`lDTy!N>GMG_6Y&LeZu-MbwEql)I||+N~U(O;vLEx*65XU$*K<>YOHw zURaTbEf{E1)vi?2*g2s+j_GdnLgXYyLZLzk$}180syFe@6y5!G-VLpMhd(M}INU?y z)A1v0u)OY#d+Y_Y#Yg1c=4HLb6^&en3gg;^WFs4IwjHf?ik6pip%P5(4~6-$aBE3> zvTA+t%^{uSjI6+-H={Js;`nK=&p6$#dB8++i~TPcF<$>e(qTEkOa3pau1Z|Iceu*2 zxO>l)W1f*RmMp}4AbpjM%8AI+Ql*A(E{}H4im!8&+NvKJ*=)?G!vYi(8A@t&VOE7T zq3&YDSRmjkhBiA>O&yanOw$EYX8{F5$HE>#!#;dS9uSjMR&nWX`Krv5yI}D*_nzew z&Y*1}h!NOrIKuaqV`wMF?hGL`u)*R?O?<;#IMQE*&{!5h4AfLRhcX(ysYS@BG0cEK!|H}8jb?1jAu>ZG zL{d*bi*58)hUjjo6~rC&DRl8al`7~ z-kFF*T+h%tH23ZME(UZM`pF^kzpL3aZ5#|tks^MWT**lPbNQLyagUgB#LnHmUHWi( zSc@R+oWa=r4mh{6vZIa6PZ0mx_~z%^QvX}bzugz&cDn80jkg*b9faXhmHVUy{Wa;n zuAdg6d}O6#P2vKgZ4(oV^6z}qmS?9ExToe7(zw*^gjj6pw=!;lZN%5 z#pM-D5`(Iv^hA#%)~_~yBr}+tL*R%UB?I)tLPa%1_QgFANM_=O==NKx>jt^P$nAt$ znP#IJN<{FBywnBnj6j<1)67*xQ4sU|Z~9ktjD3GS8WnbS{m7S`M6;zVW8##N`IT~X zB8vyX{xrP>6GT)-W;XXbr?^l;J_)DazBOt&n2*c2ZA-*4*E~RzB;4=5PdIjDn>!u3 zca+2{L?(^z(hmIncQ#?&f!FM01?pU-Wyx@skNmY=N;pOw&h+v-W_06CKxd6?!+zX% zLLY3rgYadAd>35Gp$xkGwpAL;$PARrCf+5i5Xl zpQa%0{gCSKy-?+4m*epzFi@4!FlsVqqtDNImF* ztk3FsrpM6ynEiM2K~v{r(eUzeY4E1MKJwolTj!usdA`W$@kpnpFHfhc${|!Uwo0m% zar)t%r!&Hx9sDSjPF=zIBIX@uWcw=4ht%*OEl$Cz8AyqrGPOj$uNR6-^6P>KFRHk5 zQC`YBl<0d=twmL|u9`nR2Q4+#78J5bZmL<#T%+94b>=Y*kIHoB_{*+}$C!m85@O(R zuk_dZVrko1b-2Y_D}(swaVZhauxIsif}z8ExcYahCgNmYt%Ydc8ti@1h;oN!e@Eqa zX5D``@%g&wqopV$Q1)JB24TJ3+TZ35#;?wL&-#uVklA!@!Z^ruKu{E&+I+B5?LG8< z?eEh1om<@i{d6f#Klah$rZPa35ohsuqvrleN^z2RU&@7Hhh0BBW0ikCPmXmp_f-jO zOlj0Q5=m=1~m>;XjSdz_z?8LP7w7PJq@6W69AJ52at;&oAf@;PMc#Nwaq^^mFGFQ{<;Iq zdUy(dmm;s(rOj1Utqy?0p`qB9(S7>oRV}E**wO?LOxj86Rj5&a-)l)FDI}8Dpxsrv zsBGoaN)5-|nWUK!T6SMs2ge;VEz zj%7yENy!58l!a)7f$feI?6!BGmFr4$?vmVkhz)M*s>_-7%ND&P!yk$W5=lC0%Rg?n zd*k`poAY4lRC_8t^886_8zen%eu^MPdDRp+l&twGk3wpq;h|6~)#@-En9%!u5srCG zA^Runs#VWh*O25VKNb1!{I<_$h&9lV@0KeP!fB@qj+nubjV}U=OLu+qdDh{I2WDtN z((@5YQAXfC*-c276OMN{@OliP{bEa4ry(jmzWF9UT-FcQhQSF4PVOe+4l?J-;K`w; za4bv}Z1tpdzm`76*P-4C{J0UIG{UbON?MakHJ(0=QG%f~AmM6gCL&g;=26R8pJ8`o zBM17nVdSD1`Eiq}RYCi_ZX~LA6C{#JDbH}vZIoG`4%$1XY%F(@g;Z^K_dCJe<3#j- z4bwKr7J#b^E}8tEH@_P)pLBxKHIO3H?rKvj%qqHKW1wsTf$c4yg?T+7Vi}eYl@Rq zMBx~UgH@}OS6Y)d%n!WO!`P}Iig&!K%-t&^FJG~7mzTPGypOClq4$kUx<$(RJJXkD zF;eP^nWs65QB89ir@Ta3yiL#XL(95PdFm<;A@wFdl^+E(Yfjejsug%Y(a8!%ZeIsH zw0@W|&!$l7_4y~$TeQZ6;YYbiqw07oSAG$%T_oXL>R^fZ8pj*Da)4jLt34Karr570 zG{&52gRNd#I&m!_fMrXh?BL|AD}?Zs)M_fTL<=pjauq;5XsR}u#JS?z8VgR5VhJQ& z%b}z6&U$k&%F1VqQFGGyjVfGX7S0g3i<8dxFI~zaY%t=onmKv}MU7eWwP{UrX z4@+;seYIER{@Q-q%(MFVlg{W{WJ9?q=9T*NPIIh%k%3W!_n?9b<;5yR#^!s3J-rni3#lrS!-c6(JHaAx6G$PX~7fy3dIh?9I+O zj&pLqRNqO-Nx#NOjK{ie+sl_lXI#m*b~+(uHp6e;2JfaC>GpG$#@!eTf8~rHH0@Ol zF|psmF^UIwVb;ZRHK8P$G&u|7wwYHq0T6kK(cJDNl?E=*5y1r#qn*dxQL?9j|6Ufx znZ0=F_4z2O>MG~orn?DdBD<+r&$4H;7}FXoQBUpYzDj#?=BRzfn?pVQLQGMvOeB(w z2sa!1Iptwp4``X7${Zl^ijCfHO#EB#@$t^s+^%%)fvO!RLx>X)Lt-C~+vxi#YHhR2 zSGe!TbpB4C%F@A&pCdJ7X4)%CvScXNXoqHW@8p0$Ain(g`|dOCz~a3UH2SFKDf<2t zD_fwc{v1E!-;R76;rpMc)9rNc9XpX8W9*uEn2A(OG^nVjDY8vmv96C`8!X%#&Q1Hz zw0B1ki_)U;PC+MqZQZspCW&{i})kkGVEse!tX-0>#-bv8S zrBs;GX}M?YyxWO(c?qOD)tkmVQ>h_pdUQ+VGPI_6d81YH*`R&ydLue9ddZLxyD5*8 z(__`1$xlm?-G{f&eSK7mho3qWQac)N1Rc8}qFcD^*7}b^3Ne=+dg{L^5j4{nU8I`Y zZX8SrHeEGNl+i?)vDt#(StLOW1T@dX7g}m99dZ?$Dv6;c5(I0v8)GKD?&PK=&iLus zV@j?2cK3LSD8b|^S}zz%UtE2*l@#|wyVJ443Cq{&UrW{&IrYY>{_nNcA5jE46&|ZC z-yIan5WX0Il|tXk{vKp zC#2KvpI1A>tN7TfMq^rhjJlF_=r;bT>12KSu3xnC*9`TuSt_p|vg2iBP?Xk};*7N|#QZ)z>1-A!MmR`;dAB&0w0qS;56!Ydkce ziG~)JNS!!W<~j&j5PUW>=gT1Rd1AMY+B!4T%&F8h>7uo3D_w5L6ZiLKFecsm9P2!v_p zzMp57Qb%4#-7;^aGH}O5^h{AIp}tcE#e$mZCqBXqMIPdY32R5ICks;zucvlaEWLZr zlR_{8gQem?r2y}X;RkJopCUgntX5HFLwY zc{gX;)njdji(y3+M;a)gx)tK8G}g__=_+QVx;@IQdy;PyOXL+S@07$%x-UWy8tw^w}q7Dqe7BrZC3@WvX^2oQ&& z72Z=@XsdNmZT53i7uttA`JRy@ojVfb5Bz+UM;&+79_%HX+j{H;R0@xS#-&wyHTBx_ z!4p+);``eD>T7Gl2P_{#ZW8d{8;skOeJ~#>9JrSn4Y*Shh{B>JplRxcbxOBDldhDPwZ3CK2=(Atd2{<#tq99EM_$pqqw9;xcryuUJ5b^WfSx8vh-^C7y zWo1A1ym9QC=liAb?U@i5DPlT^pu25$3jrftX`Ha`6_ zKL5kg0}VZi3z;=(h#5+= zL!iAdmB{N(w)?*Pqv}%SadOA-y&X0#Yw^i7PJV0WwM`G$;7u9(&svQp51ctcL=)u> zK~WMzCSy16W+(CHP-}R)B-PSK>h|{0%yO94D>M}}2SCcyYhH;J`y}O%<~Yk> zw|ZZj%aeU;+L$@ek=^TDBi*}aa2O;sV}ls4N1jaj`OR;moSyZm@Kru3@s&oO42iJc z8I))0o*B*SarQkpJxQR?r1Tvz0w|Sw9-F2lB$*A9;F@7-MsWA?>-cgxbSQ=z$P291 zv^ET=gue|%5lu;RflbajzHR2)6mGqGZyFFBLMf5eP~udScS6P6uaX$=>f@B5W0iB) z8ou7m*U6f}I^zVAtq{~}4xf;_RP&|PTZ_B&$e76hkwq7(0$mPWsg@F8nNFs``tQ1x zN^vu0imc~);ysIu!_rI|{mzjUji(g+sNnrP%uS|9S_rD_;q9YVnG`YH##%@>H zB!#RYeQzF7_udfj=e~bB=Bw#B$u04|KG}{?=pt{69ACvI7i?_83VnI^%`Q&JaBW8? z(-#j0V<9b;17&fl#z;1sB5-3G?~p6jxV?268|64?ZArl;gcJkh{Lq69W3$;s`bj<8 z%#R|MXeCCX0P!_J+q>`k-kHa%;NPJ1MIMH#NRo;(FlfsQFvg28pvc28JvU9`R6|5G z5xq;SoYj_QQATDJ1qCxDhB8XUQ%a4vF*f9^pCn&*JnZ8_^2g_|uO2wl;ygIfT1?lf zQEfKIZMr1%Hrr75@K?ZlV{aNed?wXi`BqG8-6X*8R(Uhe+ev8{3rS?~anrDRv zDxn>;I|9MRjjrfPqK-*JV;-z%gHTBVT9c%e{k?=5ot}NiM2fF^@{3x@AvK>tZHiJO z=7Eeer0PcU@p~G^Rjcu`w}c2t70M`Rk<%q)85@LaFMcHql1!5*6m{=} z5l}7hp?yg_rB;V%HJVBIZ0Y3X%KEDtG?TlXP-%JNO&8g|MJr8MBq}3oCnWdpc{AXe zLeVQCoO~hd+kkTU8l6?9jYdkUBrB@e>nzBuEU1XYVa%q?ax5^W#|k3IBL76?Na(0s zGYO2x0oPID5RvPAtKC-QiCfnY{H1F#)=$;5H~7^Btp>?cAY%keywY*=Z_G z#yMfA)mg!tzP!eh)5Zrj(42_K65rd%ucC_CI}|&nRHt#xxl3I#sU4TSlwf!JVdBdJ^^FzchcVU)u7u%nyhxiARhG@nLKMY~QOcY`toT(_vE!nZcE%Rp zkzw6q$flhD_}9VlHa%BrcD)zEL0wnQG+(pvc*^m#!qKAZv}V}Nrs7zqQ+7M~pk=D4 z`zGmr_}dC_(%NSdG3e2PHO?hK&D+z^SM6s&Q_@Fr?P!= z%Z3oB^<|)3PSAp%UL1AVawCt^-lYBsxI;s~s)VnoZHBnW@W6j>_^#eYc&*C~iOo6w zuSg)IyXDTLQIZX@u#!fB%|EuQ>kXR?wW4=bd@dK=f2qiC@n!!uOz}r+9F#lp@TunN z@dr~7%%SkU>RxMb?g6D^;)~8O2|NtrR9n$D9xQb^C1zM3%iC9ymb%a0b)|2W({HK`=!39FbAKr_zcQzb-xE(y9K+`q=#$r2u=ypbQ6$Et+~9+8 z_s@5s{rEm;_PfY}lbpn)Vekf!n9{n@Kf-_40mIj~JL35eUezB*Jf7aIa=dD}++dt4 zca$RhM${1m2!MO}ARWr2*3caUB$+fJpg-v(J}7?^AY_l*2#r5}K>QLR;(_del=1$D zi<*neCrq5-K?*2*vUWvAxlt65ii318D5My{K6}sb}ck?=<@FS}h3_YV0 zq$n#C_RBz%Lx!*Ne@-I(w=%qQfq{OGzoJJ$L{URVg9pR!Hokn>>4i?EFrBP{?wnX^ z8q82XPg4?L2<`|mOmT>DI1q+owDrE|JW_QUkvmOCJ<+OUh!B~SfRLGsDyz>?Q2}=f z@&r&Lv3J)9NZ9sSPWZoy%g%F$PlxpY^8w8xA~84p_dkF`-QH`OJ8?vwyh4ZhVVjT) z9l-&I?hhekWRh>~iNiGC<>(K`ums7%A(dCscc?u*T4pA)CVI)xl$H`6z@)s=osjrv zhX8rCX)E1sS^W2KEr^_jzDl`zqc#S++GBp`%T5Q*;Bk7bN}ob{ipC%cXv z4@Q3Z_I(rrme2}E02_`JfCN?`BaHzZU=hZEgdia=o7Q7H-)Vw774s1&#P{+xc(C$b zkDZ>45~6t$Anvr%5_SHHvO^W))2OcliJM9yvs&-0T6$tp1>P0917WIorwnAipgj zc8=e&l0yt=>Kx(nKQjHxX9|OLa(tL$WE~+Q3DR``l7t(T4x4%-#D#=F@>-Hpv?JQz zK()jwlY$wHJLb$mfTgrOWdPThKze<@L^`(iH8kJD_vyG8u8ezi9C`FxrSyCIB#4tc zPTyM?vC_vt;p*`?QA31K3E*0yZ0BAn7(mo_tSBKFCA2oTUWm2XiVt{4-^lwS0m{Mx zG#TU1cUyjq5#6G?{OD~W+~i>E6W;488zfPw(Mo!=O8 zA_Z`OR*UdALJ)QxG7-5m@bVKiXw&s%#XumA-@-kleo_n^?ZVgr2899muR&-9+CBL- zhH3LBc`^eZA4MNuDV`#pL}I+#;k|g5=A1yAQ{UxZ9B}jW(e86|0nc}&?|tlWOm(*& zo8Swx#Bzt#StJc8m}MBkz$)#f$_Z|#4!E&EL=KmK1!}d8Skptm-=E3ond3oDYQh~^ zTp8+Olgn3{vA6;ldbCv|Ni&W1^AUJg?Yx%BZ`$?C))2>?=(3*;67y%M@QcIOS* zhin+Lf2UfC@R0_PniK{7H~H?zp1S#Q(1el_NJ!T_B2MsH>UJ2%f%~8{iKx>-MPg(U zVFpb!Q&;G-Uy8f6U@qKR3oaEkX<_7{%CqUy#u_^5DGQ`(P+)4PgIsf3!njc8lWkL? z)X}l!Tp@e-4=Ie))@QB(=Be=mFEsXR?C2Av+r&!}ivqQ~AiyzI;hFiQ$}K)&(Gxag%OOzC_#Tx;*hfXwJ<3uoZq5JS0s z|GHWNA^af_e1Yx{>J5YWgTN}Pyg-7&h_aZ8tMrCtcPD}JxK_wAI5mQMFr3^?!Qc^OL1ydDCL`g(RNf-LdEBXv@sFZ{5)W7}eS zaLNgyplC{3p#A)CDTYb{HHm}_#VJt~&`~AlgfJ2$f*PinAnRbt=3zAwPy;Gg;7J?##p%{|ODrNwP zqDY`31f_|Xred=&rWy#MA_%66Xdr@umY{`*YHCO-NGNE6iKYk+Aj)W;a{C7~25S`doK~cy@t6!4WiH27=m=R3o zWYR=XRFo8RVFq|-lm_6w%MyRlQ3!!#!6|3@qo&JqGBc`prA?` zrkVmGiIJizB1oDBqA4h$swn(fgE2u=e?5sPL_~zE1yE4aL_`H7F;YP=v~z}fBPldu zrYlgCl+>{yL_kadL`YLW$x_m!l|V!j?ZCo{poxYiXqu>t^ z3A1=?S}{N^deeKZ4rsAsgDVlONQ_!$mj-d78Y|j+Oyer#`Lzy^YZoF&f@%qpDjoKL6vELG%uz)JArR37EW)rw0!vg)1k_Yf0Sycx6)X`G zGa*qiH8D_76buyvLrYRLNd%QJl2jB#Oq3B6Fh{VH31Wx>25G1opn@WX31&t>ftg~6 zq$mg^h(M?aVxokAlp2_%h#D!pBN8AWCWI-1m>L53vl576DFUX6NQfqxrU0s-B2pwJ zMgWMENeK~!D2NWdaScf%!B3_NDE@AH$3e}=RA|192xQ3dWKd<>L4iS3Ci`nlr71Ba z6f(;|)l44@c(NW_+^-3EwMWK)_F&x=-=UOOiO^cRoKr76`7 zaR*-|2jz*krjTvR^;kVIP8v(wi#e*!*m7k@(-!>HJp3r-i1(xSLCzZBFZ!Z#cj*%U zdlm7OrIIyEXt+y7Q4oF|nW@I**GoNF-qEHhsC_30-?3&aA=xD8sXGs%hz^3^Lr>0glC51sU zS&m?4twHR!8jqU}HJisGm*~glHG?u0)(ir33`!${Os}rr9s1mBRmI)V*Vl5tjtr!L z_^hCQy!Gi%n$w_@6yv+>-tHoVteY`%OtK25EXczsDhMi|C`zQFSctPQvJ48c96oy} z_$LsUnTiUarZ-p^(M^~*$!23!O%xF|=*Ps+K9W78MhEypO%Q!&O(D>MD58{TDM@qfC4BqBowf&3CMu=XYqSpsYrlS5FD;mu(INeW z2lF=0hZ+h})pg#3Yp|>xEhQ;TOjJZs1q8%FD@6oaa>TfG-7Y@_1{s(pp?SEThYChzQ_QKTVi(xByEH*>1jRIr z;u4G+BZxXfwq;9R+|sZXtO<|D56cFoib9$qC>o}gn35(SE#^^ClbM2KP(;c(nV1*> zCV8tyiu!Ka`;WsCQ|XEv%zxLIl!i%@TB})_nkt&J7b*#xkPZR_l!taqF>~JBad9h9 z{~;a5p^83;23*l=NC!}5iMGaxA{+?hJ&jh&8bpyFY4B!Ju*qXQIYP#B~{N=X$(8JLJ1;spZf ztQ^oZB{DIn$685k8m5?_5&(?M6DJ@jPE2*97*eK*BqLLz2SF;P7=su*IFfrus~Vx}e_l!YZCVk%V5ftn%;L6=x7hD(bXVA4Sg zOHm~)W`a#7CX6_;t?NL49`HAaWCIY=#Dx(dNED$m6p2&<&`?z%WaW)nG~{Mkm<5%I zO<7ZiVnb1&EX+bEGBS+Jn4u)%$t9~$m{CPJi-kIji%k=SIA9nM1wcU|nTl01Or!-# zW|LZA))|wFn86K+m4;vtk{%W&W(3t1?3a7ZB%x@B87K-S7?U7_3=QGorwvACFXEBZ zB}&{yW8s-pA5Qb+l-iyaFa&`FLNci`0a8o345*51oFJNTBr~jNBD4^aMN8e9jSw5m zLM8Oh&0$2~V0?C%{*1~u4i`C$1ymZbWt<{{ggj!(lVWQI5;6mDAmSjHRT++9h*DXZ zmO_9G;pR1j(|1FjAv_FC51MhHq$498#sSk>q(eagNYE70&_Nf5WQQamvXc}x;TQ#7gOwbfmMFlyIS%*s)4Ft3h(F-vG1S(M0 z6C~%aSVL057x{44GKI>)d6zlN!}=iO z06!#Xjs}@nCw$sk@l&vRpgd+$lwOvkj4GRvpp8%M(;rG@RAy*?pT)a|4Q#9qTK%LM z#4H2=ZaZ(6i1{b`f1j84Wi0DpE)2Q|7)F4^{j^wMM2wL7qeL9~k5>T016kiN^*(>i zYY^r-wJjwjI>^!d3ln9SXxod?BjI5>c51Q8C~2GGrY0st&V@zi9u%2?`l4iO zYa>&yPwYK8?ylnnwa(&#()mzySBQN3$DbGGH7xA*J+6VrZ9`m_c10?PD0!p0;u|p5 z&A|b+QtTaufuu`5smb!POop^*bebSf8FhSGDye==rV?&bh)JZfXG_ZUrmsC7_vaP| zCaBvl*h&qIc>^xvJBlOzPJWslUYSO7KNKwD5oRH<*iE63-}G)Ee&rY?j^Azup}3A4 zgem`8FIqr@$<&x+)5A*fi@DPa@Erj}irB~pDIvCiPM{u#gx7wwk`hC^(>ANt=UfiO zGL7uKCToT2@E}OMFmP~?+^nZhqUf$NnsHj1adP+^-mF9YRaJ2X! z6L1KZHVa81#+6XRrWMJb7I@(6(>FrqHnhZn@n5g%y@!fB^)iZe4KgR0MNln1D%_PTRE#oaO}WWev-GYy4c3n z7Vf2lgP$8d1&44revAmqliqwz23URgXOWlmOw-h7STHS~O%|FivWySx2=zpKR~PX*X9z*ikh%h;t)$;K^HHa`H5L-b9; z0awou!p0YUAM;r$^7BA@zYz^Y-c7N-JjcRLbK|G?V}9%%4=NBdOY>u zdWQ#2o~o2MO^HDS4>AE58q9E{p|F&qlOksb3djb>93+B-l0cC_ZZ#T(P%0Rz5T=pK z-5Yg-At98bWhML0{X?MG^df&8B|(cqIQe zefa;g!`fXt{8`DpREZtPx3W)@l?@VjO`ca2#1$l`QArQG0=i&}Ob;$=mnaEG+@7fTpKI^Y_~nN;&mSZ;-)c;H~g zs0P@aq&rjb_(kOTvpu~}jNM%p4X``8zc^rAZe}7ctmHYn#Sr@gv^qkN;1F?4q@+8B z1MM6(A->cb8JbHsEbBC~!;|%%j6RRPM?<&|@DM5bKwyxC59jsORS(d40K{wu^{k-x zhJytU&Ow9ZH~^1Ov@f_)NhFdP_z?<2}Oq3=BXueT!$^?8m@v+*1JhyXZLfo-hSPVMh<|q^puC@0>$GX zLsWEyk^*-cn>?E4~YKs&?m~3o(uZ>{|vCE zzHX1sXm@zvWFWoc#B&c34x;G;#pd#BgULq|k>`H$H&Oc!!gxP*<(|3FQ5021Wv@~{?64OwIMm!`wXx3G!5$)xW9^_br4p^1gJ#dj z(#*1eF;nh zkA4U|l(UV6^#&9xU|2+IS&A>^9S2ljhWyUO5t(w=&egcpY}|CyX_7W?7*U?S#Y4u@ z)^hi2gr^3EuXFz&yq!@{ES!NHJ2h)D2X6*7MN|yr_rUFM540`cG&BgLXMh|{b+m(m#6<|q zh9ZG>vm9&D4-`JXMaBvn`+y`>Ew_{?)I^eNH+mDO?;c|_$oYv}1IrV$m_1B^hT_Nb z9HiUi?JZxIOUKf85OZ|NA6IrB_t?q-FW3hIqjw1 zibBI%mhjD!La^`3v(rUz%WJ<>MS7c7@p;8JCZ8)_S1&@ZEF6X4S)r}p zE`-3%sW8>DKi&OxAAXrr3RCkuq=yym>WRdN@$(%o&jukc=B0cm_)n|PX9%&p{^}_1 zlN^Eu5QY(G$j>ZW>pm!u5E7&jNaCgbzopO5?5UJ7(8-;=m<5){al=fdg#yMQAI|bn z53MmY#bjTSci2tUw%1_;A9+;q6R_(A>2YqnZ&?p53`St z1TdIWU!8K`1oQ^a!ykr7L-q#%%vT}Ifnf5c*#0w@(i>qSu9$Q)52@#|><_Ouwriv2 zxVPKCF5HK=kQ(dxavU`Ss3K-3l)GuDj^jL2ZH~X+{HH#&<(@e_2FtFqIzjUp3>o?J z+@0k4a1$s4hB}NHx^;@E#fdricTuy!ZC* z4GBr$UR^NxNqE#5g+&LsCABNm%%Cr=ctaL1_B;|l7#UQ?g;(8tqI1@5C{(-Bpok}T zhfz&7lDLlDJsMnBLWY51s4^ zYp?MTRD(20fxW+{IJbJ2Px^joAGi9Y_@7Gs&-4E;Y(K7h&et)6Ezp-)E!uss8Nz)# zyuTzCA1SEXObmA9=b2wStjI*=F`xmiD1B(rkWK+e{)(sxMH`cG;Lh4XB-b?90i6t)^lc_e+wub!aga?7~@J839s)^0eQWhj+19qriJOMSM%{TCCFLil{%Ao2P zROQL|JYayeFiV5@^y3L&?M4Ltc($MHaf#$O27$D3fZuttC7o(r%OMEK_S*ZA#RBrx zW*-sToqMQzLZ;A*l1$%gIfqfjcFcLjyvVhn4b82cpIFL(% zb2m$|1wfjr0sSga-^-#yHpBy~D>sgQlK71ePez&OK-&dl0&`PnhkIv^$8j7E`cNih z9oD~BL5+`3F`2l5x+BxiP>_J-h)}u3X@gKL$oCx2RgV-bKslq9!f7g~ERt}mXKorq z{`hpwwkYGE?hmF)rN=lSw8FSdBqugVgsP*->%OM4Bw?I>SPa!8q||Lb*JHm^k*zo* zS@w`<(sQ0JjN$c6vt~ClIY8r~h$b9xn0w3*&jt7YmV-!sAJfk2yCJZ}5j+;4j7Dv~ z7vLz#ClFGH{2b*M>Wj|TVVt5a4dXyuqNCc#NCbo0mQvW1KfWeM?V&C3Q1K1v=TW1` zVSr#V%*4V7FeB`mx(e>C*WdTpY{el5YTCay>%rrpP)LxBBpr}B%xJpUDyI)M&zJ9l z9xiwfigFS}{Y&turhyLouuU6YL9~4z7U2F3^Hne4i^Em6b`=_3= zQW(Y@Z3y^q4%ycAI1!{i-jA1oocM+LAGNncztY=oa9j&-?QAWdjz}8~_q38SU$;-J z&fiT@^LGXP(;u!|dNQ6K66??7gVlTa!{>vDPGt5%9=IA8-pSHVBiV10wvPs(>vWHT z0MvX^yNyATB`5*W%bk$sBcRnc+s3jL zuz7#Rk1SAnzM)>cZZc3nAq4OA2P_#|WPysV|6LXt!Ut+5hL@$DVM{b1AA2S}KGNWj zLQI&!eu^)8$j}NYnbQ1r3u@J5 z>xCu)wEQM5N(GU^#K1TqtW9sbpU5PTN4`QdiQA(;kIig#kZZQx1CVEG-tOO{0jb@tL(Tq8@4canq2c7$pZj`T&g#)G&-?=qefCD4%be%O4WY zW83Ex#jUag^1wZgJMGfsyKlea-$SH*l6s({C-?}8ER4QLzmp9?LvI|5F#gF8n~p5w zy#DU%X!Mh}{9o}-=x5u$wW(7JO~ldqzt2&9ZZTgv#`E3VXpWqI2TYJ8Go~GHyTVMh zQ3(HX?bk2jd&g~P;|iBCi^QE6oy?&dHKVk*?a;AJ^v50mizN%(2* z{HlOh7oHzy=4gS3B*VRIug|Vcm=dMi!4zwWQX@YQ>|l15ER!+n5Y3wKgt_hI*@ zs)GwEuvA{QS)wXason|@t6W>k+|}9#=9T0;(kL;&sw~XY0E!tPDT=4%>V2f8>xLZe z(X!Ww6}2;H(}-`j{e)rp^y%7ewo@wnTR>w83A$0*Ncj~MEyB@Otz7h8gdqq*5QHHJ zLJ<)W7X5jmA|fI^Ue2#^AcV4$Wdj_r5s*33L7?&AlU;v%N1s)G12`S##? zyOAE!xcK_MZ$bRN-p_}OX^`s?Sj*{|C+P05?*odx?{*RSHqA%!5B2(@t;h7!wZqrV z_eSbhulCgZH2!7VaJL_=HPM_XO=3@N=;-C6hoe8sjD8yiII;LxbLruv4Jc+CWnawe zbF~!HtslT^T;;g_L_!5$Va*CVcJQXz<^jbIxe~|a=$8W{zdOU?NAO7}UK{mg)%lQN zeiS1|fDP0{&!zXSY8#VF*b_{D7p$iD0oDnzR^BHO-RlDv)ID=5s;a80s;aBr?vzGn zGH}TUkf1CWqHb36Kz>3)At!OzW#8&QhNI4ZxAS5tay%{AZH&Gv=NCiPE0UN*e z!w~o+cI?A2sV(0wDbE6&L8uc5#z4Xdoyz2asWJ#);#S95j3Y>93LsYQoQu!r<(*Q2 zhkt7`%Y;8@WcJQ2mvNfQ4K++b@J{ucR#}oPus;wDfnGb!d`4hEgapE2pzg_OP}<}K z1O-Pv6jrly)OPf?^E7DnLAM?34d-?YXq1H1qpA*HEl69gH17k|1v|)BiO=`>a%rT- zAb&#J!?ZdcT@G`x*2NfTc9J}yXLbSeN0z@YiGU)aox>Dh97vu3JBUlI+-=Ov-EsmV zCI|>1&Y$aEjw8mRU}dmz(mQ0$i+Tv@h|}E7v<+IAdrbv4H>O?1HM9ZLh;8P(4;WF$ ztefCEaP99-n!-wyiN6s$9+U%y8|qpTTzqwJ*-;43*&E2<^{oRtd&Sx1P)5G}C5Yx@bbX4Yu=7HtHteK?DcbJZB{apO|`@ZY?rr@kxV;@=Y zs=~W`XHiu6SgXZVEG$*xX;vQ#`e{q9KHa@A}yHgWnXuKByxg7{vhfY(JuW z+Rq6H2G}OdkmAog;`&ybY=N$96(~@ssp_V#lA3N|j^9%;ZLq3cDEIH%`hA?4cnfl4Rm^IGrWf$7mdI>8Zi!wQ%JAW0a3WAV{Q)jDXFad)ws_;1VL3l8Z#* z#56H24Kx&`HBC}d(v-9`(?Ar^(Ek;ZP((qfGNJ~DGXluMiU^tziDD+28j1)qa;ln8 zp&|&WW9_nLgSup$!QB}adAbiVyP3^n_GhMilB!BhM`%MyaOTXY>7V1~J`CNZ_WfUf z?9aQi% zLjK&R07w8N;!r4gFbGi>=ao?|`!(5y zCF!gEn34f~|9sC_gZX`qeKJWRk~#JGK9lkL<2-Wyug~wF!3+MHu17FW2#+!eB8!rt zgB9E#KL%O_AC6JfY)!@^!cEfqe1Es2kLn4c#z)xfeqUn)vjtzKzDfMh{B!!MYrCPU z8RFt?9srU04VAQ*4L=XRXKwV@3=QM%T0Dkj%x8RL^2#fbCvijb$TT*QNI?u}QYKMQ zG?bi7X?KXIgprWrAD?$5SC22e@SvL=@n)(Yuk`(znWA3927Js>mWe~uOQ9;ZPtP!ZTk%P4@ zuIY6+!a)H5&oX0Fkul|fA1IAG*~RKymNf-74wH{T6}EOPeR=;j(WClCc*XJ;$z`K44Wf{|t8&ACPc7KF97$bs4A7>$X8n3)qFbNInxVX#aMT0RMep+;~#Y$3CY6lc@vG;Dn ztnI-yz&kge)1@2N40|l5IG$hGs1j7*^mZVbXC2)z=6mkDq)uta4vhD8XTN?=6l6{) zW=0yRsUU7(Iv6la(A@`%MVW^qT)QUp?)5%C?+hWk=F#cps<+92FoVbu4w3)`xT#sc zUjLJI%tZ{~fl6vg$eF*KfvOMp@%$$CN{$gRI9>5`s}~@d%B2Rr#f|M6!iotWTyiW( zII+JCy)P~YY2^Dh(dbk0a@l;SRVFCtcqWJl@K`s3!5rI7@SVi_5KtjEy?kd2N1gT# zXFu1IRZTTPMN%}=ZJ~{^jdFdTpR8fqa z9?p6UNK=g>a>8Ppb0yPuMJ0fljyCe2o0IMRN4xcPi|dE?K%tvRZ#cpFMAkErT!?^< zb5YVh#-(uIJTA2%#WRvZb zq5W_Is|^p4<967)As;Mhc|rgon4-WcgMf`{zhFqf2&9AXk&{-e4E7SVzI*i<<45dI zA!Yqu7CW?&gf?V(jIpQ9e0-dm zo^aewz7xl;WBELPIagjW#}G^KoR=C=NwKPNZdmSyGlkGkj5lP^Ha=HByqx*hj~q8_ z1fntDnu(@45EdX^(EFI4L(j776+&%2ro{Gp z$qOH1;2mb<$oA4w8&X8}r}U?RFL8|VC(0X>=S>pJ&Z+I$vzh%6;mrlqMW__$Xb7~x zfl%9yc6J*yz{Q0}fqjSNY+P*_NH6F)6&e%EA?c)i8j-7*bWfZJGsBS4=%$ZH3u9+( z#ai$t&$BIvLL1TC6gWh?L}2!nZ<}~`N41(=lN8#X#K9tJSNanKp(K+N6BD^Q zCn?lCLjyqu1Q33pL11#;A1EFHAhaq90?0K_v22llUwmNH*lzrFcCxyRinU%RPy_vX#qb+1PS46v6#bymFI%urfs+MPPIYzLu^ zDjX8R`>4&{3n*wZbsYv`$o6NWgGqWwR47nq3Q)sEja-Dvsz#le9!P}Nz( zSIR%KQc6(@SAuuvzB?bs?HAl#^~$035VSunY)Tm>s~QQvY`;gqGpTHA)92f)nEnQ{ z+0BoM;hug|n>DQOw>+PHv?z`^;}WWQ;LSsaSjgC+jcCDDNc%W2(G|zl|0bYfw;6Nn z9j9W`q}2bQjA!1j1Zuo zR-2qyyi{W1jYR}T7C|e2YNY0V1#OF|k3^GrHHA zny0BY(gW1)HHPhRBM?f;pg=n>)d1KbsWm2}a>JmHx6hfG-jrgd2WIV|we=IrtAz6T z5=kMV6(F!MX~=1utaeX{PfXnunkQ9~t)0=%nd>Ayv>SfK!n0NP^FEh;maY($j@jJ$ z)<|N=J&L?d8n6Ii$@()5tN^Oj>3JP8?*#l`W(~Z{EV^K

kV?kLF9jqc^s@0aT%QLz+Y%Sx*pEVJa4()Xsw8u|5i>7`wsa&2+bP$k` zgl@lo2}pF~yvNIc{k=Dw+oZ6?OPW^1 zw`drpBX50VeH#vG{oL&z0xrWcYPBAwNtOm-D=73k(3H|a?0CgZw#ShB?gbAbj3;}or zkWaB7N<=%LN6{!hsXvtA?S+KN?v1dJrZk?*HB9z@_)dD$qw6`pr$SE; z6x5#0uDbyl2ogk+LIg}iOi>X8)R8pO%-rz9g(B|{?sQ9-^{C~s{!$>`tvv7S>W}5> zD#Ocg*hKWo5hHTg%d02zi*H)@!o9S>bR^2F!`6zrIqs+F=8fx`%Sso2W53=&fUElXlk*@Ad|Z!!XhRi zkU%)}T|QjtV#3TJ3bti@JU94_-E~{*?k_Nx0msaTR=>E7HQVW#Q7zNMn_~>jOn&>Y z#|3|s1J8Ks+W zHTCaGu3me6XBgp#sHZZA%()}eIOn}?{rF) zR~rq&B5l%J4Ow9fc;STyGSN~&Lq!E!h_8V|DS+7xJelx;SSBVfSF`LF?O;BlwJ)k% zbk$om>zrQx`{p>}6>Q#2389yMop0U2B@;Fv;MRf~a08%$f~{L@p%Cl!U$2~&|6Y|< zJ-PH7xEgzJjziQ#_=WC-gFB zC$_2s683&C)!ZE{q*@dhlOGberWMJghe-^mci!OY`H=pboR$B9z;80N+euF|V*vSt_a#pVM)S%#3NeWu=UPGAl@=i4kV7)auM4AD8G2?b^}V zhyzCLl0!rutWiQR}Ti`VNLI*1u#Ju7+yse)@fy`kKXYkqUmu z?ulyywxKh?NhfDR0@gULR#Oz@L4sFb8edgMMXq=4ysHi>Q}<8F^41BH!7-7I9GwGkQxxuH3i^=2-Syd zv0()aL5FUs*1aXkcP68Yu{*h!kHl5We^iAcg+x}(gHXv4 zscApfW@v-H>)YAFo#{l>K}A481q_h`Bvmv*G?ANo1E;~9GSrwzNeas>I)cQ)Os9-{ z|o#AxaKTlM= z+Bd_==XGSE2jE(2ck-Hj(y%%y&x>~0mn~<4hWBnxF2n?c$5aBa;l%CW-z?^4WF%N= zRU0xYyB{)vFsuG`@4iT${=-MYxiqB zCaxCej)DA3)u~Q4$aUl9D3045-p@I#;;o{?bP;X8Ul!T<&RQ>4E}~!;-p!DhNJ%Zp zmgCFOksLHzqPaa@5o3Lz`~Pm!xYAPwaKekrJ}?!_J-$AyXT&Aw6_HymC0$z!7<9Bg zeLVBVrB5BE|QjiLvNQPku8Jb|e zBnnaq!&XxTus_S&wsg&s@Qj+fK!$ zLBkp>^4$5MhB7cDFvBshbadc2%SKHb^s1t}|Gy1@?0V+=muy%iMBA?4r|-8HhGue{ z3eCsjK_g$2uM!=Z zo?-?)2`(CMz{k(CpWT;n#k)k1BnGS0Do4V6-Y+Qv(sh!C5@CCnZ=~saJiS`|c=t65 z-OlNAogFJeww~BHkf`A>@6+3j4CC2O(fpkI3!Q|_*&srgT%$xw)aDRf7j&10$kVVmK&Bsw z^}h85Kd2fxk<=Q8{v$IC6FXkLorH?3dZtOM;BW&?bIrHIZSu6@S2U8HkB0ZY*(Iu^l7%#_W@cbE zAs=*pj!rn=A^TCZ4Tj13W+}E9^bUxIXg|vSgYGTQR_2ezQzv zoSE|4-fI)EKxYr^-1j5enla>rl9Q5?#VQU>^~PL`5)WbW9&B?yO=xPsP`riQt* zbn||=jpaKcYUw@P)?t#j=yD0O6ok$s=on6uI#0~FFWzsWprVlq^Yzlqz}i0b`bT)K zTlhJ|=w3a`U!9LCX4$E@o4!xl@k82i$iCqZe)1p>a#lt5StXg3CZWoM?XqoU`(}+3 z7a5Va+dd{o@$tru7PdM_TICrhbMbsAMfCWcLO-0i*X85rfiC<0o2-~ED+UOlIb{@A zbpOLyfd*j=m?Ekr60^N9eS+>R83Oq(`a^`D&Q~LIZ}b!e!}}W9#dLndx)^#mzgx9p zOb@fX<#WC6&!cCr!Q^Te(7eb{bMIb=_$TxKs~?=YPj7a5Z{WRkRaI40RU|J% z(2_2t-APc6e%L`Igss@^ii)W>I_4#}$8b(Iq-7h|=j(C{dh<~od^?m-pA#JMYP31}!w0VB8-4h$-58Q@VAk_M z2NiR=A9~Z3!sND1OFOA6&6GsN;YG?qP_26F2+!B){Tvpf=Gf9rFSuxQlpbH0L_r_4 z%jviBbE-QWGczFLE$pMG!=JmS!n4afFhu4l`u<6C0M>LBw+6X}T-n-QK@2yF@n#wku9E>>`P}a-xX{kyH9S0*E_|JENSL7&%2d&TtdAJ|6d1to(&pRmcFpPyH;ss z7|%p>r+bob8RLo@E4#ie$VkG@+l&{1-&o5-1kEf&Tg>KupzMc&1uTk{IVj)5D`|d!Z~JpO3NuES5+b&Z+xQ#sY#5zibGz9 z>Ajr{Dm*>u-%k6csFLh+Ydur_KHgn?9=?Qct7V!kt)OYAnQs)M98+M>#gDBV{9 z@SSbdVDhSY0WRfj5}_%Qc%5yqK1eH>W9z_r-Dd&mTOXq7!_R)|d4;sMV{c=AsPmN> zLZ^1a0b2W&QqAaz!^NbGgU23_&o3lx_H zTjG4X`$F-z7}=M8Rxpu9$SLWupKBrmkaJEt$ukm`yz7gbo%RAi++qiBf9Lr}d(hoa z+EXEpBiqeT(RBy(>AFO%KA?YEAc0P1C*u^S&!k!FOz(daSvtq{=cs@AoE_!rmKbK; z{D8&beMq@+r!IAMH|bTz_)ktWF&#b8qKZB=F-n~xoG657ELi#!Hu%mY?)omN(@o@~T&7oPvKm;XawU~rm$#l~+G1L)=In)ipJN0n z+g&u0Y_0SvDeY}je4%AVHlI8%U`P^6%+b3~)79kMe80~}W-Ukn-p=y&a~N4HMPg;R(|u6f_8 z4|3njRB@_;t(F(tn@>WG=$d#1DYwU-4$EpLjqtJo>o)^$4xh|aKV;Y5kB4i-Kc6*O zz-xnv>RDUtYa55y*XP^vn#*@(e0ISoYkW^1-{t8St{V<^JET_oXzkv3SKo2oPb*7Z zhryS%*%}w7C&S{mQ3|J_AP{&=cbuPNmxgmDKby}5Ua&?wqru|Xa^4Acm07_N{`FsE z^RLYf%{Jrt%$#`T@%hh{Q*i1b4N~-hCybfC<$?_|jA4!}(udrK?wX3t7>06swh)a^EQ`=}nuG*Tm?*bZ_E~!7U$Qho%H@n} z*0u02b<53RmYx43b^inQv(Xu3N9t4CIPSPnl(1=j9&757;}Ef*iFezrn%A)-Z)g1q zK0geuM$hZEAY|OnZS_E^4PnIOjr6*ri%p85r)(xp-bh9-u|WFl;>^V9;DS2(XF5$a z)7=!*>!i-izjnSy&E)Mdmit+EM036z)WEv=^CQMALM|V|jVek$AD8R9U*ryMEiWqJ zacX?wILQ%|p&2^wgbi%kSjb}55b&;=rqNcEX(&#e9Ld<*fIK*DIrm2_C>rZl58B=< z@4A%ApXR};cPSs}CO7Yj^$PKMke`!qzc)U=K6q>NcnZ%J6GRqi?t?^HT;Dp#a%c)_ zp>bAFxgdmCBm_C7X^WLX`x8-&if6^;lpUIezh)sAC*`#E`!Kq@P}ZxH*W;G8i!`)g zWotsz>Co_m9#V>kIMZm=H1kxK9pc5Bn;qFk+M`n3K`L2LTuoT4Lr(i5pYAI!naMz+`NwkVmvoPLMh0) zJ%mB2l>{w}D|q3@rV@oD81|N)@m>B9WF*V&P_~F@zY8?ugBlDLcEqEy~)}J=v`zVH!864p{2(~(l*|wKY5E#WtEsNOW@@6p87Yvqo zV`-HmSLyJs`oIXjVyQpoR)(a_LLZV7gkCSJ=Av?UfIOvZoY5J;1A5R5QAtwaj@u<{$T*=0IE4ZPuRRc$ zf<+hDH%dWKxtkgt!~>^_&kdCY_Z+0>*OU9_tzR4CJby@N{B+gTuUqO1T3XoT0T#F0 zp_sc1Hz;Q27Jh4uFGGVtffykdK!tTv8NQaKa?`PqE8l$tV(nv!Uw4b+d}%{+U>L#A zTpc>JZBs)Nnae> zNt+@C3^_u_pyPgj!uw;rv9v`yJAC7UCY+g~S;UO4x!(h_}~-!E&;lu7gtE&c8EyF9g(TLSgTM4J6JU{HZ3 z8EP!T&m5s?L-lgGyM@j*slKIwA>)U1$yw_xkW_wwh%m%x61s;WPmrfp-R{-CS5&ou zu+oQd8`=UT3p3MoR_Ed_q$Fr9uGX_WbPU&nRKjAS|D>X<U^Z5AhXN&nJnLbD1TbRMs{9+p8uXSv^t5n0VUfhX?2u16C9B z#i0jiZ2neTsyC~t3YB^tE8ZrYEuN`z7sb^Ok(6B|W}4lPK&zFrjy5?$>PJTEu;4-p z$-@f>6fWHnzb>7P=cG(yMjaJRx&057^!T{K32#&1li145TeQbcsQj^lg;qW5t}vwC zMU=D|y#~g7CXmZci~apuPVH1P>g43e-L4Hz4_3GoW66~^%5dF}t5G@Zr|67HZQ8^( z=2D%72ZnpN73f7B4wxTi*E#5VHtoRikYWB9gVj$%@quxBjzD)~{Ii9hOWTAYmRffO zEvfmavSUd1Fxz)k-9&9d3H3i8G3LM-XVUjrPFdL-W3i5gFDl28X`)YD#=JfkMYP2jh7MLRZz?He44=q;C}#{2GL|m zpmhcp8DxXBA;K)~@u~cii1TY^;7Jn-dJB zDHe}Km2a}_={nfvuwYm{aLKxe7bZUHvb|tnpj?re>={x4ZGa@+v#`a&WWVE9^fw{jXYS(84@| z?CBvD^9liE^gy>u>^3svY2WqNlwVV^uh2fUHtk-@Dp_4O#+v}x<*I1&po+c6jrBnu z5-Gc64G!xIDU1&s4l=sa40+1Y7Ov9hI(jIFV}xMzGjoIk1EeD>wp@ybrpXPYZZl>) za~QfDVWl`*&&?9!R00O*Vr9p6N^0preDSss!(OWQ`n2(oKN<{@GBAoP2tDzH;!;kuDllLL_`z6{V@n)O0&Ssw3*7wZGe~*r)9IOXz}L zdYSy5qwCM&M{PAn&pmABu^-y!QqK?3O*Xsn(_-zr!i_Z<5UsDv0|HHRbsJz(E@${R ze0>*QKHJD=5bh+thJ~W7N-PXnVfYUe?yRS%F3vpER1gt9Q!RDrJU!Vn4lv^t8Wb2H zFsBQ8Ht5@mtZt^|9DzaK~*00pIi;$$~q4wSegpfB-U_bg4)Mw!w+lQIVB_e zd^zF0Kd&vb_6_QYEtVt#GDIU159!yZMu%oTUMex2qu{nbN0X;teU}4589qHfffG8` zyS@p5ywIz|_EEwJP%nh0By4JC2w4Er$Gh8g^!DYdeEG)=QzFMQo?NgSGiYzVzY4Qc zUHf46ZvFj!&#I#aFaI z$(m4)&m8M0RBNk4ZEU4!Tn!MWsj*g{4JyM>#Tv8yzQ3ECoy@v$)wP>FiwQBxh3zr# zRC<}orW5Bsq9^d8Q6o!~4(>Ys{htk-)ZKMCyS0e+tdVsH-rNMpj?~`$bo!%!E?iIY zCdV^=^i4JzDTc8%3Q`{K5~g$zpC!5w0oH(h1XgHisPLH{g8>|&B4fa1I*CFwJHxcX?Bp+* zXZ2^(diZr)1Jb>pY(7apih2|i8ty)HK8;Ee(sGjsX;MVnWZSQX0V~FI(!MD9?nwA% z^C#xm`QSz%mi_O5M2dI*c-c7;Z=w$ZitTrNE^Db?u|=&cTru+7EtRW`Z#3(Ox9991 zG>3GkWFpLqR1z?gG8<7mOz?T~TG?~wbQ-tqS{omh1P$u;8MME_pmpw(H>WRU36j91 zLaNZsk4%}SXH8i6Ml@WHQTkWc9%>}?fOSIGv`44x@Yra-OYXfk#u2%%(a}^wT+BiR zEGr*MgFaAd;?1WAmL7T5A%huDn}wS`czHq(8}p=sGPf9)%BmikCX*YYID=R|6|`*3 z${SS#%kLU-iBx}KLtiJobmyRN;j)fuExSU5oM$%%$*h?(QE78DC?<+tm@_(CetNa# zc9i5w@$%hdZQkQJiJ^@`Hljsup%F}EZMwF#X_HRopVqA*2r+WS@=V2-K+(`y?y8^F zPll2b8nyH&!&CMW!WPeC4{FC;pe@Q!*3(lJr8E&o0jc2#(;UJK#d>-Dp~m@6Mf5om zDXBolljWe|G>#$Lq3L|TJ#KE<{a*D&VeyN@)m9%0uN5?~v5UulRmLOcaPOEo$Mml= zaA)I)n&f5=#AE|J$j-~`-Z`!gIEHrh6h@YMoiokgh&Vr!;yYpUTT3hP$J0OH%Vm1G z=xDf5x}o_>B^cO7IjCs!!b}+4!1EJC((WWS;+eKOFw|H3Ig4#3*v`Aqk=VmF4$!*j z^xx#RyMldHU3ql!TFP5>X*$;pBx{qT^ z+4EiQ4JB|LkvKY0I_e9{mNI;PSP2qw-p{T#3fkIcfQY@0a9X%NrFSFfuPoy>a@~i8 z5t1E^df}3fIx<`)rf4XEd@Yf=&$9~g`*_kyC>+A$arOc9x>ZexnHBMM2;9Du;(nmv7 z`g8&4(Si@0<5y*>yjnyWIXj4Y#E@vYigMs^;M^fjrDO6fcT<%)6mipunYCMp(32i$(HaNBIKB2m^w3tR zr9ky4A@+PC4u5rM)pE@quv59y{kkHOAtMMvHoda- zA1!6WpUQUU^Bc1AWE*cc2fJs=*+*uL8p{($dyvwjNITKRo?TsV+N{Km;~8l$c%c|x zMwcwtBIcpn7TiLr@_#3Z`af@{!K^yM%L#dRXrm5ISH)#@muURl*wR&@_c2XSt8>H4 z74|qNo<>>D%d}Ubi2R3Mq~-Cc_L-~(@mWD$gDhJ4OorDapzhqLtGw^5~K`d{IqUo$31WsiPGoTw-l~ z(0U8#%|ym<-Y1-)^exIZ=R^&e%qy1Jvk$sk?xx7ldrL`c0~z$3}=8{Mv9op8rU zd9w*vD(sKri)ug&8u9DAg2pXnc;-U+XBT3NeSduQVR2(1+1Fo2| zJSo{a+zlrJ834riLv@Mp9F&I+pPe&OW)cxYv%U~Z$lfO9Y$q%!LqA9A>bzq^!5L z*v~ppZURpKiW zVa}<6nV&r5~Y zQ$UY9;}UHT2>7iVy$TO(mX0O+w%q-~`9%s0Z#%ZE1M!@Zi*WUp_b_+d>Uzz>MMvzo zn!kk=M=qMmUMH$uc9cqobIz+4=)ZtoZ4gor2ltNT+(I7_@|~lzQ@f6r6OURe=9$#L zdWxZRw{ZHBPiA&{sOrjmozm0rq^nBnrx6inuFzpfG zA*OhK`=D$*x^#Kp)_ab{TQ%X&N`RT-3xkdv?$1OR_RD*1|3&;D&%u#0Sq)WI?j@Y* z2q4pg6p+@*R5gs{9|{M)bNXUqpKI<#IA{EkY%dEObr4_3ia30&kz9e*u0-dCzI~Hs>P!{El9=1EUMXGtV~#;R~p*v3x&_ zedg7vZDpuAqlUYg^RM|M+{uApC^Eub+5e^s6m^>I8Zq|Vo*|Q|0)}H zN0YW?m2Iaezun6-u#Bj)k#e;fVnCbc_(+Wu54Hoxs#ak+u<^X#xP_P1OP+s?ji#R6 zwQ)@>JN<2sUeLO#^OoUj7i$M&*o-eO+r)lG!Pc!e&7%Xfr}Iw>u2;R5vlr0T(H^Q; zgCmc>KI(DuAQsZwCJX<)&H5{s@XQa#i&M(i5>lATFBQ+Une)IB1~Nwb6^PW!tO8*Rp?~b)K8C>pS68dn-7+vBLUi<=#0} z^*IM~no!x*=N)zL&4Ip0$1>bM)^J__Czouh{Fd4AMO_|LN>T@E))E2$s3P&cJeO`KuQcqW7Xl?Q}g zF^W$bsD<|EG-HR3kw1=Bhh26g_gxpuY|pA*b$W#;f?b{5%%a ze7KqNl1U`nL;9XQ+7=xbug}}B3|*!SdbnrU?G4KAu*b0xCtJBfyN0_)+GuF5im)xI zh1s8-ewd*aSJ_nZvgzo%3n_&bTsX{PetK+WW*P%SkLa3POXPjxGumpzk8_u^J3K7j>ZL3BE)97pwNAzT5G6(x6fw(xHbYT#-YXxR zxG#KX9Q26BJj1Rd73{oIx6`59C~jP@l(ukA!*6l@esbr3AJmk6ysGdqaydOL+;H|) zrmKUv&~*nMFxfi{sG?kk^bu%l%(=zFSl-Nm(|<*J+C(wn+e@T1e(_G0$~L8*p@ z9Xp6ABJIkx#D>K>qsvkGn%wz_{s7IXAhCYpAMKsZwg%nwaMHKSqqL?om;4iz5m6JQX1qS3(U^f|AOy2`k7zfS)zG(Y6`C0WlN?Q(&kB zXpVy_$y;6iY^A3>pB;}YsIy$8IAE}AG{DXojYk*IM5=gmRab!4ye-e>zB9$Ep|w>g zzA#95v%kjZ2u-I{>E)v0gTXbSi>ne^;RSkl2+*{sn*~JZfbQizSGQ17MpbexHp|G# z91(XRsml0*Vgd|yyT!{LJ^-kpuz>v?L~kx!7)aLW94`*2xmHitgPUasHsBf~+@HPa zLrYf6Aa9d7Vl7n0zIg$Fk*Sv3dH|W8^y5L1K!;I$Ci$FvwO<1Fij@nB>`<&Lho93e z2CAw}L@=Hi&IROP+j9!to5fP6q>Fl#lQ5ZqG6RLww0cc7W2*ynY33Uz(bVNTdMz#1 zz*&kF4kvJwJasVSQRB}xaJ+d|2*6`V+uhB_O^~*F;4vM{Y`VR@mEBUD%DN{gKD>F! zZQH^I_FV03npm?p4vTRrXw5$`u)Xx_e6-k&5$u3f7a(_;`nzKI(fRSKG~`F8yb{6> z?B+T!@tdDC9`Zd&3a3?3)B422F3#vYB3BvC&(GyMXe&OvRXV8;F3Iz$__8Kovza8| z)=t?ua2(sT)al;){_n4~#+romFM+b7JglpWOV`M4@W|NegTPpXFUhs-Ntf7)+UK$K26mX z)rWTyC|al>c06|ejgq*{WqdMB4TFH4mV`hxTXHWs+*WoKlB0j3s)_X3IP`Ksh+6I@ zkQ_3g)+cU!3ZdyVs7G1Zc875^|0&T8**@hKr5xwhE1S69z+}CT3)S3pj1BI_sx8I8X{W9yk5oC_`r2 ze3;v>PnUz8t-!BVSL_Nc;A}NNGxXayBSR`4g|->AB@Rx9i${`iI!P7R`a zZ^pP+itk)>RM~kYQ7j&8?mME^;MFyVQDo$T_WBz<`kW7@mBe2tKMEV(v43OCCweeV^WplAZkTEI7R{(zxfR+XVB5cJ{1&4ldXG z>Zj-SwNteMWg(P859y_^Q2hMRpB)rqre&I0+i)fV`z(b@Za6tsFoI&2YI`9}X-_(K zEO{B5LDx3Eiz|u!GJ8nA7dlnt@Z#Xqq4eivy^Ej^B9G{mk(cL~$ilf??>pT1>jfnx zs1?h7PD0nmCTj+xT%OJ$Ys1H*Q`GUVU|`qZevGTo&r%)`EZ0SFig##`XA(p%JPq)v zx)s#2((``mV+1Mgh7MAyR^&%D7A1#trWMbLQ*ETOq3S&nZyj+lU-Ya-)bh z%hgolmv0JMyVZzkZ2KH@M9kUxyL8YB3VI{uxnQNzJ6G+us&AaX$3XE8`dL$1bfXR> z+ou|4QN|ds2O01+0Yw6#yj3a&Yi83hCvn*yyp((1TgJZGGYlhfja(l1OOGaWlM*MF zEE@k)>f|03$xT$`iy5JaBWD-^$Tr$So2J9Tu#7Q)`xWE6hKjX8GWa6(#YHgECq*0E zU9^vNUe8*6-K^A$tL!k-H$FSq<#sA2vt=aBAi4M!3q<3_*9ucb+3$jU1T%|TDK`S2 zE*~Wi`Wts!%id@bIcndo$6aHZa`Mb@<@k1tCGR&&tw8G2|4NKu&d8{@3p_Dss_ zhSufCLuKCkn(AF2rQglC_?Tzy5mC=_3tG(MC>=FkW^a^D#T25YN`h&SatoY6^GVX_ zh)EDA2qT2q;v5+g6vhcXR&af=aySb82YIZBZ{XzS!X6*RTp5*Le23YR!`tJvQYN6( z``qKc`a+DE_dNmwy|i5CL;ays^DEW zMEb|5qdD!{TT7E4Y~9DkvzuzOAfU(h+Df@23m*yiYk@#N1_hkP=@ke{VjBoTx5HfP zFSX8cqD7ShI&8XOEJal$CN`OV*B=&>^M2Qw(>tg&CWt%cb;sC<$2Au@q=m$C(9RFkE<>Q#f9?g>cvRpi3 znw&IqY^lVt;QuYp0HMG^0Kqt@@&V$U9qC&byv_{!$>kXFW^} zZ$OSm(+U;Pc>uGR<-04SmPv`EX{gXcZeA@U2O_I(AUIDRsXt{s*CxzE;Iw(dFx zT|`Tnr<(4!v9Z?2TaSWf-)td-oMiY@;3e1+Xe#Gl8Qs%%o*|-tY%z}gXV-@w9EzR# z-#9H}!~U%M6g051i9*T|^P|$5)zP=Bn!78*J#o+_6GV(>If&{cZXorR_AM?ZG^FV{~VAo1zM+Wi)JYR8rB&U~cu z8-9O_;+P^Yi25IjOT?9^)F004`O4%I5CzR%FrloYy=s*SgLWrB6Fg(ZYlL*D!H<#P zo9)K@+KY}HcGv25cSmhBXA-r>0mTrTjZCOJ57mv8 z-dT2OceNBy~In zH$umy`}O$EVanW~sEMd#RPHnK1!9#7;ygGQ@1@4Fwkng@PC0JdSel6+274CUrNR5* zU!L%yo0DzJBB(5ono15pw)}O)NmUIEu8KBb_#Jc%-g6@2&C!DmSy+Tn_44qKFJpx? zI}Xq(4O`=)1H$%MHl)ysmVxBluPE$u1XCp8l=Q=9LF3C|diquhLijQF<*8(J*+F=5 z9CmRctOkvmgxqqfETN)=ZI4sRwtRs-b#!;yw5T863^^4s6A*DGYT(Ex)a zlhwy^o;K9OmS%GsjS3(n36dEIbQ$TYs;Yb+4xo-OcZ*0~5&2maM*%@KC1kK;S8qL~ zP3ydVlF3vdxubBwc#L0EDQ+-_G$UJ9SY!wn61Df;OzbM4X!FZO90-=mp_?+7VU2$; zBxH%pRdq$(ow7nk9ZuPpr|6)5RR?(82eqzZ*aR52!jnzxTf3WU8iiV5bGG|zaWjai znUm=1!UIIa^gX&BK_rU86-EUw<3wy`xXp6kQC-_1O7z5&yFicRdbUtT%gQ5U?#24J zSIMc$!)W%%G!(Q!U1bGD?BxS0n737RPm?c-RqBR>c}T z{*%YJZH5=*vu3s-BNm^rnq3EA{&$m8~*{o_4hl{+&_wH0iqfv;WVH(>r=Q6?9%TeO#1sTDW zm5gZ(oavdxH(->I?GqNWmcZEp;(bp%R+Y?!op-Bj1GZ1LD)--w?Kzb+7=zyL4t=@E zdiRSY5gYKl-~3g$*9qG`s$o<9sbXW^8QFev9u&#qN$n>eU%hEpwe-(1!qz=&!aDd; z-VenT<$`vrLjKGZ^fdgJ%lByN4r5w-x%>9i{KC#Bh2BTQNGf3eD;v&~I^2^l7)+4C(@=|te1 zHaP6l)wepUr>6Rr(HXKbLxXA8u7ewBC8Fs@`q8ok2k&m2DW_4CFM_^rYHAlR#uUWS z4YlH@OEAx6IbwF2BVR;-ux;|Hnj}*y_e(@cMfIa{j+*j~QJ0BM43S>SG)^^6QKwES z?-?e_4)4ULHd5f9sClqGT?HlW-#SvuV{q8nkkYNw0qM@V;Iql;iMB5PEchGs%Y83P z)bqJMUOd4_hA}YCmv-dJl2@9q+N&OpXMSsX!|vI0U1rPTY^iumjp~MPeNY&oP0;&5 z5E0ox+80cy9kjOdWTdfs)FEiqRVPhSLY=AP@!7^FpAjM3s1ao;x}{&r_QT*!fd&p_ zCS*Mj-HHxS%n)y~jnLT`rlj0%uZ`jJ)g`6Yi)}QVaNRDM@`$5>j-0T6oa%IZ=P~rr zC2Dy-knWF(1}PZ$XW6x*evMPIgDT#oQ~?^!cMO>~72?El#OuB<9#c^dBe+AjfaTS> zV}NhPAH(&rMg_#XcUnH0(=Zy4+Y8tpvc`ijX$X*@e8x$scO2bUKQZpeF5gc76Mn25 zuczCJ>Br!0LQUdfJrn6KP9e#}5(_x_!+IY9^9G3Z6&0e1-#kt5Rpxz24}x!o^l)|m z2dC1KK|<1`kb`~vKr#~g!>d3=j}FUqYuR-^bly3*5|J>`8_5zG%61>=<5HV~hq_d_;`z?35N|G|%L6RtZ6fe8y8aCVSw-&@F zSr+WVo1~y=XcOVPaFS%qjWKB2UBa5?`0#FSeCnRdzm<_Vf^&1-r_(O$C&E38k~TnB zx#=1a-Qsz4{FDI}7sDoy?kWsne;&)8({A<-EQ?PTWrokE$HLH|&Cji~MrhcBx5*Tf` zJHSlMvqnO>{>W@?nw8)*967%Wf6DT z3O%-Si3y2eTnb}tmdG^7`a(x!=gs5U$zA!)dRHrgh7$vSl4OAMHNxOtJZp*^h(d+xXkLvRfky20J^g zvY2Y)C`)qnM$Iv2aW-!Hr2NR=7gati)>fG&LQ7#mC{(*Jy5ow2`SZ@cH)Z5#@JSug z(~-cDa-mjP!c=Q3<4H^z$!uo%HkZM(8rm$sddg*CidQDb?&%}+Hg7OxJ(^16wpEso{z30uko1edpi+@3bpsZ zx`Kphj49CEhKnL4o}#}&OYV#rrdajNbxxV_i?mG-EEG&B3)#ZKJNF)7OpPRb1dP0Q zEQJ(&Ml>GG(^mV6;gn%vdWAZ(! z#sRg_?tiw7{xljxlH;g!-ihlzr&wm~Fccr1-F(~Xh=Cv-{ib>`Z)Tb`7jC@NLy5WP zTsnJ%dgDfZu6XzrpS!)C_rasC-c~oAAmqa33+m?Q@arzHXM2q&;DXb79_4c~cZScs zne4q^8o`?CK9C+gti&8S;TVR*eTSEcl9~)%)tsrN8&Z?^T2mq}(rJNNyl zs0-y$v++BCj- zGYn(yCu}$7sK=u-i}-%G=PA)d0o#a>)w;xo?u<{)dv+1_+o-NhAU#{G#Q?JFz0(B9MOMJch+crEJ`ShnA{ttWQ zvZ)qff1{Sobbdd0_;ng=nQis^f0Gvt@L>9TL#^b5VF?{^DglW)Dj1bDd~<&`A*z#E zfLg;1?^-NiCQRlQaWX-ZDy`#aujMz-iv(jYEyzk za0e0_sWwP(TO(}p)bJSLxedW#*tgHq({3|4@mV4=>KVe{_|E?qjNZlv4_$pX65X%U5C!_7sTCNmF!-2;Yts^P(( zRT*xTSTj3HOC}&huUJJs&r=q$(MIA)0pYOxQT2{Acf9HpIzgwiyi!S?U&vswerpP z4emFL83v(|*Nf&PF+KasSLoSCXPRTXF6+)O6g%MXuqMcwyS&{j`MhHg?arnO(+{2J>MXwGkcfUtjid07>N3( zILn;bs7)S&mDqB5a$fEy9%~QHPGdV4Vhutz&}VYZ^x^TqSEsL$Z9k>uo9=QqsT)7vF(dO^x)@r(1x-yBvb zsjZ^=;)zE2)Oz)-9ybz_&g8Z}u>^@CxGSh-4nof__IZzMwH-utxtUcgZxu-}&5Ipn z$B=W-^ykyJ7|$~>mX+Ljd5U<3GwG6at9KzBVmIYE;C?SV4!vUS>XaU*YLOaa4yRqz zbz`baPZXWC<8`v)v*4eq9M>Jp&b-A(p6fMKIeMeK%dD^NG`ri7Qb9 z7Pt^*r0UNZtQ2b$*fyn6**`*)Iw+D(C5av&n^it}&s-SXo0RC_iI$X(c*UVyIVmRL z6og){GpjSHxtfwT^ic9FEGib~Skq_M7{)O^h^^agQVt;JiJf50@tDJpTXax*RwrAZ z63`~!1L0;XYbnQezoMshe+4&r#`hc*N!_(wix{ws?LW zp?4AJG`<#lJL7Ek5ZYJQZxY?tW4q@q>4}o}-^BEGe(%$VjqcX={BZcr_XGSq@_P8L z{pjnziG!8p*~YYpfQ;XCva^d9eRuJmI)lu0yo-dzPh(s%z3ENq`5|(#S@n^*+Pz{0 zr4jym3Ki<6Iua0M~-J5w=ZyG(J@Q(0jDez;Ybr$i~Q%*L$#N62Ba z7sG8{Lazl>c4Ha~Y`caNB|Z_@K8nTVxqnOw?~lKxVEVqd)>Y^7KPrh(L#*}8h=I+c z{&Y>xha+D&zu8}G=afGw^gNBs!8(koDA92)UH#Jy{(rLWp9#Z=jyn76{gnJZgc<*V z>V4j<@y;4?FtJoplj&VY`f-yL8rQ@<s-S{E2IP%Iva( ze+u<)X|!33?(q`x_c_JwTpv5f0AzH~lFrc<{mYE2p~d70;AODUXUX8JIrL4J|UJ}@@Yi5_>sT2?Fj zee*f>@yu~=r`$Jz{dU8<(FbYzHsmM;P_3r9lT$XH>6bK3n`@{h3a?9L4O9==)^5v@ zT5$|6ZA-mE)<+W}|3tJ>EkveW=e+uXQ)1VjDW{3v{>|E7*c|#M;y+t}ff~Ag*g8Rm z1}jxbkoNP_+`ibOz0Vjk1@G#Lu_@+v*Gy$_)YCdR^(t_wOGeI85npe+Z8r%n(O(L# zem9`u>&mH#D$=dT6QR(A`XY9bcF4)uAlLKQDEwVC!9YPWddR{UxP$X@IX%a_GYm5f!V*JA z5X^*-%V{JegpiUFbVpc48Xvr}`0_lL0^ow=e@_rA82k6=B_d2aW}yczP;tWCv6~nP zi93MrwV<}yVr(DVK}4h4=7o=+i@o1+@Bn_3XRs`$$c2ikZZyzDbLx zNPUb3t9J8F+??Dy_INO>P;tWa=Hq)rgcg# zCmrJY6ikeF#ns$ps}e{tEh|q3+ZH#>riLZ;#p4@RHa@JFYPe>IX9Q^7uZa)UF;|6|oRc7e~9$$>dp?qihCn4sdHsSSSV=J?>#Um5y4!^`=AtQq{JH*XcU%dCm|mh zhNBE#QOVM;H%yz}it~QeeFRZ_S=u7iD_D|ar$Mj9eOTW3rmr){xY$Vhla*r!8A0^a z+6fNJNNA)k_YIG2g}ZC8amQC?<-=T^;jy7;slazsYi;&GS2J;ac1lX%byv?9&1pco zsE+OSFzJHXN}OR_Ctl(jfrto<)?l?1G*l>HLXe}qU{mYR**Q$Tu=XAO)~c%qP3-Hc zc`Cs$jj;?ww zQI!4ikvwgT?5CYZ0feDeG=|IO6;06khuZ=#sxdRblda*#p6>lG^V$Nhqt!iTA1=H< z)o$c@e*7nwi)WLT8F|O;hTOVr`s<_N@%F5ENXs5~C|x)|Z)iL&wZt3ry<$&_ z%4|BG_qcg=ge&jM*SMkFpQ#%jDHmtC<9h;Lx+4JhewEho{-0fM}whkx`dM z4E&YjrY7EfQhpCiDSchReuY{xK_pXEks)NDlhuEYdE-+1D$657tE%;;PPE=~d2aG!hv}>NTL&=M%%yJxRh&Rxaq?}J)-SstO zR-luto_HgLUJdnk0>KahUx96C%A{_Ik zNXc6SYGI4W5Diqhz(V1j>*QLz#ZdWu++hXOGk){0=I8Qr-`{~2NdCh8a*hNfO2A7J zvJiqM)3;{oxFZjUtjW&L_im^KL{u(}W$@26x6R`g&#h{S>^O-Q^;Vv@}s z{{E~PChpVr{e0tdEho$4iG}A%;vY-7SNFK?^W7*YCqT}Gl0HSXH|z5|eW@Th*8bQ- zTCHtQheRNu2twuPM_mrMJ2#1Ss!~ZMV)5vDRVvh#N!7~b#cW-7HcA$`;)E2Caw4SL zsdj}a*rQYRtL8tQB?V8T7=K*GyshoUS7lU^NXvuD8gHW)t<*!?tnwr8*;A5$f5LnB(vLzVlKIR}IuDJQ{b z6EZ=AypM9I*)NQy^-g_D0~&B1J29 zPg>nK@p+0_xq(OMvfhb65wFWkTio%3h4{s!P_><=Xv;x|rhd}PwhsT3D`FGS$<2N( zVOKqvWpwZL9=%2i7zTp6lP&m|6i3A|gCPhq0n4jQfQ<9+WY8^m#CEDfdv{Fci#iWb zfV3cE#YaAFw|`CpzDzt07x4sxNAaW)0udBNN!oCjf)bB5gAhIYKY|Nc2jB1M@@2Om zI{vTg{nKA@=c)o|oU)xyYf=n$<@8(jqZ~elBM-M`{i;cvd?GKBJY~<~Ghhn?gZvKh zf2EJ_QbHv;?WX5{?)+Nw1y}hnp~NJE0)5aBKL3x4$Niw?=zJ|1u{CN-17&=~qrQd( z8zCqfT45t!?8J2glUE(erjx!;HwrgJ4j*A9UAV@Hupl}?KZ8Y zH1Y+lEgGy+@qF{%dShGX@yU%=7};@Xtl940s&Pl(X-fFcLW^uyAeH8uNR-p;cr+8L zttnN;ioTdrL%QVqU5}KjE29KGIKg3j0wi(MWE!K|UrhT=9giw+A>xl2LVVowCq0Ia zV?WTGc~_@duSfeH<60h&k4ak!P{!c}~*6 zvfC-LM@>1ZhS7gb@rBbiTa52Ib-|3#)yiC}OnjhCbwe&!s{0%@bnPjYC3IA!zdt#$TZcl|V=_(g<3>~a5kx54fAoQRC^*Zwkz$t>(YlVijf$NOuS?wl^mlggxR$H*!TNe> zpU{MT9r{8LQ>G=gYl}dlw$V~lc{<|jFPBD1vZ~8_AY#a?sttK=FT-NDvNKb+ zjt|C-RM6ekP?gm~55S{D^w{z9(`vZNWt3ZW6^}$SgyJt1khj?$E~nE?G5Gw;+E!fSq~`e>68bz%a@~3*|5LIHDuXY zU%DLWG3F0Btlh^OD?3l})6eA6X&d`L$q9F!lcHS8pg+Jzv4SpbIk5^CuNcjsSE#zeM>_LdIYnH~=|b{|N08?9=U$DK(F2);(?e(B16hV!_~Z96 zzz)3>vGf)0Y$_*-(GM@u$$TN2df@^Exx1T*%5s0b$Vb+KQc2n26@C2~O4LLpl=m~M z%DKSr2J&`YCbNL42ZRr{>ppa?h4l^7Q>k7vO9<5Su~9f3M><5R6wLVlm)*YOvuqZ} zUdCnvuYU(e-J^wO6rwRhhhOCbr8V)C38URjoOFc*-^1!ZH|#%p{qE20&2#D3uczgY zUp9$6Q$v{%NYaGsXg7VFMXe=DQrY#Jwj6cV@ADp3x3`xa3z;-EVQ-#8H#*V<6wR1l zTa^7y&22682krK5_{c5v_2&)c3Y=h7bpjb;#SkN#=0&$!$6h}?-^#yq(i5_)<6Ri8 z{F@BQwRL^T&N}#8Yxp?Z?Rq=@N41*&49vd=k0Zrzwm6&4bF>QI2!A=5C7Cs#;O@6? zuNrUGot>Ptn56xF_Q;}BdNz7GL?pPzsAEr3{m356)CKbgyd(%luTadx)YBPEC>L9n z`FrOZW4pTCvf@xd%gpma9hJ3s9mx(0IArJe=(V!}I)QW{Gmg z)UzWpgpt`>8-c{<_Wjj-A1D(`{8|$0Bog4J&@nk}K~Y>2|K0ufvw(6g|r4G0=+?5v<`8@mSf<$0H^T2q=&u3otO0h=z)#CZR$EGQfnCq?Tlusu~$c2qcw| zgvk%)Ne5JrQW}+sY``c3EG7V{A)_Z8l4m3MurN}Q(AHr6jyNz#Pyr_R^6S~iL45r9WYn*px<8-fFrlvGenpS!ahTk3T~m&K zxBfpx=fSANGE`fUTF(;pZB4C z+)q7amKph~&##8eicY#TTv@pKkFVnfKKZ&5om9m! zVIi#}=k`JoJ~RF?yysf4Z$D&24oAOK zooqaG-8X2Slx6rL}1>aK;ZLJSUnHv`I;o2g%96Os;4)1wrz-3gsC zHX`xQud;$(gJ>qMyWkS+P9JqH$!j}~s@U$$<~kjS9+q*k7;!W6oo1fTZ2(X-Q;9H4 z97SJ$5A%m6$nUADy`#igX|n^Ar=#m?_*D+8eyc6=g$MJz8ZjV9YGnh0QcuZue`G&?S>2IbGjCV*Jxxjb z8^7FG=1jXRf#SwjMEU>8{V;l0nwUYTP^Hxb|4y%ht+DX0pVck7{tx`i+gcRfdOfIJhmcg9Kou^5oI7ZAU$5ryr*QTDYw+_0iP*a`FJFdCf@}xq~`)6$!7H{7; z#Z-IO583rx^%oiKi&-v>Yc0O0-SHoi&r~kBi0aj4cpsc=$B3HO*P4`enhd_pOk7u9 zuQh$S=0ENFG;H$wenj6*ZJ|TzWZhBZ|y#ef8+kdxaN4q z_A?L9<6Rv)*NR@Q=$-TrLZF;U&{9(%Kv>M+I4OXPqM8gDk`olf3>jgFObif&ELn{> zA@BYq{wjQ2fc`Sa--GE8WU!fr6JS{dBr{``g%QvCv}%7CLDn<6 zTzUi>;|`V18f%~!3Xcdt8V;}qK|oTJWEoRRN}P<0E}ej6hKK;dLluewprG|E7TAXBsS(v!`2l>(8F@vsueoZk9Q}th7nY^Vj z@MF#6b>zU`@J4Mvcn+-~i@B|FfD`=q z&_#S-8EdxWg5oIj^zmQ zjwsSOk>ZME@_g|((h~6}5!r@XT)~c#Hq(X>l1;)7GN$z5ay^SB)zJ`BBbH%glI4>X zBnJj%pX< &VsK?HduOy$E1q&CMJY*jhMEglApj=`&57*@++U7-tJO7T(LYAY^P znCTgh8G2JnkPSylD@k69WWmmelDIjV0_Pg9S!2{c(0aJpbt@(iY4Yz7-kw`wye-L( zA`3{Av0EEME@Y0<60>1*MuSBjH0-KKQdr>g2xH4C$lY+JN04L2tAEvD}7sDOV)7Qzf<+ekE-Om6V(mAk1q zY8%s)WW2Lf<8t`E!RhI(ZG&{GHwTc+p#qW$9$M-;7;X`gyrj*sP=wVY)LG&NJv=4Z ziwy0gi#leEZY^_i%#(&kgh5+_(uVBF(owzcLFO0?Q!O_0QZY6L9($=)hV@NP`B2pj zF;=T84ldmj#=3NQkFNUWSrHrKrB^*>qb$IBlHm|e=BlYZCLpSJg9N=^WyY0=c7(IDM_`_Y`nAQ=y)!kVdmMU|(#IRFOB=EAMj?#1amg93GUjgoxujn{PiH1-%<$m} zDWveQ_ciQ_7>QQmO4&aFHe`_RE*O@wW^YwJP3{Cg-K69G*iil#c4C43o4WY6(E*P0cBo+WDLgNIY zB3dMXh#fz?I{yd0c6;Wf`5^w^C19_tKQ{rnxIj7JpvWQ|cUI+xoMIyup+;dqcL3ud zNXaNVfEOgC5GWO-%OMY-z3l>-`XISsA~{PvY^Cqwx7+MvRzb#%JQiDu6y(4YofB=I965Q0fQ} z*I`A=Up6wt_ZUT5x?zT|?8Fzd1i<%{x*_`MqEKH7I4KT3Te z;D!(YkP!rkP>BH{;1J;mm_xuqiQXQd91zNyX{MTKrkZJ>pqQYLiVcTqk|7|#f)XRm z1)rza)YK{yTe9XrLm)s+$rrXX11J$85HLVV_1Fntgdt!)133rkkY0`h;9LV3AYupeHAFN=DB_oI1{dQC&_<&S>w&JD1I#Dq4C^r| zQB@SxAyl$NJ^9PPXE1P2vR*I>P^kbMjTsy0wutZ7%G+V+lbvZGM1KyVyKgOJRIur# zQ3NbTE|Aw0HjoDdkWR%WG~a3T%|2|GWFArBJ8@88q!aqav@eNiUe8s6ykN2{h%zfP zJw9+gPP}{?+0ae`2&zdbf}VsKE9vRAnwtw1q2~(^e7a~d+s2*~GWA4ZQf$PF;jK6* zY8sDZV-h#*Z!}TngBc<^fs7$!VG(!%tR2n;_{>bBygxsDmubp~vodpn;Bp`wc_l~> zo7zW0CUlF=kmKm3H0^++UKl)LH+6(@ixs>M_Tg&KO%ju?If(6xr&4j!$Ks5L-U;dr zd5p-9<-ME>@BW`SS&^_42`B$Cub-{AHWU;@5C?=l!ORFnzm@DULMg(WDTQBzO-l(6n3B-YkRlSbx~0COHCNO-SRURWh!K@=rmXx&g6; z>Y}ZUI*FpxI8*2Eo_sfOxX%`KM#g~iVVr~=wOsjc3YzZTJTe(C(Dl-3dBRdHz2K+S zJ|?TbqsNVKZU}8ImM@zWMN$coAnu<9xPOQMs)yMdB~vlO+l7dZKQ5AYUWco9)|Kq2?wY*8*Pq} zxHktAu##6Kl$3FlQmm@#tP$H#xT4|(jeKZwvIyLE`$#stLujM8&G2yMuQS^ z0a;sbzk+(ksJJ9U?!^OaB4`gk-hglzEOq@k8CaV{HvPFSBvfx7u!z7+7(KC&4XTnL zI`?}JEJ&eJjSS860`p+t9Ky*+GJ zO%LkIw9E#^&to~sje|t;x4!IeLnA&z2OK$*4nXG)@59%xB21@l>B#FCk#r1FK#ivO6rLRRY>g51$k~`k#-~bA z^GcA&b=ln5lzyJmo1@?-GeFhnxZ!3GDtMDc&F1&!qJ!p%;OvoVNIFT|lO7J1PKd{d z$T|F zj;}>ZK2oWrXTG@!2^?>uBEtubIu8OINH4-*VpSAxJ;V>m_v;q}HsP1@FHqe+k*aw4K}@5H+1nrD_AjTsuvze7R)X5ZZwEtpg#fr$Bk?JxjHjqX%JFA5g8%a*ZP z;x4S_RKFf}>>6GA6=9T?H7LlNbR8TmwfME%8An*ty4ZZ+CLI#?`SioV@IbA!WJC)M zqxQ@=MvWxA@PuI#ZT3T(J-4u8e|AC8EeXI(o7A8M3_?hb_8#!wxNaXITd-iV=qRa3 zd`higzUZ9dtErmal|>28$Imwy2Pj+O5G-XHWa>bx&JaC^oeqCGdZ^GyhBk)lNM6DF zLd+&ZNEvs>Hoj4#_32%wNEc)j7`^vs--Rqz6+7~sCycHsoJaJGVKeg)e8sy{GT&7q>zd6 zvdbY2IG5gzaRJO`0LcT}0;J!~C!;ld*p9%{GB^Z`ovmsiG)qYGP=g^Yf_WAw$B?IH{2cfB5fxbw{2}s2yq6 zWdXnn*c4ZcFKYx&5#Bbl}phl=eU7;SF z%(%ic2*yoh2J%dBO*U4OkZ~l+YD4(tP1=VWTKl-{rLO&-&-L1P!px`MP78%fa`c?eqWWJn)7cj z`{{c<-;{1KuV+V_mNjVj)9B8g&!6*i|6k+g>iK;h&((Gf)-^sh-?-JYlV(0%1-y2A z(vOUALq!gF<-#%R3N#F7L(4RA`M(Ko*r0O%(#2ZK4Ir3Idp8cyS0+sRplrW~jP;9l z?b;*gjD=BoX43S1+n9(R{Bb_((|cDpFYoC6|D(@+;E{DlUjA6ZTvtM+Zikrdm+v+< zlc@CiJ$wEk)veDYeaC?qM(*B^K8iQ(?9H#YfEpr{CUb2e`zB8utK0ss^GgVC_iL)3 z`Z+00YGWGmGSsWOt_mX2`>oPx6KR^Pma1vxH+=f}@BfW=E|Bp9yg7Lmy4j{sV<=B2 z(N}$aG)jADeeX>%inx|}Mc7L5<_boI57?4ls2mv`bZDbuS}m%o;bu?L+~3P*`3=l4 zQ;lN&HtO=<_3cve^zvEucAS{&@=v*0qPvoy|3=>|d-U(};i|dOmm|+y-_GWITI=k3 z=S^v7Z}!tg&!tlrr5IZL{T_@to8A9*Y!}i3w0N$=oKR=$)krSi@THO zqKYda z&%=VgUz0i~1|&*j!`XMu_J014_(J;6vyER)$#n^Zi(>};z9tT=5>DKR8TO|+LwFMi zh5&*5JD}6zQjFOCD4q{!p*U5*TGNqDo7ep8H zdrfN9W>891FQHUFog4wP9R4_$4@hqr8$QEiRT?CXLw=Cz#&Av<&Y?!%&CyH23E1ms zJ7V*87+nhp5Ge11+;&#IJ@5yrDf3$C!6G2VMks}d{-~&Cq6s223~+yJ8Z0mxKKIYq z)GaMNbKalEULWS|$h7-u`MJRF0DRt93-v&rRRI0y7b*o^00G8ix(`Zk4KFYh(M5t& z^=tYst5|xwzmq~95)TjoK!lIs2||RVWY5g|$O(V~SI%T@FcgzrO3*_jq-awo{}hz= zSP<^%#)Bdb-!3Vkm^g@ik)un!W~Z3M$b$BE(CFFxoVX0Z&eST_LD`i`&hltrl3+2W z0%in;++sr;O(_K;MIcZTGz|<&0YWlDxK9`unh}RmxhD63G(nJHnnFraB~7D4r(49+ z1RHgyL8A&^!*8x+*2~=}xz0(3Fr6l7p_F(aB4VK&i0|P(2>zKD@V;O4Re6J#wseuQ zAP&X_{p6K}foy`vhaT7PC0j4A!L3E6C4pxPn7|J!GTE_R|sms-^p$AnEYT7{@xA-Gc@UBB4YXvb0k}P`xK>t1Si6_hrT|azKu1lX{7NHUR!x#d-ic_vBk+# zMgV@I!f}|wPthty$@!3wKo128O5T8J1SP3d=`8%=X#gStK$21P<|X;G7-*kih>rW9 zNUt`4M8(2Fl&A;Rx)H^*?A^XTbGYUawWJG5E-Y*i7!M$D*T(}>5hsV#s5o|1*5O3*;=Y}gb!Ul^dyNL{B9g=l1hJHVXyP_ zsg%p;8V%Fm2dF>96xXV7D%&LCEV7}8^0_Gt5znH03JvVHwG~WoVzCBYmQHdRY6nb2 zfdU&%Vc>%5>MD5K;YG+~c@g17C&E=#0RUme^;c|Y3D?Blc&CAru2>9HLNCK*0=8lF z*?u^3!@m>F0O849#7CYN9{KUuJf2!L5af-kGmO>~~vc6jTf;VA`t zBo6@v|4yngNz*&zY_Cz_=?j~MVJKc;Ke*b(0sd*kA6j7uTpSuHf*_Z;g7Ex)8`RMJ zQm6g7j!dJW>cHXcsTed!Rr2raYR(6F&6(HJOvP`>z&AO?)V z*FtTuxKQyZj&Z7*Hn z0DE&1hrzaZhoK@5t9m#L4`$k53=P1+;*TUX=SGRu-|u#J+u@5g(sPM4h9U8fo;-Z# zb@t1_t*NOH*qfM5H;}V;me$VxAC~(e>=d6wl+2-{Urx7m+uD9N-UvSTUZwMg%E3@k z5tw|Ih}NK!+$X^e0q_YSk~EYjF{IUq6PUFJQ(v~eA`CZ2w2vkr6(c+l)}`T2qs2#x z_}t{C(f2}>&1op)LV?v1@f{SBmtzCmN5Wr7N4K|6Z??GCcz#;Der+21xlTxE?U){^ z4}#Ts^D3$<)93{g;xpseeyHskM2AmBibMvP+h9kG_9N>jfxm&s=mRBR8ucrJ$RhJKGMZ-z`Zo@%pU3)}A9|feF_=fpPT>ZM(yZc4_bK$v; z@`4nUSO0+3>SNC4O-pIEAIm5so%ww6{vXSu>)}9fJ|5;RjUT!G+x&VsW6whjMVoI- zb_WPi$&EaX$exKG!UsD3mzyV9^5DdUMUeJheTR>)=Yb1pS`NH6T58wGv%@Or&P<0* zHo3aaq6IQXJnXIPF`Rck_{hgjm=V2A+{QPRL6a7xn<&mXkF5|VCu4R6b&xw{s;P0d zlL{;zB*+Wx#uwp7HAYE%yB-3Ha)H{C1B&D3vlfQMC2V%V)Q6>~Q3}Pdj?B)_#t^S# z(_wZ|WSft@?e!yecK(c6n(AuO?T715G-SPNLc0@o+K(Ubul%jX_dEW6*inBv;?a|u zI(B)dsT8dHGjb;-+WBZnCITr2j$(INKNT&PQXkw-r?tfgQ>U?zg^cP=gLhw4E;s{}9cR3!N?sIb|p&UGp zrs+06&Zu%fd@Oe?M^f%QW3W+u5RRv>t@wCy<3mcC-MM2-)JA-h@?_&2cscLzpyul( z&0I=nx*GbYa1>n{B^%;BK6-FRx&!L1=QbhuNem%lwiC0|`_ zGXF)T=8BC5>0)7?So18!voGuBt_Vo<7+|A-j?#Wjw@`53GXkpGWIhnE-=-Do-)L4> zw&-u&2U)n}MZsn=HvWqq9Q04WiAKc>LtkJy>JN7oQ8 zKIc3rk>9;d-AnxPef5io(vQQB`rZ8Cs_!dnvyR#b1Ekyc*}}=xQhKeH=)6xH2y*km zf`Kz**fD(^< zEK>kKmm`9Es$ZI4(+ATWO(Om1N3Vy6yKxUNPF!K3TZz-IHttFu6`Kytm)GKk5)NLx zi+aj04&I(tnO4fQm{k@gWv7TyFrw!*`ghl2NpkbiQ4Kn0MoKV~QQXY@O+HHP24gY$ z{k1an>)V#&cy;sFg3~_n>b&c+g-<9xRlBHhk3>(MLfO+uaPQPGw(6_6qx#5eEKfd) z?E|44xm>rm2{x-)tB5>U-?};}kd?2^4NA_3%g3jX-J{2x7A%?b3hKG!wIDrW_92Zj zDKWnjQ~7S4Sqbplub;MpO>G>^%!)QIoyt02FhVI3^*eqLpKY=X(;iBVk|W7QQDXf( zdTN2o-TZXJE9~xalV4E-mkL>_ZBLQziK^U5c3B&$qgM$_=#xV}=~XK@k>4(#4;NhJ zqTFGe{QUEzFI$yr2(NvTiAvW`JoO{t2XepqIL7PiAii6hVz&viyE;0zX*-UF;+du5 z@=;7=cqVB|i@cJn!Oqp13eW`6!42(MB7Yat*7);LmX9>S8cU4SE{P$D??l^drR(nV zj6fUCn7K7oyIGecE>tQJdWCK!i`D4aCgemoNQlb7d}3s@ ze&jepP{oy7D(P|FFdyb)(FsT4=nXB>vf<{3tB;gy<(IzrT=RT(QbB~WqZ`rf-8!AmAG?v7 z7u_$}K4N!4poJ~b`{n6YQoRRlGW&fK3N(_Bnh;|(f1Aizv*$W} z9(F*?P#VTy)&pTvnIM9D;3vYA0^&m@iY9>o?*dNZ{gGK6;4poW^gumh@Jo>Nl?J0G zUCWCT8uj-b2W|KCPLjLyP&>~rn6UO$=QebB>fe^1HMLqFK9aII9Gt&^#^g5Px_A0p zk-Y64gp1);clJ_sp>-IYRShlrCSjNB+s*U$8Pky$`APHc`L)iUOa1SFYMcei0vVf& z07?TuV7y_(!W>{nC_6U)5HUc&>(&-QsPZdPg| zP4Hl(O+2slcdww&6L<~R;??Wqv+%E*Db;7Xh<4a>n)xQg-6w%`o9kDE8R2A@};I0*N<-zIm^>s%tF4%c5 z(c`PWG1OckmL;0da--AI(uWD~gqgSP?y}C2pHU!8Hx53ZY`xKe4Q!DC(!>5K-u@AtlG_jY?B`5o)J!(qz{AwZn_b z55$k#*~wf@}DX+R$qe;W|aHK_EFC#TRVLOYqLYjVgAoe z*Iq3vG+uVhwvh6AN*x{9^wl2R>bKRWWoJ3{=Z>h`1Uep4m4u|9RqcIwZvFjL@!jux zPHUPu%l#X^7&XOa7?YM_SbXYc`iD@-(YG-y|DKO;Bh^n0{hVJjxPH~gG)f6a0^vJt z+}MwJw(jJl#|}g~P;~l3VRo%T{{Hnr<31i?Z$H^?p8GvDWv)pL_2hNkRRQj2(1C<(*KHN>h{vTd|n

uTWiQ&khM?*7&LJg1vi4nv2PZ?MAq<;iU(b$$5y zdhGn&IPBAoS<>qNb4#W=W0qeDHB0s$cpkSWX0HE_dMWb=MMJb8c997s)Sy5N0usa| z6EMY#0MJj?R=4tpA9{Fi$O+Y-VUy8=nejiF^u@j{TS3z!ORz7~x2g|L!fr>K@_2_v zoatrafhu891`+Z;oJZ!7nufon$RdWN=uk|4p$4IKCo>+k%U|cMMTbU!T+g!MA=F)y z1LozZ%dOQ#kS~#;oe2!?;q)>cOzBDT*D29DB!ZUbtbM4*J?|LH3WwQ2VvDrqpZNCAmVE#PO-c2XbGm8ekVBg6O(g zrnG~Q7M(qm#kJ7zcf)12MnN@g?H`Xb@tdIYQy7cohEZ->HNkR0^~Y+Cj3Eq%m^l0q z7-${>SHn%%PIPs1@%PT~pfC;MOBF2|aE>2iTZ&lMz83 zl|Ct@ufugQSkY}X<6bl;Ap}Bj?N1kGf2GZF!d&#uuDy;%_-YuB3t%xeSpkMpx5YcH z>8qah4f@PYwLz-U=G9g<$?C3Z_1SLvG}v0wH3bZx3%Pj4{jOnv&9)2|ZHyXm+CjI~ zWfV%-6HHY@F#jeF)btf?;a)M;Q|6CO4P6w?f{3w44PhM`AH}ZCsZ}D#vB^cy&U3<2 ziKA)Dw1IDzJsx$dqQqR~=pM>B&dy#+XcaOvvbQTV8*hejsc3Q}ZN=hiE7doR=rHMd z{&%aUsv0eFQrCQM!i{m`WTAxLj)x^%{IHmykmmlKH}q_xk#5=54O=*DnlRhfD`Tdz zo3)Boq01i*OZJ;1&q)s^{oF9))ynd~Bt0=Y7?6#vLU@8B6VX6c?Gsy%ziu7RG8U}J zD1QAET>cHUP&b3Fvu}LiO2*r43|QE}ik6^^j<;MAjj$s@S|W5&!bnJ@X|}=0CY&6J zl|-eCVHBksj0O;jD+tBTI$bG@=yn4Ci?fE{e#Ekb-7k1yJ z=$7l6V7t|FcA##)P6RWR1Gs4993*k{9>xD2N%yu#W|GbKRix`=^s>y{D z4Po|R>=^DT3~uKRK>3jD$parEW=`*QGt_*3hT~8Bw&;kJ_L~k%pd6h^m)J$b{^ut% zr}&}SoBVd=q`|#kcdc#}c`x$Kv5}z&6Ui$(BaV-tPY~`_In-smR4bjg)^akqZ5=K`@<+ z9Z8>a!{s&I~kyaN)Y|b#T23- zO|Y2&ZZHsp|AgQ5Xa&F|UC|8*#5o91@d}O*$uR?>bpq>lH9{IQ8bE*IF$_c|S}AJc z!8nT1C>pqzDMA6*0%#$bsrmih{@5;F*nFLmXo&5`eLY=!nTBncBQqfre<9O$pxnng zxeMeYUq||>a3O@+Z@1^Y7!g0O3Yh5PY7?np`F-WN@ zYAGhi!b#g_QRu35zd9P&Gsl{F{C-VgKkORHvCBidW$C4=7{n$x!5F%hZ&yQGk=SeW zL{T3>_Ws%bCqVX`zrPgHLqmy{QDAi6+(V8pQNeB`ksPWv$J*-sero*!WnhHpm>ZC*Dz zP|ISmTzvDn-!PBdf24n}AGq4Q-8UV(v(o-iH=TN^n|O|=`9tOyreYPY;c(uB%*1#* z4Qr0Xliur~^iXq+Kz*T0SR>TCXI!nRs)PT@2P8%So&UnSd|&4;saV>6L;Wt25p%oD z>RL=C524RrzE9=(Q3n&4Q;*wQ@0-EBUA@b{_v;uxamy1neVTlyhG1CLPvrR-?fQJd zeOMRzFKHnN`&`UhOE|zLQmT-VVNG206 zr_IULzpE$S_WXU8#QdL;@BUB2+3xGwG4Rz8AGDpNs8)FCDj|h`f!oO=@sR9O>)$`O z2=so5o>_F@j_fT6n-u*?R941$sF#+!IxmZ103!&|BD4t84l10SewUe&pVSa}kUeAG z;8*dVDatN3_jW5RfzY+$9$bXf7)W+ni6k%XG!>wJu%M_xpde%jUE9>XuHYUPVt>DvV8;OGsBL5 zA3^&d5K!9X!=I~lJe|LzhXEg-^3L(PR z62>XuuZJ-Gv?<;+(b67#&#z`(S!Qt(Ze`%}fM|ui#C9^RSWls3-|B zn^y|S4D}I0{~ymMLnRmS&S;0C4H3wvVhRBY$(E5MBlLScTRz$@q@=4hW{~NVOhQpX z1WQm9-Fln}v+CFHdezJd$LxvI49K;n6(QI|ZU9hC`3Ty$ zB3yWp0{0YvX_{C>JE6O<@f!m$NhIB4F=QEc)L{rk-I>x3&}#KT`E3j_Fi3OGYD@dD zFogOpKjkr0?}RudAc>M7VhTU1GBqoN{ef!j;ZeeOZ-YUD5Iv(k1|~97gk&j7$4pef zy>bDrcc+Neq6jY{aTy&>MHQ%jJQ*XR5%{siq@;=-W*o4w1Eh|#_v}BG%!z5ZJ7#M(C>>zB1WHAd(DjY+e51f9p zQTz#`2>-zs^y{aZEko#yOh1Qj#jg*32C)5DTL3^is3=A=9sZwR`eFM0U+J=L-KWH# zEJv?Z0U=@%s-+WO6=j+2#dQ{A#%6tXC*O|v>EnUL(%t)h$AoP+>0jaA?m*>}atVh} zn)9pQ`?hJVgk{|S8Xb_x`CJvpXxTionUv`rYeXOCXXx?%@7)T2gM=F>#(rz{4J4vSx=Rotj8;~S5%Ne(YF#}4nG6m%R+4-n= z)JEdlv3zH%54iY;3rlIbBiEJv`biTUchaYWkwfK2Jbjd$?9E8R5Ec8(AlRyHjszUv zA>rwRA!J+}31*I8QAl6+BBGakx{Xa3wFRph%OUCDgEzxZnG1o*6mhfd*FYf8_CQE6FeKjTYH{IpdC0-S=$i7!8`lc=zJPy?sm`F2BFC>h5Ep zz)R*BYwP6bvb;(<`~A-unr~~ka}aDwTgIFi_IICBSPF!<9H?#KwDm6(Fe9N(nh>Py%wz08N0x&`I6wPf$Gh6aop79}Fzd%AvWA8GI80vM{=Y5O zX}KSd2gVtqFor#QP~TLvd|nMGgO3Z_#SF(Z#xl1xWPEoFiuB_GjM^M2Wkrli`8E~) zuYK6A7Z;UT9*>?=-)%8{=D13^ij8^X@yFvJbvC@gLmL`kGeY|C73WF z0t6x!m4p!)7)2z+W+q6HmRW)AfTLQ)FpDv1J_1nIp~FBrpSDn4-%nhd$e<&X@v{w=6<18U~m}?(ud|9n3QmBvZET0JFsBj4pNWuIw8M z*;BM@bl(M0=(iwa*NySJcL#mu8E{L$+r-?oEu@i8X|t-1MB=stc8+0Cutq^5Y36Xl$gzLjZGX4agfIFgl2yrv=s*Toq*}M(IKN*34&s>i1j#PN-+qKchMOlBD& zAgb04D0J>^I$Fab5_&ZH5@jH(RV3ox1d|TUZHj5EG@IQv3363PjF`n!G$Fwl9;a4J zES70$P_&_CU`&>>_>jgOQ1q-w6V4v09gwM_bW2AJS-N+4Kt10ko;*IC@%n6w|H-`K z%nMYkwl|X+*R#V03@phZ6w?Sr#O9ceR5_f=Z1EEM3qan7Lc$_51y+gNO))TP|?#nW1aDW zxk~5Qij|9Et~tGROB`A=xPE)d*~%${lnngDfE=izsv5WSYj) z&`!$RmcwsY`R&LxX9)R7JCran9LQq$tqw*K>!q`)rA(=*lHa&K}sG4cy^# z>tDmr*WXW{iu(71I{x=(jZ1kFlzX5h4fd-*%QZX zF}l0e_ql8{X+pd7^lOziB-FeN5{zSyFp@lY^p(Q9eh%TGg7RH$RmvVzC z1<mPR} zoH`ZSLP~Kp^0^$c(nH58Ipa*ykycUbmRgDk>U#aB1^6~nun)RNh&qzfQ)&W`IQEOa9biUj#39BS&$=JP1{7h; zc3MSPnl>s8NR*?@Xl~&!kuk?3l@A40TOyEJUpL@cRLyq9Ku2Z~s}R1IBv{QRi&V*| zg#yhMDwD1iLZhQ9qxRI*1>Nh|U=g=Nr$NeMXa-_ec%^LRAs5$Q8Tw&t>xW*yjnl$i z<(Kil3HFh~h83|M7gcY&i=5du&Sue2)nDct*S5p&UM-Dgb+6m`lTQJT)e>#ttM=QX zMvg6-zVM9z`7Rw#Vlr+rAO1J^MR*}N9 z*v$#F{14-x?5O>pqjb0J)Oh)QIs@qw`v`xu(f72dWKseCh(mJFr6SO+2@{X@;D5sH z#o|pBF$P1=6v{2(c6(uH8eFLa=t^PD_jJ+tAbF+Ajv6JQ8$WsPuh5ykkel?gd|9pV z>nkREaX@>2xmfMW#=`DXr^Dc3k*m_L*50tzAFglp+(qEUGA7mF@T8Ra2e3 zns4A+N8Pgev}15?L-ju0uc)GLy3gIRG1HA&DPcYvER>}idEaL}bj~Qr9Fq|7jJKSQ;)MPr2@(&`EV=h5V~;Kt{kg5E}t zar#S-ngm7Ja@XS2+PfN-H2Hs_i4K<}m;lg^mEEvOs)~=xm{Iy?)Nz!7{;A0bk3k{U z)Ht^5X3@-1@+aQId~AebdLVEhX)oslr2SkeKr^)_=BYrw1qBfGLZ>?^Y;hD}Y9zUv zao2q(txv`IK11Zy-v?bDtWDjD3A5h*ou|ud9MmEBiVtK4twWG1 zb448D0o%X7`Sv=GAIb(W!>LCA%tHWzAM(S9f%g;qo!&c7E;~#xeGAmEP43qFh*0>A zpR!WMjR}})FCS|2E?+CQgki52m`3h%P~eV_mJyTahMyA$|vVHLPkLS@B_Rb9F2U(y7J6xVr>j~zoFCQKYn&7YavM$ah_O6sbN&4NV8+l_C04Egn=XaUAv6^HG{Mq zCDU}Iax@^Ev@%m=IR31%w=~(4mmC7bU*Z754(=jSPV&zWQT$=+IIR;AhO#n9q#;Tf za&=x_Uf~q(fuRHtctFw{!R}+!NJtZL#E>ZrL-*&?H!PU1R_#sb1NAYpOf-3*P|}PV zfv9D!rtw0`Fo=Mnko4&M8!$+QBhlB>(_mtx$YZqwqJ+M;Hllm9)}WXn4PgNwL5PG2 z2?+@Tf~uL{n>@2|**!WnfeF%>fXdb~7G`6Iv!hkf({olBHV9k4KlV0jNxo;}Q3GH@~VB^yW8 z>>np7i=$&10FnwO@N2Cr%vvKNh8vMtP{J$|0#zb{i=1{=&LS-L{;yl~wS4Z<4>O*r zNSgihFHoQPAIPqX0h~-9D*h}U-x(qxB|sX0VGnNh#f89;gg&4ssK1fb@ismy627p3 zgtyjxmfI9vIL7ueg1E~>UO2Gdxiby=`D$&3Y?smweBW=psP=n4N52mnNW{fFh`0q_`a&plN8 zziVX7$F2XmX5SZ_`+o)<{&(uG<@Wsnj}0&;b**1rm`#eRaQDFQ-fC|7?cKL8n}Eb3 z{O{1%X^lTa@4Uf_X3mXm@MO-`*n=V;4}d{okg$NZMnfSZgc8|jY?%d+kaA9$84L!E zHiIFSFc5(@fv(epk{!76Q~z3okMuhB7{MMtPc0|3yh?X_G|UI|Z#+{l#!Vopu4Jc; zeE(q7)pXXsr$iIzXkr5xUv`FI*dPHgAt5G2QAHGxH55@rQB5T9c=(c}x|4>}QS$QQ zzcL7#bH6K(C&?CO@f~R(T#h$I8cf|ESB@{k%vHHPKBLW5;yc0fL08;BSowYDPXUla z?%LD^*;bpfIA5gEiB~#=kl)yCs|Qa7S!PIA$9!?)=+O-^^6|x1TZroH{5!zrKwx~D zc;&_!?7N}4F3(&(&4*WAa3dI~5O^=YQy3d+DE%+h_*=4amN@RqeBU(bE2qci=`$QS z5=0a5Kv@AKM2sYcW3$HhaiRzf>qI{4G zsRW=C<&!SAnJXISh#ii+BidrcIZ*B1aAw}t$OAT?Hi+q|>@_eyZJs@~Kc4O25ENQ5 zQYNX6-CH?*QFxf)?k@wNbP*1~g4I<&y$yS7uU;j>zy@MCU{M|tHwY-c)f znq1SCoR596V`b;ozK)gLTJOlLbjh4@n_~#KkB^zsjFPz46<=HqrUOj1BeyQ!ZlBp+ z?wj?+F+mlo6r69N!-;(f(`?e4czAqF8qgIR9Tn63CN zU1}XP@=Zsg9rimFpp@L;tDt$N0P!$*navcbe9;d`LxfLaNfX?VP9A?1y7>smc5{b< zSS|yYKs-H9XnK7+lfZj>x%J+)zG5kO5IGt6$5`ryuj)Ilh&Qyep`2+f-?1+&AwkTS$nFtKH(S|Pawv@h=LfiK+68W z*&2-4V30PGFniXmFfItim~SQ}5%hAf;ecTI#2xWr%aRv-P?IE)5*eX^qzD3pc&Ku0 zZhQ(F=5}=Ab+kSC%}ae98WYYC8=Z(zCwhZpUd#cJl&JE?L3Rd|S(Xv3-8qR++l(r5 zG+SIC>zRSIH1Z&gj^GS-Rou;;n$m8ZwyRpKS~{lm7-#C7b&x%N`S%|cBId^3yDVEc zJRt7xe|%-bM9LCW8V)K`;xOc+F`uS;BI)Wr&yA)&V-gMYgYDIDO8HOW$2(x+>mA;* zm@KtT7D8(Y(C0HCzU#*5P0O%hi^iu)DRL9Me5)DrNg)YDm35t@hZ{_>i@QB|#wDIj z01P~@&Vtl2sg+EM6#|3n4;YC=Yr<*O@Y~U8Lfd}6&dxaaNbA`CNb*Pba$Ac!HC*V^W)9&X$A`1xkL1;+WLeh@zR zsR#)oFSLootb6H8fK(hk@4g>VSW}~O)N98bmR+S9P8@o92j8DQH>jt9jBej-oOo~} zu!-$U_TL`v`CPZ}9v_4DLit9cfW)9q=NM)PfEUY!K3=c00Q7fq(;q@1*>BP2l&8A3 zx3~0g^T%!9bS0X$8DX4dENUEeh3K4nvVlHK>84ZIx88RYQ0U%OOy$%pDzV~mZmy|X z_RCTreYtm0$E*?icdw-nryTsQ58Jc4Xy>xW4--nidi9G~&OO&Nd|<)+&+wPy5OKcr z`@hQ%dCz<_zik&>^w&n1x-!21FLd5s+BzuT4B3AR$HYdLe+a$a=RAA!!hM>t?8lF7 zO)fOqY5C6xo|r*2MqVNs8U7}dgq z0b^G*Vav_EqNKgQ#>)58+qZzYUn-_`EL=_KpP^#){l@q5J(LdV1E{@nWo4e&r^~|I0@P3T6kfE4p`d_9r zqnJk7YwnD(gm9M3UNot#9iQ^&G>R&zJQq-$x&PaQdbSnL{d0I)l%68vE1@1`;M0^1 zN}ql+8^Vdsu(BPIdstW1I%!aPL>5=^sEspYIP=*X?S^-k9`NmP!6C#0q#$v}8Vp1R z5QG#MhzubJ5QG#Mhzw9-ATWd=pu|972th%JfWi=hgAoCQAq55^0|-J4;uvzfblyWP zSds4a;cR_bS@hf9wv9&EYufQx{U4K>I`rxJHC8P3c`&ZZig$S{g%b1M z4Qj2k*{-WoJr!K(5PbVclnac!*IQSXnbLXQQ5N26bk3Y(W^tuV%7=v3by1_qeC+3{ z%{J6ibn&5{)Ps0Ik+^z^;qqR2{C!VM_W5^j1r^kb5P6$@>bop!G3(!%dE(T@C*FQt zS@$W=P(RfZXNapg;C4;j&x|wY9#yP7cj9=wk?ZFiaeDaW*ALqd#xcxp?D)IF!e3MK zNn)qG>K}|v(D8t<;iCX4pVBw^kQpamkw=05xt_PKT?+Y9-D}g+TcQjlbA+Cg2?_P? z?Hhb&PB)E7K2S|3_>X{U~ zi5%bO>7$#yV{bFmiC-62Z`%7z>#RVit@B*KkMeh!ob7na#O>(E2N-xComW`x=vMEM zZ$|R*8q9v&kIp*d1z3ZAv(Gp!Che`2_t6}7c=Ee(sQ+T`3HR2W!k?exIjbt2DUdFei)MKk%T?u3O_k?6Y^7gJ0x za~-tRH`i0zypIA-u2;^;D^#7{1D2}bwO2Lu5D zISxh;gWVC(eFkvDl~95eXoHAMi|@PcOYn2I=Gg`^r}Li^mIjrqMGVg<(t*S3^)sZz zD4V)T-y9}c@~|&-WX9bR-aDxgf?EG&7j2|ye`};kwAEhr*ZHB!iTz2h*7x7qDsoXH zvph5ZS>L5GK5ok+cZZJG@U^z<_Uvuhw+pf_W@1dG8rawR#y-GM?;DfwTG}Raf%NiJ zsX47_31e>&z^#m<=z=;UEQ z-qG|O(l<^-D|QGX^-5_m^my&0)hVIBlB4%Axp;(XH_ZH2)6SmMGk)XF>EFGc5J-bU z*5yvuB~sSPq#Gi(xhj^pROM`{+T5wy@IZ}y`k_8aUL^4Qx*knU35fsT3N=XP*lF3A*v`ZwhL`5(~60uAXM3GE| zK?O`I{E&bfwM2>j_ucqD|Mz*0e?6Y#2HS9xBd*VSNZ0N&Sx3lKkIcUbY~_of^pdwiOYXf_(t zsRk3{lt@Gxbib2>Hlyf19tXW1&q4QUeyPY*ieiMFB=LVt5O9RPn&d^-#qFEb-V2}d zI>rO*_*o%S0!+=QKXGINjZPn>++))o)3+~|P9Ja0kJ%Va$EKLmDrZeGgz2T}l{cKu zg2u}J)K5qIlL7x#FgNpLZrbgwcJ14=#n{>%G`;cDEi}Ec#B~q5(E330kF=h`dXHJq zavB*LP!)Ri+4NHmZT1Dc<$1in z&}V?7#RsQ{8{;FW+PE=6;^{5ZCqfaGdOLFMJ2hR~%=#3bYO@--;ParIu{U*gt7(51 z&01l{)oV|f%igifHe(TSS4Vm(6DLnTxi*hjJb0 ze9P@7-9}JcHOj8po$-xuov@8*Icp=#&Z@5VuPI(CZsRzpyk~pCidob`napanh`c^A zddy>4B;MW}cXaM0F#B6eFER`9BF8Ju^XkKz>p3w05<8!IE6UFh4 z*ea-_sw%W*4*${n)W?!i?(m_Z)VCU!LugKl0jvS>Uo}IVET$)(eN6I z>5aBuY_GmiyG$awTMGALkccK6`s@D44BGixHeYX{)yDVe^&Ii)gJnQPNK75dr<<@` z*wn>H*6xA6;B$C{gPZ8EW2CM}9%w@GGE9(50`^+G z5Mt2C0h_a|X=5sAX010_qmPZ7&7RImO>}c#woW2t4q1bLm1x$nz2|eh>NT_NX#yHV z>2Z6V?-M(ycY-SxUNEs$io|0I?*vvOUs@|{evjLI|AUA$VvB*`H${dt@4 zgW&#y#UMh+pow4R^x1c@0!-bh0a%hCKz9vD?6_dkKYLN?5q{Hw!UTRz!(&;iub#Q{ ztQ9+8#=J+MFuAA+WtaH8dF?u*)liZVyb*~M2Yu9^Yv->yYHTbnyxa&(MiFI*IQt9nZ z#KiWeRMFeSmp$I&pm%}ZR1+-0FeX@#+sYS*Y0@TW0b)foo>aw2xr|$Od4}kXtjk!GbR>aEBMcG z&KJMw`AtFROas02cx_@TJpwR!@pc}MQxftoGe9Ox$qf&&9UR7+3fq`^s<>=nIo?W* zCyBe;+jbd`hvxRr=}#8Evy0F2>jd$TSGXdI5-M(jDr1SimsRy^hrO0#(-0376Otf_ zlmr_%}0%kH=J6p)gEDd3c^ zmIEWR=}!>ShR<53fOg~f543yL5$J;=_4Fo|@?m|~-JNq&x)yyLLB$!ACDrmlgVd%7 z5vlJ$lLz@AblyIE>WiXcJmsi1O`Z@M5)I&U2d`p3Pw$F-Nm(_tmKH}^!HtcOjwE9+#E2wg1c=cZ6>8ZVX}grT z!v}L63}$9jNJWk|WF9pV3>%1s4!m;ewC`EEokx6s%L%FE?r}pD=@SW%D5%nwVACMg zH54(sxK7#mAaKVnjIWnbN7QCR`+u6hm|a>AM&8ofzn5BfI35x4(@739+l7a&_?> zwbn4|SN#3`vH5?$pXVZ7H*b&BWJV#*eFXaW6&-#8bIgZ@b-XEg%){7%8{YJuZ%$k$ z5<45#p>t?mj(G*@<@*s=_mo{-DKl#Qy~H4TOQ17X>;C%x32mDN3?>862k1XKv7H^h zjmT<%W*%IA2~ypLR4qZZ1vF!TdHSMcMTJ!n#4LN@O=sVrKRpQ4W4kvQN=O3GbeY%fF!7n5fupy!BAD{4D4MH8; zR9{8?2lac0ZO6yrC(*?DKSc*bBpN7B^iLFVm&AN0*O+5-fR=+9<=8;O>2J(dQZU54 z>z!yP=xsoSeL~j7SLsTVgv?x8J4QAm@qjuY3Ohr@%>@^T*ce}BG8U3;?BsmL7{Ok##7LFYON>^}eCUHEk8kxcbS z`#Y!zsfwDaDyo8-0HT6{DNnoSJ$)4JK9%jTN&r34VU#|pauA_P5u${E2L-A@$Ys(A zZ9Dh!9Qk7jcKI9xL^-cz4-iY~>hJLSZV>q5j9|K=uHbt6+$;D!0zx=po@oe72?Aqa zfiUJ6nT?Qbjtkb?z9|h}UP(UF&(q@%sn!KzkUsyPkJg%<5>8)IJ6n)C#knl)xL9ER0ti&9j%djlGYrlzx*y!9E#7sq^=x60KfV*ww8j+jCWJiC$W(`Wl= z2SFkHCds=kiesmmHsYuEDJX%NfMTcGTZFG`Dge|#kU9Z#u6XgIn{+)fu3Fx}rqBcM z8825piGVY_LtU)Qq#h!mm80AuWr?LEDi|pMSpu;=ow^wsvka{Rmc?WspX-2Szbx%{ z2)BSCAf-yThEfCfRDu*ZOOq2xVV=0cZDY6;%O5bH((?_`-YVY7btPKR$h% z_)nM_1jq~+*wSKq!Oex%PZ*$KxoT|n ztY9F0kn~)|#QS>kb>MQKX*5twzO!&p#DI`LkF*4V5N`51Mtfh1HvJ^=md{Trc*RBV z_ac{dNwAN8Ue*VE!5E=bCK)ZGuI5S7+Sp{%%oJ%Z7$gYi7d>AO<~Zi#SnJNPy(?>H zD2z)`R->M;EBkFfm;64z*Pa>AO<%+FdPtG}|FQqZ=bT^stg;xV{wkZCvR}Bv z36ZXqXE6C+{%@q)c{kS~#%llI|7X64zw@Yv{Oc(J_@JPkKM#kq@YipWpEVG+0{1Ej z6?>lQ5Rn`Rq&uilGf086*Ed)|)Mu*}y3ZBI(E@F(Dpw1;y5&BgR|RIK=zR9^-eYOU zB5X2snC8eBz^DOuaQcE$zTL$DX+VD)BgBaS+3$;Oa-6#XTfCH}%(v%? zop{~b-N0}GxbD)4!_NZ(${m2R_>*1>k02?L>;Qz3&4J{KtkW7(Z& zS-*q^NHN?6J%vN?K^5lM|LP=%xyy~JrMp**~g)d zp)5yRslC>PDE=+^aGXKvBVX0=26j|6t(v(O!#B4#E(Qsd5Fj#kgi@qMH=_yb%-n2y zvpyTun;2vLVoit}1IT}Re}Y_*u){M7Oprq$?KRM!;)Qqqo;vxsL)|A>6go*usT8GI zOi6jTY%qKqrQ0)EEj9m4F}l>5zt{*Gp_4G#2m)@($T?N?Im_JX2H-$qtGKa>Sf|QT z&Dc2=reE68+Y9LAbF6YaKMqP5NbxQbQA#r@LtBG?H3L(BClV8n`3`R(C0g+&WUKkk z|CA4S`kwsA^vd?^ch2^ALUNT_jA)speDReOJL||EQC&|B9s#!_#yyn|^6}92>i@e( zS~{2?V1)9h_@zo6RNvY}&^b>d-Fibo_k{DSY8Lj5sKx7jDV>t{#CPoHBvSB6?kjpGi$X2&dGr}(9 z$4I~??a{{}At3S~ZHPG2hZ|jHW$hcVZ#y$m0h$0>TC-MoXd$i#1y`0P-MPzBOIHjvT&dC8(H>1* z#o)~JQ~3Ux**vZ^9p00b*omlcJRLp*rMRUt3l-_W@6JK$-N>oa6Z|5nV7~2`Wq@=d zM3A+Dtqql1PFOGBPcKsA?LduZJB@+MA(j8hv9y4k`|eE;aKZWYf0jps$S z2Hq<=j-^egEVAd*s0w$12rtd3t2&(%ksLvC$m_F2F^NdA#bc05m29n?X}lS3Ox~ zGXoqkmW976>|~i2-U$tOQxL;FOL{e?#>gwEsxkcxK#0U$j^jN2$LC|?ZQC~31TvLR zIm!+`haDz#>C0I65f7Ngf?^`1FL{^~K|m7`F;o>0(G5*^z+n`!Q4-MA6tB!q9-JT6 zx`>kqW$FsRK5O$Ca()r`Yx|7B1cwbzv78QD?NIzd)IPxU?djS2tV9pPQ6vcw;~+t_ zy<&`T83e2!I`u6pq+M_eA)n40%nTRG9t^-^=|IFo#+%Pyn5f0iZ^Nfx`_wzlZxZq` zh9or|x-Y9Yey?%r`5XxE(dq8(U8Jo2nKJDkD_p%IB!Y)!TC9dzLbIw2FzxU7&e7Hv z&ZTfQk=w(r4;v{p1qM{5RaF&5BVbFw1IR~X7HT_TgX+Wg?&aBz@1)A0u#HBP6CDXa z2Eh_W$q68Sx2ZOq0^eYr+>YRsrXrOk`x%__YI#|o+ zAy$`V8j# z9_dUr6dYOi=|u6Y)#34dXj~Ydz9tq!UtKMTMoFq!maW@9Gle4fP2=QsLrvPi#83{3 zHQ`jjCYKAXk0&m?V#8Y%_QMe~9juv)qJ_jm@rnr;H3q$hy3h=EX}|qv;bPo|n`=pC zg-p)9Dmz+iF+y((P=KJW%ZI;=$^hR*_T&%Fr9&tBQA9iw0 zF-m=K1?T@>u4u4MkA9y~tC#rn=qIO6g_y*(B5Ao4WbD$UtdM_D!Ub~=ntUQt*G%}9 zU7sG)Kr=;OIRv0OdVb2qC+h+Ggn!3yhMtasyS-j?uxl_01Ca-D z6TxY6zGumCd;z!X%q|A6ibWO4A8$iCjGZ|^E2!t zNS|*uUxV4hLOoxMh&#W!bWV>o5na0RUwFw5+A8?<$TcIfP*r(>{Q9N)QN|o-LYjfl z5TC_0*WLSG#FeIF1(7K?nyHnwMs#X~bi|Az(z=~bUl`tck04n<^m_dM&FyDpt?J+} zg*s)PVWw>7SCfH#x*{m3#^Vl68*pRLBIF0DqfC%K%C?2;_--()4`&vM9OMza%Oq6n z>MBk^VW7J;Y`)^-%4jJv7}CC3ku|@2vX@)5gfZidVZ0pfs)Oa?ckkQJ)kS2Z(ZW&P z6)Q;B^*w|NZ+J>kj0n}w^!(h|)K*mLBX3yuafRO-qb4;^Rk|!c9o(f-ROPiAF^*QV zpjS7u+x?)-)9$x_KS$dX!}<CQQUy0F4wIc}vA>W~L`Ikg3!EJSnDU z16lG3tbVd{mU-dckvB>-V^RYgch+5I%#*g~+2y9wdTBE^>Caw@q+Ad)b&z$=#^=15 zI2IxrFZ@Ggd}nSsngrDAM$f&@+9Y!EtwBp-}80v4JOeS9J!`IEqVNIpKBl9Fb7svEo z;6s7OpQo}N2!Tn2^hBr*6^NpHSE#GAkB5j?e0Fbpg*jms!f!T|b(MbR6RWpG(;JUhaQy)yJiHyayV6 z(pD!^xNYCcynGt5K=dIy$ol9!5fG6>i%xq@Btasd0h|m>(s8w>4JNAoTIFVzB>y}c zr)!MTlt0$l8Pw*%y|j+Pf`hP`70@0@HPp7J0Apt@z0_Dp-|)z4CtK>Sk(i~vzZHaN zzUa0)Lw$A>%Jwg=P$i;ef^* zKG9(NV0(Dry~KYz2iFdup|?29YVwIBB&&fP_`5aJmHT$2>vWzm=A3|gg@R_|9(@NA z5AS2ytv?QZY1NdSaIzTLlrbN(U$XIlLkx|kq7vl{+c%6tx^(VL)8AuvcS9>BO(O5} z+(+4!*Hra|K!CSoJ!vGaBX}1Hl2@=fc*G2#z~~0sv@p(wFDH|&OS5nLbCPXFM!i*>k9VxS0h;{PjJ+x^SwJOEGRS3*TA-QbkqNSE|u`c zgN(=Twks9+jH6hlX7xwmx*4@V)zh23F!RqW+QXv*kE~QT?_8#4gtNo2#Aw$HYlz~{ z@cB)Pw*0T-wPfhuboXxDamkqN%lC2N_Uwt_yK+|p3gqY_DwOogB z+1H7&Ojx9X9}M7@D!*C_U;~u94Zt>onT1152Ly85A33RnV*|x65#<90Jh%M5Rr3km z-d(#1xekXQp%}ksFl|AFx+h-2kcCsWaybW-)3Y!fq>kT2xC?mhtbN!PVuu=5wJuR2 zAofk7uBdhJ%gr)ggw;U00R-Fhv%@*Fkey72Q%5>Pe7pxYJu0j(C@N+S>DR35u%ic>tE|@i(-H(RAYT0V^_Fb0>`dy4AVMxPh-B@o z8}+p7Vx^Dft4U;a>g9&Y-O>p~{^BA_di7BW@fBX6n7gb@HR%^%ORxI}(cuW5`7lAh zvQH`(Z*p}1IaL2M=`+hmmcqB5KB+b8`W2VEtcH*|1t({Nk(q9*`~U(>Uwqeht@Xq5 zl26X1vCfk@`~P!)sM-A{+etHdks+WU0ONxi3wPVU^B61%=u^<+a!RC1A0}D_- z@k}dRVht2NI$b2dX|RPF7Kg=X6AMRq`n^}s!xd7XLhQ1Wr}2Eje2O2oiWWQh6Vq)) zC}xMg`5vYb^jKTVy~bc;`d5q%mSx-dz4gBO?)lnzlu1`p+L@yO{~4Skt;?CN#$)%N z#fTlfzCr>7PnR2_NZd|Dl0sQ%gft>Co@g2}=+E_Eg1n>?BqVk-s*+%>ZXe&dJ=wFH z1RpE5X%N*AT(WoW>PC@k^yAb`{d(seeU{mK{XJA${**ok9o@TDhB2XpI1&SVG5h)F zbKlEvO$sJyy*GIKw#C)T$H}D}#r?23Q*Ym!X^LfqKH;m0YA7NaoQ*6gM?V;ae% zX^-QCLuK{T8~IW-!OzU-az`#1Nb;zYfn}p2lLOF!odiF%lMcwly@Qymeg8E0j1PeF zB;gb}F7HhPhd({fnA4!hBaJ&Qd>*ilPE*&YgU+rw$jkW?`2IR&_xdSfo+vgMZd%c!?U90O{pC6hNN7&V% zOrg(Hp!iO;@jg7tkM#P#dp^E;rELvI{Lb)t?*B+~|4qL&B6^1Tfd@*;^W^;zHy1Il zDA!4qu2ac3R;H5qZsrYb{J|VfXa|%s4hh5j2iK$uNEH;h{5qs;!2b&^3PcfMx>*BJ zWSp&S`7i4Ik!rK@cy{_coxX2Rt8QG^ggYVpG&klN1ko=Y2qDWO{%illtmUilpuQl< zqJl$m!B@DH5XYy>{=RPxqpU|~Z*7(}o$nMMu=>mpC?59v%9a(35Wst{-?*63}Jx&25j3kjcp;ahjvcJd#t=+{Ma_u&?59<>W) z1Ia~JUYA}FH!!TapBua-|UyBcy<6i#u2gMKMxy3irUpF@RN~GYacV zxOee$HnB*5#&?vOW~J9S%r7~=DswRGPOSg2m8NDT?n zJpGcbUhb0}r`{dL!(r(qZg^K14DQIW6kq*=yzr)D-+!(it$wYWILt9DWtaJXAH$LB zf^|W8KUM9c$&fI5|6u-8pYwU%JU4kN z^T?_WiYTI_>Px&;;o5`}5D0O{3jqWK7B}tv9@?EO@atMnd_Of!S>~TOPpPF(tv~oX zq>^9Ir}Tc7@{alIgA26JYPAXb(r2oR?OpP-g{eE8gpiNRy?*aV81DQzt=Al`o_Csg z!QLicyuPuVJx(*+?j({(McOs+)r;C@`NSOca$>8~)z_vk)$t}{ z2C-=M4^Z_R-zL9{F&#f-U1QErh4f15Xn0UT^M#|9>2K`j>lvUX`p`GncZ}4%&vHL9 zxkN|Key-kZn4q7b6^V&48lVPXrTy_3!ZYt%aiJeBhE{hZ`uLwR$4wdhP_ak>{E$C72MT9Ab52?>=H5QCM^ zw_B;5IciqC#G{g4L2Pkp}D02g(s<7B-K49SL_TPudA4E~hx3ksCtJ&`CdwR3_dT>YI3N)Mjo)WC-z5ImpLIX)f#V9;oApyV=45^SHCqb<(A$(p^r z(>fZz>^z@YAdL0HmE61dc{*YX?do`qd-nTYk0hPyJ=^qAgDEkjx~6WaW7QVBs!sER zts1{H;Z-suNY9oLlp^iFf0EqST>m~>@iG%f?*A>*E$22E+rPo&n%fLXr*oq}(G8x_ z0gq$*H6Z6(tnZ3QJSYviaGehu~O0#iBO0I%$&tKE>qjiepfid zuKdJ*soz7pKhZd4F`lLgml4psybGBEZ)sf?)}RL+FIW7A!Pa711nK%rwI=2o@uS@&>Z^3u5lbH4k|Umz2%KeJj)8 zV`ja#R{z_$U3M^L2Q0H4P*Gw%a zMKlkRinx8yZJ;p)viB+zBvp;~Qxx;4#Q3lmud%FnBlq;s=rO%d445PkUgKh;tM6o*m^sXcO&}2hH(0tL(!M2 z8`{{=gne9UuWz@K<3QK|kaq7KvP{iwZp}DfdV&qQtbxY~!);hJMHxeW^krs@{rmNp zylehA54SWZYTsyxeeKD^_IF-l4ZbeTir}#3b5!3->Q=RVN&1A-c%Gel*9VsRfEC7IaQuowy z1PO^N9e~i70tOqL)zenascw}#nk9}e4X=FN0GPB_MZ^OpH7gZqn@ToxzMT_>D#fN; zXyYr86?u8?k0N5$2Y1x`h-OG`8!pjAspz`*u9~i=l|^g>z1;RbO`i+@B*c{GhyHcC}@ZVUkN~`B99F(4gmMbK=%^jB#9K6P6>j~mT(3sm{U|NSJ97@6KlZ?}SUKWZs&kDB0g(3U^g}YNh5^TzYPq zy<&=$ibjp_a0w(M3IHqH0@1lFE!}Cpw@G2JsIHK54oz$z( z#FvKU8RPuiYm*0jNfaosTWyRpKx~i>B0PhSvzr)2ilF96nm$dsV|paXE{Y!w!^k}& z)54!Hcw#MwtE4}`@M3AEbR1d%-I6&jOR5bNCDV_d@*_)6E?Ls%ja(&!Y3S9inzte^ z>V##{s@f;d8P&2;>Coz8W-6j^I!hg*CT{Gh);vbkh#Jc^P@c$-2&arFqKwu;V5(JkyL5uw8*-vN2Q>My-4(hw_7ee9)wnc zt*$yQ^^y|mTsR$?)@DX9li!yV^(mCMuu-quDPGFg!0{#X%`yf=_rR!MO*6C zW0dXHuZ%n2ZFHtg-c$g<#-+}+TIIU2aviDPcQ(_ab#oM3?XSrfj(FJ7?t`tacJf;r z%Q*8H%IfKe@733%9arZH$WE|0o=Krel-o9Y;qG8?ZYG@E3PX*NKX>%;door&ZQ==(7L+mJFiRiW zoEi2oIC*ucz-6Rn9@`y5qfQ7k!dFL@G*(KXs-ra@L)WiIewxy5c)c`sA`eDUqFz+h zD`57PG0uW~N(gKN4*x`Nb5i`Q#utZDbCxeLG;Rw1` zA`_k1$Y>2%_jP$_&}Ph6w@$WPPsRg%XlNw+kRkeaQtIOjZK1mF&jUI|44k#6f@^R@ zAX8qrGfOtQ9F~+R$5lXYC^`ZS=1da=nH53qwqfZVn@43QQQ;1;>U22vJ^qzVRj-oG z<)m<*Yz9+bO>i%gNQux>PlM!7jX5(SfR$_~<@bC~ge@o^enia%e+C$4Qq;?N+^*#Jcz`4 z+j&~-{;guKpTDAI9#WjWn4zl9`utpH9FGN5>oFh5g42F<-)-U>FXB2q-M?|e%50>B zjl4Nyej0voz6iPTyTej$t0Qlix;6FTy4n!vQ}pI%D8w-7mwAk>2TJep!?4}z{#geQ=bY(_UDTv*ACi5VaS$q^`POC1EGvzK0CR1 zaU=5{&cTGzX5JYfp2@?vPe_uEw;GLieGw^PXhwKDMDBQ_%z%iiK>535CL!EC>G4jz z6P_K;NBxy-Q88v33cjK7Ip+EE&(obBo7I|rw)>JaV>)msw4dod_;8ax@f2$ZwoWfS z?qCrt|8vp^n1<+FBaK5l8WMJP9m9^#t&g;6$*gg@Jum|j>|7{J8Ic=A+GCCG%6vj^ zwL_|M4%5V2-LGN_>+ovb=JWk009Q=)+!BACwEh>;o{Ty0l$taZGf-*OCZ2v5d(BYQiuRC$mD^C zD7`c6cL;nSkIBN5z7IGD)?>it;q{1&YG@ycB1r#J94jcQ=pONll0jbBOv4Z?K=g_} z0)9yW_=rn07%+(Z79eU+JtxC?S$-_SzivL8R`UuQ0_!?yZw?dGaR)MIsXA313XWN? zht=B|wqp*mFYJ;|c)WWgYV=$B;p6{{$Cz{;re(+@APx{indf}Vfg-^p6~F{JR{rY;p3u;7sBT7Z@1ST6B7tQs8Q|CaUlrUBa=Yqck{-?EwV?tyiUweNi0xxwRW5W$F!Po?40K}IIgC#`P z>M)3yl9gZxB_=5X@Noko0tF}T*?|Pk0XY^J6@*k#H6f6@Hr;V6Os-W3+jawO$Pu`x zIO?jkm`iHH(`tZ{CPD{OKo($!1Tbu7!NkY}87%<77+C^X(-CtDs*IWE@|N@q(lb#j%#+# zf>8GMaP(3BW&GZ6p5Np-*)HH@L@t&8nnSNOcPm)6d2kt&h0)h=6!>4A<<`{rK zmOwReJi#16RfvHwp{PEqgKfkHXvYYM=>d@MF(@f0nams{ii+9v!?_iAC{mzE5HTbY zkU(LWEp8w;iJHVySgTiNFi;x8t`t@waf-cNJ_m<~Aap5QPz9FVxax>DCKwp(kEeTyX(A|UCSWRtCKyU$LWm(qT4sU@G=j!BBZRLZq0$8* zK}^%6Ef5d=HlCPc4M3~8ab1#s|_aEcK;{<{a)f`A`d>7N|(-?iS#G#+{CJo~R8FbHLc=4wAc478xt z8>j^A+XP))MKRqt<0P50IGR5Du4?HD>K0=9V11CAVL>Q5m)w7Y{qT2j$UF)D{3z1h zT1nz7TKK*D+^9m0gQx_d{)wXT?rZO$XWTi#E%!EuX!^cJ@oTTI@z;X*>E}#o1@HbO zH*dw)j&`D7^+bP#2V6)l(x@6G zW@PL%VSb9o1xU?UgbS%2Oa$eOGWreKSDN#aZ+OZ0EP@%qSD+#SUOZ!cIXB(q?}N5e z0}_s$zc1(AXQK`s4`OIx^)_!rubAe%>&iYw2R{r_#k~8r(G2wN&&N8hzQWb6{4L4E z7AzI;d_stl4i_ixuFkaVKrO-J^#%OiQ)##y@RrWlMigJ#VfeTq!S4;67nZbPIjD(^ zGa|*47#Et--mk~6eg3UY3FY-h_n65AyBo`5b0C9zaP3_6E(1~K45qlh5+BD(nV~8N_Vx`T_iU>sj=2`tmtsv0|a{ zXQTPQLGwNwWDdWDWn!d7he<{8!XyW{%S|;O;TpZDUXiABXR6?O;<}=u!webVcDw$Bvd}wv4f`ey2^bH^Xt@Dd|JNek0z>*-#%WR>%KU?!zjLn zmtm2{H>o)7bCD0J@Zr zdF-J7dTT_|Lxv;13~j+JkXr|1Vv2&HDz(NDT+cQ2PCWiL?yRw~s{%C7f|ujhPACUz zd^UZ3*K*;4RDV7?77JxPShw)_w~!1U32@pQwx$HO=`*GhJ<@az&XQKA8z*2}USTDy zJbs`VS*=8rg98kolwAUtw*GB)JI)Rl)+25?o1?x z=4hEA`bRThsg()WzA8dsiMFfAPz0qpwJzqV8Y!v^2H_rhDb!D2OkW<^+dbH~H~8x> zn*IA4Ws0tlwQ7Yx;(0!wXnUg}7{RI_p^~50Mkib{S%#E~gK_yfy{;mKW(D9e_d>5d z75A`v3gQNp-P1;N)rl1 zflVa$noVR;M7Ydp#4|LelSu*w zh)lweuto}56hf5aMVNqaLn(w|MHER8gXx8LBta=0W?{)~S!s-84V@i?((wVu?4QsQsP~0VEy%*x5m^Ldm%L`KC zsk)H7cWcuDY@*c@`Tmc&%i;CdbWRg2foa^rpOChr%mUcvDA440c;!|4?R zzdVV&_j8|w2EsSBfPQ5EB>IHWKgB6EC-o=Xl$a;-q#Z~45|bp zPxYnKB<7#UnMj+}{mGP}B1EL5+S7V$nz2w|4iE$m2oQcif`Gg~SUL~T5e&;i8I^(y zf?(lbS`i6=NsNPFYz7z|h6lnQIDZf@p|%M7(E^4Bkplq_AY(|MFhn(p0>P*#9T)@* zgFvL9uo{r(gFiV#yOTg$4zqzkam5q)|GXRrTrmom4Sc><+5+k2Et;Zy;xF(82@nJQ z$p`3GMDd>JLx>=R;A0Sf=p;xWs4M~MFek71e`DU9faCzc2N0lNkf6Et0?-Lh=qNMn zq+UV$w6y*$s1LRTfuImSnx1z-?=QfD5RkX`TMX9#4A_AFHTpU3`{>o(RRc+ZRp#nd%Zs#Sq6hNp^vln=J2WS zL0u1K50NsEYT^cgDWABOCF6KljqUwb3r682gzoyyGaJw5Hcg)if9UA_qm0MzOg1QS4P6E`bIF{ety{0tzA4pE5z*hCrB_^g|Euv&4CwV4ZRz$siX+uqs&wseFAV z?13Vu(m;XOC+;&T1BwE9N<6kiYoA9!G!P&O6k;L;3PoBNND>eu5o8yD3Q=I|)Q2n! z6Hw?1ygO9$N&M6WLPOe|sX0(nq;4d-M+tzMDanYTMziyh!Vw~0UNJ7BbEiU5SgDDa z^_qf*?fa}me~(_5R47=7F&D|;3b{}%V2ZpWy=@*Tl-*BxIl7>9W%Q8LPDi@^W@ceo05Eq0vK9k#2m;VxEZ9?s%rJ4{X=AIWQycAA zqYwD_Q^5tr#nMLc}#K|l_Z)?#{2p5g)mKi3pdMHGRx(l9in)DcQJs8g~A4aj9s zPQ)BEQA6IL(g*|0setmJKGpXnOcfA86j2eUxilzkT?T=;93G%8e5ZPMBu;dclm#Z8 zYJzk6bWI0D<{)~YAb4|M>Bi#4;*d^|eO<>S;rmJt^kgVi z^U>ZAk3<9C5d0?POC8;?Gn3v35NORXLIdmoVlAXlKgN`VU)D}#m2?59Gf_R=otEnM ztOGzvAco?QaCep`*Z`kjY$GJp)PiLzg2g#NOY1@rADT~QlW&jXlq3(w_Q!0LF2Hoh@Nb1gJ0b7cFh(?j!pbllHaM(L{eo>B9`gAE!@@ zWyrG><3O0{gddb(Dmqpd@uH0thRdM(U_(B@S8bK00%I(|a+-%z9 z6!pjEDsk&8zONg`tNbvPVvgY6z8=OhW{h2((o3MEyf++4$9>C#N!pMs0sPt&0gvjX zcmZ!Sl2MEv>5`%dZWH!@TltUJnem_+dg4T^dbwCZfh#27D4pww!xEGvL+4@uTejxU=dIpzDDT~cc3|eFbODtHhby^bpW-7 zfE{4maUi_D1b}zbz9kBf5Rz>tLQ0eD{BL%BQ&cw*L1IG{e+oUI7L<^L>@EW%fDnXY z7@*__c^FPaL%VXR>a#_8LDynJa4cAU8R22nGOL{8B+Cz4r74dDd{2tvnR*st=RP_%CwNSEubN*fNo-J{0n9!-N` zpbjE(@eD)$~2s;fNgkg+UBiIAg{vPvz6OkzoR+X_f0CFY6 z-{?BP%fCkcHh|&*xGF(T$Tv&_h9_qGnSeQ-Tq+G!gey=R(0Xrnj~`^>+maB;0W<(n z7h}Sw>=P1G32T@r7x&{)>=F;^{meNbA}ID;!w9z&J}?fR1UwHw9={se#ph_pg3te+>)cWpA*X z7Slo13Qgym=}(B@W?2cfG0+$g<>k{GY(y0mdD@|>N;_ugm(eu z(Lun?79YK(LtErhMd*p%5QnWO6vX7DT(<+=1~^`_ zP@=jQ#QMNbg$zmoJjrXRf{Bj)Fb7tNpa349P!6=^)*@y54Wb2?P$+UM$VC^>2$^gJ zoV(D0SfCu#YBCHsc0VjJDK_bQkuM-G0I(qBI)HT#uUv$`&~l84hJr!__9vJLB$7%! zAa7@EKL;u6O)h#s>j$0)PW+scBZJWm*$cv*fPQs6^M&zNTA~=8Z9zfSHkhThL8^$; zk`=ofcGW0bTpehX29V(u{HNC;-mnU8VxNT0gd`B{ zsu>L`l|6ASA0fdM@=D#W$2vG)kCz;8%#n-$=RUofKURr)P7ZWI6`^ybj+oODVVCte z$|TKZaG|T_gQA?db_XMdC9ZhS{iL(Vm^P6{9tINau+w1LMwrIU=+-n2__Omd%N&8g z5EE8~*nKtbWXZ`V;%BRDCQO9f&P~uI3A!m18=GVkY%@G1n2MP&rm#zgSSH56?+C_& z$l(VK_`t?++h!-`XE|$SpWTlvcxgLxxQ+ISS3xDwTgsBRVKDfnb~qVD);BFFZT6I51DYETMKMv?@>I)|HB`e<42T4K zxs&M3i#mNg2R3%%AcjMKlG^*F-UgZu=p2@SDLk!a8i?#*WCqxRX+m2@J@0v%qrb$` zUHDx=)b!6Z>b;{q#6(0v1PlyC6Hu)z0|5AsnK%Qe8Uq#RCnqs6N}*L06-89O)KKma zp8)Nnl|{r32dA)JVXeiZIB+@< zHogVo5z;UzE0@I5o0TmfD3=uu*^uq9I+QFy=uzAU08!wpVFNH0L_5xaB?vnPZ7__| zq4I&4zrv@jFIs2>Hp(ZAAR-e%CT)rvtuFN-%vB!Z7Pdu#qej2C5;E% zpYcjm!o?x;5O|3CUOR>*e5CeUy$6gFtWdNp5JJI=ASh988e!yq!wHiJ&47BKN65`i zGiD_mdMQ1(7{_)lMQ_8RoFX9$s#_EQ^?-I@9Ker4(utD-fN_|x8lj}wt-<6#gcTZ- zOsT{a>;*_YDvwE&diVt`m+12Jc~K3bTu)881Wd)!*W2myS`=4~xB!0X&9X}Qif(g(dY)xVv ziM7uzM6jocR53E8W+3|l2BRm9JfT5JL?S>46dEdSgY(4!bbrDIn-bty$PE}F#ICS9 zqNhKDx$eIpcl#g-5|DHl**gLThAL8B#E3B21rP%OY!X954CNGC<6KZIy9rl~=H!`9 z5yGVNs*MS#YEWTPLPCWA?n7Gw(buh2f~m0%fWg+$idu-tg&a7b`?%}Z5iU=VW8d%mwlY2% zH3J7Y-E;k&hXZP&5rn7gl+Af6K4~ID&tYYNta~r4wJYvEUlK%ph6<1mrpg$lQujc7 z`QmfT@OK)Kb$9Z%z51~9r6jk2G0l3S2E%e4n@s#d31gt45&1CG0_gAYr(u3aV9G;9 zGF3|D-#Iv#K?QjIueLq!u#cMwl%p+a@<5Z(i6lYRIm zcC9bY8`1(m5+DRk*3!eM6MB9F+4BFyLJ-`K^caUCX|3=+{d7aR4#=26NdX>`5As-} zw1Xhb#Q$Wy2|>{)`Z&PS&{2OZ9)DY$ehTWN?DN;qKLHUs!vyu9O2q9GKK{~j}Gl-$D=o0TY4I&7CtWhrP;{L=ISkW_;(2kRgBtdyI;epl!%%0M`DS4WJ!J8q$_vJ}|%-@V4Xu zX0o8#Q_jIz>clnX9~bkf;mbh;co-%HEJ#C;;xl)DjQR|{at3(JYv1k({UKZ?k~Ju{ zYE_6yyj~mCAe$C|o6|5)#=Qt`PiYh0M1(RB;1EUw->NE+Ff3pxG9K_vA}2Jy4?mtD zqBLXN9o}M6c>x+r4-qSIj{?t_K!7A0grPmvu;9QL2u@lWNFW{|Hm4Tu^!NxVLDlTs zONLDpwA~@sM-?_39!}i`q82XzGf0q4>F1!ZaD#pyfhjJul$1oUwD$$2CJY6o0cntV z2#XP$l7!Q>2UO7_M8_O}cX3@qq2@f&^H|kV1lC~SxaEccA(c^)kxMaDQDzwyVFJoD zAt6ge5&_@~gTe`%8<~kPzE})N7&~fNWQo^&PN}5cY%i zatWTi1UiZ3-%UhS6;c#?%~`4m8mop6SfvKw+~yi0G15hZHzT|Q+;gGHYWRfc&=Y8a zZh#c}U$_Qm)D`>WJgBW^SSsU9*Fwm}S$is#qs(}kDhCVDy2v&@9;+9SKtrHcS~5Q zPy=iO@CWCOVKeXoy@#w%G9SG7c+5dFo+b)aJ4C?mffgC_h2r9>o}~Un?fofiQ$f9 zHj{bgHJ8BVN%FLyBIRj!GjzBr4uZfb;8~h8q^m>)hGhqm!FSFfdTaQV@kvGmVLaiE3donx<2V zT123pkyTBn6U82}G3fxB__|bFz$~DANtr>41XIVv7A_sfikF@4qnDRh!6C4uDydAk z0~ZHy4nZ_9r?jRc2sMd`m%cvkTj*oSLc}5*q(mVKfICDsq7Mrgk0-W?rNvKp)D*@> z0h#CH5eiR>A$9l_)}Kwx2h4H5s^|9jC}jMdDdJ9qlM+J`OA`|kP52l9T%?>Q%z78Y zZ4*SK(KZ)ELemNb3c@S{m*GwLqUv|@32jHLN0ihUXkb`%!b2-c`BLEcYzyRqU`Vh! zK|Cir42uL6hlNJz41h}YK6$S}m=uoq9;3hy<5idZYOHb+U zLmwa<6P-K9LMymWG**%ajVKY~PCeDh&|G*OeIihZ@(a98=QwOGs#!QBONAvQPxDrw z{&LAdgj-m06C&&pHSJ0c04cMeK{~+U)6_m3EDd1N25qH^o^d=7u?!T22pQPn4o?rd zL0`ijx%rQm9Y6&I6bHr&Ej>1%HqXGP>Y?IX1lUsp`#8drypp?4&bx^axH)0pTXMeUCrcG0+4N-v9VWbCa3*f(z5F8?r`=P$Ub|^Hj%YMLIkRFb)j>-UA{F^0* zv{0Zmg{dGO=qPrbN!ph9)6cXc7!mpg#J~~}I|Mn2wgZeuQ@wk@vE=x~Xb@rp0C9(i z{ivWSv5Yh9r$SuSzz5nT{od57+N!{6;o%!e z`#i@bJcRBJ!?%qDHz4v<4DIPY2ER5~hC%IKa+Njnx{kBNT_2MjKyeV|Ap&=Ea`mS= zMDQd^NR$*1F7tCQtVkgQ&`6=bK~t|IXp_UkhqpTqYZHvvy2W6FawE`?2qZ9RD`7;0 z%Tp8xlOdon21jFbx~-Q{?2ke62gPJh*2BON0t6x>ez`Fqkc7g(_l7um%t8EFmvEsL zn`vLs9F9pKB)-HlvMod7Q!N+9+)}{}%xfsuntp%DsV(qqDhUtv*v`i&9#QS0HXnp+ zmarPNHx-Z%kqscvibae@Q&-iTgge;nwSyX>DM*EbNsE%wIoI$04Ft$K_CZx2YP|wTB_ugdLV&9z+(eKpTw0A zgs)!8p=L`&`2fUV1g26cpi4(C62v(mrV!U?gUEzH@?i=Q{DdYzgZ6|W;Dgz8*ru?8 zL;eQE3jiDvk@xJp;u(d)$*Dih%UyoG_7le+1V?~L1DKh@MCOEqog@5m^wu2$f<2H2 zNq>r0tck>BTxAf6xeNT>XXQ_kD6!pMjKiNi3x{tT%;;&YHKwB7+yl5af)pH!VDtiY z97JHmiQ7Pl0f=xCs1coSoI%T+^akoFLx3v8&VVmIV4T7zNy;bH0kD&4 zAcm!01?wP>8Q69P<20cFFm}=p5WoY+-^m3E+5H9Y@Ezz{%IrEw6hQkyq6ZT|iZIOO zwE@Oi0_fBwk=B$n9jHWxu?^*ovIL4|6n4k91Gp2QQU=#zrBVl_zP&3-VFLEfDKN#<)bfMWyfx3P?r_Qp5;> z1H)lBgH1h!t5LJ4)S~MAA&PV!$Q|_n+<1e$92Cfu6u+i+uamLVY2qO|SDfFn(BPGl z31pEaf`KScnE8_a|IHHqA*#T(kg%@btN0rJr?Y(Ue@HJ5^t}RP2{D8NC34&m$GJby zKj8)>zdC2;8T(&f6hF{!@DXq{HPQho{G}CO*nXWtS^Z-7yTP=Xh|{ScfyZQ=_oW^f(BSOpC+x~}}^!L$MHGvYLEQf(7rTrdtp6a}9$ za|8hWbMmAa0+cNX5(EhX1c3y8*e<5~5K1ZBD0q5GGBPnEG1$9h2A=ObF%d@CIqYHI z%P%pBOeEB&W7Vd@v8yMV%r4cFj3{=9@suvyLEZrNm*ziFJ^y2K5$zxWBm+tBKVbfd z44gc!G64*@z;dswSI^ht8=7c)vCD zk-#3t#0UixyTT+a15`TTNQZ#Vjz|Vz^(10Jfz%!g?>;o*;wdg+-#G57og4DCRaq_~ zXU>P8SbV&u_jsN)5osOrd3*)@)NtX|Y%rq?akel!M@4jhG-wF`-vsa?UJvFhkZjci z;CFT`5Qid!fW-8zl{{iD!47D^@l@OafmPmt=tAndJ>7iQG*RctUE4Pdz}y}469EiC zLuZr+y}(m|MD5$>?g6<{el(%zBb-iHVGNZC06(^b^5DuU-YY&V+5_DIgbgVDa(_#X zW*Pgro9@NZLQ=)K$^ut^@z!N!RfhMB#xzMJ;F*abt`M{@2@{2Wy*z)HzlS zwrDcPSktA)sv(eK;2U4`-d z;;|T`0ssZW;SaOIV!jK{5Krmed_mL!`Su$S4MLPCd<(<_s16?bfO^H`1E2&CaC(s7 zQSpWCHBE#)r;wAUem5BEK)=g|%g_CVg7LD!I|N~>V>)(tuGYbgTK-C zhoKt?8$0Zej1H9v=R3kgh(*tWXRI@cf&>^({7@A@pS2p7Bkw|F{?xe*3rR~rP~3(m z2*9bP$jM9~Lx@UgR)GpoCQwaIq)+;-N`Cw%$Ox!3Sqr!{5Q@dP*lRLFr0KN^VPuJf z2B1(|A(@B)Qnf;$i1x?9Q^U#Y6+P1wH=gsN@jxk%g2rlHPhug9VZWY}&;WYaD7%v{ zJ9S8+Arc^=faZGi@3IAD0keX@APM)D(hlM;?05oTPblzF7iNV#fFKS|ePszpLCC{M za4ZmFe@qKGN3ciAAf#YkDU8KT2ptLsiC>}$4-LnEf#6a1%+CRuDa<7XB5r*CXi@4o zfH5|oK)elr5HMn)$pS7SV99b2h$MrDVg~?@fl`3yAJ~Q|asPH`Yakkp04oIvu<(Tz zP&FW-$xVY8$KmO~O_S=x98`drfsav;bSWre$R15B2EtB=k-QWjP_&o?R?BotcJ2d} z{e>qt%ZhO>jc3meMN+?1rY!`E_u<(G>340e;H)k)@aE_=o43J3d7PV|sjJ;HX4=Wl zmV0iTLcd)QZp9dI#=z)Bvbj?pSdb1t|8b`%;ryQg?$e(T1A1i4K9NDw%|U!KXp{@m~NC+6my`jK2?o;Rr7* zp>QvLa&RL)bqnPubkAi&dk?xCcaLN$7QsgNun^Qk=7EiAlOUGXg~~V>z!tXwlw2C# ziA=K@O-4tFdkv7oNFad(2Y3ksf?BCagdCY5(9rATDL_n!!i6#fBOC@15JCp6q8r7(JUU((v-6g_#t$qJZyrGiUK;9cHNpqdgO;Mo zjMA1w& ziL5sP;|*HAK+HXYr-#+&)&?5I4k&XP#e$CYjN*bBDu;j;Zum+ZaG<9pNCbgP=U3n4i#iP#0m!hC!uNQ&f+11FJc(7GcS5|mRj!A*rXwE;>bpdbYbh*cnQY3yiP ze?36~Nla)=k;g17u(Ld49Tu}QMp-l(igFWEkw(z+K?ADNYP*yQObfLJCQ)ZbL)<9* zTStiE2AoemW!-8Hq>*_;m=3VNkM{;3KPcS*%^wOJ6Nq@2Fn}C&Ayh>!a1xy`xQywP z(J1!wK5UvL?2>mtGrl$s>zrdkZTn@z%IBf(YF>^ZItOx=IfU~a0$aC>Kx9L(E)m|A$$LXYHUw-LM1h!v zufN$oC?qHdr26K8qyyKW#Xm{Y{I)K@2@vlv&Om@3n0*lo!Tpc~*9Tlv`eGi9RKGbD z$kAd#q0JKCCrT`ho*+ehHdbvtz4azkqOLDL5++6)7CZ#Z82j zB%l%b3J4SH?yNebA-$n+TNY-dU1%K@CmBo9;29xEP?QY?1tB2|L(w=&!8ay}bcy8) z2M|ETH^kVaH~V;FfNk*)_*QezeouD%aX5^A0YsQHh*kZMG)4{a@-_h%fQD)@XrK-; zBo0VCYgHswRYn>Zpxk91yff5iiLNx5r_^>GTu8b#y~au083s8$PZ;5_=3LVmVMhf{VE_*oi)pAwLtse3K+yIp0OC_o6T4CI`S2pQ0ZJ!%M_hBxUm16gnlPq-ZXHrUGP?o1mIct1)|K2yLc0hZuDqe*c2Ji(mB|p<9TBi$f*xi0w7zj#NfI

)B_^xz z#z`{~ARG~nftNi3Zbv%+LY3EHC^dIvPk1D7$5;k*E*OrA|1vs|>V)m*g^_+DKWD2O zD#0?)M86^Tw1J`xW&uI=FzKn(lqH5_WK)pj%v!?;p)^WaiIO%ZZdBAdlOa1wWVC~y zpAJIRxEgq(Ol+UBF`Wb_G6plylO;}>f+Zy>@c=r&ew8Ehgz!P8{__CCVPB;T9Tv=R z*ld8qP)5c=MlfFiML)0_CwKb2zRJs6a-^&mt>{z8Y?@x^B#erXZhkQGe!ul+@?_l1 zqN@VK@}HE%DC7`MY=HA1r*aAzDcy828dOh^fC=pqy?`3j#6c6dUJ9qiP>G;i4@?QW zh{rTALF?)}e2S|oRsD^%TR(J258V&yRfZT<#LHft(iJXM4HZCc#&q$8)C0gEogWGvv_^!(YQ`Ya9$&j#dpG<`41x-`Hr@#kLH` z!VSu-hj|Zt%vB#mL(BY~!Qyz!qh3#pORRmq59)Q&1+>vs3y0%bh8uz>VF`rM@yLL5T79?GvS6`>&K~3ZW+LXK{Fp% z(i@_}IU;4xWnbS41nI@GTCB6%0-;-wGmx?4;j_BVr30T4t-b^EeHv*r@CVosAV7h* zISIWLb=5USd**=T9hn%|Nkc##QDi|--2qHX^&S`@&mBS61^*sjoPWN42yX+~;*4sI zzDREfJ#nN6o)J3Hp}I$q8wLty?S1L?91EWsqQ4+*1cUl#8M6!UsfWwW+6@kzW$PL0^g59MM*eLjryQ#sEU0X+z zAKwx&kOLxrDC{SI0PMHnKE-et{`vo@NZtfIU3{nUw0_z~{)lf!-sE;aE+h0W@EyKO zHStsS3=i=8{b~HXyQVs4AI07*Ki}R=F@E^}x?1HG`~D*Q0uJB5`@hTm<{bP7d{_CP zNG6y$Tg)ZEh9xhD`_7N>{^@s+)$%{4(A@_l&g1=_Xe_%q+ zS{RV3DE(iv{5tiu=lmS)!WZPm!);BQ`f;_X&?ZPvL4!y>6?T{12e15$wBBQtxH+L> z%NE-Y9am$6EJtfJ{(H3uKJ2^ndgNu7i+7>o2v{|AP{vjM!&yfhbbkoprZr*w!=&m2 ze^Z$5@_qg{Jz^ONAtaI+Atw0kVdjI;3Voe@ejkU0DuFT?Qo~6xr}+Jl&3t;ea`1Un zfIM8gAZQ7snUf%(BBp_+II5_os;@$OVzUyW5+T}wXY?N!wOhf$epRP$D`g~+^Vr~stZ(tLdPsg5AYor2czo(E1R(d?*ZGy-+->4Z}AKgelt~Mu!hiC0Pv7u8TZ?T8_O1ZOI1FgT!an&oseh$bK%hes zy>F2bq`Te2=_h!QGKXBpbi%>T&2ErXX>lMXfNIDM$yENpgU$74??-?^)r~P}&YnO8 z3^BWn)ko<7@@WRUt|}?RX{MN+MGmt7G0bBuDZI9MS@Y4Tet^u4$S1j*PGiD*5HnZ$r}7d6lF0y3*8?Gh7?Ft@8WJTU zL17{Z54u3Y2$5FS02ri%5=5jyN(ug$AF_WnG|)&Pv499+Rv0pg#HmavDk>T&fFm#g zC(u$2f|`N6j<}!uIV$S{2HKE{F)#742m8OS3pan-|7$e9_`gLXV{G*@B%a@H_<38P zotcRyM(1BI@*m~z*c}L#6qFHp+10E*1YDCb!{z?oPvbvBGeel9W1pg+{82H*{}v3l z^Zt5OrrYS~-Ge!EiLczkZ$CB9%g^~Y&6GxD2X^_<>px4ySM14rTLTLyEc8Ma8-n{h z|81BEqd(tttK9jFbfMibj#7&6U|XQu%6QO-*pMTHv|>?A5n%#ir~2XL;0X=7J5C0x zZMF`#M0LVWuc0hjEQBEyBLIZi-`C%j2t%Ox$wjxRwQ|!$53`LuU+z~E6S04$vg4v{ z-LLa_`SrL%Ak|t}Z>vPJc)fGgFCWR8``%RJtT96%*`+tLEpn0^a*vKCk#UXkpKT#l zGTT->eAZ2O3Uq-_T%h|^-fi)o4s4F+>sNJ+S{n-{vyVdC#>b>EFN^l_+Dz!D>(=yc zPKVlf)^~1Kd&zgevZhVgZFoTmBuXHhA$9a!Iq1BY(K4)8V4vtK5TnW>A6JR*hxxyr zmlIFr`M$itwwTSCD?Z+BD~ugqC7uVKi&^N={s<3t$7z3qp^9-kWTGc*<(`@_Rq~)c zCmbL1YP{sVcqih9U>f82=?{VyBDcnA{k&STALE;kqmKuXT~#NIhx`?>;=SL}tt&<3 zkUk17TBh0$#H>KE(p3ky$%-Wl-W;J83`mx8dLSIJj)$&L`mF5pN9Xm|O&82z`bQu41T!yb6#&5)j1rmyy=HjKD7dF{hDz4c>jdMz4uwPl4iB& zj2Rk@b#z(b-mEbSO7?VA7oS}%oM8tZ4lh2h;bBDTL#WBgdJjSzcP5P#n`sSw{@s)x zctUzY`N$tb7w-6qZULrwF%L|_B$b{IO%9VLRNnfLDKS@VOnCZYN2BBIjZ7du^5!AW z%_}Pn0&LlmjTqqGvYct9DqM^L5Fuo=5~Wuvwz_wf_^gJNjj37kE9CmTu{2@*pP!vx zBulD4^YY(q9rTuJ{X>b5(H{>-_Zh6HgaqW-RTD>J>Z@w$2p{JOM(d}jA|BwwAhiYo z^Mx_Ihul3Z#!-;{&t@uNs|LKZO3L`7J%T|)w!Xe3J=#Xuv#J!e)zZ{$rihXY#~QTX z@`=3AIh)N8Gzo@Y>bQe$SdcYqDS`|ZtYAQqW4kAJ7#z2x{gsq;X3+l=2EY7#@1A;h z=g5C}Q_ibygbL5sd=8$&#h2cAo7?jJE#K>-%@1gP5&JiV2$i2gAm5Tu`1`W2EFyIp zJ)hUd)zaLo567fl0jTms>XuavQ)nYOOT7ZJ+fpFW>WoK$^Qb|xwY~a<18hUTYYkUq zANXrZKx_~PG7~kf6(KN=|Ay$RUfG36B7?`k%IdN%VXr@JNBWRrS{m=!sLQ95Qlf@P zl_rZ^>}R(DeH1tu9&B}b)#F!_AGBfUILMP-Z;ADg_TTL>z?XeNNSnJ6CapEM~r4s-SL)%n=!my=e%NBnz_nVF$(7l;jS1h>1T0uX?m zw+9<=e(?!nMqHzlEs4R|B$7x_3r7`ACNVaQ%#tyuF=GSiYU+OmK+{2wOx8p&V;Q(a zO*d_@sfma|!QK9!v%kg%t+w#oJ8~CzkEr(tDT?th-yIF5k>Rg@)$Y9>G<&2r?fs&x zq;L77`rCUrG2A9U$p;2OSbIH0S%1&wgM8nri1v1C2arkmNqCRs^6kEe#Sg^v6YZ7@ z)R1D4mF21f`Ovx*^8R0!_Q;tAAFde*6(MX@KYv1Cq>EV)r~*Lyv?|c;PmSC$Cikv{ z_~U^kHAUxE0tX>%4Ii+MfRD?B1sPTSYz7hrC-cdI0}Nk)dt1FE!R}uB{IY=jo!(Q~ zc9?J3rGe8;pKa9K9~Y8lqf}3~AV1E3)Ti_5=yFw5VBR4dSQh^tlDdTvfWre0W`k$B z2{^(wLp0q2AEKH@!Mw6_K*UR&F`>pFAEE$k5jKzzfdjl?(E$Boa{1FzdtiLs!{s4D z(6!VC1wDh@CuZ{8B!rW}?DzPgz+q{R1EM}8E;&sL$s8 zy$=wxsBnhjFD%eRs1k)1ja&*?00u-;)B}h>GQco~DdF)aVhA9H?ZHqrA zz0M5`;hPX+GWU$hiN;&z+Di;DvA|?x2=VPRY-9_k{A2@YiPk4mp8Rdkb7``2LdTWE zIns)%q)TQL>`mN*X!{C>*Ck9$Ko{_OIj8{u&{wbjPv+|(IkN=eSmuXY^itV zv~@D1R0unptw z<+ncAMoCF&Qm(G9uCLwYtO)`@fH@)5ML~rcw($&yaR^`V7?7R_^@F_RCpRJ;smxDc zbe-=g3V=8s@k%qV8{ z0j;bMbN3$rh<9`Wfx{imj*6Nggmv5KG@Kq^8SwO8?q3;U`Vt8*nnMU3>?9L`p+~La z16+vE4&uYq3K+OaVHcPi!wPI=Ln+Xk(gu`S2tzAex|MP741<&tt^j*eNcv1*H^YqU zNCg>O7bApqfOMI1+n z(1Vft@{D3e9M~R;a;KU44r72kW7+DX=2I zhXe`xVgg zhv7UJ${)xEDUh_@2@5Yqh=UDD1&5g?Glxd4S&y0uhp^3+{jgbrZy>>5T5sF)FX zJf6kK9P~AMi!A86z5J#iVDC6IRf8_q4bcWxoFf~?loDRHms!AKVk9LXC4eA+CI}d5 zAv6jhvG05i0of@_=ZDt`uyu%E6gRm?W0;2!4Oc+itOy4{oTorq1A=&|SI}>Qh>9QX zK=gJ)lu00zq&=QSbVUlp_aB)~}6Nu=YHUW4cxXSMq ztSCcx3gA3z=VmU(;7As;C^ZJ4Im1r&3QAr~#NUBL6h>G|gcd-XM|*l90M=E|AwhsR zoD&UZiIALHo~_Dv|FHARzG5RaoH>_&C5=+u*^?c{`a`BE54<|va(rB@8%`v93 zFsg~bSRkedrVx6aLUIBl%m{n?8V>n(dDeId0(;;LwAX`&_e55j|jhlHSj_)lNY z;>GY#VPH1_$UZwlv(b!9@DslA?Qwyw1cXw0p4s42Ax9O)QSOik+BH_j1y2EM-N7wBnyIAl4O!b z5FoVzI~p}<$|ngjsw%Yxr&4AP6l65=B%XUj6eLKM5fKqcBjEXXTdwdQ5*C*CsGNtR z4BLcvtPvf0CnlG1kTvK-7ZE&zzt%c^1YZ4zB^YQkRBKEZ$Hg0-&OMe+>`WRYxFrO1 z?^Sd=VU&8Nu({QUUdmx;a8bj(FnRNyNj8j9wHjcCT-GWFv$D{&9g>d|Ks%&ZA!384 zKpF|HU5|av|-5ZyzLBi6bD zNH|@BP~{wNkql^%VhCcqDHBK;hBE~LFiBAFq$0q_PzBQ^6PR*U>KaZ62MgP`vkLGa zjLlxzx4mp06^I`f)8FDA9VOinCfh`D5z0g z^3Fw)9#6wiUB-|O329Gqb@rGHW@t^sKofjOO%f6)Y&+yPLF&FvWV3MvFvys{W((j0oiD+mbQfeJ` zuoRGBBbYyL?(4E{AK9mTMAHjJAVsDF1bc<#zM^Z>!E!33c?=zB!Pz7?hr1tj>=8W* zr@KVn7-nNlA(m!9xq`K3WV4?Rs5PpbFg)Tb1Url(hdBs?;hKCZhQc9tNmIZ*J=9fr zzOtgI8^HBGniJ33s;ADq&&@jT|3;0-co~lwhEyJxyebHyI&;_)fnaPewRpIA9+}Ls ziaRfCWT;du28xo%3AYI&m3$}2j!!RewsbxT9D{`#(qIuK2yneb?u2=I7OaNOvF=J#Jt76W#@0AA`DL4#$tPMwdXBWIWb$Sd+I>fND63sM_WQV(CHwcEKViYE@4?aO;bVry52Dc}Hic&L> z`ERl9Q!JkBrKZwCNhIwaadaXg@dWiD?G8cllZ?T~*fkO-D+Ur+7-X?ho&kbE0qd(B zr;ZZ`V6#!oJVS9c2-xLZ&NCxm0h0cIySz))LziJ&?|oA5-EYv_3Oa1P&s?SNrFRGMiT?dcDZnc`a z42=F-;+p&DzKp=||0$uoUHWv!)-Mt->d18BR-A_osy2`N&*G?+L;FJ=Ye4uI`{MgE%Iyg-JZ;ngH*%yF9G{!sN zrEFmRSyHWt`}m@BwJKOhmWo;)>9@r_eohY- zFO2)4vtG%D*d`K(_7x~)xW$x$mvWd!1(6vslmU~0DC4ZgVm&7D7Xn>Z7C)c!bD<&? z!*oG^Gon}A&qgnoxI0Kv~(1Z{`h zG_&G@C**|RkBIgPxRHZ<*$Mh!ZH6_Cu-D%* zoj(*HcV4F)hvGb;5F4!bQAF?7bL6J?ZiG&LZ2+}VU5!Q_PU~+t;r{0`Two}}ZulksY*QZYc0Xd(c_#xRZN z+xv7rGeHwSyh=>d!LZ2Bo~Wd#Jnq^(duaZW5m8!6pv8L9er3pp9|H0PERHfib(Mi3s2ab&495P2vjawtVJ~Vu+tm^Ft0FJ z@nVk+j77nhQb=i9ujdLe%+)L!bdEq8O!(YPZm@vOtuzx*er@h9yyK$Gd#x*r1IR{> znk2Y4G&CVd>)vbXpgYg3fKNf{{Dc}Pzes<`8x!#GY&H-<1RFrwZl0Pc6TRTmqk1Af z=qM2&$SeejKVkTcNZ(sXRa8v{HBm%S5o9h?1XWPf zpR9qx5DAcG=!5*y{f^vaT>>EHkR4)3h?02rdErUMyao540txsx-W*_$Kbwitkf38~ zL01x8x?H3Py!jjU**nY;J>7v-0^%fqRD>>yi5jXcU}XqNV33qUxDbJC0)oS5?oKC|2& zmGq?u()$D7iu(}f08AhR#0pBj>q7_yS>L#YcWu0FsfvOq9&f?wwcBW^sY`}m-Rtl1 zQo1gCw6+lP@{2;B9IhLaITzhCAeB}4;*4?}C85kPEGsdH49ubyDp-M)2&qD1fo6gb zC6!4asSyGeM9K;DeLVkv6f40^P3MC$C5bMc7VXf#i8@zM@o4!-Z8)A_aWduvy<_p=b}J;{_d<`}_p< z$`FMV2oWTu6oj!wBM?g{P=QNH1wl;#6op8nLvX zgXq#B0(L#9bie30p1E%uYB`N5!N>SIK)D0U3gUtQrUG!Qn(Z^XP-XdXWX+3M9ya9-(OIxG0KnNC$3V;F4sNAG!=@wcF}aNbX_E zA`16iZ4{c;gIxUhXpo{~ag*E`gfht*7{G@0bii_;J^XiaJ0@lrBszqEra?jINF3(J zY!n?GeI|oYK?o<0XmJz2>pZ&Vzz#|pk)c9^$Px1zBgE9PhBY zRp30N^HlWmE#_6-dG4s142`(qr%Dk~HYk?$aCr-86Eew)(O7l8jhqPtDP? zf$H`{?~nGU_fg-0O|lGo4?HlzFU)hz!LQTHjmINxg%F8F6r;V{2X}-^sBZ(hvWeb1 z(z`?t_dy6j0zpqZyWhb7+=w1t_o#I#ynv1gm?46Pr$&W>1{f5CJ_{1*Vne9L3F9wj zZ~kdbL87x9A~^(+$l)q7H5*KQc%F@Q1>!(66h70ypgi%3A%#{Z1d=fUfGdFj5fDLT zVHg++@@9q&1Q1SDWm`>UW@aO-^PaFy{=w|+@K&?pdP30z0tNn=a429RAsC30`(&b& ziCiKGiP4ylPl1L4;iuV9K zpkz12IT9iz}K*;$w<<5|)L})h(H!%0+`rHLWZl<`(A-QHqr2 zDR&LFXyFAws4hv68zV?a1cjw3?H5PR>~2h%9S-d~*qC5nYgT7Gp3f0HWbi}fAUN;N z)<}HuxdTLyg%pGoIfgzllJO{DNG7e4iJ*arKq3Su!&(PbNj%Avmf`$9tU%Z&>%?+O zddq^kq;sB%K~d(i;uO zKzjdtRSXkAlMEXVvaCg_b4Zm48rT_+PfKG5qXb7CCO#t!Mj9X=+MK8=ZpTnRbGQ1B zHn4JW1k7bfp+&jQ2Cs-D3Pd`h1dl2|7Gs#iBt=OTM{30p>OK=BKCBR2qe=!P1UsSQ zI8c{SI!n&Ilu$E7Zio*{a8^+%JEb4t)g#_XjisXx~SZ416;>V@KHq+QB8U?}BAFfVdv<wwTEeCk{l!*DOr1$E?2>~8yP)?)YqoWu$ zV4|KL3{7OY&zA}d0w(((#>y}wz_BZ)4nkxJ^THZMnsWFc)CqBb55v&OlV>GaCS(_oP;3BW(Mf`4*v6B=b2 zOqZ;f#R5`N5txNb+#-bg<(#~fmV31(V*`|wMapAcMp$8vsre0bbn-N&KDm<8hRJrk zQ$*6(jieb1Z_XfRN1cxzr=UHfI)q*rGj*dAGQEMi2M>;PkSML zZUg9r`QS1`+tCk-q`k&C#6$XDj)`fi2>@V`5@qu=gHa>}G|Chy{aovF`e%V^e=qPb zg&;n#Q^+Ucv0bbLwDQ4A0aVmY&}!VVhBY!9vMB>Zq1sJDsYJ_C>Jw08E?JH#SaN6S z<-i2$k6%IOo7kD_gZK&tjTi>;!y`SI>dQ5mPBlc>Rz_wr=0$OuwFQ_wT1!!kQJ7#9 z@n)E?v2zNtT0U7ZhADNMjL_FEvslsuQbKdpSzr)`jk8Ci$}OJ<1@Y-g#o4Q+pp{A~ zN+Qr?A%qHHBG3g0*hVGs;$=|OTEsC(duAq)G8xAU6B3nU?wlx*VGG3GMlw)jLC4nx zRNYJuc44J-K;UDlpoVQPhekp|K~xSIybk(_Yj5&lh)|VD{bwX~2+% zSV|&dc!p(ZQ1p)_Zic#pQTe5y13^wXB3sd;5`PJp3BZazbwo5yc0Il4$+m;8)@vX$ z-0?tGgdz~6aumovObs-Gt{&V#)QupLq^J=HF$l84gc6EsT2u-R$Oa71P^7SEZ4FEH;x4NgV`8+`^MP*>yrd)y5p4@}=4otG zfRq)WtBVkePhY@+(E@bEI6YL`DAi8E48vefu@|ouH}^ARLB`;ab?hP}BdqH)jwohy zE8gy*TSqv7SBys+%AmJgAuF4BX395L8&aB@&J$A(^I+ce=_`5S27nic;aRS^X9}1& zA?m+mvY|=&uLm=CdE?OzgWAnK%Ia@N@N1(tjxE5Q zmE9ELb6Z9nx|q#r^w5XB7c|2m3SknfNu-)fQK9N=SdM2!oN{5$5nwf^qH5+siRPmc znZe6Q9IH0o-VcRJ-ZtrF)R9V>OsTFehB&sZIiads21F)gB!EK+jCK&|(h>2^tS?EX zm11*dwrfn!y*mS!HZ?|M4Z(*Jy^(zbt6&g;G?W|Y#*reR8XxC0y;PJvZ&|)~&|~uF zlsO1^5LOC6gemeGa_%0@njU-|(N8h35gGucf=Pq`J03yf$>M8K9#6Z{ptwkeNJu0g z0SLWBXJrQ`Uk`dReO(m$5ceNl?zziaf%pk=^fZsxgRYGDoHex0+A1E-4G6L}lu0GujK)}&32c;zY zy7xSR<@#QFfID|-oWW=@f-)T-qf76G#tx;cSy#o20CnO19`N5b8B!2mn!*}72XiUL zgRdECz?ML2RNgZEH!En5QT0bErLW@O@K{~H3R(doEBcxW3A$>xjtPvvo=8{aH+1xu zCIuBUF$BqO<27;^81=W z1#v2$rk>(91>nI45Q=kk;NQwBF#4e2A6<9n%m%@XZH#q+0NNUAAb})J=OvTNZvn&* zsc*aI#~dqWS8sMB0f{$&pA9X5hWQ{jgTzGp&sKZEe6Fb6_=E8Wj}$;O7>TN@``PD< zAV~jYPLcwho|c&!V3|M@7=7_}!c4z6hgr(#e z)&@hCO(N_4Io8t@NgZHjC|E`Y)gn2Pcz<#I-p{8X2W%wicOi+rR}mUt9(eR~o%cQp zb{PpImP8>UAVxx31|U_GgkC?Z)$5Qxn27Y|D89lIAW8}ZPLP;EL*D!~>ckB1=*Iy- zG0W4N@Z138@=`iq2k3-a1F;DFld?TfCm&9IEWxhmubjgO-()V`$O3wFuI}bR(jL@U z6T{Dj(YPJBhLczo0SzaIy9m@Xai25LD4?U>%p2~CP zc_9b{Cc*$2Do~UZM3!O%VT2it8Dxe-RIm`P1jOLTn2@;1>#?eu1$&MGa8&i2s^Nt zi1*kDYM=$$eZhy1h%R_=(!J3R$ag%9k5RKh5MgdO4;CXjSYE{uWEFvMbNTI^W1 zTTLThRuI5O;(lT$`Tb{$-3+s|8@V%|1b2t){gBAwOOrIq8%hJZ9-fk7RvI_KVoM#zc=M>qcHXO_5dBB z@j5`XKL`>h07NnXo&W?vFyfT&i4Q)b+CZuJk`>lb%8ty@Rn}iZ%A*f<@iZStztmjH zc0WQN>|^?Qq)1`MNK+)pjRJ|7k{5Kz%DNJ_VfD1fa@{seqm!uif5gU|hcJovYJ{OZ zS*103yH{reyBeglMj&_JiQG7I}jvU4>=Wa01KVpXGg$bfTk#^ zoK)nRL9`S$_$pzGQ{Xv_ni7K@;uu{%uaiOh)33cvSi}H}S5Ozktux3Gu>(n+}F8J3=-@QH><~C;m||C-7LaUgJaTPN~6PIp&&g*g9m>zEzD*1 zv3+fNvI32A!=S|bvFe-`l(fU3O&eysws2$yB$(1GK(^X2>iOv(Ew$jK=)UI+KpPoUHVB3}X*b^OErJ+3Z*u56GdC@>Z2uJkXrL>sPk)-o zHW7g&TGHEuh9uSsV-gGyVVI(N6|@{>=~!h=t%bLOL8y?OTyiF(GUlNbMe5ZWs%B}H z1$49k+F}qOU?~L|I1*vHc-LW`ImRN4qp*;voq1CZ2W^^sjh3|42sGF{fVPrGbOV?@ z4*9P>V~bX0zk=nvQR45^=;f|+X%K{3*sl>mlxQc^Xu*j#7U7`x5!YsJVt7LbDY9_L zqXLgdr#(r`CFzfb-g?hpBflDoxjb`0RZvvX6B9&L*Af)$F=%vYjD3k9Q@?{g&Rj8< z;tqNX?lN;AYC;l3iXM6kH0dhTqv!Y6scYQ&BR|wzY|b*iLu*H--1qcP?K;GdsDdIO zbk%;|9-y>LN1OV$>WUv6$bgU9dFV#tX2`ZSO`$LitTvW7BM?D8yzaUo&K4wc5tw>$ znNY>qfe&%S;Mi$MKTFRx;w6L?T{MLOpii{*c@MYi-N|9emCV6#kS1w{Xz=nl9|(rs z#C_M^aShwzPdIswU{VGY&{`144uHm$u#2IS3TQDD11tk`025PC4FubKGKP*+(a~V) zZM-s~d;oj>z2|+d-kYHC6tGc1zGHZXNfAKA=qp|;iUk6xE`#vXd*0+&RU2hy z$8gHVoK6g`lq{-^qB=#>Mze4DVRyjeQaPfGd&o>P6&xv+jj^^k=;CFT!JdQ<)*1sH z%?A)>OQfYq)mC8z1x(UW1t|$ewc9giPB78p!AgCQXhbA>BO<~dA-Q==2D4FB%oee* z-hbI9Gz^c&?A>Ga#zGNfNJDYGRP)(6`UI*8qG2NY*sYfSsN_1~oexTu7>U&DFv3GL z!%b9>#IU@EXyph%WJVDny}tqTc|R|l=`i!;a?SdKcO%Qtl5qk?txojPieuG7!B>=E z&+K!f!MS#f&q8tk8)@6$IoFHcfg)1u3VmcR2@vY&)OnB0vI)ym9z>UIb9i{*$l?%ANK{?XQ=mJ5^9RBhqAmr20_-^J`sV|ASYedJ*k?^+ zgyPIJN3=JLTHdr~88f8B!!lB!tQf4$j>l$$aahmpyY&LqJvL)iaV5br)G21 zJ&94vwfrgKr%dhz4h%Rjj(QbLF^ppn&YYxk&lrlr5Q!W$hGd~sFEkL!$k0&4Bto2i zJXP>QZ>N$by#gPcQ?d&PorxiJ>$)tWqf7m^Py{YYN=(pvA8&;m&d+}sTrJnO$1}i$ zNT5J_8Vxch85Y#a!P;nJX*o)WnJ7W9t-32kTS?Z4s-(e)#=@4UooH#jjv9(#7_?e5 zB8{eGXx33<#7zTWK&2}nHdIDTY2G@}k()JYajFS-g$Z0UJ6b;ty_jYuFc&5#d`xc# zT6)g~6A{FLk_!Yd1WY0aN#Yd4au)PS6~y5H8x7$SBdJy?6q3JeHZCTT1b2oYIPy3F zph!f85Yi)qh!O;`NR(2EoQIl5CH?97AossH#-DRlF&-f;frxz23!+fzC+g%QdT21< z$}?%SG#Fuoz)?iTgtU7W4FMFS63D|d6cmv(I$n&lgh5?keK}YiXK@l!sSwEwlO`oF z>454F(GQU(KxR&AQXu6teK8NHv3Gi8mVMgk8hL3=P?56&0|PR!Anm~K@Oi_Q8_}Gg z@P^~Wk68E-UJO`Z;8)%-0MQ9Ro-i1a87@LGOc^DZ0hxs_A3Al)D~`$-0f3?z7s4s1 zK~RW*ZJ(psR^Z(UyTlbhFovUJPE$2SUcehClk*#cJC8QC2ee&<9j>e!vMOCsEUZIg zQecsju|&WcH;xU5z=p%vdiFI(!po4%Y?lpTk}-ssQ!zNfHbSJitSd7{kcgcaSz!bi z(UKG*OoApL$pmD?ikJjBG?@^_7^WnQvM_){gMhIj5@KKpfDmfXLeNx0pMOTdHX>Ze zXyXL#kl_$@xZ_$MG1M7O`L=zjeDFVioZSUgN2WM~M85eb0+gj{W`vlSs%Z!b znx-NkpoEE9ih_n3Dypg~s)b;XN}&RgD26GjNuQJ0iHSKe9U@xNp%8fUuzP^x?auqB zVUhXlHY{1Pcg$lOs}f;Az`(%zHH>#a(8EEB5`{$ys6c@O0<6`*raW;nP%tiPWOXbC z6ewkDy80(a@}CTAz`6O2J3LE}@;o1b2VnXDh=@=_1aYD7Z9w&2v!5lWOmgHd8j z0S_&B{nHGM{T&_X?OnX?bs?xj4a(UDuwsx?Z$*yS1rL0l{1OH*kh&~{aDc2r zAG|*7MGYWL3~XJAq^;iU-tO#n^`X~NcZnFnE=2m!@OZ`dyYFmt-bx}H&@?$1OmasT zAUjxXCTklLi7ZJcP7=kRdh^-A)1d5jehitsw3XCLFtOyDAaq2~jDT7^kQY~jFumx7 zMbcr*UibGsm<|y%r%%`L=lXj6uGxDpnsG(G`&!1tMu(_E%tjo+!>U*+Z!YQhq~pU9 zn>pcw8@Q1$%8OuF8)9tzv5K8FDJ{x6S*g11H-=gs?sOYRu01K!UO1RQO$Z()jZKiA zQYTZ9eY|&4$#My?Um6q}VjDeAko2@1EkacRhnzf|g{=;?zlwJTJUC>;0s$mE|6N-U z_8OGz0gHebJ>f%X!jpTgm_#tJd?vaDV0~~BilC>ZE+O%!HNg#0c!-vO^bxVqnqrso zL-Bq*@`Hhm#&oeLi3pON{Mt=H5QVtIj2x3MZ0JlUR)Jx{yMSYi+YGX-qM@!K#S}7t z=Q&wPjACXdPQDyfRZg=+si4FY0G=0bgff;>MoPMbiAwNbW%);)TqkTDSecR{aE z@If|Is*ZQyKzPntyWXoy%be{A(-04vw_kNtt;?8k#~|2{9)OO?wYJf+UMY-1f4XH3 zC!XEAbYrc-$_Hd5NQE&3rg0?6NgZ`pGa0jbw9`;v+rfhQ>a6jA0(i4e-{Ks}i3rbCB?vE=erYmruFw^C} zGz(KVM%s33rJ?LS0bM}KAF2m1L~7J_nZFQuUT-Y~w4{gE&r9Frtc_tZxr;9{S#v9f zr-zTtJ~;bgcU2<%fd)xWVLSj6zg`!9vsR<+J?TVB697X^H2XT{PqNZ7h*!_^c^D(a zW1|-LQ|U||kD%wcG-4d|t;D#c#D56Lp?|W3vKI#>2P`2D2-P7XYFh%s257J`V0D;K zEC?Ab36rQ8ktkOfT|tgwfPA1rYy(DhUus|`!3FCW%!dUbtTm@3CRCuw*0WIHl8{Jr zmWKtMNMkY>Kzu%6#nBB!j~wd_0On!}QK?v!X)2V{`_Q``6BaHdO~LZJ{#xw8D!Pex zd7_c12^9EBL^PwL>-s%cybpl0S%i?%CXy&iV@+5K*(w;JVM&36;-nUhJBJhG#iIb= zGjL}K+0q6Q0lO!Nj{xwJlA58emf=0c>hpZNH3=I@bN0eWw4oq8$1L?Q@S=N@UM8LE zp>v88eJw=ky64^dS=&?u>d?A}AD@UTvIkkuTndN2 zKK4X0<>oMPhUd)`ojtK1hmIU!-KIFF9|)@7vSXL$`*CatJ|j3;3#gFayf^kl>-Kk4 zIfEy91&%+@TA92)c2@}oK3sa#pw0w+4PSHGOwgBdUNV6wLkB|?E|CrEM*GT;+tWlMB1pUJZ3ePAyaR6=!t90F zrt!PUf^`A^3?2mZ?<$jyx;6%q2?Wi`P=1$?!gSquYhc$w=_8noZG&IWHd+m}--V5#H-55`x4_7}JeNQxV4q7MZ-~Qb&NkyggFJ((Gg^y7D4mf0p_1aBXVI@_*wB|(;q$+8xYB7!`O)+)fV6c$W z8yiU-A~gU^u%-kI(gs}&S~V9oSoE^FNHarH#S8`}ay=SaqY_#}L}VTdh^>UsLNYyX z5nD`T7-LxSxk+k5Q9T>=7ZIi<5s*1zD~uSjeUPpZO)X3Y>M+g@mbVs3AsG}JvIw^s z=rbqGjC(bUK}dJ_7&^>Mon}3!Ac$BaB*23#D|^nu4n}M$lqm@B)6R^8ANqM1&rF=; zRj@1-VI8xxC_2tHf~_dP#Kf`Xh+Pt@3d$BA#>7SmwvfeUq$oCPA_z5GSi&)pqF52u zs&%)9XNxFR-b#t%aYAxc27)fP52jo}8yn+iH#U5MnE+oK>t zHzM62_=(0OdV-Jh zMy){%p-dW*ClP)JBYZw{XH0K#&Z`$n(j0|Il5rM_uaAkLfn)@jaWS|X*9iX~+t_)w zgS(EHBP!Ew7Gi3`HKw#6oGZj2(TfHHQB3vV&A}RN-DZn-6;)Gkq*W9)y4gG+GXt^T zB*=L`08~J$zt`^3>9=%~r3BPb=1iYxdV^k@_^`P*%!f0I7m$7EMwDTGEp36zQ%4*~ zhTallqB$EtZ{ej&Ob6Mb@JcHvGoVrijcW4F#uUI+c}J-j*ldv7BeBA=OBHM4 zKCqx-(){M!V=J-;a>oxjXk~Eq@LMTy+jHy^)OlF**%L)q+i-?08A>svb*y0H9 z6o8F;0Qe5W6ggeIkATx;3{EqU^P!%QW?{I;yPE8~8o{|lQs9k$nQv^IHp$_Oc2pvFFQS)~7Z>pXzGY`Kr z9}(l?-K{k$sdW6?0Dlo91{I?)DrN!-7%8cS;{kO7{vikN3Opv24TOMtzASeTL`6!; z5E`FHmVot!&M1I7Dx~3Y0A)e~xr>7s8Hx}98JH5_LZxI=m>4-2TeN|! z90^R47@xB=LqHUkn|c!oMeZbAj%3DYLMDYGMOnF=l_DNi1;Sh*LHgl9zytf?506-k zqC!d{%p5X+5afE7eGrl|L>@XGskwyRh}ibwL?GJpKFFEr@9*$d{G?woBt0XMym;B6 zmdwcktv9BPX}4AyrdwFRjI9)ws@ABdNJSwNF%U#FtV&Ff6C?!H6f(q&5JOA_m>3l@RFd@)CIX}b0u3j} z=nf#Hpr-Y5`NchNakN0O-U?p-DLmB{C8(57qtVgx-TEL;KdzuYzeIrSASfat8I~YG zhM_7UN>qK2pZ2?MD)oBsL-ayW))H%=aiBLcL=YSmQ$r#WG(v4dOAJ9x+Hd&q>@SSd+KiC{a}&lV(X6l2ru36jLM~e8LK6WM>hQaOOc1I*r_(MsDPYp^MW@8!U2*RlG9- z4wBshW^EALHS6eDBO4RG)jsPEUyE7gtD|wYhD~HB z#%e(h%yrtOpMVijwfKlnPI6~W80(G?ciel1qD7E#E8&c?&=I0fREV&WIe>F4YvlC- zvZTKmi-rVdCO9SNbdmV;g$K<#ecmf0eOFy~ceD<`6F^J6)reYLBv7EUa=RE5dHXyA z*rJ8g*@uKw^>rn6;#nr|ZNFX|Ivva*hOog%CrRPG8weTW4B-?*2zA6eBKV3Q1Aj+R zT;fRTPLgP5!-#I7^|YNTHc)b^^z$6!H$Wcz`Fi{dMneI*?CXifL)l}P;dIQTwAC9q z2-I8NuL;fpa0d%34w@QA_m_7&yuMhF!Pb0Cv{NA4Wlug~r4@I|CkRMPBv3I3R8!4; z1lZJolVZk(Dr3{~+#NuH29R)|F9?S?YYM|)SP}>UP$2RKuz-M&kl-9V;g5&6r=a&0 zZvDfbd7LdJX!D$Vju55@{;bL^XSL`CF%#E2cXwo3W-2}^#3CMfO%U&ehe){V80y<; z4{9NBNtrMXqiD&rotf(+jZ+tN*b34N4;Yr9&Yi5yK!}9|2&JSU4?2L(78aEH67)FC z?Vz#{@W9*ELekV`{#f%}Fyk{IMITv6i|p6FHwI}0wLO80FdGO30s~>QM23V7rYC}F z7nNmXgn;tM0kFV`I_Im>yXFU?Cp3f%zKx-IdU&Z~;jy^sD9X52vyBq6DpFL!DiFQ= zI*UXJ;l7Vd8bf@&U$57&??JXS33wAf9pAa!RpCWR`Dvd+)%X&E8ervqdW&z)dWgMK z2t5t6UQ#*jPu_zgER#2#0IFV5K8S6!2E7&Y4^Lt~kk zAV7lfaIi86hY;czQXE211P}y*pg`<#3j!e!h(s(4+dXq`Fod2M-#W`*S9Vbz!C--? zX=q5xH{C$K%stQ=L8UK5y}2+%f&hXij10uM4I9ADeE&(Iz6AGgBLg|v z)sWhGobyBwQLJ!(TMn2Qx7eg^W(t=*y@+r_vne}3=q(PW(7|FARSw6zPN^TDm%O0J zskA~$o$#Hek|0eLQc~sKNmND93n2a9zx|D>?~~4RUPk}}Er;HdsIiKi1Mv$(-2v)| z1|VD%KEEFT_!wT<;I7ap=y!Pq7J7&){IkA0cxODP)^JW$tIvrcVGx@mz7a_#CgP&-V{!A>}ahBnO!Mg%l_A4M-L zy9)N#39V|eqg6>(Oo+NLUzJV$BAvYYrZ70G-UY<03Y92Y#n>5v@%cp`NTbH_yhte@ zn`#xjX^#>_RxaU#q!lZ$K6(_*1XrWnLz#tM#x?76qFd8fF);Qayhsvnn{zopgeFWQ zkaA%MNx=dR(3PIgXl{-v+hHicZ8$_mnA(I=BC=HLr_Q?e267OCvc;1p@){4!8eiP` zJtA$q{WWub3FnS5J#X*d6bx^FwJ2{>yWNN}!KH4e4+!T;ywknkFCMS$UEn|<)EY`p z!p?CDJs*5?y*~x-leZlvh9HBSG7Zmllgt&v;ezegpBMwj)>IgVRxXTmi7e;RRjtEv z5%nZF^Wuo#2uG9Q9y=2@5H$$gXh7hQBuN8^zP}HP*sqyF|2y4FE9j8Oxr7|Bqz1g% z<~vJgt?1VfG^=CIHIvckd6aAgBW;R1t>#xJHZa>-d9ON6IcbcdSH({=9t-kwCn7R- z+!VZy?C2pwF;3fYHz%)ItYe(iS6C>{Dg|hF2OXZBnBk$-D^qh!MjFeWeKt0m$IYVU zjOSi%WoP+=4OWi@iTSqY45^0>9=o@Ai4%c^1a${q~lyD{^Y%Q%@ z@xCF4^?m0`4<{LFYV=sHwns8kc#hro&v&dWJNVY^i8~xK8)m1@@ZiCI(*q8JrUyqo zHZ(GU1MD@pI@$}C11|4AYEgO@1f3@#*uZW%3(}%6=wgg(rVs`;HpCf*c;J5;7+k4xUfvnU zr1IT??%UuUlWvhS?W=H=>)RuU5K9c$w;1fBNOlq)JCzbvM&(tR1CM61F>Ap4bLBfH zt|`HB#2%<-{da`@TmjFHsG?mnbS)wZ@^oopNIE2Rw4n50n0UB$HfuT}!)`pq2aaD7 zI@$un(%AMUlNMlV8n>g>F=5IR0EH>5q{W0vQ$--sF*K0{9r*Jpxmkl-41kDi?)4pt zhvaUFj--^DH9+BEfx_X*UPtpSixKQ9fJV22MDRp#cwq71F~MTNghNEWnu=?x#26g3 zkj9s7LUo6O6zBrt4nfOUP(?7t0J5334$$UtEY&u6lcsMRqrS~TVcIecV4v7%4K1uH zBBH9Qs-~tYXzu4VTjnu*+1d^ZrWzT)NnVEzPNEhFId@7S5uzq9R?NCitrW`H(pg}_ z>qJ<#$^=_>!H63qz=Ov@)Ef+kQ227W;yAEwVgwsRqaohW!f9uCVov9~(12_@bTh&Z zLu$lXGZg5KLn#qB%jJdRW*gd$fG|kJfQD4ULhYwJe~JBY_pV~IA#=gR;C7emHwwhq z)9ep~+Fn{$!iw3p%%m%j!?Ou9qXZ5_Io_%nmNk~j<55zkIuwe%OPPBs8KMLLHtGLoRCz-TSFHOda(6vI#ZHhS9z5R%NHIk4~~4I?sN* z8#mUl&JK>kGw~ruhrDfJJS7qBXG=IZOz@T$avv&d!&TRMoRx8$m&SZ}#H?WPpEV2> z(Be$%$T%a)nW1>WOl)wCN6O)H(Bx63;QY7_e0q9yR5v4dhT!V>gFO*n9PceCrVYe* z@y+6qhz7~w*)1LVe1QAg+X1B3)2z~6CDxtCqXw7`-@71>PV@n@U~ui01?>-=yXaJHI@4AJe$xp<{fJBH{AKE)b-E z?41V_D}LRP&J5|iVbR7hgNm^SE_moqgR{VcD7tnKl=?vrZ5rwGs3pm1&q_NXju5PO zd@c@JyLNpb7EU8to@QaRD)RU&$xp*3M`I*R6oY{JHQsGworzA3Akk-T67Mo&hvA@j zKpqoww*|#nkg9TE>Gv5$BM5G|DjA9bah!Dq@veoHsDqxbl&a&|t=qEJ7;$eK6y5L} zo4Wm_S_>T8N3O!HJo<5>ZMHptFbL9xy{1?!^UJ_@P@*wK;wvg zs7#FYO{ugL?-JXN{>5!KSbopQquu*1YgXj3DE1cOMMQ%KppP*V;+j(u3ko0A;J~{R zlb;+G$91GLHkUB`3b5=A?dg2s+4$$4&B=ECL6M>4sgBW;(dcbEM{dJpWte*n`pFHW zJn9x$v`&X&#K(qLD~#}7@Z1~{(NshZahY#wZTj)fuL4Ly64HE!r1pjzeTUB3hGo#} z9r4y`J7>jEo2@=5>;tw39+SF5^f%A5j#?oMR6Ti>GHMW=6pkUKyD}4iY_~o< zH+8jp^841Ww;JQbR&dL{>ATfFGvk-ULyXQ^8Hq0Ddpu!@VL6Bs6Q@gL*e#=kdV1q~ z$`W|&gPiiA)tZ`R($|-Sdg+Pgs$yJ9UIj>y-Ul=yID2P%@2igm>}nJb6(ll;DHWld zf|#ORQ?gzg2=U!KdGkI~Au^imVDA7LMS4GE#inLUw{l|pvybT0V$w*oT3n_Bf*oEK z64OZ=#On#$&R`s(@4vX~wS<(17;{da8i(UoDTcf_Lg5sNr-2(}7OJ(WMx2EhL*j?m zGnr#6gbXdV4*jxoM^if%;5(qk3TP<|#CYrFS9f`KD1_s(N?!1d+}~J|GU0K`cG&i3 zlL^TLOF&GZf*|ZyU0$4o?FVi-gH0_U?CH_1>o02x@*O;qV+MkBIg_=_7SKXq7fJ`> zAH6dXBb;%FG0}zsXQ(R@k$jGNA&`c}4upoZIMki8>|@Sf#Ubz>kG0D^LW(e!`#|?m z<53yCE7^HOuo3B06mN>(#mL{bO*=VYmn#M3Q zsGXr@*fjOTT4V5@UCE3&iX>^%DXcfMhO16FHz%z;H*U}4if(vU9gICEMW{i-#XA@k z37B)P)gjxv@s%B}n7$n#hZCJ6e7u_;dX3Hqx(#QJ4l_ceLt@{b1!pZnNrUay2OT#? zGi)Bl;x(xx(AstcJF}Lw(ztPB2N9;C7APT7k%vqax*8P)R>wSkW0YrQUjqT3VC6A8j39q#qXMnY-%UFsg*9z#R?~3U2@W1 zHEo(@G1g{ir-*&_g~kxLamg4NL`O>= zy<=GEEECxr)f6@$g>dmBq8wBinRpC86Uv_0A+l#wH8XazlXDTkxPS5Mo3|`*5F;Z#JUdYh-=SIJ6`_B%6y&#{6Ll{(AsSy04I>n z+crVk+)N$Q9M5)*rnGNS)U~e((;e%UF^zW)>hHUUqv=Ooth ztdX`epk9|3tI|=AtBh~ETrqhK95a{MfGz}S3kOizqd?V~#jv@mtQAt2@kZ5yN&rXB zowAvw4axEyy0>+kXC(y*n`mkTlQ58kC7V=rMHuGhy6MHvZ)Q(<`@hs1otLT46l|z=p{>sA9NTgj*qc4wFP-CR z%)580!Zgvm7^_aR5859k62}S6_=N^d94s4gx4jV<%Jy6@oV(!fs^(pdn3>jGZy`5e z{F!@VokDgQxed-LM5m_gOxi9wZQfSZZ|=Cyc3c_6 zHyXS~<&*WN&bc>K{dR&N&r`<%lX>WFSaKU2tUe0CXN%V;HUibuQ3Gp+ZSlc|1VM8< zQ#)0J)CMyqvvYM*5xC12MvP2PLT3uk1@Ez=cGCxJa+eKFX9npB-PYo|vX zbX<<8fIzG+)+tgE1V*%F5*Mhw3L`=_4p;)f0~8YrJY2F(z?i_8v2mNk%8yr+&=o{R zF+Uv;}_IMGGgm`&UkxRtR_;EqqQ66Mh*dI80Yhx57Y9&)3LCJ{yXg1#BUmq?}E;{ z;CD*h)o*NzfUjeW;E0PeD+#kQj0_}$9D{NUY>XOmLsBt~-j{d>i1HCaZwK{1VN`3L zFv74iD>E>sDC0@J8xdI@Dhy;`DG-(nbgj(OU5vywCMIH##z%pi>%W{*d8r(={s4J_ z&>pah1}PE&k>1QRvIFGzu;@oVddN0GH3ze9oCuA%QR!NgrH7FS(-PA%L1L#h)dkRd zV%tkMmQITUF{vU5#0xrnMCq80Hg^*fCw6+XHPf{kL+aiZBkE)$6B{$x!mRe4%b~`&>n6%ASyjaaJgYtrg8M_&Ya^@|EkSzg`xg_Wk zr&kQ|drA|evhMYxsIH)cWqN4U269*(jOD7DV-94_Nx;>MF^+Up%wDl@Ind{nI>J%B zRl%BW*kvLxP?D+dh39&Cv20jCNI)3_N(xgsyza@!GbCXNkasBy5|pvwi8|tkI3VLZ zwFS69+!PByyN42Rs3%orj%ct#%e_o4C~nHjtR=v9hxRTaP0}vAT|g}2P(YNM1-|;vMPog%&4oT(g_&l0OJ7C zCz+Nhgkqr%cSKdd=nNlZm4#A6*ui=#=t1+kPUJcUASiDY6A20$qK1QDwZgzn@C!9y zQ^X>=h%p5^2vDG9*wNX@Q3nJ^375I$W&}f%%$@q8fH8z}D!US>Qq&L-dJ_dZ`8f%a zswkO~;W~xF2Hmk#L><5z-hqW%IMJ{4~^|CnqnA+WJK*d zJc=YpC72ZmfFgZ(4oE@c-HeviKjV->ib@d2mh-2YV;Kv`(GrNz}UZUxZL08)&B5(ihw z6!31i5lL`p#TfCuA{fa4obhC-=8Jq!RiVA9ep4<|z(@!V@0FgFId3!|@YfnFcA0RCV+rDu`n6j_A(VVAYu?w%L@t>-;n6M8QNS^AT|p>kYUXPo{HLbA_Ebv zWvvDb7|R~(D1!+oprK+5F#{z`h2X;=t^&lYKizz$r!-36Va&t;{G&yDvmJ)yh85b@QpzTY(b(C!sfF>dWg``btW?;F{6n` zh+-NTfDC{NssPDs3^-U_K!h;}LTpYgkkQ6nPE%NMpvVN^4nr515n}-PCYwChf)@2UNob2$bp}Z zMLf(tJY+HD;qzAI&IXf@E@9Tp_PXNqk~W){#5yj2Pkk=Sb?3Qy2Y$t?$ZJS_1p6^} zo>d|^NR>~(Ia0_*6QhAMjlH`BV-RXJ1^ROoUE+A(iEzNpGF^?KGZ&}6j|R|BK^$~W zGov+k-t>2CTJzcdL(>4FTonwIg?xF2jO-j z!rq?zJI79;-^B1tRKro@dXm$pE4)8#+~rI-^04wNq78PoV?Hx0G$RKcyTosd;hCV^ zT312iFF+=jc(a_5q7AgD(Gb(^It@@fPYVMI@fv*f9k6J}jLhyAfNA941D*EJoK4KR z(3KD1sBCXXI&47Jp>t!64-P&Q7^gUVI}TBY?=Ggyj$m21q~~?dgAm<@5^r*{63)j4 zuDG^mLiAI96m59j9sF$YVdXz|b8!8mw2@Vf6NRURsd#$~^5>qc!Z=TyxlbHEa}Bk- z<5^v3?@hatn{H}j?TjuC;bE();zHx2J5$A7w8b;KAg}*{|LKhN4-wcLe^Dbuyp-!ocM|h3F3^jT0lPft)V-wqW zg0|dM6^_weJl5(Ko~4~ah^HaJ+G`|@HA(#2--?HMBPJ%vgLd_u1+Op9Ol}=muP<8T zX~`ZNGk6Q$Q#y)?a;n|y8pQX>!p>8h(!j0PnAS6tw6z8kaJg?82i)cIws$vv4wki= z!ZMpEZB5O@$+M}%)=7pCJcrrNfy!Jcx**|lycFm#V(O3#HXP_oO*IN=f%i^x;h<9Q zh%}(xG}e@+-hJw2u?vR4pn()o@f)(K8a5`0{4eT{WT`OGuN5|k5ms3QabM7*i0@#Ai!y+ z3AdFc>EvEl0@DI`8HBjfQf6V6W>y$TIwbJ$A)&(J9S%A+BvJ?F)JFWo9P=cmVm^;*dwEg;0?y>_vN|Mwuxfh*A^?1X@H)L+6Y6 z83=(7-AV3(C;61c?*d3re)WRAh&`ac>5x<2nk07E06zjNAipeeDM$gNeks5d_=JH- z-Y9#d07^oFqM;XWe|R*6LTK0gfr6pXkmZz5k`Tf{I^+#ad|xd-V?=+auNgB!{SJ!R z^8sT3;U9)MAT2o=x!TX4oOf)S+tODuEh1-#$=c8C6n=CZhLqzb0u${P;xnf2s6ViR z{TqMQ;)1YyEP_o0qKo3vlRtYql~eqw%0t8HgH)NRMmSxFVnJPv_}P4;ZHNnayBdNM zS$ARMJ280y-}xpWIIskf_npJx1oc6FIraYR9+PVpAevjV!oosAOl^Qjkhqf=v{GZ} z8xXMjwB@tvKZo-E71}RM8yzczzm7Vqj~)!-ostlUB!O z2+pWv=&{QQa?3-RlC(cJ#Gdf^I&uA;&%rOtKHEh4LMW5f-fJj?J_06&1mUOzVG~1; zjFK^+uF@etyegv*qeMGp;|0PB0wh?KS%3+Em?R*mFx$NrHI~s#QKo8N)IeeYQmy;` z2YPipjPe6q9T;7dq6z4VbYMMTUH zRD)fGPo4qti9ZM+NM_!H=1gx!)Ea@NGl9HB=eh^hBSni65mV{199sw>glUOiap+e} zS$C1xTrNy^5fm5XA*2)zn5gUS!5iT*(Q`cO5X9AzEKq6@!Az2bprWWipbXOn;2a>^ zO1baih@-_H5z5>LTg;$0SSh%x0EnuYrUs|MnqD^>Ts&M}97?boj8ToI(Igp;RVGP^ z4Hl6na@LA#ng+1jqxf=(jjo__(Xx@NA=ieknL}+5VPlpvh9ivRTXPO#ZZ18t}YOpPAB`NW|)5A^< zlvYKnBV}hi6LbYQ@CVZVl4%J|O6=Iqm7Grg{0h=+Db3~@Ya$E^F^N$#iuWqw320b* z+mQD}-_a9ZS-?A_$W-{j@av5NSHDibBx6uMl0)ZcD0+ehQm`*Z6P+;%I>9m>$WT(% zp5Lv=*q_3g*$f?ZWE(^t&Vav>I3Y>|@sRp-js#FbXn_HiR-`1!%8yVZr6=@t)GNNj zWZE6?7Lorb4~R(?06_^AL&oA{;nauK1>7K6@n<9<{wL-yjM>)ePCLH$Jp^|LP$+Nj zSPPI^GVFdH&K)$@S<%k%R!d6zYo#KRaxp>QZ$p&97e`tHQx$c??$!}SpnI{Q4ol8MM zSw=MiK*tb}ST>oIu7HwgAU)&EB5BZp5Hfx#p=m=YAciDAL@fzQfrv7q9S9xhlBOZW zL>dxISpdcYRmg}05&&_tokAd_2WO-MQZ5MN!j6?Y$?GUcc9BRgciVMvXP(h(tlyxI zltr?MK}48%azkpOt&-%dZ+S~9+F}Haj-z-wpoUf1;pT9okFEbi$Yb)sbL271*J zha-sWh@C@o+In?ySrw=@j&X`Rh$Wp2|X-ShF?IB}8737KQtL@*xt~*aEc?~h1 zGp$h%Q7>z|4p7DL2q+jW^H?WEH5hbW`RhlE6rI2}3`FFJ zQj;Kjcxlnw%Xmhjl^m&pWh})eB48L0|53+&gMEP1P!RRC)P~V(gDYi zaRyp=?*$6#;_GpGHi`O7p(C6Q=j?m6WSt2qZ5;Ls1*Zypb%+4~ZpgNO7zG!4N zzC)9#NFF_*VwPqL)oPkS05>F0ItSeZkse+fHHw&v+wxBjwv*r^w#GJmaFNDfnHiK7 zAC@?I-!sM*AEQ{n&tak{&%>BBMFGB`r_3JUjyV5JexmpYpnRh*wlVr=0AT~opN0d# zmI!7Lfszq41M}5Z6V8I_`bdGu?W;K8n-mVYlN21CJ=a|AUKl1(HO`=&ki>#&z@@t_ zFAL)}d{lVic5ABybYOUq0zlXtu6uwV>HxzSATH zF+gZZ6K96tSP<=wt|455R5wID@FE$9_V?!r>fIE`iR=3EZ$;OfDy=VPkpl*gC&u*& z+|&OW!KF!h^-@kCemEVs#vz7C5}ShMa_mlV)G;{6UAtMjw$%EqK{?|&Zm6#F89-VY zsgTz04OB{OiKPR67u`PVmvy(eP14r_9n**|WICJ`&N*iG&Jx46P9d&dL#tfLNp7YFA%f$LA1zsb^TUojB-by2k#uLFCUL~g*ccQ2y zlPG^3pPvs&c=B=4ZH_a_&@SCq5;?M$H6h1+Q`}_o@g3g~mWuP(<~h=hunmo#duxcA zihzDZAzCF)yT>OF+qtQ%5}}}eE(6DIHz`w{8OE^`?#bCgh-@=k;QjN)GI#hte>`6m z-9raw-z@EFYGXEc?TRqrCt8tqaLeU*UK_q19VvGgqtb)XLlln27N|KFr7m2{lpEp>hdZKW=KEJlptxpx zlL?_C3Xtdyo0y=dr^ilHw8x=0EvoN4XN5;?K9Iwta}5j{hR0oFXP!4MB=087qmDQt z-S`m;M;%<4cjHc*5=Tz*Qnzzxjp94JKJ;IQ+BI3~iciAoct=Ht0?ijC;>*-?P~0jw zIK#PP*D(>@=NRjEHYF}{zA!d>ffw0blv(s&$!C_i|q!==XGVqG6c&6%w!-+ z3EkYn%2FFJ#nc=Z2{2kUhYHfgLlOzcCUK#6k&Vcdet4jQHCP5TE>&!gM-0h`ukUuH z@9Bcs>}`j3l`ncxF5&4$C>sR`Vcz8IJTwIT@~j=tjv*)Gvq)T^jvv`0wIJAyK@l*) z`yken5zZiCIor?^VYIlyECO5ykdzcB1m1+uZH`5~w-!bI78eF0A?mAEJ^LR|p7Kd2 zhmjwWboInp7pNbSUINvcs1wIPm&Rb_1^7EaaUH&@6DYl*))0WkeO8WnNGvNvG7lj@ zuL*<)fLMbJe4?BHT}`@DB00wtLir>1%u(GH0LX$JC##m99KwuA-PMw+1|cLr0VBjGRdyVvq6(+Y zWFLw-ICRBKaiR2(#RtVzBWM~*(rLp^BW)clo?p{o~6B963k*fN+fH?_cCjT<$X7?M-qXp4c3Hp773 zP&PSI9E-5qGgWQ`1}UOb3PzFv79>ap;q`!d9;3Ms;`+H0s`opX#K@*+?Mnf{P|ysD zNfd>)A23BQPa6{e4prn49^>W?u#`)}8-@MWSr>ObOUzcmm>dvyrl&F>Y6FPWXA7LQ zeVe5A7K2s{Qa0FW<5U6n7Bm$)7173=429_<00Z&DG^hm8ke1*u5)7_%k*cpga`Z4jl9|zA9E{XLM zbU0uG!!Q8sKe>!# zWYIF~S%hT6sYWu48xBwt7=ZkAI+t5Gv~!9}2FY@~IXsuy-0ppZ85KwN(GiD`5gaf- zDiiXs>ok;x(In08cTDM*L<~&+WaMAU{)|UbCrXcJb_qh4R5Q4j-5QzE!9bv-NQFYE zEldc=s8vH&W-A_HKWh;{|DMDVni@SAaF|?QoaA~Qt$~a%XZIIgr2y91z)CdR;xEp@ zCdSa?k`%!-GzidvN`?<;CihX@CXmliy0CX!HcD5n@cGVx0SZbO9^ez?Ne6xC%)_Ym z>TGeD4Gz|RwF6A(;k4BClj`N0E+_au?b_}gPW84%MCY&KIFNf^mu zRALc?H;J%Lm>I>Y;`^Mu{XRaUo+Rg-2XGWb5!%S&#Qa&AIT|^Gk4YU6cvF$6Ip$+# zw#N6MbcGQ}N>CL+a!c2z1>$vg2Ag{$v6?6sNTbV|v?5~jAIOwDqK6o#EhgcM(m*#0 zYK9u(W1n4oL{jyvpv{^VzxM2qF({w zAv@T|%x71bDy9P)#|&dvc_D_3LgvRKCV{}Q)@9#e5YwtEM8xmwt?k8x>=D;Xj$LXE zNgBK`{?l77J80`0nhsltWCBA(Cz`+%LbrfqG*=Rot`g%Zl2%F0kZ5AE)HrIu9Y||f z(70wQP)=gzV$$K63|6GmYYYr>2uiFlgAAfF%vubZ>%22uBGH3kB9Czp&01EWUhPHQXIj5dhN|YJ{NyWD*qmh%uMBsPInx@Cy+MN`hloap;PLij; zl`0>ndB1xSzaY@Z`>xK{*n-?+!6cP_;gIt6S z)mGN?(T>>qKbSTRS_(Y0c;LiYkprhtE3d!|jN&I|4J0KyW5-d-hCav|I0`8@>-^@s z2QmO|2d+LD^&Y~LOUeg(&IF)1hc)HM024$G#Mr{Cc}8nqkG@mu*+t@5hSJsSKfeQv zAJj1_Fnd2)2z}tlG}LG>%0OM-CZ2@wg(YjG_ZZXQ@==eLszPl^uW$TN{k}wW} zx@HTJfD#)&tu~E=1o$aZql0K|@sOrRmy>ssnH)nUAsG?G`T!QRgWeE04}QgzPqqgW zh;Ut~sf-ApHdQn8`;R|yn$#g2VL>#;!i=CA7-9PS{;%Uk1Lx%C%@*QC;)P9c2?HXU zYA>QK&vYn!Z!@qwARe#=8MBfIew$kPh=XIg5 zZm&~;(=9Y)FXEW=a}lBv*wu$fn99&1`cU6rLjcUo^DUJ!A}j@ZB7sLnQ40&d^LJf? z&t5yYmK>`dzH1)$+`lT&_o7U;`n0OzXJjrJepsbA?!6AWAmdefKi4VtNir^s|9|Fd zdy%%@+>GJ3N0w2y5|NGYY|`Uc3F^?mX)IV|^et!@9cNB^Lp3l+#tPH1m>Tz?iV2;b8VF4+BjlRYYq0PN{SYZDzuY)_ zr++#QS5yHQ1Td@oGK6|Dc>5m-8fHU;Y%T^dD+4N4u}Ny|mxvT&Mw~?f%%CX<0ES!r z*m>D^wbt~KXUtUCQh~U7V4A?+1Uka}liub9C_h4F?=$dT58%{x5)>lPNlh8zC9*QT8%<+Huk#mIN-LN90-O= z?CRcwMu@a1LnaXK8jRlZZ#EcZ!5mRZn>0Cw5fMctB{3S%SUL)aL4lUDC84WEjXEVU zF!bU-=+I;l#{;UWs}(UV{kvAZyhvGm;-%H06wTgtO99J*?TV5sCqeHbidBQoiYZEZ zA)4;|I(iF%bGzv1O{6_K+FY>n)FivVX2@|5u_Tg71yxiK2j?;dhyAjApoSfYqGE}e ziio0l-@&a0p!y1qoV*c5Ow828MHA#cLCeT@9bh4b>V!H!&_+Rea89RSUq9D{B|l?^ zQ*N|~#uAjNw8q*hijG)O%OuPr8#7pHrOYwOwPsbIh>yC+HC9xQ9*i?wa)3gFwv*n&86Qlgv3kmUb5o zMZHo{nXWd7ZbP&tL8wk6Tp!z^+&!QUAP!|WE~LmnG8Z|q3V4sap&r(WK6PJG6rX7P z)YP8&ZOZo^6k`b+0JMDtj{*j3kO@I~hE0gtE`7L#^UV?207wjgVE}l98KIjsk}up< z0OYK5=~U`;fsH=pq2^Ks;v5*{^80XOZy$D$O13)@9SqYka$Ag4iM63hTtvwl<*W9~ z*7@A{Rt(9}1AZhrXLu*eNTL1lUJ*VhAk+}vJq0^E=aJP!IZy~TY%zddtq#yOpvn$J zrpW@6B><3@6Yqfkza&9WLX}8)&^R6h&lMElme&FhJJCuu0lFnmcV_f?Kp3x_as&+K z@9@dTC1jsV45@ovE{C@4XJskq`M3GMO5RS6PErzHX z%PPxvli}oOw{l?#2?|%Uv>-dNA1N*cLo5{0sCOBxOqL$I0(GIO|s5)anAzjJxAKG#7Y##U_%Be|cFLJkIG zNmDzD#^<((6wOW3(p|v~*?AC32@pUwn9WeG0}6)Z8L)t_vqPeXh(BKjJ0Z712TkhQ zMMe=A5UnhA85lDNDAO+q9&kp0W_BC!o-TN{`s1XNwX&qFgRFNN){%4uu?D_cBBaRa zr=TPD;eZhIf{p1won%25iM4eKw?Sw!C^GQY6Phe_+oByF6NQwLVq%=Rpxk5`24S4Z zp$QBwNIR#5HmFocu1O#;h(d4Usgnw6)57))g+jMW32C4k(Ok9&U<(B(M#v^Ws8JPQ zG{}HNL5CZr+-J6^G>=XnmLlKL6?d8eN;*Z}L<_n`(B6((yg!2=IQuKT9_x9FdA?;g z2!~1=_Ns0Jc_d@cVA5d)mL%9zH33A#G_*09h8dPaGKNhdBZGsUwUt9v7*)w>BjfZM z1H+^s@<^e=j!pf3hX?Hopv)xzPzNSq#CRshaykS^LHX+THRHMjn=}+a=hH%`#@sRy zF+@wOF_H8f_HO7frKX|^07X)R&K5kST@vH!o)^+($WBxv;WDJmghM-6%#uDi&PK_~ z1w@1RJR>(W#-nK8O5#acwA%p`8 z4@f@93r0aV-l?V_PKUi5ga&o4STbjbWS~zEU#A2)b$@+=h_mun14WQYi0&6itceB! zPx6%lA7S7Kd{EMShoyqotCedgVh3Va+jI8(Jb4!|D1Fl0(z%2>)&_!4ggwWAWWByZ zp1#`0%_{1fg|-m8I0u6DK|hcp0^o`hkGK4A;VPC_)Tfd~+GMnxh%Jh(x;jNOG=*@|l*hNO(dG)6F~jHu%R zIRb{T#3h@nDg-2CC_>O3LZRyIQ3Ef0ONe5Fj6y5qR3f?)@m<6(<%j3her(BwGk=pKS&@;n zD8fv^FbOrNs&I=&YZjAa8AgYNY_i#XjD;D1Cxd|`LutqpC~5~JB8-<-NkAB5t%mS( zR8y?Tbh(RE2~8DMhDoMq)S5bBy!Dz*6l}4B5^|^}Vg@)20K}Ku1`!kz?KTolw3>sM zwTQ$KMInuo28_wx4)vH}kdrXcPH#q<2y-g)rYkn)s%okjrWvY&pp3&Hl!B;OAhmD=v7-u!Ce|57unby_ z5oSslW?>le{uLVSrhK!bGi^jEF&# zMu#Bl8dQ+A4JN?N1{0?+)krmMF^UXm7>3H^AjT-;gi#o*F-B!%nMVeE81G@Vqf8i6 zb_gR92F}om@hCJF5J?M$TG5IGLgKlFn9p_&txj0kVMI&{sscrKm7;_bu*5tK%Ro>U zuTP^O9&+=FCVP1QV6>Dyr@h9iaX3eV922h3>2Xa#1KMngCuvp}$5V zks>J)ATWau;NSrI;0h2Qyf`Pe$#zC0xkfAqhr_u419H89S=!pVfnOSdpkhFzpo+{y zGN6fBCL$223MnXB0BLC&h-#<`DN0HJrB;!GD4>Y|prBd+h(w~OXeb&|l%Oi9p(#pA z3Z`TzXi}6YqN;=nLa7=7DQRd}ilV3*3SwF*R+>r*5oiJ+X((v`r2-+ODHf8Nsv4>i zAS!^OhN%dsS|Xx?iiiS`3Py^FXi5TiZ3`|`c z?m{=fNH-!}w{3(ilo&v%)_`?cY6%=ETa}V9V~ny2EAdWTUnpGexsHWGvUx}aBG3Uc z6bVpDZ8ZeYM37AY_TYQwn$jG7eOE$sfg{b?aZvhoG^g*ZjX)v8SF=C>r%+_N0OW!_ zQ2Gbcw09r~Y`W$V1sNtmP(lzB6GF7J69m-KQxa1Hizkez$w?$d5k&<}O(Zh~10g9S z6v0hNKuobnQqWNZNkqv6lLJqNB@rY35}*nZ zU&ePJWssEXfYOTVI!#Rk5gD5Z+V==94gbtjccSBhDgbE}XaLBgM7Ru-3MV6A46fN% zHb_K;iM0-au0*rY9r0Y?9~E2ZLIemG8A07aWMzUSTJ{S|gt=<@uy&!K?G<*6QiToh z3IPlxSc)Ect*TBlG!4^SR&DC@$DtZ*QLtlAm(T;ZTif!^{Ky(nLJ~p7W+xhw8KKeO z9?uL-o)uwX-QJL{l<^{~#6;4kxR5=O=R^mfPUUjcQB4#S(noC-DryK2IfGe}VtDcJ zfILgy7Z)h5qM}mVNb%l9hwdjGE z0O3Y0tgM`n&#D9K2t)4=YBtsZP|!2Qd^vP;Nd1!wq~SmJxdfY-ajHb=!iD z(J>HS_)I!+iLPuY`U%I}27Nt_?FsQkD?ne8_K~O3f#`%JX{soFgxT9h`(vQRL6LeX zg0(;`5h}|A`@$syK$K_4@PC(&oc~e>(sVjaM}P#~6?n)kMD8Mr89PizpPM6-zmKV( z50zEuU5>H&16UYPl(i(WWq@G-U^2-TdVZdPnOYnuL)1W+u#+iBX|^ziK>$LCf?z#x zY0X;I6U~M7VBrA)L$rkXL*!S+K=T|3EB)}40YcJ)LahLT(u##3r4*?Uf*)DlC{RI2 zfToC@vdcM07Kf^+*@=!eECQN=?2-CcY^(X{zmdvDprYlKV3OiO|Q8%4j6f7{EtT7>W+;JFKvRCscQ6G}kca z;w(;_FDJK7*NT&1YaXzDZ4ksv#gmCdL0OqgnUslTgce~K$p|#0gN$-e!3 zqgu*oyYeTSAT>K9Af&D;2N|I%mtG-U(iO|h~|VC|Kb zvR0jNY)olFsK{tEG(|RRF~HDj2@Jz0O^Z#4iOCP(eKT5vSnEV>gJokYrI2ny65C~x z#_fuYjW(FuZi5IisUt8`L71W32oG&a<148KOr_>3F#@b6Lo*w8G03O!NVNOiXUTlOBh2 zEToRdB$U;QFu_y4gH}d?ylYj$)be2_WXu~RSjP_h8FX$139{+FY1qg@cs2 z#WI`QH>@V9sW672bYS1|THQBUu%yHrw&{foVuMd!S4`7wbmDLkp}*u6HN55p3~jfC zmZ?G!P2{r~s9@~KNaJaeL6)Ye8yUX&jI6A>RW>7}HmV_#U_VADOnB^%Fgh@fn7*=7BB?J^|D5WP5BJ3$T{#};a zxHjqtqfIFQzH~SOG!Fd<@6AE+dli;MkOjx-5qOT|0M-Y%%$C>=$a|k4v;bGAfKnQ2 zs;VVPUcG0!Pp+PiP^QOWG#lvvWR9$7r62b&`+rCHG`yZZXh5Neq`u)cqv?eg<$)bW z1egM_33kP(b# zPJlHb=_NLTX!P^gG*Q{G<8~UkfSQp(fQ_1AHx-LPH3a==W?V$-AR2=<3}UB_D6Lc< z?ep#LsQ~YssIX2uC~VhY@xBoGU??Ip^q)_}s`#=BMM)V60znTTN_u<+Biep2tc-vS z>b+V2vmcp=V3!V1pbrvT-%E$ht0ZwbmW0;;`!M<}S{9uI>wDx*y02}!EH)~Mpt`|a(1(eTy;B7|XzdR;CQgR!Y`rs&s-T8^3u@sckJUv9_l)FhC%x_nV zbF!SBoZ7XdI#ljd@fWSebE}t4nHrFswtc4YhoQ;wpF4i9l)FBy4n!M!Y(GfSDYd6! z1ytbH%{iiRr?T37b=!efR$$EwTbLBKF0&D|h{FVuBFx9z=FQVlt*Sf2gx6ts2hgvwup zBs3;;NyWiV!_Cz5M@GXJCmYmjr)-STBdo?$LL(G1f}zRKw^Z5SN*hzA=tGw7NlmzS zT1*a@;$N;YIm?}Hqn&ak&7v&@%gt7lA;-}X8&+v!y|q&mEN_QpclG^3n z+9QVe{e`2}55M z4JnIQnNYy!bFH_^+Ni^h*-OJ}i7CAu$$kiFRH+3v+}xUt#vLpwx4g&$znH-@xNv1t zSc}Z2)ZlP130^q>n?ai5?OV#N%#GZp5;g9#Qv*gO$TTrB3&4r{K>$!FP<-lDczo)b zd%k#=N!xEc8a;Bp!k;N`vl_E4YVACfXo*_RSBi7;#b#IZ$T=AV*&vINFo^X!K7a9D z7dr)g7JH4N;(6WhGbII7q9AfbF92O|q3rvJLUh=@G=Z*!_QLQ>ZuA>{{L#Y}fH3Ml zJr`UDY@H=2W~sak3N*O+gPdUUeNm)iH#M^Uos>W=hR2Brv%9h@9g5Yf(Uvwo$Wa&D zC_D9#_2hgtjfsafW#^>2kS-9zz?Pi^L1?VRG*$)}N?=3{1RH?}G!PuB*ukbahN$Hz z#M^-sXdqG=<{D^bg9`&e&>_U{?K-m1n!&fWwha~S3KKwyo>mVCm9Vn|@TuHGu-@>4 zvEiYmAgiWG)PZ4=2MI9#Ib2&1T~G?dzdicG-5#@jB1k5xN~)@&DykxhjBsap{P~S~ zVjwjGt!vY|?}|8wcJ3sjd5OV1g_)cTx`0jAU>R+#hNa9B#wB(=QZr*4Lm5V|@56=$ zWE2?A3kz+aNd#b=EJb}G7NFuX1Etj7Bf%GMe?xnRC$x@1&6c3lISN-AfdX10)h#5 z@VXDHVbA6P!UENT1JsASiQ6PZ#^KC}LqM`W2zszS9ixdzZDZFi3P@-|;~*q1;# zVsZzttg;|VkKb<^ARK5qj$wU}6o9eKU2|_;Bg@}02&TPzq#zQYh(d}WA_VwU}=)rD#Z&q>5?=qC$zw8E}FsDk>?Y z0+fbI3kL*uhRaDy5K%~!(^Ro51O!Y%P?S=#3$dT@Hqh zrNCf+xh*)h<-4T>`y!!%2gP8H7gNBIeCzheBK(8~5Q8KlC?5#{5Xsf?@kTIi0*BiX z3ge7|a>hsCV5UBPo+&Dlyl0Z0LiMwT)qS1>3K1XMU)zBynh2Cr1SeRl(DeDwbDEi; zh=5{LngsOUKJa2XYku=*C`0vG0mOpg5h+1R(>Y)iL^M$#RLD?3QI-;g3j`FU6hH(* zO)5)JNKg=gFckzqEQEmp1jJ1g)WS@_L{fy12ci)%VJIR=p`j=kNP-lKpoRn}Dn=p% zsgQwcrGSE2g1Xp&xK|2Tpdluj0LUBhVCX3*33uHd$v$W^zeFrFBZUw+(6yT5N;pok z0PEUF6Vg!g%S81=s5Jvl_(nrBsVH=E#Wy!w<1VDahi|q6({hf`PYD&%ha--Oznp7C z2SAt*$jWP$s;h7t`X;WvX{Kte0>bqL`mekB3)$UEZ>m!0>ide6qz&yaN(U539~31k z_x?R;iC%pJ_>Y$;rzFTI*d6D?qr9r1@*wr=2FNsh?Sg?Uq`?y0;4hNq3J82m^EM!6v(wOQ zOhu6mXR^u*DbR+W%oh-x!%M}(35`NL$dGFbbBiSI%l7TjqXU~YgRT@5G1Q^&h!+=j z#~fh{4lRjW2L*fd7L*Qy5a|&y4oxRa4G>~D8=_Mjqd#5UF;KYJC`=U~orje|=dKq! zMQq>5&e=N#U+kn3&A2Wqm=HY-YEZ~VdS3wN@gXk0GZF!1eWb)2^ioki;Y;&gki&wy z&A~-N1hTt7mm!!(6i{E1SJZ<%0N`vBn5yYxEKwZIn3dCwLLC^+cXb~45-J4BXhV2} zW3Z|j^m+5Ar`UfC2|$q%B@H4S1{BChhK7Mx=Krq(V)h77+b6LQ(WBz7&q=DTZIdX6 zOaTv31TO(77$rtPj!0(lRM1dh7HU%qD2+PfO)z5}jijBjCdoob3yGUPt~YB~ag{fx z;Qw;wl`_hCK#}(e@UEG$6d!IF1b?Y7h#J7&r;k?9-il=4ozR(3go0dC$=)KosNCmQ z9XLb`;2AKD1xTto-Gos>GFw`)CZow{L6QQPR$5qrl6}n;l9SsoD3Em*55|Devi|s{ znF=*YAr0jTLOcxYO#^jrmTz+jk)5nS+kc>uDAtLTCS?Oe4~M=7p<~!oxLO(t2AZIjfOxuNL%YEL zH>l&knZUccKp86-+M_M+b+F$Vvs;``=8*$RivTQ|&9ag>43!DiRZxH?=k!tVE=Fh? zOYAyftg_XF?d_|V20YbC=9h>akVX7Z4`T&%%0DT)2;7VpS~Fo^!%6wz7ZH^yQ4LW* zzABy=e1CtB-!8w8kP&@RO(2OtfKs1nDs~UNpW|O6U>k$C@cjY@)8BV;f|>k1K3PZb z2dt`Us;R1}fyM8-Ddczb`G4Sk&GGa(Pl=s1ne*9n4Cf)XjE1m2XJkt^8jT;|Vx>#e z9c}!vozxJZj>OLm_PmA@(i~(0;Ajvsll(RRWM#o5CR!4xck!*Wkg9Ibm060}TVR@H zJC-qmsJ*GCX^lOzdys5J!Yg4c1c@!oof=WSINF4f?fxcm&}p$S9-$!QA=i)h-`<9A z(geI_ENqY*9!TvGPJT>Tm`B-@NIRf>7x~C}txZFC5I`sxz!B*w zN)R_56o7EumpMJctEl~4oPV=kk7^;`RSgIp0oVwlnpz;D7J?y&38F!&Vxb!m{(B<^ z&>7wgoxEFQowEU4H9?@@gh2z~I!zq!A`mplJTOTBHAFQVpVVG4vYQl%a018y*RRS5 z78Akp**pLx>No7xs|uLGNyA~6^i8IP=afeYVq&5sP>lyK@V<5Wr`NCmbf--{OC&kMLSf+xhAv%R zB2onz8yrPL3#V=rwmL>KwNj74eKf?3Xxd|Hkdd%CECyo%Ano|*PkUN%>-DvTrv+%@ z4`Z4WUPLgPsFWGH3BZg~E>d3w$F@wK46J#ICfZV3A6Mmc#EJ5E;yuyOh>h`yxli8X z6L4cHZX??tO0E!(=kS%-8h+*m`8i3PiBura=)v%#M~-2@JwJ94g$wwyhJ`b4qj^-Sd5#u~iBDCGP49%x1vkG_kW6Y%K! zH{)(Wu8pEgDiME8HpI}FQy5bW7sCFYbcXxI9&H}7m6Anr)`|R`HPzRSEDW)vm!_e> zk(f-5zk1EcGdw&D6C&7d*6WE9K@1}sGps7UkOj%_>fgJ zO-8_*HX69si;jOgzk+=Kw?ct5V-^2jc@^&IES=u0}ugl!ABwA5h2y# zeo-fEU0GsQ5RuKXf@LVTuQ`*ud7#(jJ(#Qk~GPoN&BUO-N*d zVS`9btpf-ek=GhS=47EvP>it(mI&)jWW+UKqZvl@!i}p37DV}Foes0hP18-blU=L^ zBuo(la%lFpWZcq{YCtVm1P9D%N{xsF68$0kK>n}VS8gsoO=+S&4WYA)nG>@WROBA< z1_tyjAFvBmv0l_50fq0XB~?=-q(S_L$(Gll*CJK65u@Q^{94gkkgU`ro5NN=0&~l> zQ;UgdHz4GqM7Bf2qgV1twgMjsa!zxn*_(xY0TP|4`b3Yf$L?4GyKe(v zV4aUf_B-UVj&~VJsK}$umbGoSHj^m?m=!qeIHpvP)7#H#^>ew~p8WPR$c$zird)8j zq5>f|$NNb1>^TUOhC--nuSR5DtbF*mAxZ0%6NyeBQ@Jj(FGwA9#K4>gstrP95hH{U zAxdXcHDKfeDT2eSTTBSJ5!-^gObi~*7y}afPm=h+fRL?VK7t^r0tXwadq^}>RRLU4 zcTh_tb|@vhyUjYN8XL*LOeta}))>PjZyiRXEW(Q>n1}Q5CxM4y3E3%ix1xhbZFy@>9@*F`pF3sX#5hu-`~t?0iqa;Q@uv} zRFwpybfz0?RQCl80fBoUZ>%tLj=D#2B$L7!hjE8uVh+*SG?A+~eKz_wuA8)_2GI18 z=TTQHK+c}Peg~dq4_1GVjv_*0_sI5uauD}f9~MRo1fvAR_dp)_YJ?gMKc&Xs)0?SA zlw@W?8jx}a$xTuNZ7@=lDscxEv<^y1mOxk;VFrTrkXsqHXK5Z-l3g)MAHp)SZ(%>K9f;6ja_3VOBWE zO~P@h_$6(%UaC1)b;l>4Rr!C4DDcqG*nDzdbiVV}Yjqxq;x((rI}MWr3*JNObrvi^ zKpim5%ptJy&>7Ptq)Rro>*Y+ew-ygSl(R+@Vb2E%L3;eoo;U+b%W=SIghW$cv=TVr z#`eoAZcM{7S?JWXcQo>y>)UzvhH7S<0}BKKaH<3<01|a8b-;)mx#>k6n;qT>o`Lcv ztxAaqNZEkY0-7jYHCNdai&$hZH@X@eT;QDVOdg+ys7;K_bnS%W!#*cmcBRpa{Z1ky zLB|ZF$(v#uOAJh-z|owE;BY|_pR_>ZBAlRc+xxU0G9%0_Ohh5;g!P040&@bJu2K2sVI3J7&LA|#z^3Jv2*KVq!nB9d+VT~A67s5l4T)~9jFk{Y) zX`+OPY9M2HIUz(%6hlE0o{J@+Wi^@AxYiNM5ro8%PhL#xY@mm>^M1_YXLw`=N;rh| zlgb<>^4REtM~X{QbS;q#5xXK88ffrJT3|Au%8W)_e0n)vA&=Dofgs5vLX!eRBY3U> zfdK&k*mroCMbrWEVPm(SEu@6-HCG(sf2UV#Bv#Aw70FvI5V#nH|EdU{kkVv6^ERi?hOqa4h@&y!dh zbIp70a($m)wqIks$3K=6BJag~WTiiHf1W<*=eqvjI+^j`7bk9g-qhtdsH3-Q4R<&( z6+;A$t3pz>#XwxQT>*tayc5qLdHx$JRenG1zfkLo)@cLjhb5hWcWB~ts7VCGSRSS^ z`GxIv{WTLCNLdKFe<>?@tT%<(hF;}E9ub-wAJJovso9_zk!FEC#I?|va8;m_Og6-) z5KCv%z_fF)N*pJHA;lTK)XZ4}>Qg1{xj#{0dsrGffd4Z3sILWK3H1aDlA3xYqTyA5 za)oqvQzAprxmQJhqX+Mj2Dv`x@|rt;hl0&<`6{4FiTuaq_vF#hE+~QKHJ`0)`ixO< z^WC;IK%*TX8iGi*5tu+AL4zI+HYn6+LnuPRptb~A1rWx5p~tDD%3}zI%HtlQ)2X8Y zqLpZ*LriNl$u;PdT;YBrw3TPxuGR!Ksis)LRfcN6>P5^L{0AeBhBrZx}J5J$tH9&#DBI+~- zfyhnR!s=LzgK~yKFaPFZad9se0Rn<|3`t2SOaZ4^sLCvXFaiohfnc2}iN-f=WuUDq zfw*@B2N0sOtG&K2TZ51WwiPe-n9aRLOBK@kkZ-ST5326$ixm+3!!Kf)|309*uW z$`Gi8x(@+<{1z|s=&4xk^U>oV4TvEv9jwdG=qH*v~BLLDdFXG9>@{mbMMi9#Wjbe#@ zW1)%Dw#?L#Q@`FnHp}eUSIP$QREk5u526bqvLYLX`j8S9L9+D_o^sg*YBfqrnBt2c z(~x`?mS=onqgauFo{0~l6M(pq3LXmAECGT<69Uo!=Fns)={8QQ3F&{I!u-NPPu?M&~s8z4};dSYgAdx0P^b*v*@8jh~J1P=;9e zPYR`+Jn1b&O)-mqn$~rkkA9qH;(A>+MOK?>6E3S0bjAM-8u(ocWeXjS2g?--~ zKgZjIf!6W?mk$%Y=^obEz5r|C#Y~x^P5~%_-NDFpi-AA{IX((^w-`GQt)B4zT80#NR#ka~b9|$|D zOd}_b^8;e?hZfstsi9BZYF&UrmLPD3rH8`6!l$7}7KlPuFc}J0DnE6EVV-WJ==#Ds zh!P^Y91IY8YbYqdhV*421rab@++fw}w2_xBO~uT>u?t}x`f%^e+Z|`EqB>B@JBZ+Y zQSmcL>xczT@f?8cq8r)e+olsn{wWIO9k2NadMYpyJ{o)>*^<%z$K{2DQK)%_TrOZ~ z85bDIQ%thcX$4 z1a~Pm5smBbK|KA zQ4$a$9--|L0|ewy!R3@V83@o)L>Q*WY&fB?*o%r9AOb)&U;r3NBLp2jQ0X}L_%_ua zz6V2cBv=Uu1cC%0h?P`}@qLdXSbhM~{GrM=E*NYWp#lsTbvlj?F+&R!Vd6QLo&7O&Oj_C>)PAaP+eVlnqmAJj zoC6qloy_N!E94(#B?(AG&;Wg_r}=4#B_fE5R+vc1B8m8n1WcinG(K;dj6(H2*KB@i z5#_oLoCsr3KuBcK_kaLURzKei6yF#u&4d8? zB506^p(&E7nt<7eA1oob;!J_8kjN-#B6uXuq!ynv?oS*?kE~o^t^pl&4i!YIcUqR5 zX}H1?9}ADoti_J9LrguJ!{_*QPobGXLEQ!se}^*evVt=ld6yv~2FvXJ$JJVT`9P&& zEB_TxRm0;_Fe`Zd@W~~d_SJi#1=sij2aqJWPUtMrg{g@+q3!vK)qf*cs0K<M?(z-ms`prkCY zCWk_HrBb1}5+R^s6%GgxJw%DRJ4pa|aNZBo4PrMFRytP(x6)s%O!|i*$?faO zyNTP_`^=t`D^WcmBP1k?2oXq4VBq8vGzm&X;06Xd%aXQg=*Z}n@fkkTeQabgnh+|A2~@RGl76Tq>y$6#Ub8B{%%g5k-5sVD-90*kk8 zzTdl^yYA8+%Qg5c-f{^uT?lz3y&U8^o_YWmaKLa(B=OZSr#L6IHL&sF9zB$uSSaqI z;h9k}982n=&nRRpu=jg0slcERe}c8 zFhW;gIkr|{{qB3tc`nDoX~^PnWj}5TK@5WQ@C~(o(<$mbkF&FPSJD#Ub%w&^fD$08 zszceBZcOv88Rx?-M6h8!Y?6~x8Nibv28k&hoiR>{e#sa&>?GOKq$Xq8 zlMxII!$OR;@!WO0sKE?K0SGOHA9|5bSVcWAp1EJ9Q4Z(_I1i$myx)(Es9mWy8App~ zH>eK~0Pcu^dlzB&DlZ%{{f;KP>6f6*MLNX)4&QDtaRMX)uWe!(``88~ zj}}7-qn+znBcPnv8)O|RqBgOuvIV>m#Yu@4hNwuYiWG!kLWH0#;N%4+xYibxB?1T} zqNoZ`i2{Q&GYmr~B*+&43}rKRBylD~5*FtKH#kH|O&Sg6kVjL+N@}8DU%?Jj5NkK1 zD!%M(8nn3;Q4U5(5{)^DO$HLi7AR4fh!n*!6--oEW@VX+7G^j(21L0=U`}OXSTwe~#WO%? zs(7>f*zzO1^A33LDo#)935CzYkhM_eg24qC6>BI^3`h)0O5jWG-) zTv$3y=T%8lGS{&(N@jG0XmD{5kr1JhBYklg%p8a#JYLlG0%cytC^XidC%yX~jj;Ge z^Q?u@uGuge$2o#Y6ef_*F%hFQO&W8CaiVYmT0n;&Eu0yeLmkGt4k>~}goMU`okV(K z=>~gn_E3Z8i9*G;+HJeT(@R4}FjR0E%Zwp)V=87y#LW&cW31%2Vze-({!|2acMpD2vw!J~1SX++=J}z~H*gFseprlr};QQkrC2 zMAv6(R9#^+s#ucZn4nUcDu)b)-rS8OHcWGlsg4s5USYvZ24lQJj@i{~L((+S#~SK_ z$Y|&_fw+76^c$Rc%!bG!DwD>hs4-yo6J%h}#56U6>4LX9V$Et(Q-O|A<~F$8#May% z**%gbjvqC}7&dXT0BDIuj3)pT2_a}G!w}GUHCk*gcprO$eIbvQE{W(P$inD)e66iq z83_rfhS5_D(t4_76GuY>Ffk0e8I_noO=Yp5MIxQ@8Ll>#p0ZFLSe0ioX(eP3P;3Yt z8LTngvSXYzsxuj2O2(v75w0FRCU00+O|deyV=hxd)Ell{29ydIl`{;K#!#7rb`0`l z4GnPa(1@A4Dy%HEvRt$&0@;%)R>W2VNx0WU^%F%v(biL1!%*~xS31$9p~Bn`Dne|y zvOwc7=ZzYoyXR2Q@sUKuU3G(D(($Q;T4XuOURz{YlxjR`Xsw$J-$MZIk<@j}UC%Rt zj6#TR<|!m9C1Tq}2byZP2DkJB!wdt81Pt1%1&nQjk1f_J>~30TR{C*i$mfGzI2Y!O z;Gy^CG*VYfZvxQ3m_yNbYn|5Fu&bD$X#_XKLd3xlp#X71OKdn~?SkKnhZ$@ivh?ZA z)UYS&k@bc?O!`Z}@_tR?gF|VGPu5r`Eh}tqhZ{`BW0n}g(h7`&$6Xkk9So$SWMq-X z#uetjK-H;@q~Js-fu-6AtgP{T^Yhupx5tIGPOdH>nzEjgHLF*?5%IwfiWs^z81Qky z8s?uX(WKih^@|X36J>odN03SloininM{T`v93%jojReA8kOiPO$HyP2Ch*W83B+@hV)Xj zn;`Ve!zA?c)yM=k!Fa$BEX8 zN<&p5Kqw*@VX+V(M$*(v9E(6HVnN&$tVr!lC4aQ)hwVqW_>V6D^LSxZI&5%PQg|B(pji6NS zsRm#kN0kzp>B8^(qc|TAUWmDBg5xQ%BaWLfa@~Mx_!CJ-1(DI^kD>664sS!J#t;bU zy*@5Yq1d#5fql+WDxoES( zOyh95mvlVPr4cDM%8FmONZqzEl{QAL*~aOyX=zT10!MX}FUI^cz`?P!dwO`}`ACkc%z*JVivNB3oIR~TUGg>qstgK*$(9nq}7)tOU; z5;TzrQpYoaNC(nAEtOs^u1M?l(7_Cp2AMW%E{NOd`s~6 z@Bz?D5eif<1E`>Q5Lj8fGF%o@A+bXgf|Q9dz+J*+m^jcx?j1mF1c5dNpra5CPM9y& z(ovP822#l)0yIye)m~VeBs!gDYBeShb0V1lZcP$o0U(glzna-=BPa+Vr6`^;DG|aB zCvuwzU0Ue|;;?}tA*#WeVT^1vj0i>%F$AzkWrZ8o38DKNek*pQ%SW1=#b4o zLD}H3p#+9df?#o&hJykLAqB9lYeu59Mx7c$2xy^#N~0C97jmY^0t9p^BZd-aol~qV zOvf0^wJC(6n(W4c;Sgp(3ZjyPf=9%m2@C*EU;*`O8VRVXW6ow0Q#4e`6i_uXL1 z0sC;CtB(RZp+nq8OWnLpM%A@sq^=N}`=@g;F9xviluiISaA@R-)rBsNbOe3hF#S>W zkhm|(K`=f)Noy4&=VDXw(`Z_yOZx3{tqYp0V1#NNtR4>bj*d$*5nebiKPpkLzxU3; zsUcfL8a=85^~f&)$wY)e#8X9dKTiS&f*zE4>+JaMFx8&(SfRf+N@$1CJH^E?KE`n> zR|q)YG5~}aH^6BhKNSTqCFS@izj%KpaWfZud7vPj)Tk%N*BIawVznt5U6bOOr>98yFt zw!q%SBMZ=K38J9&FraJH&&fWfJoDOgTnE($wCjFGb2vLg{N(Hq=dQBvj_5ncvI5#NM9g;7W4=nfV>|UyZG!-dQM+W@i$Rz$wa!lhWiXN zS&ET39vj0{lxG$)Bfv#84|pnZ9;g%C5P_qZ6N{H=k2w-O%_Nu8*Uv^YcKogWY`L?c zDBf#S-chY>*_i>aNGBMb;VCjDC`1BK6AKbFq7x#43;-Piga?pe1lT6XhwAui?l=xk zNx(S+t{o3VfM28!ucx!}CsltfBvipgEhy`aLNSq3%iJ63^Xv+gMCyp!^Or*7v)9!c z4_WdZzfIzC6YOz4l1Y)40!+y+AT#-uJD?JZi{i|Gdjk}Ke%K>|C|)ny^8P-bcbfTM z)_DR}+s+EVCVKsbXB{hzSKstx@l1r2N9l149zlkn`o@N!{jSP`SydxeUOdJdL?R+L z4qIef;a!%@E`KPvHO#n_5^_nwVDAt<0|4wgi7L41nXRfOhx9?vJp<*0LGAYX-ZL&Q zPj{O7jYgIeu3BCNLRBHLl@n5jq&qi~OiEPK(hqqO-_eu$9Lue+S=3s&zbd|T6I*kt2J#+Z1LLKA@(P?PqCkrh5QLKifk??07={eEL5zv0 z)E{I!kfoudLW)(OPd4*GY31**hkAX`4$T$#lf)-^C}=bG2E))fdx#h&2`H5V{PLoF zI`#ULJ;VCG_16*-SfRJSj5}Y+L^jD3d^pHHBmkfaJkoB~1(ZQB#)+F4BSC|UiDD#X zWM*NIIUr=T;c87n6dW5IDcwyr^-St#a_&vb%oxdNFm=7?$xLHum=u&#keEuuG~__3 ztQ5&L0QERMn0EIwW_+B1(TO_Q7~o-K1`MSFU;=gz+}ncgMd<(<(HH2*ks?!GA^Gm2 zIyvDaHUjB3R6zh(6bLl&3R_IO`nO&r2*iX?NswTP2v8xSk^zNY=o(RyK?R|~%t5J# zsieS>toVaZ$&s;@3$pIT$~kYa<6z2)QkJ6*6%xuJMrI_4C;=sR7+aE)L}`M`%!y>0 zpomHkor)k}EtvrY69N$kM1@H$0I)%;C<;PFjkqQe422-XEJ)f6LCmp@PO8+9K|nwd zLKLJx(F_<2K*YhOf=Hc#LWr`ktp*VQU_~@S!4<4iBsGpn6ATg*nE>Q6L|FrsqcW;g zJ}f;}_5c`@KvGl>A}2Uv$N^f8Fd)IT9B3Xl5|G_m-QJDzun?m!D59PGY%^noAs_@n ztPO(bnLvaLY2XO}-2Q|hWoC?o2L|8<(A|jIZF9WD5(*f{6o}x0mVj$P84f|ftO5qX zIU<0HDA=y4HMBq?4GdI@hcoP)Wb43gd%~)EHc>wi=ebVdIlwp*zr!*Jl7nQ@P!Ul~ zNMTlBnGgiRSuP=&g^P9V0Sf{gW&r@ToNZr%QxzEap-QtF01r5pJyd(5mhcm*cs$oP zDYAl#6R?-yb@)nK{crrSZF~+sGFEe#{mmOq31PQP8#I3Fr__?}cjuxFFaeErovJ5N zFFOO0GkJxhSre-)S}KdfGJ-3P415l8;|#FMT8Ro+i}iT=I56>idUPuF%jCjPudWBI zA8@gPuo&z4v!S>>}NV){Z80#Bt*1d=9#3{fc*(&Bui zWWK16c=Ue%!vkF93P7!Hu>kWxLnbJmPop<4NjMJv{OBifGID(pp!UveZgwRX4w(olal7m}}bVx-Xp_0N0y5k?~e1`ULX19YCTsdH( zd{VBG7z_y#BVgFtlbWI(P0Q8X+yw?5ry#a!-#icThf!g&p8h|MbnhnK1l%rSqt^w} z0wU>(H^SwxQ;-g@N0nt7lkrwM)>KMl5JeOc36$YthX|N~Hs8M^PT>tf+|mxa+TLR& z;~3lFp{@-mQQoiB*kR?sH%Y1-FuK$feH`Y$Z!v&~nW8g0GHVnz6I9|F$L{1d2lBG0%D1*n4>D z^us4SBW*L0I7K=Dh>l{CUX(4+HDpf+X^~3_uelLO3fnskS#t;kFGSoR%cl;U;K)o6 z9c#pLW4IwZ=W)k*iPgCu2(cEKA)S|Yh2MvIC} z!<=Y|VV=+g1DUKQyX>GtTAo<8B8A9yLO==>rc*@cXNMqK1864gP^2}HF;2D)IG=t#wia=w5NUVQ{Jek`p|Qi4KJf%$PXL!7Z2#G;OH86O(k9 zgRD&g4-;pWDwUBMI0zw5AvAQm5s((2Zkfnn@&>a~7bZ$bDL{3PHA-f%!G@%d@8nI6 za<^-y>Bu9vi_T+Vt@x&+aO!|N+ZQcpVs6`jI>^7i8*(-1a+ne-NDOdYvkuA>0)`R8 zj?JJu9#_kvc=pgsXN}E2>NbC9&~=UNzvqZIu*0J)*kwm%+ji^f=Q_u3WD`&qf!Lc< z`ha#bhzBP|cH!S0F%9x>Futp|m_3cN{%& zF_kDiWP!#fe)Pb)Rz_KI9!wJ`Bk<&|itl2SXhCC`5lu~UOKKiEh(UEL*k*z=6d;hN z60S0a2%}8W8IXWj`KEeLec!;Vs&-izC25D^LMIUd2?kGE^yhgY2_(hE35{jfXHqwc zhI=%6C-s;q`1NppTG0#vX+;fiBm`L*2a5CE%xTnk?C4KIc4Fe+>NmT9#|6dWNvk$A zYPO;h7M04MdPFdKd91HKZdQKt{j1-?{hxywSV;X4$5hM{(F(6HAuD8ataDOwdM@ejhBm?b{4A21v z7zQjkiy*^-V8kI0x8&y8v4AhQz%f|{k+B@1F&}0RtEzgu4K@|I#Ze-bSuKhpOv^{?xntIy@I*0HGZfH>&@1%dhRGkjwNO9W6cPhS0s2Bp zXo3LfoB_%S$h%XRKy~$?X8<3fDL&`%1W+H3(Sg%x^vB9ng%C1Qk`+gkSy*6@luAr7 zg%J~#8JU3Dh6PKQWFMS0i4`TR2||SkV*()xLkep%Ga$)}6D7qY1)>atGcd~~$fFVi zAeg3P#0-T3L`)=>1Q3A|5Sa`Kl!Fif{n|?$gd8Jdkcbfj@&Qr~+fK^)kij}aG?Ga9 z)t%RQ(gKcGhsF8e2g)qYB~D%mJu0Wq0JI_e@(J}ogQ*cU3NAuWf%3wOkS4(cs1%jc z5r_gvR)?#|9h|6fdJgSfu?!2Bp|QbldsP+OT9#K8g%IQsK=vCFZaRJz-(%)H{{cIl z!OQJif-y+5L?P_@1L*Hn#Db56mI)fOO1jI?q~M7~$Ohm_phO`Pzq0{4k05{t`g1g1 zh(|M!J^@c`2>~(CQ*UwZ=~6}esUH~zdTY%j zLBhp~?eD5zyY%5!tfL38{!spTygui%pw7{Ds$13SOj>D!X}G$J$>5~oQ98iI4bYjH z(gXaBW|$jx^niJy^oFE8e<=VTe*_fqDcm0UxgBIfRG^e7K=DEQHk_A98?G2IzriC& zE(9?tQEo<`OrxqBjGVwM#{&!)T6N%(^NSJY>O5+yp!bEFhWSl&@QuY+`c|q$ofz zl}!9ulR%UXi!33=C({N*cwtM#2Lzgw^GR_}*hJ8Q6uO*JHeDZfsa)_BK{Fv3-UMJa z1BoI#KsgLw)ePaXd$P9mRX!P@8c|PLz&#K>o!LMio>9OgPN;bCvzWgxf_wcq4oW|c zP^Tg3A(uoCcXPxc+^7%1AT25sigIjZK+bPq3OKT$&^1E%MMXMSVh z+bZKWgUli42%!jp6d8X!#J<4>kz!k#duGLi%uw+D$kdN^lr<^%~3wsJ2iFqoq5%u}C-$G^LdeA$p~ zv%bIz3Suau%eDcm!O7!T=!V`o3{SCYH@Cwtz-%9ob0;IM*T{0KnOaRwPpsY^0M!T9-rcXs6%WIji#kf{ARTFh`tA_~hs z>|8$qndlJuQWxj(G$Zs3TN`6-i}w5-;YK^{8g@4D$$vg)7zJ^zG_DkH6v#6S3RX?d zk~X_1HK=RIV}pr8xQR!jXQdXdU(Wz{w{AY<-EQbZh-8R2Ev$0W{v8xQL>$~5JwMNT z0m_j>)O^yfftY}Kf&H?mz|<598#@yz8f|SNuBcdSC?PiKyiXj-n1tIr+U79(G1f?hqOWg{20#&6>PJT{J zst!i@DxXY{5#JF4a!E>m3=0E}&Sj-Jpo(n2DY^JJ=N}2xq;^5^w*<*}yj%#tm`Jw% zuflSIGRN2I>}ca5AXEEy>`eg&Tm%DtKOp%z-Up8ig)<;HcIF6rLPtY1Vl3ehKs_rk zn?_@z%55Yr<;F)P10bME2mpmK2mr-MQV_vr1&TEMM+um+=m`P|6$2~UZFLXw`M8Q7 zW%ZQ%vDi*0;lQAwC=oc3aubOFpbtzt$gy3t!Wkm)LZCBW*K4K6|kl`tf zO9mzc8c-nWDEmoH0WSqGJ${dXnf%ra6cR>vboPKBw~rJ>gpfZRs;=-}E0zT>S8E_qaV z)ptXG`v@2(ZRno57DMQ<-DIIi5g`zViXbLW&1nl-{U4uM!Hh>+kko%HC83}|&BC)7 z0P_p?fM7;?|2TdS`rmLtOwdHal?+m$qkuk`d!f$=MiA(Wy2TuTxw?*U5P_?%-%ajX zu-;VcgV9y7k*H`PDHz5@2sYdqn6o5|o<4j_8!;dVqii4NpimEccqIayB9#z5pA5CC zHds`O4Ax~CrqbY^7zMo=7+C-?;X@!pDngcu<*fD5k3%K ziHYs85U@G?D{kY7>#ph9fDAoZ!KiE+;(Vds*QPz2S!imR{Hd~0X=!RQ1Sd*#2D0DT zl`D5rb`w)^&qHG{zDx!}8yR5@+Zy_I13N14GfKEQB?319pjISTy&iD@;FRTXI5h9K zn|>t${DqMsTK=@)>)9IXc!#(AuOeWRb%9kdR zL#oS35}T>~dD}toPYuZ&>_C*FzKkT@RmF;;ov{e0-|o=7Gp8|(-|^LP=5u$D{qW-) zbXsk~RTf%wK;Ur`3{Ua4Xa{c!#%7fKX2&Qfo6DXC5n{*E2fSUTO>98^;j5L za-AHl2;+_pkRl+cShHNGEr#{thNN3#i5iNm8VDf)*m`o#KD^F*kZb%#Agv!jA-fwr z1w}ABhx^5}%^FqjzWu0Z>d=TL1%VQm$7;o%eoU`>wsWw^HgK;gLq#!El}i-3LL(K? zY`quC#4ZdX9mr{E{Rs~4f!i2il1V1koJ@owf%Fgum7UDN(OCk+R2usM%_*h4!WP^n zO+$t72P~C>f^e|X#DkHSMliiZBA6T7A%{XO*WfWvgl%Kk_|r$GcR^#PKRq;oB^ZKj z3*kdNyyGp9d9dSya8USAm~Z6}f2NflzCp)e73%}TYX-xnpE)khaK(Cacl$# zi9(@3&@ejJlYqAi1*8gELJ8RdeN=cYM4eF10_Nl~iIyeQY```R4jeI5O@r6~3B(e7 zQ$p!9$Wg`|XIT#fFRpZ&-I`PON4=8PC7Yku}qk2lLb%W?7Z<mY)q>3m(sevObr zRFiTCLL4qaLJVpZX(lne85r0}CR!(lMpdE6v=mWkA|x4NC^rWziqU_F%@X&`49!s# z#W4&^(4=CGA_D;fb8TP?pcSUhw;Ony(IK~^d|WZ5IV_Z69&?kQY9{<0o6-65eHO1j z>&I^|hZ>VS9-#~xlOUvIj!9oN-@YoQDoo#nZ2yaor9Z`6bwGUZNf+J(KR^5dO2kA# z>p&d?;vOM01RoG)5?~)Fehg1~BKtDqlc1>rLZq*#-4sYgIN%GYILw-1Kzt=0o5GGH zaug4E2c!=mQ{q4q^1=)7)IdaCX_81vZ!<~& zsAM2%?YsyEU}G5>6nCKVcudwltD=F-!8`m9!ML|LopA4>h2ZNh7v8{d#Cd3lMhCR$ zDLsTl#LQJyQcVzM^f$NLr&`sOQM6qC!s!0X!cn|7-msHUVZGhw8eze2=Wk) zN;-pT5(Rb;FqMe}B1J&FBZyqIk@7Jls#0aGj>x?6(mTHO$TQ_Km_=u&rnp+Gs*OpJ z;k9B%8P98j2~kh-s~Si179X5ojv)>i*XS)++ziZRBEgz0Acq&Id<*aryH2cpG&MR8 z<^h5b2F@Ltj>JR9vk#q>Dl$|@!a+5X^iH5YZo`6gso4ULi^2kG3!w2GnIjk$B_s

@>Y zUq(Yz(`L5BkZ+6hT>)lI4TCk84IyrW+tL_6yIAakY=j&nV;UMhj)>=`)-}^%4jR{N zD>{sWd=Y4bQ2I&BLeR!AIZPvrjB7)w66@=U_U+rgm)^FZ*mAW8#8XWTtWhJPx`C#S z0rPbQ2YAC=*42a#Ct9(DgFybPi3kD$E)D|LaUqs46dA0?BU((1F{rUKAHNT^2Z4( zn2xc88~t8*{8awGz4WRF9vx~f>@J!#eL#K(?aWM+fQ%EdOd<9%>d6VHN}3iE0>UU_ zcM4i?T|jQYRNVxpcXw}=E~Tw&po(>np^7A^iWrdUxDVEOpP^|pI|HIPgq`HT?9X>YGH|kV>of2@Wmf=ND%{9PCM(~A2bhfQc|ro z84|~=2`xu*r&R`o49!bdI3jtl+k(8X*~3usWE=k6htj7?Ab5bYtA%A+ks(u*tzG!0 zz#{Js5681?-iX^_2A8<&lEB5U&84tuZ(BCQn`i`OCrb~YR{lTLJ!izdr557iOw4FM z$<}20zb2zeQA_?lYzv8|5H*qBRw>-!+0)^$-kc)9c(n-=I zh~b|BArYIOlpb3f}>^7ufgr%t=m9t3lD6%pT-K#9|W>IkKAYx%dk{} z#vIoiMX-Db9Y{Oj_d?O8l?o|Fkd%jq_f^BKJYi)HWcCysQ0gO$4XGT+yl}bmP;9gc zaRCBvdXH<{(tvwmMXX`u*c4L8DPN$vjDh?a3=x6l2U&57bX&fg3?T?}3kL3cZC)Gq z?&xXBrL8I)bl5iq+|_|W%oMuIw2Q4=T>$1cKAiaT9wZ*@>jjsFVXUl!8eC+;Di0i^ zG$D$|NL@&HxPqPubF=qInKC*?Sv7Ao%c*j7u|t`Lrjg&H1_uz3a^Boi_7;xf-kzlt zghB-6*GF_jnrh9Ab(t}5L~;{Nu}h51mIka^NCuHAI>dBWY>$p3$5_pIcHkQiBE?UF zB=66fl1xBTY6p4&A_fX+Mum&{;pLs%sO^S3)ArSf`irAcXOZ~^Bq1tLzzU))fXu)$ z8K{bgge7AO8A?!u8knM@sA5t{M14EKXi>WP;~`A(*GC&)3CPAW5gU)(C(PU21Daw)Cn*z`A%l)T;%KWLym~1s?eoU z$p0>o2h*y;gF{nJx_^=Nh-EscB~1#zW~@=4<7YU>`?Ld37jlYcU2R!&+_@NCJvCjM zPOmzR2AR;C(2)qiBA|G?_#MG@r*LCrM$ul-yI}p`mZFr|LQo$^x$&N(ZirqeqI&MG zMmLNcD{i(x1siZ|3zsaJSr{}wz~Ne%BUQm!0kab-tP@1~pY-!6OyNRdSrF40h-Q1i z`8rY@8e{&R){HVJh~yy|>9oKg)aooCi3H>^HjGtQ21?ull~TZLyp{rB+QHWw)1yr+ z6#)PNGBF_>g4{8&ojBvZFxrVQr2rOgI^8B}F+BNbgokGPEbfZE3~zBxNMOBiVm}6- zS)ez_&=yf%9XuWZEbe$Y^Uh2aH)IYpQ*oUquIGRafP%pT2oN(e1Ox`2=J9n-VxoM_JXNqTpoy6l*aKBO`DcwA%!b9Az&2$F2@M5*dL8KyeukrE!R>n_@$tnm~kTnT(7B zaG4Rg-i!#dGD(7<2&k;vkrs(4$x}_E4cWZjX*D@ZGZCyZYM0r8ttLQJ6cG_E2vbba z43dpdMAa125DDy)iPaEN6tp!7%z))e)h?uMgG^;?PCSZ85`+;9n97Eud6Z2ogi*H5 z<^fjYQK_mX8r~QivVn$1%*ZD*DhOnh-G;LWLN!x{lLsj%geYo>rh+O>VUbKx5JeRd zOhse{L`e*pCJ{uko6<#5B#a|PYBHhputjZv;Tr}|t1vE0AgQL9HyASwF~%Xu4yq~$ zi7ANVGF}YMGaqN|>+8(wheMgMX&MTekf1UeOo|r>4}`SJX^pT0feo6SBtbb*IILYf zL?5Ovn3$0-x|!zB3+QM;Ee7;qxQo@9MG!-xKfgjI3olb0gh?P8r=WciqePh>(t2dg zo8CBcm4o2~u$$t$8Wv)e!y$5cxLKa#IWQZbH`L`@6Od^Ls3>aZ$UzxjGNg^MAnD}! z4rDI@P>1HdcG*w@XM_yjmX(G?V+_Elq8K&@{Rlo@6h2#Qdk5u}6NOPGgWbu%>q)}f zg7T_uWd#tTFdx7RCy2Tl(Gt8lyF%>CHc*o812>XxV+AwIczm~xf777{x>P+RzM1zy z)dFX+dY*nl*ErF>GL8x3}sWfI%Qe~Aiu*BpLG~Sb1ZPq;&`rh&_Frhj!HbJ1-#sgs3eGJVDG~n&Qvsl`)Qo?ei3IiZ57y+e7 zh+zw2tzk%p(^(=+pvKq?iGoTI)TX7(3`uAV%v{6lQRt+oN@9lqLBK$eK!F6j2HY@o zlfK~N)>~>+b{wP-!((7N`YDAv3h1ag1)(HiiIifJ3=G62+9QA`o(=`%F?*8%)MlX< z3#j2B6@mmPK-X1M3t??IMGReov1Bw9FpkYQspe(>Ju}2C+)9FhN`Ck$Kmmmme5h&~ zj(KqRus?RStiMAtL|r0W5t>iA)<6*1Akseo;wcD!P?|KOQWV5gkqD3gO#hojbMqgA ztB>i4J{tL!KD*MB<^wZQ5s_$2W(dE}=!Q2NoHz84ge;G;4&j=(kOA*RffQGdkFZ}2 z#rh6&2b5%g-w8ma4`+9@K{~>W$pjG~bi)Q@Ow1DtGZn%CNhMd|`UBy-PN5MIOE3iu zAwl0Mgmw}E=9^Xwq)f3bF(gtYW?-GIGG&59gpe?_0g;Ex6iZzje3L$lN2?Sv@VswBIJdV<-R1+aUr6AC=MCdFa(hmY4eu)$h zD0V}J!?^%)G^Gp36b#ES5(@;@J*Y)Ci4-g@`i2#I51uPb6ex z$hW3uYe^2F#5Y_<1g^B~%7r8`gKkpCT%-wWt;nlzk8LP6)|y(=z>TnNHajDR`e>TS z6G)|@CbiKWThwC^c*&}2O>d3pH8rqb2zZA_Y7Dn+;|?PZuQGyu8j&4JA-Dj^RUJro z5TmW=i7S^fjg|)MG{~}{N{+XR!KJ#_Uaj4R(CHxtf|+P}5K|B;+K8|PQV2vWs&`_k zq?8A#0)vA9A;~G^^WR~ap%COHdm$iTN(lFoCeyYEiP~%5*Fo|8^p<(}wBGNGu72qGw{am)-LGwzH)w0x!@c5<46%0MEY5fS%9kT~Gh zR43(6z8_Q+B(VxifW%V~F(imOHi1eJ6fAu@yW`QAW|Es}4Ybfbl=~&7q!Mfsax$xt z(y0bwqRMV9+qGF3c>c!!oO%@)!=F+@53Oi25MZ1k_$M6`KNWjkHrtX4qy# zqYdh`V6VC#8k2>FNQsq%PH?kBCVst2lLHUT>nNxA=ypsSX)yDEPwU2-f;4d_56Mpj z-mgX)*P7&)`U5=LA}EpqA_)Vk1<6%j9+M4BY;beVc*J^O+y=??@EVR*!8_$lfFYA) zoY0vl4p3d7Z1npsjpwGyzQ$-xT2k#asvr#LBwG4L+>QC$e8{dE zT5WUnj0!5t(O6onCBU0t9=|LJ6NQ7r@KBqgXpWHAt;YC#URTXV>#c=-um-&k$$X$p zDOf;}OtFxtA*7iEn7~ZIB3f0ON8(WHhg?HR4>U8{iR~l=L6A~FR>R*dMud7FH=D*> z*&b-_2&YtaYY0*=n2LV*?CA<}fE$uz=L+{k11Yu$dOs?2@56sCeDhG$bN(w@wbA|y~%JcJ|e3ctfaMfNgK$+$2J2ealW zz^UgDK86hjdR5Tka|(nm@)RH7;(N)Z;7$P|sSgi5Ui zLqmU`{%!8z!6{QD;lm9QzYNl30jMgPSPh!Q%^}~IA@{p_%>f`NP3?rgU0G2ru%vGP3!EtQ2kMJA7Cbdif+rB7 zxIz818gch>=YoT0AsmU0G@&4Fw1qbTHo_m2fH5jSpbif|CNWG9oBmTk7@CNp>0we& zKT@gZ!bj}BZ-g*ond1fk&%aP2AQjnmd z^x_jqU z7W_mX;(JNxc5_+W4l$_%_M0bH(Li&*5IL#fU`iRiQA}V70OKLwF%5^jiK|s-q*%fE z5I&g*yk|k1t630q3__4V)~=pz_toQ)9uXneO{`QI29>rVS*zZRe|QxhysNFj9|b`qBx2@;Dw@KRm9eYLQ&mR5g|$eBnTS`4V>Y8sjPd*+pUU1&?N?k z3t$waO<0*qVTy{>xKU~~COVwdYKQ^0#xyb3h|?L6p;U+pOt}X@tz(l#B^Z$sWvDQi zsGw#FVk&^7R512?JF=wp^f@D^Lcp}Rxg(=YHlV-?6R`#vVhELlE)v3k7$V3>8ZaHB zi3kP(A@GC>VuXqPYl57-6w)|hh`YaYq-Z}C6DA=|nYWkmVXU^w|baayL z91h&Wz?-x|U)k3<(d6sP65bOA#p|XYF5ak&BbDVkGP`B=9J{x!v#Q6)k56obSFt!Y zn`kpR4NsZx@RNN$(Y3TUsXgv-Pv!?Zp{+A>YZHgbVob*U=!D6zt8N%x1d+qZ4*p?C z;Jfu6u3vS<507dm*O&3FYp9@y_n*jkFEfF%h6N&HhU>%0czr{xWaGbx8$Xk8?9XUYq)z7&IGqXFRi`XU?g(W50dq!c0GLH0IhQFE#c(DS6!4hbzcI!98JVoW zjtSQ>=-JL&;NV$A8X$zmb08aM(OrBvL%akTfS^{kq!Kg}!C8YiUz@eHe((A80kaF5 zl?9@gCekqj0gDEWp#>85PE$B$aVKHLmIXcyIybkzor8d2fdUF^v17w!rV~Q2N7siv zS%$m?qu$GC<M5{hBGewuh%RB#*_9+YO0j(?%P*#X8nFrp`%bDodPH%&K^Zh(m6; zS}~R>$6*~X_U)v`O;DJI3tDE8z=nL#`qpkjkz3|{xEu4VQqyW7xIvw6;qbW`q`eG= zN`VNiK-Q+1Bd8gt?Ptz>dYHGpptv)CK7F(z*gksZWumt;yC281=hg3rG-Dy|4kF`W z(*w7}9QN0~@N=z7c7kQ}CP-IWB9z&^20!=>Zi)ijBf654g3yXe+aK||D;FcdHE?gS zIAu*NHv)Ktd05?UYM4!HnSmOOHk(Z`>L#>Woj8X^TukU4sTLYx$1^#FNR`rN84yLz z-{pOhu$IWSG$E_3Mn2CZc-|4r?RzpO za6HR%9NlJH7@0*=h`*{9aZkj5&Gpe_h}>#Ea{0Hn@di8?>%_Y> zn2YnkR9R2v0r!{NOEyvHnX(t0OEXR#o8c~(C~PKXc1_>SbVlQTGjEZfP464aWuWIq zIz+G(f&9O>rE$eGaorC+FhR-7JSsXj9p;;d#-Ay-p0S!7QenaSIM2g`Al@?u(=ADF z1lx6{v3(Pa*GfjA(Hvru=Lr%El8NEQ9kFiW8yYJjP+=UBG(koVM)u+ut8O;Iggio} z=GP1?@vO>SvV^4}_XoeMl)gM`25Zv^{Fcs>lj*FJTS%1Nz9q!(Gb^n1@&g@M8mWXY1svUAfNQ9I$j z8jN8Oj5s_&B7AV)zIg`%y|aP)-mF31%O|Io!BQG%e{vk}>-F19R$rC2^>JNCu`f8k zT-4{70LnU}OC09L!UlxN8kaG=kiuA(J+Se&VJ~N=O108S31I3W)bH@?Ye2U+sZy}w zj+4K1+1t{)^3RDA<#V_1mu7_x**X`YYwd{Vu?>_m#-o}~PZ92#7g`zW_2yp)c9jx^ zT{Au&Eo?E9i!nSMI#QT5!%%9?8`n)*xnEPkgiR+Q9&n^xkeCq0od4+MAf<8}( zY!#!cV(pj1JJ*WA>p3Iia9#kWXXaS`R`THk@<+VpD6S>7UiRAK7WKD#SZo$A3=})A-wby)UF{nfN%Y;^r+|&(p zx2I@iBfa?PQNA=|Ier!~PIP)1g$1Q!&m_~!;*C}!NPHyG82LpqN|Sm%V)bUAu|;}v zPZZgFGK9+-^g-y(-jI{TdMRVCs$!P7rg*V-#ZqQE#ZCrXx87L&l0DDV5Hua+Vi++! zI2vr){mJw%*dPBppg(;bB?I|Wle=avn%9jnw z6h4^aUlj7KyEH3Ogs3JL3mQq&FojCE(y4^6mpxgQ?)?lXlYj7@Q^t zdmWB$wAJ1?b@8s(jeh)<>XV-12X1)mhpvcz(nV16R8MbjEZNI`k{(ZKaK|@!FAmb!9~bCmV56 zV1F8ZiDqMxC0vim65r>16cX8)f)x04%%Fmbs*y8})YPk)KV^`Qv*!Nyvv$1I1#yAl zJ*Xv0P!R}s%Euk+5svSPQ+|Mu8OcZ3n+LX?y7ct+>YA5=^^$GZYwo1eSa6P5*NCNw zd1?vRdG?={fx*)e+IGmp4$KK+R8vKDKPnr=Z8=j${(P;iu_z2FWGMO|OhE}d!}m?+ z6HyZ0)<&xR4+S=_dxhOzT+oCg1G@^KAt8FW_fQavq2^gFlqrR~AAtbk1j)Ey!0^iT zm@Na&lf~j8wYRQp!kh?ngd_+|RJfBdw8Hr~(64_vsGi?AZh3Q@IAv*k*0HPaP?(u> z%4bEacf>K(Iiy7bNK-5aiNLrdyF)g~B8D}yu`I~@XP=tW=0wfs6y!Zb_bkqud`4Rc z+9Ph`nK3An38@(mt|_8h7!dB}luw$ZQhzqwOVSL+SR~U+(C+0&-sj4_bCU*XMmXdp zLpnP={(}!1E_126B8K-P4KoxX^y90(G#IY%Xk&VNEbpM&NjI&QE^=3;Y6B%0AejN# z(ZZYW!ajKGIp#(*REO9p@77Qd-KEaf+61B3t_g+u=Y%Q+^pOrQRMRV z`V`GMHw#xp&w7gaOm|M`IN_LYiBL0O(1eYmTMU5!3=lyuK~NA(3@ikNG!VrUL_q)& zFc2gm1u-(R5>?lSznbWfosoCbrPD0uf}(U)6#{Kc?H|S-??)>ejo2RFl;&m08VU}W zoasZiYO0z`Johj!X%6WeiUY1X(&QhaLub@rFA^Pv4#;^@v=D@M7`2zIZWmCCIbt0q zQzS&qv@Bin{z!QF{olX=3-RD&kfQkywj9oHCt+SgeRtTpPUJRJI$v4wXy00@s*)yR zdZw3QT|m%o!=ca@F`;(e`BqUhr-D4 zjAdSVeR5{Ah&(l@TTNzj`&`wtTo_qeYGkr!s|wC0E;l{9)2B%hBnJ8!xLK(sqb`)x zc<^z@)X6@aeRGVyQHIn(!Y_3ENqCco)mm8_j@srzl)kvm4Q)XEBj9_2XLgu6O(eMD z5SmCmnVA+0qtuL$BzG`8;E@L+jW!1ZIu95I*d(;dd6f&OZxvS6=EHiC{tqeNw(Q-K zQsQ68wa|UeAWt8+#SF;V8*LI>6xBNU%bJ`-`priZG($J#bhw)zlh-bJpkWQ>`G9Y2 zC=rVw5)B0;4iG~Tj?@Z(Vc1Vuq%pRbaGz(!gF0B45QhBO(f}rM5|k0wfSbolik%1< z6hj6^NO`_r$L0wkaI?#;4&kn=Y*(0$qcWw53m5NtyYcU5k>4!(bdHm;UtZbka9$Dk0Cl?w_J)Ffa2_~g<{KA z?(Ay{mVFZ@+#%xVQK)N(w-p5Nzc!5&5{-@|Ailn+cgh=-&| zae65C?ouT6P-~n%t*G1^z7KKAg@}jW`D+_IGs&O^SA2r1MVASUQMIx8dAEhP!twcU z84p3RAFMx+H>2l(b&=xX{^_v$hJP3k@lbpnAs~>^ed`xJQ_ijc9k7QSkuH%V89L8W zmOa0(CECo0YSv{KTq37b4#)=_ts&vd)Si^I&hBBsPntm$&Ge2~Iks8NbhvH2T-_qJF+78L zw^NrD-6;)f@b57*Zmr8NJX~W-Y~K($ZI3ld#bjD&(+oK|A*U6IS2qPxMW!62_L?&g zH59>MnGa*(ywuJO(QA$&Q&EJGsb;efmZn#}o8VB`5)lkgheH9*aYGqrnNR3692!Fu zB?u9i=q?a@55FRM{=T<`zi-d40*C~lt?c*=4}67iudLf*qIsa49v|ar!8|Oh2Dma0 z^1u#(wIWf+G0F+E?!n+CLV%8tS*`CuCR=57STwkp5I{ixWwuR97ef&KNvNpYUKs4} z?sDlHNb?(T9u`>_!y?dpT2T~*fv2XCwi-xMMwPkVIU}icZq9}tr`0qAJa;`&H39F1 zpa(L=g1HD+UnCA-u-((gX$;?e@pK1$TpXORe%NCcQey9Ghm#Pl8nL@H2{l@v76tpPw3sVnIOHd-%P#iu7QFak4}+o1(qfs#@U zNJM8jOE_kdLupWit>9*X3>fsQKc{~*;YFTV$2%b&v~maS%tUrMK9bjd4RpOR-K`lh zsi^EAw&M^a8mB@KCM7m$$4t!GA7o=E%t{C?hEHP$hb%}V-Gk#L84f{52I_FdFc}F~ z<`Z5T5&Xw5tFXMZ&0c6SiF|EC?Iv%{+b-<l6NJ9D_Y7m5|fzpB@rVoYH zml{2B4o3;0RQWbPZx3AUPTfR@A>)Vnt^ho1LtPwS2TF3~=69{6YU07L|1dP$$I}#GK zW^O}P5ExmQ4Gt1y$XPKN5hju;4H6MnvNE$UCNj)}6o||)%!+|Tg*}Omr5u5~kVG&P z7ZnmA4J8Co0To0jP!iOG3Q{vHz_T8M2Vu|`w7ho23r!AAh$*M09{22f-{Hk2Mnfbj z!oI+)SVfjmsUne%GQu?7juDNI?qp34s*i$1HhXalDEM>oeH#r47r}SyAbZ3-h0QfZ z1q4*HG))}YElkTHQ&A8};q>Juh-0=UL)>SpSPii|A%ekb=hIc-hJp9AU`6~yf+mFi ztwmQBCK5TjmwC@{ixZ}S2S~^cesvx^x&%V!A>2{ACl)Y$gU*Rz>xb2izQY4e`H3|h zozfEynS_Pe++N!C2CDvH!koPF9T|{xpG_u8OQIqxRuWWMA&n(L?1DbnC!80x0=hk2 z?(NwrH%H$^g@qE5iL-ZhL5YN@=X&ym!wJ@}TDw!34ucRwD6jT>`&)ThJuzgSOZEYB zD0oJ}j6nXlh#c`v=Qo}4z@o3*zG9s$9Jyj`dmw461(FaZSSMo&tFlRk{c3|}LvccP zcW}Z=!PU|qAPp(})&Y+gITSolf%!dCNr;TW35;?*05mQk{~X1K)(?#31VY@LR2Y$L zMeVA5$q#I?9i8)eRx*#kkR($G6?zA=r1f`lU_lv6N&`q8kX~`sL*tSjh^mMVB&Eny z{uuK?znACfznc)pHd}HRF1w4Zi;gDydhRyky1Di8y4xt7p@$rfHAD0K-h>-)!)e|E z!2;K%b^s(uL_~;1h*k2yKcx?VWhgUYXUNX_D+xF7ZzG|zN1^C`PkZl+-brB@mL(`d z6v0dol0!pH0VNd#g$hUFu%v0`!W+@}s|^iAB?>A?lEBcX_7XUx)WnMa1d#xg3qVnX zt3nhgZw6JzjZ+~KW*IaP5(G^Y1Q@7k7RAiiv@*6hi6QqMSvJy#&f=~}mQ85Ck6I<8 zcQrRK(Q)!!8!)k-AA5;w`%1Q;c}j8Acq4hNL5zW*9nc!r>PX%uv+TG8`smLtoR@ zxzPb6P{V0AX}ucEHMGjjSwXbUqzXWgS2Wu|jDz;b`!%5f;dxyhfKZLG=sIeuI{;-Pp%9iUFwmi-3{?myGy`B^4hdo^76L~A zP|%7lKs6MA*iwP86sK!s0Jy{yu%{~WCn~ar)Zk%+I26I!aN-sO2qq8Z4hJu1#`=D~ zHei4rQTmJ7c7PWVZJ9p&*S1rP&vWMKrf zE`#qzE`w&hAyI|Mg9D$h_d0Uz_VRDp!7&j~#o+eiD1HExKx@DB86KP;ssm|P9AaNZ zpy3yk-G=ySY69L>(k;7)2dA}lbw7SZ9%ekxIH9bzzD6gAUfpoDrnr@H^TE9w#Y>n* zjv7O732T06+B7+diYO#9M6&1{1NaA^AVAC1Bzh#U#4lX$?>-A;?{#pVto#_hkWDT| zM6FOB+{KVRFdMWf5*vicu+h2;iAHL$qZ6=%bgwHb)*EgUUc{bwJY+<%H2_fD?$#G< zF3OP$q7-Wab)yV9*0oV`wMDt+#KK4=8ji#SZWk_t0K}RQkS)+XXs&kp$Q@uS;!?IO zFUCYW`WgjPVN!@vj1D+Cg_dE7fyU4;&rd`#qdED}3!ybcKTVirA83l`4^K;&urVRk zz)bQPHdN%rvv#WR!iEg6DI|9&Ua0wiMG_P!M;t#*dJlzQzAuZn0HEts6lYQ3y@34P2>F zhu@kO2!}fQQ!Hq)Bo7Bg>{kjg&n_}#6owP_9tIx8XM#_j`fk-PTPw!^&Tv?=$ap=y zOwb=p>+e88@WlpMfWcv4LrzJViV{(UQ;CdN;$$>Z13;2OB&Z&j1MjQA3x%2f{TIk~ z>okA_i46exk}u5rPB{v4NO5zW&P6my0iic*x+5giM9lm3`HD#-a32(Xf}&}awgO+JW8@F*onDx$(jW7{2hsu2YFRAKlCodvM)UYF~{E zQ0{;?Bv(lzA8**Phm2s{QW8QCm#GZ103!&Tq!~S& z^hSx9nQojsIDydwGZ^kCtxkzL!qFs-A((ltZSk%;MHf&<-zRCVh3Jwl=$MF-B5Np{ z8Yr^H$1<;zjMewN{|DpwPp&Y3#|uLPu;FvJ6vlHY+wyM+jmjN*1$$ewXJGPcid-GX zzul-5_kZy$r`&Dd!mS_b?{T}yy3HxaFvRhh=Brhb3Q@d<6T382k50-*e>$s1G1Lfg z#Q0+^q}*-GJN7t@aw0c}6B>)+S^G%rf;q=&HbKmBn#D%rSlmd_D=EtrAqfW)beG@W z_^sn8=Z;MrP|~s7J7zPs=cg#6VWzJ@akXHCk0nXv#`7C(x8y`lCT|LB4mj)_G)xpl z45UI8F7U6oCh4{W3g@mcaIFbwq1nEabo0`o!T=4#5Yq0|9E&=)-J#3~AyK!QiBal; zsanwVONc?Vqlp5;l-gQjEFx7V_EAHZ4Gwi;&1-t>{F>NeLY#4{SJK7_hOIH%EwI>h zn-Jqb(gcb!1C(7?SH{_-!<`$1*0@k4NE%{|v8YIt$r6;s48Suu)}RT~22(Ku3=*M) zP$mcr-;GNZT7{Rt z8|;Sg*jHGk%(34noedl3Ari)P=|IvMd2?p3mx#3_Qnrw{mc3iIG%f??piL_8jAE1w~=aD!tN===+jApyr*2+FGyS>P;O!|mOzfP+~F zb*a^2BHrVBSZwPn3HzsYn=xgJdrZU+34k||6TEYvz(sS3qDM6omXw8wY8h!1NZ^xj zV>NR@!vwLsiOXfc`rc8XP|h=mOkbA>WU!qL!?=XXozMtaAls%uJ!!zp zv}X5iQ)%8rKHYG`#-f}j4(=OG@WVc8PgV|j%4qWidRyM z;$MtGoZd3qG!9n~SfY5*y%tm5OmKnFlqR&;pB%WKh=AW9EGm977-nIfFb(VFWsFLm7O?gv`YwwjMB!x>SYB#7J_2M#ComrQwcX$rCG`0HZ#Wb zVi=b)1BS57?3*eBVroj9JH7*C>1CLp8eS0+LeV6lN?X+SJ6`15CL+^1)&gb{Ms;g~ z*sD!7xMwzTNtEl72#N0Xg9&tW{Obud$Am_8&oiEYLvzEN@0J0nXPHv)rQ031*RN5( zRMuR(vqL3O3xONT2#$KVWE)N(EVR46?f44EeK~x+rs^UmqB7mPv4(dXLmjB)hwTBg zjXxTG!ju%|Sw{2`MGnj`RLLKTwJDY|F@2p1yw^kdbogOeG;^l)MQLPw5 ztmh4@u5jSi>eRB0gHM@R##32$2pKmn^{Pb(kjueoz`>ZgFvw?7e0Iv%azh!nJMU8| z4TawN)uXLr66{vq<-kO-GJ;ZN@cN@6=FM@1N~2rO{d8$D2a3ZO}88o*&zY68xtXEF{JJd&vS$tnB$f~ zhZbO?GU^%U0l3IjRO60QQ)s6+8RxGoYFP@Z66-C>;ObhCahgj=h%-*~*2Y<>g^e;{ zvYmt|$g^JlJv14T@Nmx~hRH@WXE79Qs^KS-4i>eO6>e+J6CXGldds^rTLF|Y)cBBo z8=PY4O`JgIrse3ChTW(+r^p-_t2sB8xaErAxMdk6Of*Txx3Xg0rfvVLrUZ|IEso|L zjy5MFr)peA_>js9V8Ay7*8$pU+`+lv`(fd#%M3v>;yR9QPgn6rVMOX@95=@*eOh<{F8M5UjVx(b#m(S5Y zfwir4v4ed`7OX%v+EzlGalySUu6je43pB@!P>XuY*0%*q+HZM%PHbXz2MmakFKDRZ;GXP6zH^v6v)G>0!#yq(H0%rt@q2y@0k_h#e_7*a{h9y;Fe#Wzv2 zSG(DxP{!8aF%h@z*uE;WIHK#J8ai~j@Y+tL5#$Wop>|y`@V2-+ z1{4}dSkNv7LI~^r+rC%9SAHTNmyJ0PI6L)I)zzflVk%vh@Mja;bimhGbWC=eeLW(F zyHhFR2L!lLZ(6)e7^-F6XAWm1itZm4^*5-Rjn1!_wUAFPxQr)^wcSoE=5L6w#~Kb; ztQD79=MX8PVlrkHvW}Oe5yyqI)))p&=oq^-9Izd@mvk^e*=DNjSTuEwbhRKqcl2wg zs3~3}3@vPN=?jZ+&(3?W-H!oeaoSnlycd*$Bp#U@7k7q#kGJm5bTzvzjS%eJ*rD|7 z+R*M+VWmRK9U~2R`GKU*YWOgo2c(8;Od%6UGO{h@<>TLM`=@mEJQ#$sYoSSw8)>!< zkIXd8wt*IH3x=3DAOQFw&Q3FC-o5H@a2w9zfq=)kPC;osJuw2l1FYk%qJ@l&)v?zwQsA`b8iSrgjbh}z_J4fnwLbV z(1w{A5|)r9WJwtYl^`_$U_xXgf)FbJCd>d>2*g%~D5iL8tm8PP*h~aioGEsjy`>yU zji6GesM{bU3qpY+tP==L-C}9dloP)(`C)D#R167(38)>096$$vK?VzmYgQF>8 zgV52DgAN3^prN3Yf;{CD5knAA4nFhKiQ)v{93c>JB8wOuh;$*Y+ru+EDD6SQiHM|x z85GH(LDHOrHdlGv zZ6T0{%p8w$ng|#ID42>!l7#RPAmK!#V}<7P)@pUEM$89DcQQ#VoOVY+poR??cNc#W z(0bqu)==4ijRgRnck%<^aC`rA>!q!^U*t&c8|CEnOJbFgrjg5>r7H(-W~bJsX_^^1 za_PWzsBl32P)QjS0CDI3UPTK}8CjbOCx(g%7n&6l$t3qN)QnOe(<}53RNI_vG>{WR zHcPZL=6MQJgv`-1V_1#D<+IdP_Q>ofPb(Y$Gp zI<>|N)LyNhstX0`9tH;&hQNHn7GlLqG7fg|2+eS28z9K-A>*e{Q#F#bV*(n&>L{>s zS7{t=yJVGYNR&qIsJkd&A43(Rv^b(3mVzLqq?pOb41o{25XoPRvEWU_61`#QNP5jJ zlB{m-Sy3HTKnySu^uat)5IK@2#DT@HtH;nv;2OfPd;?m%DbE4GZ0up}t|j1L(F^Z0 z8XHH`&(IjXWFfy{ObiGvZ4Sxgm1 zIEvJXni#=2!N#DnCOd49VqncGp^XhJBzPtf#@RK+sAm#mBS9EY%LOGAJWGbNRHdwP zj3VbnpfL+L&W4CK5ysG@suClZ9RMbAXh;cGag5m()Nu|vA_{ZBM8gDY@H5f1?xkA> zh>vlXw%{8^sXJwp8N;wLO0@$TV^dd&voAxqoN{`kvEkM5>p2=)X=%Z{=}bon8g*6I zl*O#gv}&B*v>7%dF}qm`46Bo&1`u62X_@r%k>xjgy-v4+B4Qg$3vTX_&lhiYoMEO@ ztZ9b;(+W_a9}h$*;JTjD(7C50&j|y5R&T0{!ME;&VN6&CD3GB_X_Fzw5SCPiqazsx z1RY<{Hoj5G@E;aHpEanE(l82BTLZ2?`?+P@-0ud>qXI;U6pHVIl(i$L@<}!M439bk z>gB$c2v1qv>@*|3EKGCWrIXG0_8a;NfTa${hr|knE;*g|F<`Z$mr(ZdqjEZ!O zk9VS^q5zhNiV=8BAReqwXJ&!$8?yC?myB~E#wcRb4Kgs4c@AlGsjW&}@)co4AX0-y>jl-FSY>w8=l`SS1WlbCr!w!NstznsFw{8lcC@7J9 zdc_gSVn2!pyt&sHekQOqn#-39=KwVSK$%D2|7tg@`R{TA;cvJ@mFc0lq_OF1}}I*5P_T+ zBTO4Hq_J9B#4WUTW-%DYpn^ujby`lA;KLx?zQ6;RO_7CPfq`Igunm5>*i)_){>5D58jhihi8Hs)!;6s+y*$swkqG zh$2d-=njI2`A8HBP>ptu?d1Zaxmpnxw`ZpVHHl}Av~DZ0h7sO$4hMvgA_7pC(x-`p zBuEKB{tcQBFT(tf$F!piS^rd~jbSE50ii6d+?xP_;0~ouLN`?Fy;WDqtPH)_8ngpU zOh^P0C9Cd9(@>O=YBNDVk%Ib04BdhpN|Xk@?jiN-W}yk=kq_|7x`Z_k1`Z|N2>FrLFEcy zLzwb_a3Khs5K;nsQj63)uhW^CnHo{zyB&0mtO}Ay9bo=##`o-*Lx!ciw>4%uD@orF zp3ras3cjPqi1yxXVL=jXp#Am4OApRO%Le=-6V`bhLh(4FaZZ?1&!!XE8%MhWUljIa zVwiJS=R=CRa8aAYjqs@oaPGFNT(Sz`2-2(v&@+yM)jBck&7ta`T9|>KA_mip2qlI9 z&K7arO}*vcIcieO!x-N9)hccPr%3`B!%C=vEM;ZZ>YFWF)+%o%HG?;sx-}WNMlAzD zq}$L95=PXDFlf|TBZzK|3~r30j#xy~d6-w1jc(ovyfCrEh^&GmQ@JsuG=U2>LrImw z5hgOUJq;+CgeVUxirKe<-tO4gHlE&!iCdAPykKKBrw0+LkqDboB(XG$LMDV{#_Ep9 znqb<4mJ1j*^&64_Sz5MZ#{rDfQW8v3$RipYiK+nv$lY6bGjuYfLQBGCDVSvDZs_5W zOiGlaHingZb+iW?+t&9mm^5sVfgs0YGLqRe#B5#1?hN3RQ6|Aa~fT90}k#M&>jA?I|BazPFyP=1M90w@H zFp6iw#-|S1sItalqGU9n@)3paV0be#HILKA_gNM@7>xBU^a zEw8Ev?+tKRQH4o|JsfS4=~CK-hHZ*N{G}$?QF%!PMqVuk+Qar7iFK=?2#eCR`k$+? zcHrAkV;r*f&D@A*1)VvjeY#byG7EBW$<}S5X|=eGia*B>ClO-dgkWY?7<~V^ridbf zH@poS&VN(${KwM##3Vx!H5CyccIQoE2i~OY5|9@XMK=l`wNRsyClKvP9|%Oq6x31_Co-5-#Ewc; z2vbyxGm;oc5JCYysXpC3=7K}y^m2imk8~uQc?<8iKy*SUf@|(Kr%X(6STsu^%M2j# z)~ly}4`3hQ0Q=IRkxGpTNErw&F1T=*u>0mJOQd}~1FShHx10y-3&-E(kkl{$x)uw?oAr+4TKnPE2x{wD@GeIggPf( z?IXnA&WWT?J)ZYT(Ik*5hP$3wFVrQzSfk>Kg+v^Vb2xXzL!lHy&UV@KjETnRhQYfT zcoa^1FwrC=utEI4j4(9Hl#@d+l1W6%EilxD5)~|jjR7P;z{o#4juJsFQKFvJEQ;8G z07xVFg^_y*I_(dDnG_-lO?#!-N;w9@)$pgE-|)N#w?fo`N=xg9!>nz~_KXU*vc?rD zB6D!lHqAA-zcRa5FVnP2@wEsjz-VJ2w+q*vfa!mjx}L=9ccZilX$Vq5L*V?|D*qx;s1B<`hWKS z@A&(F^k@6O^M9hba{sT3{v98?{(XPX{~w$GPtW|H`2XztfAIg!|409?KmId|{*U}s z^?&(){{PR_{r~y?U;Q8Yb${ah|EvD5{a^n6PyE01<^Nwl`~UKP)AR9X|M~NO-2cn} zoBpq`4}|$YsI(zyA7n^J`E3@U;ovm}qBjPhYMw0+aBqr8(?r^X0xOAd|ARR#Nx(dr z5N>xwCp*--h}@civmfH)fZQ91$T*O*9qcz6*=inLnGv`*G*iV#TF|vxRgA`pGy{=o z!G?_mWjK?1$&JCeYMw0;@b7@5L9_Y|m7wAW8Zb_VpUcH0(NfG88`>Ks$^Bq=IXn+^ z-`Cqlvpsg9A_$RUNR|f-JMW(TaGzf529u5B5bJkcQ-l$q&IpOPwFEt7G*J-|MAbw@ z;CIHuFy)&@2d>F`$S4XF@<=?|#VBbfh!ax98Xp-#ni2^lkrGr+tp$|Sm|C#m^%=g! zz-XAbup%VT8o|*9@WkdEAmVr}5X3PXu!x9=h?>-8#~RR9^_n4$3}PH1f3>IsI)(v; z(7>UkJecH;iKH6yH&;g<=>tPKgw#^7J&Xewa}P*;QMkCnCal9I2d@*OR=S_qtg zv3d!mOvaGv$p0({`hvv>P85Kb=DAGa49Wd5wkH3uTmSJnqJTrNFX{dt8CM*-l-Iu@zQZtUl=#naO+&}5xGD!fU8zBJ)IV4lsr-nWqSbl;ftkxdx$%F%uikptJ>$kjOPNS#j!K zIjc(;Ju+LH-O*d#Tpm4W-&(O&AtJO0=(n6Dz;bdK%NIAC=22#fq=`7V3qdgz!g16z zhONKiCMXE*LMCgP*0enUB6O<}C4gWh31Wd*6kvc*^YO6Y3;!Z9cbTv-nhIqEkO+Q5 z5SJhrA;`KG(96)RVO}C&ONe2+gF84S5wsH!(7>RfM;PD`C>g=)(5~=`qH7E?%Leqo zYG5KRKt=euz)`-xlPJ=W2-5O^ig$wQh`=;g_M!$65+TKgMW~=%QCxe%f`FM-Qab&! zMrkMyN&ixH-2nx}7*C~6?HVZt0#BzG1R`b%ncE463MW&#KJ|~+?ZfU{K$4tI0=uTL z4pv#~0RkB!4qcWTMg$4vplUC#8VpgyD6;ij5`~IFPIVKb7LyR%dFW3Fb3(U~HjH5d zkpG8K-{t>lVP21Fc|( z*Z%ZB_<09mp^ktJj4c~NV?4j@>qg1!^C$WIk+f6UT&NKErAP2W6ai1AL(BgH4MwGn z%2JBN85lqbMNA0&d=3^DfH|!Yi4)7mYcV4871_(6bd}10ouGjEpdgtK99kWw4aTae z+-9C*MWu)n{`&E><8+u3o)@401RFF*SV5t0j4mdk0f{s=p_Qvj3|1;s;6wvhMN0y7 zD@Z{PI;!Nj3O(XzMgT9!PyV$jAwaqyJ!%K0&ru3@b^N%RMe7uaLJU9v(iG83{3m|F z8^b%=Szd|l?{oi%SqEv*p76~9*Y8O33?m_;3ip&bpb1lVZ^>Uf0yOFuFiyGw)UhJ! zKn;K0(f@n9)8w)sLcmKyMou$9BSKR!O#sT%2=)LlBKlx@JuvzsmqI8WLk4!)1gR z0p3t0c0|})lmpV>_96M{_kM1L&|yeM^-PWy!c?F0b=)xX5=ni36^jp$NC5Ze|62tf z&_riF0H08T`9m@6C?e9MuLq->{>BN+5IE<(TUif$0bA>(f2PVSRNU z6tG2wfe}O-FjJ+d@brswfSt2{U_d}d4F9@)37aRSuFspJ{4t>!B7w|lp@YHpSFqLAE=;xKL{AL`>sSz5F0<^?Z`8K z9upcFBzz}LjOVrsASoiOA{YmIb$aKI{^bGiGz4H}k@WrVjR-0dL8T7Ae(0ekiKZ1e zo@E#n<34TFQ$NP&O6`athH3;OfDYH58mLVO8|0hh4-)<$xooA`iA87zX`_Fa6>x zAS#BCS`QsY9T`MAJpt6-1AsXR`J@$1T2F9Mfq-P1jDtYw4xG?wCTq*8%QcC%>Q6*a zM=?e~OA#ULHxJ<%`+|LRF%tc@1X9#PPnG|hI;w_(n29Be{5Rm8O*B8?!zn5PC?SN2 z{1HX{8TbRh{F)P(UeLKI<0qW8506{{iAU#w#3eSv&!bwHsJ~an?FmCI?P+rqsLiN; z66HV(lThs);l1zMEA@hy4}b7}p#3u7Sg8|4)eaarXXP_c>PCUIhBOJFkx2*^4CZ)O z(Rc=oGYUwv3@Mtz8v_YKj=1C%IDb4;vO%DA#|Fh29FU6IStG#2fU#2|NTl@Uk*Xpg zlC>5u+Elnns|LcF#bCzFvk9!nGclemTE?K!m|DclgldGC1cWtY6BQ)^1rksy@(Fqe zY|p5g3-mPG^$JVS6)i+q352mU$%$kFJYcY(=%PfWXUtu-no+_n2Mu5MW5IQthXJ`g z?KX>nav~d7Zp>rxBnaf5Q7Wk$QH_HLVi3EZ!q_qb6{MObl_=;d>6D=Yl~KTkX8FI| zWUd(P@lVDnVWlVE$PfC%`kn{q&%c-csQ3{I6I6W0xKdIQ9W`9t)HTJ*B+W$_0RJul z(sT>Aj-)1^7s;SpI}D(;zt@@9av@Dp5Te#Wq)IN)M7+@-{5%JE+islDiID&8m;L?m zNEdJ!d?bJBt@*wA4T=u8-BEV!dg#wwJtBqK*xNU~GALqXq2`guNRQ!-LLNKdjU*C^ zAkcqR5nw%BdD@>`wZnao+leHb5(vo6^wb67J9u@0p^)WauOoI*Z6X@^xy_QA+&>vT z=rnfXsh9xYh6RyK;34|O8YxZe~1KK!QjpA%Yo}kb@5U4je&0Z4A&NJ!l$4Us#%q zvHy)SIa}Bcm6PQUq^lH>Brm+PGMpsIaw8hGlw^ z9sEKEQ9D!Jj!6*BP?6dm?HGjfGhsN7LSUTQZqDMCq<~ce`B4BhUC9%oO_4~A14MH9 z&aRDE%d`3?)^^xB855>@C7PQigiKq9pln9}=-|9PzBbW4@~~IsL3ffeB~{Hh53YBb zr*x0Dib{r_3iOcYg+K`a%tXBbmV$(G=`}795v=m(^r7HKmO9Hpi;gmDfo? zE-(V5l1%t_+IL+c$f~LcVWygBV1f>8qADU{N+5y#q6~tYKTqk@ZX>_(?H&tnAn1Yr z)zvP>=wl69xadhr($W0#IdzK!A|kXI`V~ z3RU}Cr=)iZZN}mZ zfClcPB@sEqos-0FbTUyp3_TpjQXH7!Y10t0Zi29a;vXEYC^{fL&&5?2r-W4E=IuJV znTxp)p&gK=3GV$_g=Pbp>9rHFF%ArcAw~soX^b^uffco<2~QY5Iz;+R4<^Zwgn%zh zq4M>_5z>lz&#FG2?8qWG%#sIrfI(Er295qj$UN0K4n-aYyUfown$P?j-kJ~r*gO^A zMsCXZX5RmN0LJ%}9h!qkI;%23r`#*TBkh%6WQIxw0tfTUq#?qi$;UZX>ZT8g=^Ny^ zY9b%d6`f(nhX)}=QvXn6r2+OGHzod{146(=^5qE;2-m3<;46;mxA zH0Yusk!T=?$1~|k4rr81K&FZn{9hLlVCEy-L(i(J2RRglrij#R?>~!;nvH|&3^tR@ zaUs_ERj<=xl6T=2Kx1{eTlmOjl*ElB{cq=#l>_5z;DOk65{X1ANXIZr6RysC+VY)- zPYkM0fPCDH&;I^D&;Kb0z=vO``Up&Fpu>$A+_wFHrI7vRjp|VM`m?LW@gWT`QV|#I z585&_X8euhancDpgcTgIFI{iGMsC2KK!E7O{rQQzx((rpN=d|BJ7=pubC&$YIE)_` zaUjfuGDiQppj_2JN)sT+?C5mPqRis;IZHvloG0`B|AYLLNqrKMxY8ETjV|FAA4@Xd z^GsGGlhGJsz=lMMK$oBjGPy9L;kMiU7^9O!cDB1)g+E7D2LViYa0HWxM9or?}Kd`hQ&F|v9~!+XDy=YhZz$! z8zW=C-NN@|hI0z6@8t7&a>oj)VJbBUcQTxW@p@A7a#8-NQTv4EOq=IsRcuAG8Iv&X`V79v2-H;d(; zzxaMF`UggvKl^m>LudiY1||!NLJ=SmI1UTv14bbdol|Hf3_==C1Mg4w`hvxn9Dq{& z3z8qA0?0|U%LMkDLq3=vi>v72T1e<0IniTuLge~?7mrr}GK$Cri)(%NK%|3wyzLYp zG55K%)Fx!YOc~?wbrInQPjnq~q23M%p~f*#0qX%{&*-G;4nV>{9nQU;4loXMI{B;x zgZ);#&yPiI3J7vAsZXh4QwmlLV^T`pg9jXs2g~o|k9QFk!5cXg>cp`W1FVus1w


aNdY9VQIS_g1i6Eo9$Q|N?{9$d%|5PH-z=YpC04td}+H=w!R zF1{Y$eSHFf=_F`MW?ys9kF$JA9)dtJpcRP(Hyj(p8jVMrGs{3+vC&=OsU*ry4(>jM z086+{>knB@(K$UT8ZcEM6-7B6bs(8{U9uvSAp|u9QVj*4Vgi~4_3iEnN_L6BPgI#Skc1v~t{?aW`9S~h5j)+)B#?oAv^zO@4p}*E=kxdaO&aIRx9Yi_ zni5b>C^(?)%{eqFU#1X53Hxe{QqS8AlWr;tV>UMP$HmEGAMlJspyees!z%-ayCxGr z*o1Y9K^TzVt-e+@q~j{s4%#m$f^3Opa>&->QWaZiy1E@u;!%1qFl+`XBWiCeVv!}= z57hK^aMW5l<*~`b2qC&^hMACoMrrDip<|^?Z(A@l&RXD4ToI7VO?Ji#w`l{3fZ%Yq zKxD*6bQ*ZWB++&0o%buAIT~XcW@zCsN3#pVUO7N zPNByF7Dnb%QPCfBOy^E$&@iBa7-bf;uL zA~{wlmuEqA7{L%xi#HD{qc~`uuBS}QTK_d}wAaN>K>X!3#9sv;ZbU2}He=Q1HI(&^@CsDhiO8AMW58q7k= z0y5UMJ9zP^3{GZYgRgQ;OvKx<(h|}%%*N53-_ayM#b+*`=|11wnmD`oJNMn+k;Uv5 ztIoYigx!l}Gl9+4WBXP>0pnNA#%Z5EConw1Iv#LT zKVb)tcKKlw1sHvuA_bDj1(~!szvdDzoy-t_tz-l9Fg*E@KhDCXD5(sDkxGoPA|EfZ zgk7ES_%j@Ua)t3rB_EatNh1W5AVdKH0)+^_fKd;3wTYrG!gfNHF+OdR&OX$C`F{*( z4N*iqSMKce*SrXaE$s^>ws($E$+!P~NMagO2xb}(`|a(=n6hhpo=o(H51TRk-^ybV zU~WwJcwJCvAhg&y ze#kc8s0ZU?=>kBgm=A3N|3alKF)xvant#w{=^6}%oN&YMy_UP_aK8!k{w2!Mp-jwd z%;%d}>~pV;G1p`m69FfpOlBo=X4w*1R&zJ_YxQ#9Zty4t; zP{dNxVTmCzI6z{B5E7x7Vhb4*E7CFuktkY90wvPIM6_WoDM5x}FvLU=5fKuR5fKp) z5d=&@1i6M3w6Oz_;VXd!VJb#A5ZM4yh)|l4Tq1=jb%p~KAxg#~7-R-ONn~V1u^3B| zU{BpCkx`^SkJ;50V(((#e=F z_Whc@#7li|>y~9lkozN51hC#?NJQ_XcF=NoHG85{-w%8EbOnRhc)|T{%`~dq55oKd zY^R}KR~e~6Mp5-XT66+FLW1^)2wb$zW6On`gQ_o&>$-na6aP=`eCn*D=KYvMol6Yi z3dwB_bi+|I_*X~Q(;~e6UTt*n>#r}h_b44;DQO6k^nQyHs|+JA-PVw*1)$hUgFsn0 zrniB+5fHeI#1DddNSU(~Ox+E!{NIojZYiV@s)bn5K>pCc80!Xu9sp#t=n7bXcSgi@ z4T^t{gZqgZ0RJ^+C;QOuI6B8sp``1CV`2~*8ciXfZ0s|bn~*f*JKEJOLX=QO=qSe4 z^{6+17pDUt503qEE~E>NWFzN{GP9^VgCR_XGEbi{V3YUz!u`#44v_N+lF(6*Cen>4 zTglTa)E1<|I7^I%QNl>^#T1?}j9m|ksQ*{HziYz8A9ZXG9nbFkv_Y|<0zE5OfnaqD ze(f_G{MoyIg{CA~m`EE{G~X7^x&k@B^je?BTz5@BX0O4Ki4&qCWfBr6@0)xWp#iYy z=ts`!dWdd^`NHU`Kj2p?I(5f#Apuk8`5n0edDA8gj@8ZoyP@O9pX!T|iku1>5K#(` zG1Qmf3Zh=YVdE{7`u2QS`$izf!?3TSAs!_oef?eA8U%io?+!IfL8paP_Z{s4wWD12 zazl{X)`#3u;F+0_fq416kYj27zXw&5%{7zyal+{&JzkQVMMxxSE9xUqYzvGR%+T;N zG~dpKUVgLA$(;;oE)BQxB#bq5r7=`#<>0!U87a{_+24|D^w<#4$uq`cL|bcYjqM;%h(UGA@7gAN7_0 zY9HM{_7FD{P(%K|{bdLKvLBQGXOsUY>;IUz~UdF&TG_RihD`rik)d%e)rRazJWFc1JF81_iMYoE56<>$%muQZ56$SfI0`?W8JTNklWUtzU=Afp`Zn=*S5^O zd%B$f3~Ur1O?uqKHQk>^P(Gfip+I}y`@nqw0YI(t-k#5WkFM>`d!Kv3*~`1{xB=)s z?|l2^vtEE(b2S0;w)pBxNCE73yZ{e5y|%jaI{FNND4;9ob5EhicmOmM4(-VgyPQNlXc6|= zdfd?t*hq@{w%q&dpyzSoWy=}Jnz1+LOe0|-d_DgoxTemm6rPtl}x3gBh^Vf@E@4deE z4(+aR002JkPB*t*@3Hf}(Rv>0)z7n~?XPToW$kCzPWA_O`2yQ5 z8lCT6IqSG|uPV;NyEkFd`+W~KdF#hB?E3k5_~q_A?$4%=eYAZ&9`|2*`h9J??+Z71 zy{{*=+2P&p9?0}=!Kcwra>occ8(_|WUKD%6<(%9@;m@{oJZDdKz4Z5wr_;qF-g4x$ zo>$D*JZ*ON=U;B_1!vyXD)P3*-QRl;Ti(xd^Hr)HHKu|#wNkcKyR|M;qa5R-ai*Q` zeH*X4?;goB*L%6q=zZPF@3$k>uSZ`3tL!)3&0hQ9-t}#VZS&uAyXIZJ zZ!_bgu}?Y1`{}mu^WQo0+u07Sd7ZAK=JxMS*>$$}n&U2C48HE|TOw%|`_<>YzHfcB z@4WQBy>@CQfE~;LrSfLbd&}LY-uu4aeY`%#eA@ck<+vp@w|(FTdvdR?s5+LtG*xEX z)0YLka=I&Ax*c70!@G06?#*`gho^bnv*zBtx!*iAU;zS39#uOvPF*@Ax%Y>?3pcl1 zaqj25xwvlMbn90=x4X9Pj@SSiZs!M1J2U3ztq)qAYK)m1G_2g(owD@~`?~T#5#{r* zqumzSPfgiDK*gi8y1Uz_r>(UB;~?i^ zZ++#gPZs-{c8h8CCt}s_1(%!D=Hsuoy8GpIfp25II`!{0<`f>cVA9#6O?%i{!u9~@ z89cHNafbHiv0kq5s%Tp@Z!q_tU$**4tR<^XMuc<3?HWQ)WZWnyt z9edMtdgE7>@41WT*L4~Ox;eq^$?tQy#;yTNthQ~c1rMR16uq*AD=WD7y}skGK(^2Z z_HC#M-s8%>cI`JB-r5I4RF-$#H+!ar`D=nfu~IZxwQk(Zr0qJ-*?{Xb-Q|77tNCGr){Nt*gXLHXnl0u-R}2v zY4h9O?cDn5(|4a9E>Rw!c5=g6t&g7XdNX(44!zfNYPQVwz-Q38yCC%Io!53@^n34l zx*P8M>u`6$^l|_Jx4F>KUY_kwyPVSOZD*TO?F|dvuO9Z^hbp^gz3WZqwxAE7=;@~R zt@EB9t7@U>`*iEg9?s+A?t1j@BO?soZUj}?r~#HorPsN8U1QU2La5vCy7o_64K0dZ z&#gUsD#yFovkuv2caB!teTSg!@K68&pLNHNKDXARh^)SL>uw2CO`lt zfB+L901zQhCz5)nl+o&GwNJ`H`l0F`nrc0&9#8-P7(wa)01PEG2q6RzK$>YWsg%Yb zm_~|tr>OC&dXFeQO{CLm2AT$ddWL||000000000000e?WLK8v*KoOHcrXW+viIm!> z;sTy2=_j#M*p&99_Nn?Q`9YIN^*u(9P{yDD(@#@IfuIcrjR&Y2Y3h2L)byZ*A|V23 z37|}vnFL`C8feo&sKhli!W8_;4N3V^#XUTVdNm$unaM*o>3vyy z*dES`R%TLUaq&L(NdM<#e5`|skv0ul9Ye>m5NT${7B+92Dx=}>J$>h<4})rKTB`O# z>*}HyVQ2sEB!rR7%QFZ>y6fYj$WP__ACaWkPtN+|gDCUH6KWerEd1Q^lw8J#5WHR- zsO0;%-A{Rv3EJs+*zP>=f>h~EUI^RA9MQK|%{+!PJ^2p+OF*>0zZ^Zrj-=tYg@$pu zO#QhFB_}sdM$eOnVIQwU-W(`e{I1ovA5k0E>CSF^;OQOt<^%QMvJTvDqFPiyyo+Ak z@(TNJ%c#9GoJ`@w zlT3FTZ+sdfNF;Zrn^jmukb*$~|6dy}Fpx*#Ap4j${Gae-e&}k^e<>)%{K$X#-YS89 zmv<-P5AC1X;KrAert0V*)1Np1$bfy6;vZZ}W)2ZC9IO2oS5>nAu22E~v52h<{a@tn zGrg?`aLS5}`N)4~C#|*E^{4!8Dml(WoW8CaUR|9RdeV*M0)R*loGOSx)F9G`IZ^^) zD40l@D2_m)n7}4TQmSMEITRqd2xKe%l#W6L3MC3s3ct;mCg8w@DOQ=0T!9lN5eN9= z_`lNrZ_oaYIRCBB&%WonsF+$8#uPrHR5Afl;G#&XD)7nwGyKo_zvgy-*#E=-tN$M( zm-%r*prRZI3cON9BBG7J5m$j=qd&v^pWpv$xA*_p|Ks&P>wmBQ$J_q5_kZwz2k`#S z|Bp-(Jv1JyUaCE2gp^4#022C-Z_)feU+Mop{U7vyfB5tM&-C7e7>SZGLjaOX_8rIT z@BZPC(1X;HtdPo=*bjK6^?0@OAJ=#R?lZZxY2=M=o^Q zpsJ%IBw_@~JRlYSsP7SQ6aK6p@J@t3;bcKS1|Hhfo;_Kl2Pg*(e$Yukadk z@f$Ey_#9NC1VL3wDk`9*LInsvJ5?XrA;liV4+MzlksPT+sgS}%A`tkXG(ezGx+DWU z@fFarktTvN0}6u?R#-Uk{}u=MZ9e`#^?$H_TJoxjYiYE>FhA?QJ5l6Bq&^4uV1AmfDi~n5d1PWi|L?L?6hQ_pVHx19*W;TjB zGf0MHgh)gyzkQs4YNY_@1UQ=a^iEyjye#Vw2W;p!pT=-#>zn$2+tz?T=9+Ps?ttzj z{b&=bjhMOqEMIPC48t9s^Zoc{!$-v5=? zdigd1`AP7M9_EQ$pKh;1n-PM8CAo8(>No1+|Awwuo6Tnfe;8wVahX$QW*SM#OyJ}e z7!Rj6&N$Ar7sJ)5yWsva*0gP>%LNqUh3a(7JWQThPsfCQc9_$E$vkL{a2;5b3tWIQ z+ux{zP}FCQ7Vj`w{8tl9D$QT{Ub!mmb4};Lz6NHV;sEo3wCNu%@@M=9l=5$iYgH|f zkVw4?(b01D86Dp(8uNsEjZOcq^_QqOk!@vRp}=zH!BPKFlz-#86w^X#hB+IaF1HNZ zDb=n9287fllC{u^$$WXV+k596s*+nx+kS(S@CrzW7gUT7kW3&$zqJ(97TApy+sqwpT=?9%#IjQ8t*f zH3v7UaPV1Sp?|9T-Vr;0_lVEYHS0(CX`fH>M|D1!csrdLAi_T`cU|f9xBSsoF@@jq z+xA-jcX#`L)4GmHS!t#3+Q)35#;H5rW`W>tDe0ZJ;okYP$3}l8pYmDmz|Np#0QzAZ z&EfG%bC7Cr9ey^Bj8v?tRZC|FM~B7ROj_&VlfoT^$DGa{A{0{z zjEXR==wdF&t-I0PiC<`E_43CWL8?a1PE0gVCuWE!{D)`HzMq+6Nu*sM{W#bb0ihXP z8S{1?FHP;(bV(hVXqIdqe4fpVvd_`xaDgDw3VnK8)&b^JuRs?a_4=K8fiphcvOXh`gYY zHveo*csIA6JeZ>MR&3-9^Zy^NsgxS2$(5E_4|=a84TlxGDUZP%v{SuQuWD=Ab{9(< zN{y5mtj|Pvs;8*$N_)CrJKaW-(Pv=js;;QjH}7Vvc^kweV9VIQ+L;hrrLHkdGAW{K z<>xgXWpU7bWggTr>WT8MvriseEIA{t%r~u6vNtgW2x|`^U@fNCUp_EqIlNB}4K^4& z`1O2L5;|>GAH&1+dLuTON0$!_3~gM7pFtu`QU13RGmbb8LIKvlpZI@UdAG8a2jzI) z7*HvAx65ztn$u%B!I93H~6aWY%QZZ7v0Z>eY4RbURQcO2RY>NO0OTmQL@%1I`{s5=*~|M zBEzy*v`+&H@)VY6Bk+`;C!<#6RLpeLiw0_3a%~c>DJ7>bIUe-mNB!74>E@rrUpg<0%OAmze5w7ju8S=e7hSv+EFiULn5a<9PL6 z?VE>vgaf4A)8KUF?v@HV@3wI>NDUu?A8!nNfU}m7vA=s!bngi7Tu~Ovq1U>lJ$3@) z(!V7)(B9V6CSyhn*T#NCBeI-3b+9)#?Qv!9<>qqe z5()*n(L@+u1C%jd@ZSa8!M#s*(sq|vX1{vr@+`gmttW)uTzISr&wkeRV^Rvo6@gYlJ+=&I=)HgjW52C}lz z%7~IREcQ|r%D4)+4I2Jp`)0L{zAQ#%huyw;UpkT<^|5 zf}^Z&e#vcAarQZ`(-vd)2p=wXI5I^;;VXqQhUJ9hu!Y4j!eiqiYqO=Vr%?zB19z9x zu&V12K{w|NCSdzm69d{e3<6f=%~3{)N|Wh2LTew<+)`G|G?_4IV!9kb7aP<@Bn{n9 zzrzMdcNQ&GB|Io@hzDJGGj4+-hQHFjyVevQfiHh@x1-x z45_}?_lDBVSHzBtbj(w<`sGPQOd?3)Xjaq^1MgQ7DVfspjz+Hky#LB)mSqu_Q*gocJdrHO* zSZVwRF4Iy%b)DC3MDd?FZy_@hB@{%cDV!MC6aFjW^EI3$rw7A57yX7aGS zykg2bC|+(tR54=3hsPru8#}8EF=bN@7Ud$A(iQw7M+Mh5-_ZOP zZ}q(O*G7lxDVHrFjLbdFp@O46(+|BDVQ$@ITSFVBn$i$iwp95`qbIBmXphAWCytH- z$sfjvZnVPBUw}8$l;HyCb=ir*@GG>xjvSAMIf@lKKAiM6R9BJ?jN_F|+%sk(DJZj2 z)`Y?RB*#2B)~hn~(XPT|>eY6XH+m*!AQJGo>Ngh_7Lp2BHypP$jGRv;o3J~5 z9p_M(NRcAB@6jsyv45<%SV2hdj&mi_lVpw19$U_soc$-sni-(-F~p4~DuC~zzpEKu zXU@0k%dCk`k-u^)fK)`vexCCHc0bWG((F3VRVV6!QTSq9Ne_+(@Wjq1)dSrQJ4(3k zkIyrK@0SBqcfs2o&@+J};w8t-Y~Nww=B%UT(P-HNYz@%g0}(y((hbS#gV6^`JZGdm zqof^R?K+1f=Ab#fa8p6u4_WI6Gty2cx(;BZ=4dhs4(KvWoRhR2(sYxobdxEi1)#zT zK?pLKq!NcfFRXqLQW`twxjyfSuNm{YLDmXsDesfMeHV-r6db|UXem4(>j$C@!AZI8 z2ITZlNisen4C{l;)9@c=dSvgO(0DF8JSPKF!r+L z>!t|7lsex#1eh^oI~~UZPVzEf!Itt46tHnpNR&d}hcvO+!!>NZ%o*6&$hm`KXkc~* zU^XpcHE86J*S+y!>o2Xr)!c*hbPk4mP|G^2@?db-*3A05J?=TR z4pyxyV#?$lOKQ9B+ZFvq>4^TLiF?9yip?h%yO@-)SI`nk{4dx-ho*Qyeh-jghC#|C<2 z%*S$1rTe*y&U3lS(fNS`zE{2$3(O zCK}U5Q3c#Nw2_zPnwZr&6=v}HP~kmMN{D>(bIsxT^*CizR17fl8#GN*G~w2&So{v2 zO1*R{2~NCdffV3UJ-OMn$p`WWBpr?oLBU^SnIP15L1ege5KmBQ7`+xMH1-nfNh)Iz zQH7@pPY(W#J;hZE1j(6bWM)+nRZ;FJ@7~{M&_e@GBp_-B_-;DJW;1RNJ1osa&4pOg zGUs($47RbTb4(VYj%Kk)s+NEt%v&hUb(;!|w$8_TS?j+K)kYM?>YD>H@hK>W@T0z5 zCZb@MiaF&>5tN7x?hoxZ&D5nx%49fTx_npo#m@p^Q3n)Eiolvcj;lO zizTIfxPu}v#h%rJfS<`6%j9TqVc3FapVOPv?N_w|3(jbUxxQy8+qQiC6cE6ghrr_K zgen~#z3#B7$UdLJMy2L1>rvT$p$LL=Vn~OIKb|0SB|-EDf=|XK_F^3P8?F;=?#OUC4Oo|b9(&ArH0JImMVe4)m+xfva6>_6(@kjZe8GVsqPNJjSL;p zo>Vd%YZ=(G%sVR0|2{GDYrc&iUjo)en4SA_uUJ9`giUN-S}9gHMIlMEr43|7Wkll8 zq>-?O)j*rL+?hU+A9iQmFVTjCEQsK<>L$5rIus+O3^t)V;AF&esWhs$V4@^9YzRfbsUEXWMo8!-i?%@gbkGU zk>FtO2(=IH5p~deg$5{ryvVrR#}|R&L5eX&TSMKS7D?I72`HJyAxyZ#zWTFLLWD9= zFV#~-2?;XPr(GRcszrFV-zpQ?UP!Do5;ZMEOBkT>W+?79lGhP%>pUp{UIRcsv4l$*4DL#6Fbjimt{Due`R%|ftACieEbMhjJig=DLB9R(A zujV@}ui*UO$&5-xJeG1yt9brK-ND}PBB7|kP`(NT%<7fh-nUS>3%26Kyj^7bt}-zTE;&0)%6 zAppAAKqfEE`@MgUa#Ar3J|wv+rJ%^0AXMsL`7bg1BkL-r1ta^4;Nq*1!&7lIS(ux# z=x8KxVG(b`ehC*pppM%NVcq&2PW4Mer^A_nnwg$bgVWMxb`c37B;ezr`=7h|(?UsT z{Jo}C@9sD9pI=^`DyqKEfa~bsII60uFHb8?mdnc$#kKRpzlIIg;;TW5!q{)g=czsy1?lFM?a#Fs^Waxgv_#Rw(~ zM@WXj`HU7|dop5nd-HBVG`}mi>NNZ}1;jdWm%XIJ!*8LCjd`PE$&|FawJdSM5{T3C zAY}pvu})%l8`aWF!{bSxA7X#P@dltn_Cuicc`?M!y>9^TPC(9n$G2k-5wR;ylCR+2 z+DmsoaI(|7IkS1oOO@@Krav?s`<~bLiZHl(h!~J~rAgkv5Lq>K1*A8MM&FE$wmgg~ zlxt)%ZN>fYZgz?8@fCcY=}$49$j<``Qk11BN>Y@iAVA}T;72*a&O{@GgQQ@Bk1J?4 zu~n4wWuiYGhaVn3Pe+%Lz`V&3Ls^kx(uD`ED-uk9R~h)=@%-ZinFj@=>}7<<$KkzC zv4)>6>mPD2=0pq^gP?2%BBv1Yz24 z^9Xag>_Fl^wfjk%w6}auZsjR+^2s`wSezqFTy-snMU70!D>%xaRz#%LM?k^hHWUs~ z6u1+{?F=7PYB_S#b$piP5a4mNG$WaaQzW8*;z9zPv~SnYW1t8|R$ovv6euuvM76mx zpH6C(TO{fDKIut4km8hqflV(T&U zv7fNjqf^N59Y$!I9;X8#h?O4U(mRy}h6GOaBBts}!p&W_Th1rkc@0m^FoEhod1A5w zA|9w=Ful7Ay|?GZ)Z`ZjJ=_W1@lA6_i&*8;ps2atKt@ zN$1NgroSi7#{4eeId_v(wQSzGCZ2w5xLdI)nv zpt7SA$6U(Td_pYK2^M~0Q!cx&r8tMKFpJyeGG6I7`z=vYA$*Nh3mliy*uC{9j zb%mC0qc%DU?m*0?O;8f694BizVYHnzxj)kd0gc5{H9lx(2$t3%RYSho3Mb*A8&rmf z@F^JghfH%04wxKaVr?9euH)e&xN9vly(ZXM0TD_B&XMjU!;)q!9wWFo`y;kU$lN?` zq@ad!;%9wWs#NeUiAlyejTS5?rXs>-0TWQi!s1m9W-}BZkit|978V^Ph_<1q4t$LE zYEDq{8&Y$@2@e26mlU*RSY_3TK@)6^4Uwg0 zpxQ`DNMT^2RBlth*%G9$sqAEnE(+1yQ8ro4Jh){DV|N|v*~5rc6jX<%@p#)(tWx(- zJy6EDC_0|Ld!$O}IF(!|1Sc~gf~D=!7o*@uP!(OKtt@BOz!%r8y)8kzesI@h`Pzdc zLP7(&mndb%kQ96b5uPHDoT;#c>YHq%o{w?aNA5xMPaIC?>wolz$LVkzaQ@d08XrqT zPbu{3$4{@S_c@tZo`A7PEMD4*?a)rwh9KCud=jDy#>c&sY?R?19tvh%P-H%_s_n7Lnu0nXoI|B|$xzZ-vo9u8}t5}ThP6QomE zxtWlNLt=w@{DlWES+&+hc);@S=O7;yK-a`7PlMPGeIAHCbD@#oTN z`NsC>{@>FNkMA~T(f!+-PJq6JW>~(m10SKtYBfH(o{|ry7&X+HJlfHVgJ+Wrx)AqIWTQH`bq0rANb*A za{^hagsZ9$cerW^mo~V?L#7-0QOWN$e&=Rpk;cnQK$3+4{SVInWBsqh+ikyj{LY(H zLxxxN-v*E*fpW;N;2|^He&h6h53}i)2=u3{== zr*;Y+W#sN+>M&uf`t}gy(N;wf^idF^3=hNm7;tRD zBM2fGf;h@ZEj&xwJ3V;}wCgpR-I}g;{*rcz@ptufdg(ts4y9w1u-u_bG4HVy$8!^D z_o3v9f04iA-$(p0-}e2xCJW-tX^1pY*AmbC-}vQ^-l)@lH_ya*GCld zgID`MD@2VzcRQ#s)Hkj#Z9PX+advI(@pVju{wA-g9g`=1Uv%VD)X6&P2#?PMN9uwx zE$C^_L-PExX0jf0{JSsrKc{};M7?K?TvwFI{b|RP7uym%W?_8&A4vm?RV6Xvfe(Ux z9*I$|8A#1t1#;Zqx+G)JLeH7Bz?~!@LMGS{?>PN#JgDS#@NqevUc;YBckzh~aJahN zFs}2!$bLSTJ_tf`VhS@1FrqMK8FAo-);xI8gD}Gi0fR7@^AaOi@#9FwvE#-gBZ-NK zrU+ocg2c!&AIJ9?z`_Z>xbpuV^9J0>^ilT2iycgMNdF!wKYZA*1Q4K&uB*~=z=!Wb zdvKmVxl8AS?ckW(ZT$948Z{v#C&>wzO8FAtL|esliBfz;U!Fv_O$HGobB@DVf510< zq*`G!>m2+0{+kKPHIZAie}lgjPVL*GMT~XxK~7Xj^8+w`2txtkis#9CeP;{z-mSXw zZYDGO=k=QUiYoC9$i5;FCy1NBR~tLG$t03@%)g4t zzgyJjJ_F!1eu^lo9`C=LTmAE0d#ARUfV0X$CX;(%edI(r;o{6v-mB#O@{ zle0y~7duB(?aJ?y^FMi|`JHmH1}JuZPedWk{;!6Dh(egJj+e2M-M^FJm22HWz`9EM zz6=jEInzoc9SqI$yREEewZ>rh*f~ZB&aa>Feo0*dgl=riBh1+Iw!JZg*Kmz(R2=)iAgO{6R14bP0fObAtk(_l;;Oo~2$YQUXz6!&OfLqs| zlh0n>?lc}IL8z}&3^Uq;F+tW@nRGz~w{0xBT>Mw5v@^ImB=bQ`f0Veac+RHBMQtLu zQq09}k|VBK>nhJ>z6)tcys{1A>=YS_Q<@7emnWg{ZMC(Op%#GcuiAfJ;)5SHEZ*rS z&*Jq$a!-4w;<}2YrJF<)B~FTHU!$hHQG*Mm z!ab2m(=gt)9hsPBcjxw9^<1hzSG8@&+N{)4wNR+!hB~CB3}B&jR>-K=Ha@th`W;c) zTy+7=B!lAb%-1##qcHjMMy|E)T}oTZHGRNHQs`6UV;f90_`q9F>!DeUGY!fzB@ULkxJ^aXf>wk zvbDdpk?5+waDtbU!<>#(3WfLBvZ_}sp#6=PKvvtHrFds zc}?GHB_X8a5g?GXwN{*SRR~O|9Cy&?9b%&eg?1j~B$XHgq#)^dumL7WgK&X}3P!l?rmf6<3B=au7qk8)2wBd^N5>@SK35@~ zreSVLM)8^aHJAkO@e=Sc%#n$9q=hGtt8?)fY%X0GU5yfUAM3LQ?Y^(TZzE&7WO$5s zcKT~~gQ;Gugu(iK<*%1H2!|7|cqJM%W6n>j1JL`WAkQJ*j7{}uo3<*3(HdbQO#=rX zOBI*XLzPf8+EnFyb|6$Jw~DFtwqzZdP{a~qPEFT%Q+H{_Jju#62Z^?!pA=Bo!RNXajwUijY;YX%Kk4B+()Ydc0FxkJih&* z!+Ut}t6woF+o*OJyH!{bkj1EdSdS>{u81}=_rU}LJZrKQ#7u7JmG3;mh9#Y`N>^eW!-KI&&j#LI;azGoa3?_U_s@_yr5LEjBEyfpBAE-_0uTiz zP$2Rd|2JJ~a)I-n0_dyRRdt2XBeC>DxsqUHZDbyTTPdKXNHP%VD$0J|)A4G{u0IjC z7V@AU!{w3e%z3z|-naNsd}5;wq0(>S)v`*w?wyM)3oO?dsK?9T)Om51ZzeG&(KH&e z$FrsBo~vaZ`au@l;@w%U9+_w1xs%#j>M5J38Fp<6!fs}J4_g~ciLvEqC*oHc(}8jI(DtK>(Y0GAccl@NHZ|Z1OsM^ELKYj zv>o-{#!&C(?etr)iw&QAFY1p5X}ae)p))avpPT-cj`#VwzOLW?AO1i84)^`+Rw)7fS+gp?`{xOO zlAHhNwelQdLIMHy|MY)*{mHV+!8}`4~|7Wq>0upEW-<|qj z|8v~_pZT5tz5Va@f7SmtM>^*XX%ISDf4}{H@BDA|drHc}n!y4qf4l#RDFgyWD6Rww z!ee)7N&pN!u;3O!00Fcihx>o&?-B%JKi%y_yJz$n^}c^^-2P9?wlDMyApC&GKz4(O zi!Vrf;Sm1tOdlvnHh}^C;9xKySNWIy0fC%>ijQ;-f>-)NRCFHT|6}E>V+{YM8Vmp+ zAxmfaBn28oV1B@PmyjRqhXMQn{3SRJM{KMO4X|xcc_v_cLeL<^)ud_Qk5n);R91tq zavBI?Fc`u=$_4;_!~UP)v=hL65&w?G3i8AM_x`8-&-#Cpnqc>qEXBrm3HV>vK^v7JUj zkRZ;3I22JqI;#J&LH$H3gh2m|fW^MT!X8N-LTW-}K!`|z{@g$0kM;lC>Kk98ngtj{ zq9D1%KiPC6V-$YXlS-U=uu}|iQOO_dgZ_D?3Q{JPB%rDmpMuE}kqQQcm=i+mmXP^~ zM+p!J<-o~Kgl4hGq!=LrA*2VaA%rZDv`Hv$$qNHV4Ck{AI&g$Y$L(nV)PTzYR0#6o z;$UVd11TaAw*)XCvk}Nbl<7GE5fCE`GX_YzWwdRsn*h{_1PD-6NJOakz+{R>*qmHu zk&I$uVt!3J)(!|0O$3m_1v2-@;YOI4n3$X}gbOin%Brft9&H+8aR`z|18Js^%K(ib z*(CputTBJ-|J}1P5<*7*LM2GPc%pDHG9aj$z{4VH z#u6k|f%hJ&O9AAFQ~#Sn0Z?7Ygi3=zr>6`6V3r{UVFSRhDEB@3Q1Sg(0&z1Gh#WXz z7{G=Ql0YL8sKlwv3G>Ph*#OxA5{pVijxqDWra+`95@AP7B6kVup7X!I%Ph|g*;}`= z!-P>23XXTC1c4wJ_Y;Bl2A%*%^v{{_&yGW)^$@92ng~dgkRg~tR%jtANQn~@ta#_& z3rqcL{>=ZE5y1tJ<~=0@PxfvsvUIQy2{TmQrJMcO#8U~RJFT)GCd}d-A|)XNNdf0RVt{w`J0Swow1eX4 zqm>j!)Cly}c3D7#$J~In1Rve~JugprTH1nMsy*u7u~1enh;m{k-tg-okU-7b>2Z&b zV+A;mmQgtnc?2SYWq=@{grx`y5WxT8h4+l1(f~eb1wHZuL85XTBOyHn(0!7=2giBG zvOe^9Q(wXE={&Y05fSi)b20w5Y5%1$d&V1cyPCv2LL!Yq*!yJ>8l|hmxRdT-(7HJB z(?D>`SUeG6?Hz}~`M=z6{6hBi)t>bvsCqmsi#x`dd z%0a8BTGtbZH^u8KJvf8pA|upK6bG6pTvSWuq*KMs$=k2(ck^@UgS~4tnZ_nk#-4Sp zRp#-O?+)ol;AeWW_dE^waNlk@nc=6-^9R@2M&}m@k%VMf3IZV-0wFYfq%M&{a;VovQ~f68QEA}@f)3EcvXWs^vvYt8`+&}j%KeY(nmWc=9H*3CY3MA z%*GznRYvGliG0-<+if+<+bUB}&pn7e!z>#ROG z*5Jg%R&DAcE;1@kv}08R>ULiP7HxeFbN0u-eS7-%y_(DFUtH&P!MKdS594t$ch2~X zm5gVeXIw+vrMuRmFN@=deD9&3P8^`A+rXx^m@_H-!a?9HR83JC%x8I%KXW1;}@CJ8aV_Xcc*``jDQ|3qVW zCI{{ZCd~vv3(SE?0fYJdzO3{=Yv6NPtzl%iLoa;MnXRsP2AVlX+J{gy4kSC3$vuPt zjG}50$r6xclP4lf$_$4HJ*+w*bU}=nEwd8|1NP%`2C&6UlyHI|$p;7wkTD?r28}L@ z6!t$#!qi2DDHJ@Oxcyg6Y6u?AWlf-CNNqy~#TQXw-?c>AN=X2WMzaB8suKbL8p#cU zBhcHTAXNTFF^7Qyd7!lde*HovOaY{dqH3aGlByw!qNtc;-Y!r_(j;X>$bRT;U7FoQ z!bvU=Vn9g~M5j_rN%hE?K_rknAj%5~$_PmqQUn7eQh_iyE@l4zp!3}%fRJ>~P3ZV$ zF^POLOrOPq_4%hEXuN?Ni3tG%A&JSop?RPQjE%1RtmH^3PjO#N{m3feT|+{N;2;4; z8lZG2uj>1KCczHn$Xuq1L;}->zvR;G*@Ko2OWtM(X@*A(A~9E!LxA!Jt;dU!$z?`E zi2{IXq8A{{14Q88*oQCtUm_5Q zLrsQ^GsjpbJ2BCdI1vic13)1pAU%l;iYTUpN>fBRHA4{KH9>|T{z4VNzjDW%c#`UE z9JIJVGOIk2uF#G|4V$&)njKvZYFjoi&BvCOU z6C9i@h*fYVfXM@i#L(k}LsA2Ti(4GA&@i-9NE*`XG>MYA05ypVVBoG0iAWJe7rPY2 z)GG-n5g?5U)&gUQEg!M`o#*M=oRttkT#%RTn5dd4Aqk=;bU_wE;=z(kkt||h;22;z z2@p6)KdM6rN>I@WH8jIGN`w&P35hOBE~!|PBJa37B4h;_KG9W3MI2}#kgiqfgfc{i zh!fI6Y@(u_5mbs9`sOaAKN?Qp(Eu?yee*^FC+oqH5~6Mlgut3yLX0r(Va7BP|cU|J6#zT|+AI{N?6IQE^# zoE*4x0x3}wori>%2)2@v1XuG)8J}1sKMIBpRmZHI;-!X zd#&g(^K_hmha(sf$5!^>{ zpv@w}V3I&n1|6Ll2&c_2R^f?_9`+0I&-9<&*2X3bV-~=#SX>F+Ty*a5AW|T5Fp&WD zR`v}Ws%#nyCtMRlCs`ih{m}k!@F8i0)Q1A|=wIO2SQ$(zky0!4vY=KXg<`;RizN}U zBEW${;Fa|@Jf$Ox$@9qT_c-+T%2kwxXX%5W)iywg#3@c=V;Bcf4*jUWhRVQ0Lu0(4 z)Z%RYr(xLGj~WrFz~;1Z5kz}(QU1=2ZoRXQc6>29R<}<)q1xxB<-KF5uG2inA_V|s zP~hdk{AVdZZBs=cEGJcSgTMQ zj)G)zsLB9ph9zfksHZti>>YSK0vvLR1W!8S*!P0Q(!{9V%)%2vDBV3%S8h1rTVUASR`x5Yb54ibX7dRBJD0=ZWj_?Nm+bD~(Lhe8Ua& zv@`Y_N5I%-uFw!iMUeBAU;9LtQ(kAcq&Fk=@%DW0?g|R27)Ge@nVvZh?kqN z>ra$|4Gna(V^KwUO4 zLO~=Alp;Dl!1kH;D1EThML$UZenTo3`944VIVmv zxKA{QzjW=;(uYX=GJHgV{@81Z8SJDykOv|u|CE21`M!a{#Xs=%e{N^~HlIRjoM4Df zs*dsX+KfcPH)3z-DPLBIz)zigBuVp)QoSAyuk~M*`CPdOY-(qBb~?VB4@`1dwz`uc zfY1i8VxR9ZYYaJ=6Ip@7^vCTn9R78)jhZ0`<@?j)Krj&s#@ia~Zw8|K)SkbEnj{nq zW)CpL4}_?^rJ`UAOwXq}pNb`+LeVPd3iHrv*WcpW5A?*3KS6O1lj~bWVoiL1< z3L>d$jNMt^lQ;w`DxmuRVA)qX5teY3-9O=K)-nh4Cau%jU{1I zu~{@6=rfS9zr})oeWrPLXteRMGB1T2O^)FS`4F8%ayyh)+5jd6P&F_`| z%<-avYcODL0!wKz>9%DcszPGI$39ymD@z=`hhglf8JgKxcJ4u>q+jt{V&W!j4-hdy zwPwsx8H~+r48~!Y(Aa2+1O6&Sq(UfRMY$hhF=UWG;$OzGoP|lRNdksEty&cP85ETW zI8Q2JvIfSqy(7kOx6#2HMf_iVcbV$+9EW$Ol|G)habbUAHB~`xd7>(+iLXbRSKT#i zhUCWEZMQwu-n%8~17hzPDfO~5pEy4-Fkm*{D>Nh0jtDJ;I#&gJXnnaGKZ>3su*Y^g zu;2**cp@fJB-_&tX>K}V?4Ac{c22ex>^d5m-*C~lz@WPw6*A?|Q2CJum4zw}TMutm z)0p2zN{Iy24ud3wpgwS@WNZJ3X!d;bp;UDi8L5=r4-j&}3pF_xjxy*bQHzJ-X&mYR zI#LXWM!|Uk9D4!YnndgdQadX6V!6M+y%7R}{&CC)C$&4TvU>G7X zVZ1Fp#bHn%JvfvHk&aZ%U1OkSCDU4h=_qE*&WD5blfUD({GC3C*k*jVTL~gMaHj!C zgQN@&wiy$%+bmz?6P)sPhd~h9bL*0w*iQpMFJ5~5A=G9VxR5{wJ;Rf*r$IYmD)ooe-$8Rs0VeW^v_^GCSQm0p-be%Rpg~Uu~N?Rm8ZB#02@*7xzi|AJB)H5wUg3QA!h9WMO zP%;w|6Q4tYa3X(4Va#UqF0OXM1A-Gji=dEz18yP%g>QRdXA5rG9xZg4BC|B4p6ots9>7NNWL{djF`#%3oVhzt}YBKlh z=b+kLe`yZ(fIS3;`t`B&#K0Ft)ba=B+UEm{d8v-fI1VSQI|Ptm`leT*FijC6KIS|BPsZHm!KNKJSdX}6=g-N+Zv~rdd&+#_!gjKay!=EI zg?Z=$Eov*)615dmGv_>|C6Vz@H$bL!w3ozpK~%Yum2@4wY9a0qX_nQyu&-UkNpTlv z2;Zj4QN^_Qx@B<^`(yV2X+W00`0>|%kHf@?qnVY;#}5FkvAGtNCHJq1!@>-;H&pu1 zd*fQS>hBNK`cE#612mUD$+5KU@(Nf4_1cl0BU>SfW4&y^p2#`)- zfLK8OABRgHngD*C6=Xb<_YV_5eiG^EfaE|(Fam=@65N5pX!y2Dq3|jmD8PdQ7!)Fr z0ZyzDH;*sJjlIT+%YwU&15o07gdjK39N~ru@Ey<%7)Qck+esf;2DGZXOD( z&10UtMTeuxIS!(LiQ_5|SWuGe5N6szVXR)nG5m%MjnmVi)>x2eGeQ2C4w!xuS=e@# z4ie7NB?lNYe~-X+CiQv>k9j7(+?fMm#1Z}j!g>3Up*2C>B&Z2!ZUo{9{DtE@IR+5* znOwkkAyLJ66r&9qU)ngs*B%6H;0%PLS=g#6DX43VNGlJFKFGnOLY+`(3W~+=LIw}a zy*cANUD%y5#Fqo4;k9i6mW2RR5y1z?=D}kUc!B{K17Ms%LZF;y@l3EL4EA@RMNlV+H@jDvU05h zBJmuF2!ai6x%6zPnht(W_jax-3Z93Cdqf$*9zYP~s5Zva$LPG)4bVnu z8ZEDgUr?EXzF*rssj8zp_#Py@( z#z#DB+kuJ@BkTq{$J&F~cmem1a>RX%VT>3u@Ev ze3Hbp0(_+B*%&BUXBfr?%@{eYn+?DloN$tiAj=klU%)sy97t@CJ{Ck1@LUUVh5`mS zU|}TT-2j!H!LA1iM8k(r#;n`I(Rqv68)w*f(ZP~*%xp|Jj11q7ejjc=)jEH}tVL7J zVlgZp!v++cOPq=e1;{MI^^2HMHU@(Jw5(2awcIYUmq`s1W3qodaIu^*lv?GNu z2$DF1nciJcrFUpp^yTvGQR?BJNCGf2QA~*F5!5G0aM~@vhX@v%!Uu@sGX#V+{p`h< zMPs=8YpiCYO@2J#Tw{)a-f%MzU>%JNj&>=FiY!X!t&>TU@EmqT2^ybcVx(`s-&BRT zpv+WYpCV2Wt)Lwaq8ahT$gFgkYKxlLL{N7Wj-#;`kT}OUT(bg@4pwAtiWOu6M~k%E zQAlSM<8m_O6uHagpji|Iaqf^JF=34kEj9uuEIlYHui7AOAP)c#GgPH1Pdg<$5*WBJ z5y-*@n~tPr3704r@J?&v-w=q{3$y4TME9eeH)%pTLrO>t=PJ%DvLs`xvAivP*z+{1 zCb3xfUegC*qeA$TKKjkwL$!=Ub zR)awshjR{#jm3ws<~Vz5FIzlEi^uCBtebon9koe@G@8;hF(U)@eODc(W3=KndSAX^ z+6$wtiMC23GN7VnYCLe_s;Vim$Q8!pNFY4a^>H6b`Hg3^nbdHoVF*7856N%Tk71ZZ z2&PNEJID>cg^TLT^be#ty~XJkAXprd{DxrhcxxCJ&8XS;n4vEP4BZ~+i0O>Eo!${U zo2i6{8$p=-giMa3|F}2;&UeN=p9nv2#`Lxq9pJDcc$VUWImA?QpAlJ?wvdR%;(~$~ z3@pPSbVr%Sk;*YhWynAr^H1~@fPr3N8Vy4*m&i^|RO5{iD}(v{O8SgM%!Pvhm8&xZa}5g^ zkV+x#=Hv_Kvsyr06*zMKZd2dmWvfi#CDSN(r|kJi{Qpf4I{)KB_=ADtg> z?&+N!t@Zpb6TSxi0y=F)=PDR2C$wXs4KhqX&E*|P1Pu~ML-SQSE)M}=^^UPBCwT+4 zCV?7{Vb&~HNfO|?1_lL$iT+=^3#kiGYp_G9{+fs-kEHwv1Ki?&t{2Zv1Q99#);1&4 z09%a_4KpzjAbN+|smmiIpcH>9ct_ska(D>8K@{S6yFn>9uh1*mNyOG^BBC(M+;K#% zw0y=~hq?V_2N2rO?`U*%AEmZB)^zKI#%LO*`Qc1QV1&sOl$=0weTM;ZFoqBKLNxQw zG1oz496_j5Oc3ONQgm{62Ic4f&Je@(GW^3VZrM>2uj(}r0=%Gg=W>@${7ApR%;*v8 z3V#7q5ekoJc~K{GoN+NgwQgmf8pRCCrq=K`Ie#S8P%nv{0&45T| z8HPjPI)h!>Zj?}8ITb)0t}a*M~L#4D#_R{o`CTYFF50U z15r4vft6QlpHUMF&Z4-govIv>S-go^q|`>ECN3)%h@{HGBdN%M7ZM4%W2e-`C8xp4 zW-cab)KP|~4SQi2h>C;Fhhi&lQHQ96baD~XmW8mWpyEGGDs>)nZ)v>P^#lw+;U0jS z=1OCj>oE9cQlgskAW?E>3Vs@h)G#wGBafXiLe!RW%@R8Hx05p`g>se3;cb?+T%%N? zt3PiKW6S$lhD&l;lQL!xCC25;B*Bql&36K4x#SNwvJgzinT80oLVM_rlhmUs>4JJs zb+!a@2vC9)c%9c_&tSL2EG<7z=_yYDGblOIX$1T;>)-x3!iREC-85Pw1RR55T7`&g z9`6T9JhZ&zMN9-n$RTkRB)a!!ABy_R+AKgQVh8O%0tvZFVOM~t>MLd#`;tJk3pped z^2ab77z3z@U(&@AQ(@Ss{q1{cEp?5*eOsVQ9Ct1XM{n?Jgtiz4bLkxDKe&&;Ky$(| z{&9(w1N`L%qnM;&$vOP9?eG*8tXDxu#Y5{dP(l<@M>AJLj~+Zuu*;(w2oe6P9*_ta-_mO?*ul8!M9mGk7YsU#D5v)m)=wqp& ziXG%B=P3_YyL)IDA7X_m278`N4zmV6zL{;2|u-WB9!47#KK_2`?uz(*a_q;-oaw8=2PEdA% zT^mMYofL>2vJ0`252>(OP4q-yOnd$AdZG~C*cI7{uqB=#N>zSDP>7*NW?^AKKwxAf z5Y&v2fOMlAtgg!fqcQR(YWqI0QzH!Y<$3O}XD*ZI$Ml6BsG=X50%jnbh%3>RKa7D* zO_&M%@-N=u#ToohamgSUe@O@lqr~F$j%ytB@Bxi6mD(DrmZ6gRSlyiiQGZ(=QYk@a zOf-TOSY$Tt*^BF~M+)XZvP3w3x+*M;@)f>@{=R1kqwqln`jJ8!*@(d~HU)Gregyn9 z5zmo?$p`b1V$@(-&ERg?HB3?%=Yyz6qtY#3WZa)`k~VUF_)W;KroCs7)Nw$I6DcdE zMl99OATtb^fc%39cJ|_36OFQr8jvH83!{1u*xB!+FwlvOut?HSLuHoyQbi}fC`~ET zN%y0_adB40D{&DxL#JOu%-%T~@US#}%rGQ)r*KweWssoxOOLDS`OTLSIJ>p^-L`X- z8dd1UGJ+U_V}n&sYgXHyQznW+t&%?Tp{Nun;-YtwQ7~%d@1LyAX-Zrg!Uq<^f|AT| z2zQlHX$SF|>M)W!6Dp4xH4>Fn1ydYZ(=wDQPM@UV&O?Faz86=jV5d32gV-zIzSTk1 zS&QI?g@c;moZ={(6DZpJJxeTwV|kfziY?$gNnP zoZoi>XSDmyLnINxjN`6Qh1WAzvw(TgZNb(79Fgij27_-~?UUBqCXyl^MmQoaGDld$ zj%qqR5%|%V@ur1H`1FSnfzEPh5#r!qM;|rMz6VH5CfZ;R*(foQ$3OUq(Y_+B7^3t@ zAXMRFmNml(R9B!sL4=ZGdteowy{->D6Vnlfg=S@;VsWDWq9SToE$XI=rMbtH!^Kxr z_+SNOdL%zN_&;6Qb1jfMsXNSX?c#gUaMMDhAl*n*2MWyuc1b_PH-8y$t#Au^gR&sZ zjRyk6Km`GkFvak9sglZ4g`E%XD_=qzr?IkC4bmw)-kaUGoGH^$AyH9{+~Pr_eS6~H z75ZEpRjpKep9?=x_@6TO51T=pB#B7|lUHveVbEns-_q8z`i>*f0x>pfna-nC^R7gQ zIENSp9mgL;eYjw%2=7I$^OY%>l+ratk=`b(V=?g$ivnhCB&)tkL5@QVc3*Z?Y%41? zE$0JqdJaS(G7vIt7AIzRa-DukvOLEsVCYopX2EKKVW!ua2N>Qyc@a&dhV{f6Jq|Y{ zY_-crQ((mF6k`SjL?uxRg+)(-6eY?mQnWy>)2!LjN;!b)XC!m2plQ0;#ujm76f`V? zf?~SYW2;x{=`o!hkm}-e(Yt;w+o~&K z7R7fl2UrP^`BbEziLKIs%u30EiHF47z%b|$n{~i&`BV47H}aRCO=ZU+ zc0MumlEbzNJUAj#EpC8^F-1 zRD&s*NZGS&;4xNpO$soe+CtU{NGvjxeO*Nbm?IkIJYSIFXl{CJv#-=}?l5L27!V>I zI|@sLiP7YH5i2jE%12;hIS3L$$ep3J4*}S_+p69OqgU?1q8IUnQ15`3D?cIJlz(reYQuzuMh980r{GZzR*3=9XNde7NPj17yx?0g)QN|o;nuPhIHj%au+9?i9zuUv7o}D*+l(dAYHJCt2<^!TkS_NVN~ppS}_hQ$Z$UxPQy>I z;s#I&0FVL+uT9-OHao^87en0zrwyjpT}*aV@diU=frdswm@-neR}d>KHwu%=U{RPv zfjV#J*2vMF*qGMw@)nnkoFl^Eq8V0y!Vs(&`3sRA}8;joea3LzK58MFIm97_p$i3ZB;yJapHqKXP@eI^75R!dF8a4EPf~-X-lCbGbDy&FKBaEbZG35kLTQp9V8D5U&R~4ye$r`AH>=G$`v}SnBIkwI7>X3-`I?J}2V8nVEtJtUeR-GVCBzB}yB^6g5M|?XcfO&JKM& zlzhj-f_eJsm?Vm!VM36k3}fe!z@?BfMKD4ZsSQHem@+_;(`Fb81`-8HjATHOgyd!k zmPP?%f@6dgn$oV3bP$FmGl4mV0U4CEEe0t{38x%JZ#OO04fkf%45~=Ej#d?*%)&V$ zELYZMq4zw$L+kC0!Yuf5kHHMWkzTPx+0|fFBkpL^tARq<8!E_DV&W#&_%nMUgg>Bu zqU0%{{bde~y0|)2%Z=nn!zV{{X0Z8V{qN@(k0)Xak@Oh3XHuwO&jWaWHm$2v$|mWC zr{<~dZ?)Osy|0Tz>8hldRj8YjUIdf0@(`OK&7A7=`ZS@r1BfPaB25_O*9wKZa)a^& zHe8g>L+Y+z{v1G_k|h0*+TQ>oPn7)rcO3N4C?t1}cDfXZ3Bh zbDAipprk_rCT$rcBM{mGG?YBb9<5L+HiZyfOVLcmU?pRCuqqsyp^Oqht4moyu19Is zSs*MuWyaG;Y#>&CvVuY7KI_U0hAAQzpUjFJV#AO(@s8-yq~sRc{N}LCAq*?llfV_7 z#CKv>UXmUH^Py%hs-gn4GnhHj*N}k2kP?|mO(f5DK$7rOFo5wF(eV4)Syi42Y-=QZ zvvOmzgPWPkGP6uoCLw<(+3=fy{jf+RBLgRNeyOex#TP!=u*s+|H=7TP>scF(E}V!b z&i*DGVQLC#G}%9JeL_I?nH-fu{V*5x;mAbx37(w&w=bAn;<}iR(^!s?rZP(|cQn~d z<4PEsT!<#sAp{2yPqURgyI+IFqz&4v!Orgp$Etdv%y94TjORs}$B)0qj@jUKuKC?% z_tvAgbek7sZ2FZ1pn}}a5fPci_@>FlHW}Sf5RJvhKfi&E~IT8@ly!E=Z2>uPwx>zv^mZq7e0QIeawxw70|`-Bu{ zAhIHmV25rnO{SP`#2M`HGZJ>ELdjNAUo-==vMVVqAQkRNd_8p;FjSr{9QRiaSl4kE z)Ic)eH7oiC+RJ*5-s~pXn)zD7wwoS<(0Di=avugNGumP%Xn%$lY(HiI@i^>yx#3zf zzZ{8#d1QzKhIj*!Fj)sA3<41ej8NG{JF#j>v8HbglVmll>O%Xy)=5CoIcg46uzsD2s-`FH3cKY5(3!VsO0>uo&ndR=q z@0|$RhDKvCDjU1<}Eh}&rb1v)+Yr6a(?%*diI#r?0kk===uS~12$4@2aQB_LHsiw}q% z$nn3b!wHO|=}ie>enCK>Ojc<7||atgjW zQuh4V2Y{c>EZKqT?-}tg`7zW+;0MNin^Yc?RfMiI?o6%6~P7XGuEI0<^6o0Xz{H z6>W_Bqt}VsXhl&hX^O$X3#lijdU*Tg#%+vpm>a6l;+dE3&GwVs1#MisM=HRJPjYQ- z3Hb;FN&HBHIAnm#p`8l1SN`G0Wf*qwBka$`ahQjLvH>D5%myj0b^+J;gcvlSDDe<EQrAmNFo*A&OPyDB+S->vMl?pJ11^|Po|o9K|OQ8;YU}2w$+S+z^PZl8pbA} zC&)Tgu~J{OOS}{pJ=XlMk=XqZFOM1v8-i3?JQP9Q6sB&`I8d$&Y7nfh*-2r1R3bLP zf~Bf*iL~~Wa4Q_Ks5a=~w>2Sh0wc8*({fX>6k%yvGBO^(nvdFz&>FyVM8iC3kdl8G z;Q~>V6gU#RzG7Z7m!}vkS_lj^m`YMC`HDkKm3S@?rLY{85CsKs4aArg>*`1delzj{ z8%zV(^D&Hm)|(q?p-7TGA;JlUrGR8oB%Cvaia2p1%kvau_%g)I86{0SG}PQIkw7sA zx=(e3>5DZqkv!+HFo?(MwZv0KSHemt3+y=L%z)_)h@xkL!&nE*TteB`X4~(jig|QF zErZhHM71*=2~JHCG-;KiMw{S@AM#ly6z6cJNM=A#$**{k9>jb4IR$m)O_&Zf1!G&y z0vFPT(N`mZ(%Mm3Qjo=>CzP|9JwQJpC1u8cXMcCs@-QDH>uJ;^wt{9RXEKX;X0vf- zRc@`3RaLsHd*0?+2K;rc;S((l zOglZW5?Mf`j1Vs~Ldb_Mu3`t7cv6aqFf&=8$)i>-cD93zA$P+l!lj%ME_F;zBKSfQ-tvog-lbD%Q^#cUw`&y8p#&B!ed7rbP64TZ=F^Hx#GE_

+$;9lLmB)#zij=IZB_96oM zVY8zb=N__b!GvIO>k{4h6``dVhDZiIG(Tb0N8DE07&@-Gj0_)qUdRC;eX;zrNFYZ6 z&}ymff&hj--EbX=^D?cE118Y=N~95}X#tWLy^=_ho8`R7_>OPZ0o-|d23cWsf=TW= z%s`gGJut=jernePpCn%n?LB6hN+;q#!mcE}N_mjmB>pO}@%ilQW{Hrebkq1O-7+Nk+y*AL@*4=r%h5yDzQVghX5l%62xMx5@X<@Wh*1u5 z=q>?))m=I7-)~QH9>{=tV1sD^$y`(XE3LYS2MakEDc#)bA|JIN+)(;RDIlG21Und< zUbYe3<2mEwD*JMHWNGE122+vBd~7@{{Jom|b1O0^#@gO1tzo@-bg-S)<3Oejxjvn^ zeBss*ga{uYXCY(P*mCmTq;ps>N1XkQUoUhxAoAh+qzS-;dzxXR8K8KgNb~EGWJLnb zE)94DTpSNT;V}Ub$beUXP!TIAKxi%<2r>q#WK7Qi1wyGh+Fre{5) zn@B*0VxHT^?PnyJ03zw^jzxNsIJo$hh>!DAWsK(2fSkWVWJNNhBJI4>OSJ zG^oSt=Hu|$OvPDcXH;Kd;CiyCg-t`l6+i|?9mK=11ewChfE}Y_S zu3H%c!#*mp3eHVI7;TVBz9=FBF3Q;Mo0ClzH$l<4?6j?sy8LIG3dtDMTFB28pMFbO zb8Jb@YYGAZ>Nx;Z0J9>{_nGDjL70C;D5>lN7Rk3Ge6nf*|Epv5C@7JcZ%CYK(r`CKYNN^#`rcyMkwGHaMFV5lim?A7q zpI*lDmda9sq-f?88kZEbfdG-BfeRwU^r6&bJ48b_ggt1QvU5fKgjJ+7U<3R6k#`QG z$(Qx?onqiD#l=NKhj`>Y^Eu)eiRvhiX9ya!!@Ut8HlhYo$O0Y;A!&s=!CEk2FT1eO zKO%q8O{ly@gnvQ_`%0uUU?AUuO#~mk^%*F@!xbc#2F*zBtn!T%0~x`)NQS_9cx;@? zyGilZtVjc}^LO(c=&leQ5{p_u$_mS?M99S`yTO9Y90Y@;o8XJn9m*9?=nvds3-*i= z>+Gk;gCX0uOd#>>(Ign~gwr72%3D|ztwL!w^( z2yp>JUf7q~k#3!htx*z;>a$~mvyK}^BdSDV@HnS!Ohpg+GF>_ZWp@+`icf}D5L#!L zhAlW1!wCr$(m!8|KP9wzt4kJ0HJq+yHVX zwEiuGsHMyr`y7^!VGg*J_k?@o4s&2oR^DL}4QK+xSbNGHJrt)Y5p)xnqd?krQ1ZaT zA`3sz<>Y~kDJVq&wN|1@(C}y8&P<3B+WOhHcV1Sdv}N+gzm69#X0l>v0o zTBTc)tl^}AKu=|YKtTZ%1+Q@;J!g_4jok*qp3$qV%0|LA{2JV|H59?hqI=a=Rj9&s zS2JO0;g;Xu=V6a~I^?5iuDt4epr+Gy=$2-onDX7ygL#m$W}bQVAg&!D(UiyX|Ea&v z*!r0W&l?$>J$47te)@p2M7VJ2y3@saRm!MAMwM5bQbK1Nq{nGSHA_4_$F zA24?O|Je(Rg-2SpQWv7qMD$JM`yUPNGOjVTcCeLO4YSOV$Hf(b5B4oH@HHmxAj|v@;3tV+`JW;I8!||#7&?mY_=r$ed5uL3PdNG>XS z%>#D{%*LvEOlo3eKvptC&DzKxhCg3ysyCe-m6Y@y4Wc?vgQ7Pc!`x?Ekc~>Say2}YB~->-`}^Kh?GO<57GfbAx$d2l`KGLP)06ew4ouh9zM-hM>LyDe}N#9JEBtD_^3kw}|_l1uFz_*~J)y7cW5NoE9h zzw%+9v|mA!>omAhi>SJbkPm5!1571~C)Rk;;1u^C&Pn2a;9&YC1gZno zIV{cEQZe2?Agr>pm8z-e_({zi|giKNpkH!tU|B*av9qs%Y-oO$s1F z5F{szCFbT0+DiS|t`~=j+5wmC`3Kbj?4cmh7TCaxu0Z7SaS@b zR$EP)EB#P8vuzl#u&`jgQRY^u#_CEU-6znhuKF!07g=2aS&1XQd}29RL?X;F5@UdJ zAQ8ER42&Gfp}`kgY)qV<#Pdi*6p-rNe^VHYT39m``s+3FZPY}xW2W>j|Lt~kGoidF zT}L>sN>L46!4Z^kuxByo__rS+r*-tK>Uswp&$=gm(h+b50!`F1A$U@Ld8=bf!x@7m z`IQ%w_eJ{6LjiiWZUGjxzXcLk1CjJjc&{dqrl`9|n6_+@Hbjwa6&M}_r$rVkMp&$W zDr@lIw;=AgcK~P_xz%fln)QONAYV>!!q*VrC{6aof5fogA<#|F`ju~qTje00(60E2K zk6xX}Jp*}&)oEKBwjw>_F;NAILI@HQvQ9bh8KTO`K=G>W0-_PjgGw!>63z}&SxB|M zH&fR7&QdBLsFT`JBl)@?S`KCxt=t6649EeJqAFQqK^7?)IJuZlk6VsJV#%emvuy)$^Xvq5p5I?Q0l(!F@jEUgir%}(8wmn>75Dz|O{`_AjrgKerj zk;6&SN~Cv@#$_K-Cx>2}xn~B@$~p@gQ7R?ULse8Ge~P`Ty6R7%Y{oiv%+0eSKG;HY zq%C(%YaTS`YzUn<&KwCEgIj&L#vmRM%H z{J(&|E%ME->*Tg9Fr0I_7m;~hfyI6eOWmxp&qRB5Ggk^B5M~B0JuZN-p?fUEiA5q4 z{tPG^%h3uL!#x;AlO8e61dH*}Ox{h%d&=Lu-+E{Px5R81LILd8QcgK|)fp#bQdQTu zyZIQdvY@Vl?iPJh4=uB%b@kPh$B8kG9w);RK6dh6x-s=DYYqr0S)=fDd&5OtI1<$u zRy{0ToQ7Ule@=38%Ixm7Vms)bcJue2 z6J>Yb82KC~(vA7{**I~}Odk@QmAK+D{M6b%$(G-nXQ_VSl)yb)DeH@d(vG4#p_f3@ z&$$_lIh7}7cQ)Q})I3=Zw!y$zmy?$DodZ--QkeOD3d#(1E*bmDa+GFU=^S~NsAwjb z16)rCiysILtfZ)%CV|MfAiDxk&6lfks&U~ybqfKHh3vE4> zt*AQ9t3QObHMk6DMQ(ya40}d1#|NiO5-(+m;(}olg}BI>`$_@Jsx`ic%_zpVdJf?* zxlLTPp7al%yd>3t-XLI5ObOE<-$ES|Qd1i_QdjWmN0&hg$|}ywTvD?U${8JZ_*bSU z*cldHT&)?MUQ8muRzfOg8HHuACy|Avu>+2x_{!qSq4(^FBp+iW28Kx?Nm|8-S`|R`TnIc+VNHAB4cIXN?^KwQQXc{WE6gmVQFFbuFOpq>)JP6VFC@RI+ zS}T3MrAnb|R;*$oB4fcEAU7ddj0~QD!QH4nCW~z@L&c?n4_mPIT)7aq`{3i%M9AXS zjb-?a4N?d|b!*Meb*#>8nu>!}X;M}>qbn~jv4%ir*`gUVvRYdBwHp*OL~)iD7aj<~ z-9YU_SWyDsfKs@E(K`rfANZlGRNPQ43K6+zqmEE`42! zvgzN#U(p+qaCJl#44V_3{dX^2GW|0lpO}FAO+4ogqdf-f!Zf3HS(yk(XMbO6_3h%D zl1*iwDY1?&Nub|t$t`B}tM}UZH_Vn(wXu+srV?&kvLjk@FR|Mrk|_xzB++4tRxSt< z_XQ#P46h+UNk($p?~EzzR)yKRcGpsqR}WE~i45b8pjuE;&Q31LkHVhnhrlv3g|#(` z91b(NJgdr6)@A*6Lqch@Ttz;U=NxlMl4xykwnN0nsIcfwV#(C&Ynsc*xwWz-A(-pm zM-yft%49&~WuUTGT2r0YcE>(enlh+wb=aB)OoL%Dn1{jeM?b_Ep*RmhDLu>NG3H+_ z-TxyDtKa40V&f_gtn%4mOP2Z;Ir(e-AIda&_!&Vk!z*5;#R}mjEWhzFDAA7c)(1lX zSI50`0hxa;q#NQxFX$_&!L1#o@`h~!(|hjRjQ@f&r9phoWXc6WCy|N*|4JuX0Q8VX z_^PD)8As>hEN+#%HSYMea zj(%FN^&0}UMacHSLoT7|y7XBUprzRZ7Fq9{Qqpd6mhV+r4Q1xhT3X%gD#?i9S|Euy z{|O8rqRh<<4D@L8IE)$l#o_zLg-2_>mq-d43|@YHTK;>y-HIHc*}esC1TCAg=%vq) z@|^oC+HMOH~}oj|6P`RIT{w(Qiug_Dv(!FgJ3GIYrcAvu7gD}oh-CO#OF0A&MD7gvfG|#sU=;-Bm*D z{H{!jptSO#VmQMDXCj*8{Sqp}1CA#5{>h>;CLid@9H)0`&}hN%9A_But@IvZl9FL~ z!tNWi<}Db+h(HSv6I?|0ctZYalzL!x{1)u%(YnIyR;7QgLZu9arI2|8h$AqW-x#RCrB7d!M)Mg?gHt1784EWaW3@vY z264fVYX%sjVWkw7#HFiIDGSppb)OymdI^!Vlu5e9bNBNhBZpb?aDKd;71;M)$f$qJ zy$yy9`nd+}5e{Xw_B}7^amV8)>dq79FSW>qXkTdL_2CY!gQ7Uh!_>z3G zZbwPV5zu@-U56#BpR*>!q*@jfwiz35#Cv&Dm;hyLsHv?n2+bJFHMf`+B4+Dh(EZ$tiZW4|2SO8Xtu&)X~12$|Y91YvuYz}D2VnJ0Q0<0_h1IpIX7 zjNwa#Ely&q67_MJJhQ9R zD-vcS;e_pXC>)WA6+vyQux6)^H3v0|WmHTwk|<^3Gh}{F@MkMGn{GFQp=o4=+98L6 zXHKL@IxsufVfDoqiQ+@>m=HA1tsD#i#v3}jRa2WAM^_wW#@Y%vzgevDl$3==qNC*; z;}|>mc^b^KW8-mEo-T$NfKAD&pRpJmp83&HS1Zl~v4Nl+0i7$eJqY>9tgnP>AXhD-J_^2 zJqt2k{2gRdSTh4cs>y^{B8T-5j>Ds52G(iJ(MOQDRZ+CK&Eb|LP%KHB&KgP&33(=F zkO8p0xMnM%)zp+zjY9$2Fl;y*E!Up7+V|gdXCAFss70nxD+eRgnDopEr0}7hk(?6bHaMJ?godh8U6Dlu%HD`}APQ5d)Zj^% z+%Xmwh@t1Ml|>TNj0Y?tG8|P|?;g>M$zt~B6ih91rqWr+)e^dFcsS}NPb^cpUIdxOc}$D)7_Sk^M$OgLamcc` z1)mx^(~-X3QmkSH2${*$SFMc3vEW(*kI?y4!|!e>98lArTMe6Ox<$O*C|9!zy-0az z5z`lhvyM%xN_J-=R5S*F$R}xFwHAPf+&&USM3Z{yiZ<3$h+@h`$eIEO0>Gy7l_)4N zB7!b98<0K{k~lFUHIPz!^)c<)G&5hbhqclgajik86h3rfAW4YTKwFH(77_@z4=8q0 zV{}cQlt-cDlZ13|Im^7enh@NCjNry%nihmhJM25sa4v!zWJ$D;+J2-Chm6_VicE=; zC#=y-o01siMC+m0+=q_A%_5zen9z`d{AVe+_ZxFSo6?<$>NDoY#%s;eaMdaos@9J2 zBI*Ivj_a5-S$(CMg&Ue~v}D6@e*5u>A=gv`Z4608iLM?<=q!X%SoHiu zl~*eiXykks(EKbr`qsqEownI?UEf`>37FRE+r~Wu|F)QovLhljI(lVy!F@ z%l1Rm#?29eq7%5qP5>c@6MXg%*paN!lBnh&BK024QfH^Bb!d%C9wfyi#C|#bGE!H; z=2(^_Pt*=TJZp_*fLsxnPNgpn88w^)%F1;ku~fom82bLB&P0qf6q74eXr@;@S_JrX zfx)lm?-bHRo0aW7Ld#&uC%G9QH}zJ3DslMr0rL^TtP`5O+TjGPnF^W3O60 z4*8BuCpn@@II9!@cNdS=(PG{|BrR3UfhJn-CPG$D1>>10AW|xRR8I(0ahCIyTGXX{ zgorgID?m}qT9{3Rb#}OAE@ILSjZ(7;(S0V1Q9~tEomM;X62VCHnxg{d^V7Fe;cIac zj@;iP5Q|rfzSbh!qCO5%)X3Gi4AOooOU7?wkcN#1-waRQ(%P&Wg zB_WBZJL>o)UC!kLi1L#nNZNhJe2HOUQKYP>GljJ2G#C`w;R=dK_{~s7_M%ASavagg zqNYa<9>nq-N{7+YV^a_ zBxFUJhNR2WxA8^!FytSY@?<`?<2jb>dHLO(0ut!$>l@l1;Iox3U*z|{I5tUj@S^Hs zA&BoHp56n*Q-GSJW-<3MKBSQE80eAXNn(~Xzu8u zK}{D42KPpbSjHB0C=IqE9fUV9jG#~>m_Q51siT+*+*} z$IHA%;nY?!Hu1&HSQYE2g|%o$Z?#aViuN-IUZx2$N$e0#2_d#X@-PmQbDu&FC&Umu z=RzY85djLKp@1IQ+#QBu9#shDDffp8($cdmF)N1~xztU}w{&Rp);k={jg`Rj>&Zv5 zUKwW%lT7CG`7#;XM*Z~oIodmOksJOS$3-@xLL+Pf%h-{b8G9)(fb5(xL)BiGfH z==N!8$P>__4LovI-konc-g|)X2%sK;gnbNBAY)v?5OlaSa+pT;zF>Y+0k&F1-gaHwsy)pQl{ z9|ANv%?em4Zh`}l>M1zNlcptSK>gw&RoZdBx!s7?vm-e`=o!M+6ci#^$axJBHU*aq zih127Q8DcZY%@Z;iNb{-9DcmIZlZjssALlfJ1&r4fmJe;IOCA+ncOqgQ0!<4zGJFFXmSq4Z3ha&LQ8%YcfSg>)b@c6}WVF(fgFDBRAJU9VO$c$eD^2GRsH4 zmWCovvw&%fQrAq4c%HOTC~`T}P>OE_ToYC`NU269e54u{0D~fmOyerE%_IRxZvBR5 zF{65{voK@15QAROD2GW9(pXcl?vg%jRT}q-PI@`lp=aQcmxl6LOt3D*$*;^-CD$8E z47vL5o8}AclNjNA$Z+|7+^@=EoZ(= zqT-r<*6`+`=lh2sdnd@#G9}LkQDes*W*{-J(uhup@|CS3;+EKFL@7%Bm13+n=qjbx$FM18{(X;dBa9zgZnZ9FBWH*=#CTJ)TRmTZ|- zakO={MnP7s3JeJm7%pHzaL4m(lWrK&a^d#!M3Q2nf&%iz;LTHt{wF!OxibPhkUE=%Jw3qcJOeRTv$&yv=G%kF-*~i|N5-K(gQKhE= z^=g%0o?h>h0c>hbTeFV%j6n{aNSt`g*P>iF7_h<{%-bJX!vX3Aw--qGSo&f@8fbf# z_1`TZAX-x-UF?scpc%;*m!Vx>E7B*Fs58LpG!QXP!6&iYC>a3xk2RF7CW~>Q>r^z> zGxrZ^&&EA!-Z00n3Wz1WnX%Mj=Vhg(N2FkV*?Kgb!@I_o+d2}u9vu=d-L>-OojKa# zWT+%3fkSap;-HDlRj7s>+cRhwtgV#B7+{1*oRQ4CsIQ;ibooEmT;PUQoWwqBMWSeq zw|5wD@xUTkQm)!m$0<-0WHXAP%}9(>Cet)OY3e=etlrNzSb$xoBcz#=Z2H{EwW#(` zCH2>R|2Dlnwf&Q3ud)%N>4WPxf>8}U0wZl09CS{SIM-J+3u>Z6b@{7F8muNe0|WQk z>ihB{j{=bdG@xbIlx+63$MZ%_Yk-T!)`&BriYm%qnH#DoJVFqmO0R!Er(1;nSMjqejB zz=oEDqzsULgk^XM9hNjfxS>KYiUCFl17@JcJc$GtQiy^(XC(mHfr1xPF@lgMzYVa7 z!3A_6GWSO1IW}Nwag#)ZKq-#a(r_V~Rn3cI1U?CNP_#lPo^We&-30hn z3BQv>4TfUEhz=AyVN8w`cMvl{IQ@_jruC+z6^9(AA#&dW25WDH?~q}|EO6m7ED6EA z?N09F4f)tX$N_9RQLtl4k@pcI21AuFNc7;?RMKo!8UmbE@)y<`DH($c2L@yaLr0i~ z<}0zuW%%#!^KJ<6z>cwmAzjNUNtZu3l|G)n;o$(@?1SajPIQ7!XMq%tKCU{RF^b7C zZw~RB(yFdl49BGLGsY4m;qZkgrMr6S_)KjKS+;gURMn>6MySE&zP4uSx2?9d%N&=E zUQXV-)H6Enyh~eV{6iNPWFHRXQOSpBZ|BDRFy~$i#ix{=r^RVu4VRL6 z%XW-L$%b`kV6LdH1a6?=oew?-JY?jqjyxD@u9^HD(VmSD+pdN;QVk;ynE2$gd?u)C zqiz{3cb74acwjSipYp`Fnr?DwplzLj`?n9x^Ru3|az zP;yZ`V8%P@F9pe&ADdy=0*$dpVh7oS=Y}bpwjM6_5j>Gtsp}l8;lwQivco8eQacY~ zCL!ygQ2=s_nDb+P}q!$T}SPd``-PJG#=gSUwZmSG8IlQ*(`j{^> z-wmSdsCL=lN$97GxEfO56IG4!&U7>n%I;tjTnhZ<{62PZyMfBQk*(qk z4V?ziP~&ZcobR0lEuqD637pM$lUqCfGd~{NjIJDaJAER9wM9Iv{Gnk1*M*uR6oBF5 z9CBjBrk+^=oXV3n-1X)y&7|wmQbh1I912Wv3QC0T9FnIj)P;m;DM^N5pAWYpK}tQ= z6zv%FB?RqM>oXfal=j_34IJ;17vghT7vxm!14!)5H7ul3WBDl6#WI{;LfggJgof2f zM1QV2{U)s@TR(Lp^0+|Vm0}w0@-ZygBOEq2yE2TuLQ0TnEKunab}mIBY25riubTiNSzjftWgGPWlKs zsg*4&1F7c{!fO1|MzuIG(!}jIGu9}MsSO$`sSD~X?=6zsmr>8Djt_d`eC-V+OQ)68 zj|}z%PxM(ut~)h2qQ&l6pQ4OdiRGj0IFi@OoFsNM?7DyD6UU+~RURaI40Q&iPa$Bt^F_}w~YZBoUPFxiM_5-yQIYQrQ>Sm{Mk44YFn z2Qv~LLd{b8$9nhzLPzL32y%P3oORQPgE$IH7E;6N_?l|6GgO37p7jd%K|%%kjb>NT zxO`kzUR+qX^d9u-IRi_O#`X=;iIXA9?4>)(OlKgU(?pOM;l@mhk6CPC3{hPtM?RW$ z90s+*6*XD`v$&&-@xA16$qK@~lp2PHXGv#+mQi64*1aY=Ol8bwv145`ryO)dr(v3! zSYj!*$_FV3_y(G#n7cdeG~b^w$5~NS5Xy2-psR0V8omPYzcB9>n{z1eVymnq70^bYI!{! zi84B0B8v|PB93(IWvJl|=`$Beft$~)vp21jNevddt|CLD6{-*cDY6D?#-{zTy}2wd zST&jm@IfwjAutu%LfcP;38(XVoSomDK3V5DOAxc2S;&Xx7(wDf8{qcSvDfU= zvQ5LhiOa>Y`*=|dr8GG{uB7gF$zjAGYs6<}{3f>sk3-2P3=`sJ^n;V|MjG(e#u64$ zJBS=%s#Q^(;BK#|p-14xh9~Nmp`Nq;qB^gypQ;k=8H^{u@^?Y;+~AXskA~Y9OHJ_; zIrOAco*%eIC8bpow(>SyU z)KKlTZDUx$7!3iO?|3>%ON?o?RrBhV*hsMXXwya;09L0t$!!5ZDK8{Uh+LU-q#(%I zi7P7b3(P}ic9_9#1OsU?^~8iIV>t^BC0dx}3I+|}P2`k2xqzek0APmRv`gobA9x+4 zfz7^54nvY>WDwP%%c?%v$DHK7R+@M&cc%M|8QzDDzbk}ub;u(J6HgQzS0tK^xjl{N z90pwB_8BKN@>>ROr3$(}~F#PdWp9QwsXKjIG2)byx3NFtoEn3iaKYB*NOH$MUh zZmGEmfAQrIVq7ade8|vbY^M0S7}H{oxm(LT)=m0rs;JelhfU>lMx6phGV`<{}>74p`YhcA4#L2uL6Fb5;ml%`GY8&Rq=YIJZyAl|VeF(l{ zEy9ShD3e9%CQC_}zokdmd+umMXDLUSLoG&7fy)wHZfDCtEfv?VFQm|c>XqzEnGgUX z5lIIOazu!*K(|={yLD5HhoHc&!PQVNnVl?1{g1i!Kc+Y6BJwAjx#+jYsmIqoc6`6A zM4V*~EF_Xt4*ARr@s^pShs!*ymV)*}K-$V=PkEg%0IE_My|V4pLYSd90#H;3Jhc7A zeu>{3;|;kMSc}*!VJj6~{xTq#WvH-eJO{7}^Ju#EmK8~WMb3kFM*!;9NX~fFyh>3U z`V7D_l7@oK##uL3T0=2`+;5XL0z@d!$aPZ_bx%YYxj3RZRb>=O-!M>lPQs9*`p?Gw zNP!;E>`y{+kc3lyJf>J5gyhsjQ0#V0Q%R4*CBnZ%^Hi+#(bPV9&UL;~@FQ4M0pzAd@5#B79x| zQa?a_;aGXXA!6{aAUI4pL&&84mkuNBk_^=uKVe}O0xG`tKhp|J>P!cr#^GG zaZ`6^eO{?6T)jmky?>eS2W4u~PO_asNw%qL;Pk0SG=cW2IXsBL-c z9y8j`{Ptaxt10xYaHzxWB$t(HRHUs^mEk3V-qb33gtD-uQ`9Ae-E^qw-16_)+=p|Q zexHT3mrdeZ4C5~z?*9UebH@=YgqL+jp4WBCq284#FzI?zUfB%tmn$oUl$O;m3rmA9 zm6Vq$*RtVql6mKa21qz-VJ=roqo>N!OH1AMehxlPCk?oME7R}qeYlIc_v`gS!Sy8e z0igV_eIqByi(kGjMPm`IOE8hveZW}8%BLYxQ1b=1L-KG^tKo> zDK@a_?Z~sRg5cEp1e6qOL^Oz-$AkLHP`-^R>$*_gal%NMi8f4NfVxaU#ouMQs$i{; z-v?TTOM+QEGrI-qg~f>=UI3cyg0;0{kmX4?V9EuA^-wu@U6|g+;%Fe2whzNARfKh9P@st(5&;M%B3R=GPiGOg(Cayl zn-D*JRALf{As~Q2X;LHXKfs7!azTg$0w&JG6%-#itgQKe5t#A^@kcNPiGXClHt*(8 zTp$x9o&6{C^QFph2y-9L_j`=TU+j2&e)G%jZ?UIY`snxnJuL0r3;sy8YxP#+GrQL+ zZhD#7zoD$V@}G2UrNmCgs<>gWnbGFzeXDmbz|cp@I7Ol!CP&1?>2RWSG&zI#H2cG# zK)kHKtm{fD44QwWVf>zdlg7NBJo=0@=-g=L<|>POeV%&OHgGAkr1=M51A7mvj(t4q zbrP?=!D{*o~Oo}FbA3Dj{mo!U)yRDFb?R6j$*9QJ7BSN`i>+g^A)K0NFEInJ}V zykeU8JTtrI%=`F%)VmZ>MHkjsHyGT*KxP}igS)wlO>}a_Q-N}LuQ#4X82*;w|0t0FA>4B3_3C0!$b5rDPB>fP&x@FN=Msg zlB16Ej}nZ}QP<9K={e7fuPQDm<<+w38WF7h@aomD%noymIdTEd6uKJvI9%9U&{#ys zZy?OLh>2dv41r%)A+5+r=wiBM;vue!1Mu6-dyK}?28&EF<2en1AkL6!WCLd9CKe4f z6PJPMJ%`Kl{2TdR6hQb$A9S%4turhzOcrJ*55=Kf!!1h`6n4H|J^jbrjWWL}L!?3a z2L^_s8TEK!GOuep_WDCKDsCtne}}v#>P4hV1*BK~HKkomBQ!)8N^B z8@{rCe{sf+R_NT}YYp>c#0!Ne9o0bj*7|&O{j=G+6KW>!98tZ|eWvpL<&1L7pzv?6 z2rq;YQe+;$EvBtnW+a8L>0JjOBYp))+Qx@V&d6cM1?v7k%Qvz|aK>|seoE;4jXjJz zQbEcWz&D7}SdIFF=Q(R*y5=D8r!IG7#$%Sz7I(^t&iaoiRn#!W>l}%d&m-1#VG;gi zhD9r+qI90)<`;%0VAypO@xP53dHf%I7DW8MhA5(B$;xbG9wyU&i|2_ghOzvd?Zcno zT)TO(3Hp2K-UCQM<-mK(?pc{m*%!sW2$Xb9b$*#JSfV-uR*(%md< zWW9%CQ|gwkBb21LXFY-6^Lf14Z@X=R-ZwBQ@g9PnJjUQWnfss`s5t&Ef+61z06OAA z=NTfFxQQPBcR?asZP2sx9zVGDTd4D!O-4m#kq;~nXTP({W#UBh>LVAg@L>+g!NTD-fXcvnMxG%#1{n zD|9%7l_kc{EVmY(evd;HF2Y-Q%WlwVq}(+|Z6h&&a7Dpe1M@2gdmPLgSZMIgu2fmJ zK!jS(qJ4)GIfz<(2b||3T3oagnmODDB3@soo}<`g?wTgNzXyM2#q$i_)xKPrJFe4l znN3pD=tr?1f+9!5O&!kh=Nqnq%lA@5q;xMIteMRk=EJ{5DIt3xk2O`hQ3r21rZnYF zWamwZl57!DDMF1gGvyURnMO?axaKA})1Fl@D$8KYJ!G?zvUP=F*I%<>b#tAJdC#TX zjCz^-V&z0`vK5sQoh)JDs{HSZ%cd|i$9yBpS@6oE38T8*Xt@(f7Rq0mYwx|~zbn@-`LG0$p%*>&%R4&26-Y_Zo{CBO;Zsk&NioTI8_KFh z-m^>Mxj$6k?D>O?B2RrxzYmmJ!a~P6i}0ti+KKEboE@OcRH>g}gdNJPk`h#N*}B_# zs5RQc8VlX9kbR5Wzk_(H)WZuka8(mOO*}}TH1y#p=53JVx_M5f#G%4muggo#uZ06Z zL!py%ze{y7)r;#VUsDclqKYUbIvAl>vgg&AgqKyXYGQA>fJn_$cR5Ta4ylH!Ld#I- z7Yb(r5h@@t)k1a%-`M9N@QbLhE~eY!b{uAJH{5v3wn7psJcVR6UIpQ)cb1XQdbw#F z_pDDA8tQ@M+XkT?(R$AxAz?)7VlAaZb2~tQ9el^?xV3vITSwS&6KyC9bkuT^ewnEa zVM)Fr0g~iAtH7jIxza*8do;IIXJy6bCZbW`fb4-mtPU}PQW?y(d%@9JpV0rOhu=yKT2r3&AQdEAzA*(8;UP1Q5aR1L2dL(7kSxXPy&Do{Lnaz(%ZMxpRpRZw zq01%Gd?bxmFN1iiApD1ftrV;+Trs{3FcVzXNVE<060DSvfYN8%3g$H8Vnw2tuxEp6 zb-6TEwz=dPV0&nw-B@IJLw;n`*R-g)p;Mh!Y+ow??99vwI0h>B0>m-{7xw{1`?3S_m({2gG9iDNI_8mKunN8L@+TZ5hN^x z6;V-I%xH;18b}F>Bw;O12~-DEoPdCl0stgKW0_S0eG!NGp)gt~i729qD2NGZs-mi@ zs;Hhu!}@a#7AQ-Wf>5K4z6KEEq|%=YgL-onIIuy8dsr!8zfE% zLu-IaOfcZ7h|Iena3G~&gf*D03LJ?8fjmo+BSNB&vcV({FvA%PAtV@Kh8SUn7-5DW z2$6vZ80VDI>IPv*NdX{b*briv1%s24JxnmVL6m9379t4VDqy4#!*HMDzzqW?$1zF< z5Qrp^BmDpK%o9LTFtjrT8z&YQ{$T+Zb(UGIJw_eovfzb72v~s#A|?|oc?81}We{ai zj`={z1UH#gRZ&$$kVZ$8U@1^tQbh9lPre=gZxD5h4}YiP^q-UAF7FZXW+Tx-&Z<6t z>GhrL!D;xJzCSmI97G6C$mLvqXb+wS_#?SHZRkFAE<($e3A@tWX2Hfp(|{HaZMy zJF(T#!){6`gKZ9tp+gNAIm~AhlNiibkzeY9#2IK2bBbS=R(O%~a>$DEGG3P-;MHOH zp1L{Moc}EWK}6_ciY82)rpD8wZ$i!3W~9Spsx^MuB12kd#+U2phK(9%4JMj{ta~#t z3aX@}qI5CYey%W4C_eGeCOtI3@b-j6E%1{Kf!)r&snctbF~lZj2no9w zS)ffLl5`jxsb*DB(F*^EoIPX#{gwdJ%gdz1wI9ov5wb}bNL4Y9=3!fceW8jW>?vq4 zP;L3BHLEos6oYquG4E^~<77bD?f7JBJ1g4G)v94#sUqQ$J>Ph>}7;eMAaF zr~o<$E791ronHxb`~PUws*H7zMEyRS8RM1g#7Ezs5E} z2Lm%OY=u8eVd~g~zkp#Fe@O=xl45%ik0fCbcN7ps6AX+b8sm8yH-K=HpyLc;YJ=;l zs;Y{rC^klj}yfe|IouMOJ}rU6^%BU>f$tV)TnIeJyIELTPN3g zDB{OjsiuEE2Rc&*2Ae;QD8aQ@8QlQAM#eFrk5u5X2UrnsXqBLSnHvruVRYOma9%ZX zFl^HsLh98T7(I~?!j$Ymu<4jYK?yz=Bv5K_z`!CJ8#f5g^@2tyb=+{_l zL|Y(>cX7C|h$N0q4jV?&Ooln4R<2o2tRNt}sf~?wt0>J947!Ga{HCU9L>w@W5Y!b(FI&YATfr})EObtqni?=OHPs6RwmUR z(xoW0$PK+nJ_iScE<~uqO=W?58&nPvz0li64zSYM09eql)Mkjmp|KQcMszs1@(j{+ zF~r6i^A?8M(^fFp#!-%03OJ>~+-w@Hqay54O_{llcpAlu*@m8P3Vw>G}avUF6^6-i$xpJS0#&;{Bn*4LHm-&K!n}2{6bKU?7<~BX9UPbR0U&2$qIM z1+o+rPzrf`|5MsEQK^KI1=o zpH97K7c`sJTw!QTHDd0DL{4)HAc!bNgym#{C(M^QhVG$h;YZ%xuK}3Of0p=JUqqZs3dIwXk z!RchWoRbHk0n(q)KvHlDF%UO!*yPkLfS4BH!pb2Pi8p~ohshKX-IRVKbt+5NF9bV{ zY4=05L>faFhJr+tUAn^tK45Eb%yTWyXv}qW3Jd+FiYOAORRSA$mgvlTwWNa;nAZ!b zvv~SVnU!B4a%&PzP~biYDK%lQMxLh!ly-_D9k~V-INBITvOQ31n}|fwNNi9UI{?QL z1~6U$6cS)|f~ll&hE?BD2J<4ugC~)=MnZ{LV_8N;yf*VT2Z$gk42%fFNN;1KZ5lM@ z78OC@hfs<`jExRqz9qqaF$)icDIxxq%sLWn*Q9a6nPw^iJ~HFvO`*&R z{~{WoSm6;80BJB%ID#RzgS>R2h(&}e;`XLI%%%-th7>&7n%1e0GbxWVDUUNLk25KQ zFvAKMRbmMk*<7%jDfZ18(;FKe$cdsUh=B$+Ha0uHYJYuwDmbA8az`RDjY z_^?$Ygd)p>BU>F~1k9^1S^I~SKI6{(DQax0ADn>G=!}wppo5}>7{)=6V+ay8)I3Ov zQYeq4VVxuE2+)4J(qNcIB^V%>Mpy~NL4T6kd?)8A0Qo>cat-j;RBa>DN1P7`$KkO` zTbl-;{7~}K1EO)6Ax2u2US z>&JoqE5)^?@(O`*gj6wzeiN2}NU0^29{li$W?#*@QL_X($Y_6WFmn?LOLwuEjKvLP z4ZDv8m} zE=~vHOH;UihiwTq6NFg>Bv>pwNJD156{J`CLS1r;)D5Dsh**Ar=Tcc1TKlRDFa(K- zh&#l?u7kuXzXAGIFVTBtgL;#~BQmhUA`eN10M)yG{rc26K*TU0h89>PnX}UfQJ7?<0OUuQ7%_);c3Z92N%NrHU_KuzHj)%dWTq$( zRt#VTfS3~RXUD<#0wNA5z{JIfdFM`MCOQDB3Q*9`OT)C9l-I_dPuSqW5@QxV9FFnq z7(ig+H{3PHc6sdNN1eo&&>WHzghz252B2rj`h@r$J9!qkSulAs4CCQ)8o|){ z0wJZi5&+a8hh~%x7=gpvVc+W<2}rB~e7=Wu{bP7=LCC}RJ-HE~WP=GHgr=lLy zoJ4kvCow{|5wOILeQzPHp0p%(mlgy>puK_c2F@j3yCK1c(l9>J!(s$!90CIZ2M8FT z1mY1+XMG^hCJno0QOIi1U%9d|RS1TOv_TN0@7u?!PGNW_GCrYiray+=k*^gAB!xYlxp z7LP-qQ|E++ze#ra$Tb6|bD06m6(#3)28H6pQjj(WkeIc)IJ0_h%m>o&Z#k9s>NNegCMzOO|LY;* z%_uYB1{49BNjQAR(kh|i0r|)(@EikQfXQa#1`iCK#urw?24JJ^8*2ll(uD*e1H=fG z0I+;z8-`J7jZh?Pj)j|m9;5>y0x#XZNrE^xt=ziWcON)w!O_V95ve4bj4(k1RyZyT z3k%V~a07wC!G;)Q1cYnl1SK!v59y{44Fxygurx`rs9rS+LMEtV+j&amu5{y?2y=yp zpGO3Qgo-Z+u*sr|2=6}`$QyeE9l@Wd&WK&4n0qXA9+1c#gAb^N{XHp2k!$J7O*|VrUAw0)MHc=gV0f1=~54uP2$}5C2 z#1RlgK@!Ch|GaOt+YdsTIX+N3z~I_32xRvVOr;EvKvh&kkjRq2kiihtz@6udqQSxW zADrc9Ta)~ucy+RMkfzuA$PfF3hxsa0CRuX~Fr>5H3il8psHP)DL8S#GiYYF;PAy1X&#QFX8>;TwFxJVS&+tVo|1^;9l z4gWFFIPVVm(S1dQ1xM$B>F99NOuTW2qQ5IdJ%{EVg-56L&qtKKib@j$SoZE7FtN*s z`tukURAo(&^E^CO_IQ)k=EFSMW^=uP$E{Ww6}@N zq*if^Fu{j?o2$3N9K^v)V)1}uF`y(tCK)6AJj8k=owjk?kLEh(5bp5UbeQP!9vmhd zzF(iQ28112sDcgJ=do)4boC$1o{W4PzF2Wt;5&g#^~R5XIYGh6)e0$Ye%~&O^yEl| z2D^&5U+h{bJQZ_hJ*DM`&~aV;`usy4b9tY(1z5-sapuIhDFUwGPJ9@Vx;4fn2^2Fi z^>&0O`{`Z|Pd4J)N%z;SVXoK+q@^<+)>Y&x-A^P zcVX0W)gGKMX3R+(tho+zdF_cD2%1h_T(xhgSJNw^-4Ud(=$}nBa)s|EW^FS0p4nDx z880fRgac9R<_^Cxz{m1txXnivwWlPL4yW7?RP6s){;%Vw);?lzba?(R-!vXgzzhUT zku=3aFcS$MzhrtZ3=gg%r4eyUPdWUEKdkFAH73uKpy)~hL?Az&Q3Hqo)E*_2C}mlW z9m8Tjc0>H6MZ1Ff);w7Vp;Pu)0qg%CPrX7@ehuF$AtBTGm-3CU2DoDY>+^M0-4n~; zAI?%~@XyKWRrgcZMSdr_m&0AHJ3M9UO4d3+ILRb;Q>vdc4NhI%n$6g0$~LP$y3Kb^ zdTKRd72!PS^M(0svB~U8Y*3QOQ7C$dT^`%D`~*ya4*PCBtf`p&Mg5lVyg8N{!2cUt z$>p0iaeTRCVg*a{jpgV$%>+*D67&QPYR_~5*@hCBi2b?37>`6INdh(Dh~kQkBp^2L z84Ac5i5^0I#Q`+MD|5i1gPZF)0@EZuk{Q785F$~tT!9KOA^VZ^o{X(_et;l^9DGM| zNcqRzG6yGCTM8T+p+^X@otQJ1Llr}}&HwApTAX`u(oP3CX! zXd4jQru)&rn=O|pI=8x5WE)VxeWxXae$l09pWpps@mYX@L~$Y@C-+Y5|B(-Sb;|%LlQy!U<*Yej*Ysk}0$nWyVNopBLjvIg{E7AH7zW)WPn3{| ze)|FD6itIeL;R3QEdAN{eWUSTx&GG|{bxkS{--@N{*Uxm@jH#T#}#Yh{x*FNnp;f( zd?}ym_GgV-`#cm&qv*sRo?ZRkGQD{xxhL2R@E||%z&;1lg3x@yL{HdlEvSk7Q-`vj zl1K;O|EN5LuObu7v*P}ZctL-Y*zH2zY6vPWKt*+&v?Lo~Ak5TFi7u4;C6H(8%lhy) zf|SrGIwx^%1|2vwp!$ei!$#x7$mhb^FcA=QACq`H2>{74k=~AxMF)OSYIB8JF{cmP zl)*Gcv(!I?Gwk>A50~quLtnyE$?7zEeiolSJV$f~RqYs_mW*!w%QKy{i%IKavd;f~fX4x)|H%;Tm zh_C8nGR}73zX>uDt2;xW{3l8KQXt^j)hRx54{SqFO#%m4_{tRuhJG%n0OJT4ioP-j z*91FVbcHoX*rLC-klHXkaQ7e3eO%%04M6{hK|XR1GV;+#0UqcFAH_#3{$5H0njjA> zM#uynXS5_CMCg#j_h+GdBfbM_Kcph*f`SP?L()=nBY{lPPyr2s3%&|O4|YAia_RhI5PqL-gn8xYJR2(R2|iaB({#w9iWGxtM5)%d_YN7p!jw+OE``6WG{KxWh{JiF~#Cmp9!|SemM~c(c_pEj((boaJ(2n7ve=rXA9Ys>3K01^al-??+9vz=2 z*cKZZ?Y`$hd(Jd>L209_#1HDR20P%Ui7JAaT2MCuxnbZBn6>lAP)E)(R178PUoi^GkV-^}H#kAo5X2Mtf(T1iCE z>Be2V47{%fGs>n5czC2lW=-)jc4TZ}-O|*?Z)=(vXZf~}tPy)yP!2Bm$pOTXitLp- zibg0w#f~RoRU(xbK_GB9G*oHxZ8Z8km*YLXF2zYdfMZ7_6yi9LWI5s$T#VZZk_KQa zOp5`Cd5dd|EE$ivYbuIDN-lar;#mR@P(IQN`xq@uerGBQ-Cgbc6`tyjB?Fo#R$)hC zGX6s^fbbpX9^fxlzoaZ<2u>%*4>wTtBL_S%PjbC!4u{-ea$hJH=4tdoBvaBbHT}=K zO$^^j#%&Lis;_$)-K0z&pkxyV1n59FdPI#$l4I~3g`>m_#bKo9*dGPJNcK2@RVE;h zg!opVB?EZ?mF8l?56p3o-fo+KBppV9Hh3rt{$a7kY$e8Ij1P~i3p}2VM zFBn^q!4*M8yk4k4&|+A67$qimZzCH9j144+LUhR{R-aOS6UvlW{OPif+>mE~H}88g z9en?4GkD|2$a1TlkXkbgoHUN6+{_#Ukj>fXfZUTWHz#v^JEFK7934^L>rq>Mt3o!B zQDbGg>o~&fs8sAAL2@y+=_85-9OnWIbB>avITNUv&Ig#9B$vLH`7+*{~9M8fkKN+EEeL)oMdVq^Q-Ti7ULhF+By_rTFqi;{ zJC){94an+Ko#7D6D8Rr6qF*uqe29o5J`><6edqAF4xmzvE`S$!U=In}UK&ESISGN@ z2oO4C2N1&k_1DQ2)vw(v{g97T)9pU_HxvNl;8Igs@ z)0tAP)h3Ae9%5TVk%7_Q!U2LAC7F?1BvahB^`r7mkyxQVx$%_t68Y;r#Qf3dF0oJ2 zp3Gh#_d^&V(-$v_fW$Z*XKN>EXV1yFh7tC$Fl6Xn%J-jputgMo@+3?|XYMT;3=;}I zgfm8v;Ee0Wi`~#TJkAXHj<9eTzrIP4O4SjO3LraJ4pfxTZ1i$}8V(J+QXHDgf!SvP zP{m=k(jtX&8*ny1jKPn;Oqlr!&Og8OY_sbBI{DA@9lQg3`-+L$sGS16WI_=S7WpKh zRkVuBzqjxIha9#6v=2{mHf~-vf#@P9GCEDj(l}w}?SVjg5O~x>*F$Ohg)w~qRC5|` z0t-C@B8VDs{@uFPOqXF$l+a7lpgokj)2xJOMTMF%JMW+C7Q{|Za5yjFrvWj+)< zPM(>F5Rk$YQ~qNxvfq#@rnDm3h->2dzMbZywyw4+^kY?D*H|&I#o*c*%{AmRm}Ynk zP?>p5IN2R%ym1|;c<*sZ@tYTKG$ss>>(0xLGU6+f$`Fr@obr4+zI&gNG2h=l1Gij|9Uo{offwtTD{}qM&kn;LVq>>SxBqDSWG?~beB2=3}UxEP}e<5rQK|yTW<17jZ=#W;iQ!qa%u68e;@&sIQkF=n{AR-z%sCUBd+47`6n1B=XKEt2v+YKHF zQ66XTZym4q$2Eu4WDFtm80;i7*pT<1ocPai0)iwqe`Y_3WbF1ZA^CJEQTf~e&#=V( zDFZ+X`dRi4ZS*e3V&s(kt&|qs2h3}lA^rp6G6AfgwB|noeIQUBz6PW6=55QI*jWZP zM)2{6?TePKZjj4B!fH=bp#8y+?+x7(QDS)oh!h(!oheZ`a@|f2w+{zE|FOi$h>3xa zilm^KCH`D6DPoD*0+=1gz&#EFfPYSuAAptO)Al0_5Hv_ z=E`|t7#nr}PJsK*<(jYD#Wc`RPE%sci;H!8GFgpIemo{^vw+iWcGu&ToiZ#v6n|c_ zfh9*0`_93J6b423pLqb@MW42wUb^$2*{kEveoH|+2=>eCuUXd1HIYTd?yq4iNX7u) z%R#V-=0)gp?|$;rqDvM&mPY6Uq*&RRKw!SZNsLs6S{stl(5cPerZE_?v(9)>9A%{n zrde*#Ts@PFcXC(7JFzWhW@cs?nVE%AZj1MtjGCGy_@4YV_-_r0H$Sm!u%>i2UGr*! zzd8j&49F9=V;Wehw!^8ScsJW79N|qC$*6Q1D$P79k6*nY(0QES+`x3Q7cv7zLbm4x zj(--LI7SXZhGyJPvuBFqetsOD{Bpnz=8<|EDDVSOi>2g26dC4&D^Ph*Iu3*$A^T8z z(0WjLkar;P=7+$C^{Hrh5a>h1C$S0pRP-VJNOb6m7nRKBJIr(=K}jz+<3APu(~lY0 zX!lp$Ul=v#@$Vhu${*el2KdG84`98g!YL^DMdS+t#H>SDDkET0A2o&Ad7VM)A|9&B;1WeWJE!UIASmSKIVY0aMUpyC(OFKDJrNF0+|<&1o)eeT$;El& zhkg_uHF3`@t#l6$iwpTAKLn)m8rR(ewgI|DOhNpgZ7rk&(I2t=Uie?UJ(p+Xd~C0d|ILgFAi>I-p>6;dIO_>;mQt!Naf3_qTBjQ+5 z`@XXj8~m6c;t-JnhwNAHV}#IdOqxT)kUqjSDN9dDQ&6Xg_=5wn0uvDk)jKfD6H|foYtJ`MR}S5k4Qmal@4OJE%7?`?op~+IES+ za9%_?HaGQpIQ{hmyHwClqjV2lMJEtqj`WCZPt}9m?_ZurB0WgSB?J658&VhAD$*YW4~l)n zzq$ZyH|-WO7=WOCLJOE+PIng%jt#r)EdZqM!2e2ZFffE7 z#xxd(Zo~>ZPDN01R|9?WP&5=ZwB0}zTptp6>@}126-S|pG?>dWf&z2^A9w)tg77{E zQ|KF^D$>(nB$Q8pB5qrG^gj)!m73o zrc(pFB(#Q8l39h2t}h~13=O5sZt|+}>4DK)1Uu5h zC-#v|tWA!pNIA!pOLnm9O8_^9L%^Tu+`yGW`oCS#;t{kXqI5cd*rhm_IxW6hx<-BKR{cO0|mOosrU4!E*NA1VVw{K3C& z`l_m`kde70j(h&s>~_gEUnd0VzoXDIf$_m?eK_gCu7I9B%qK*3P&G(3M=c2sRGwl( z)M;iI`XNyVyUOmH21Lwb6zV;u;ebzU0N+jSeo1lxa7t5Gob%n4E6v88-|^SFdHYe9 ztlm~}n5@0kTes9B0BjrVVK6Xq?7n%IfvAWh!jNb*5s*kxaC-tKq+W>N5$Rx{nD3z{ z7Sy>XX`XAdQ0#gKqHs>tc+5`&MyXv?iWJP8n3&b1gF@%m-u;+zhcz5@EFCXpz=M$f zY^LT=ihDwiT*sJ}uL<1Fgu@N*fw9#_SYn<6vaXWDI#o0!%WhA zj@%&Toc0chyk2~cCWXjGq=-mp8FHV1?K{k%hp2)FXu<&UK0|JzHW`ovN!=zu@V<5& zy;=}}h8Qt0WguA)4v0Xa7t){-7%$?0#0sPezPS#svl0>!V8OAG!uKMkfH_7&z^*)N zn2CRdviY>Ocm31n6PQ6?;eJgFBlgY^SyQ>XuDEY~)uj(Ubr`v#u0; z6lcbqTRxJR8QN2Bw$W*gk_&VRn}(?IjN*J2YgB7srFdV;UB=*j`thiI`?5s3I3-A}mJ- z)LxiONH6C#jpWUKBO?B>3~a+xKTp2i#D8ZvBl=hz>7^YS^(4u`_>Z8`zSto0w<6@7 zY9)o9m1TF0EY)OHCMz+a|0g{7&pB#|ysEuHORK*v*Kg^X>o!zJS4A|^70$>}gWbz! zzcb)xIAv{ek<2$8`6%_*o=D?gcknqMQu&#W1e5qfae*t->UmuIc_QbmOKoe{7@nT2 zrh*PU?pVuzZyM{}p65(64?_*aIh@itD?Ak7L>O~itb&$vTC=yJoNqjAx6e3iQYICO6KL{#DPg(@FC4k^71@vbkc;g@w>cctM5SX zv2xK#1jO3mlrk%o6OX{ynBz|hY+#nx`?4TjUf3z1ADYjv4>b|dO&pQrE0#ZeAkE`` z`*OE@g%Hh;4f7Wc=vqZpaGoi$d@gC< zTD|-TF|{kwlfo6fCnqk$5_W4udvkTdpb(qmn9i$9}K8`Xm z#06G}o_2?0y-&e@|7@QRi<55H<4NE~kWa2Ftq&6?q=v*`Z7tzUrXBMrC{aLGM$+{9 zCj=BUA2Q!QS?X@81tzWQbXpQXcr5Bhp9vorP53@Jt>*_TlVJqC!G)J z2K;Mg8|y$H#(pD$B~x(3REljT;vJ+g8=C!TWstOuBM}y*+>wJhFJ+&olKWxSq1a97 zBO)b?>ZN&LF%f9|3*+k7s5*zvTWc&RPEg5Ua-tat5#7vMQ7q*3*C@&bW0(+87?tLv zWg%unJ(#Dn#fc3yI@|+9^7;w7nn;{EJ?d2>r`+A^{O-h!F zRAFt2ZsOBCv7_?P`N>#P<;|{E>6z-HgDxv6qb&Xj5x&LX2<_lnYX|ZzVP&k$%-03A zVvd5a@7f5o&!f%e&2JSnD6Q30qG~m=WQ-k>I2*a5)WIW=W?x|la7ka7;r*a6>}N$$ zAM1oE_D97&@(>_}Q&@kG$l5Iy1FiOl*l#<{48g>D2Y>GdWqbSnXh_#*XA@rvY9rwP z0r?00MDa2xeW#G(u@T?wsKHXlDQslpFwq20+Wg$MmA|g7D|Ka-jNr66^DQe17T)>uBld;_~kb(U{_-@37)aq60)`$HzUSA7hp|H2%B&a>AVE&2|eE;{>Pe<6Ra9 zdSQ%b%kv)q{|!GzI8*EtACWNO{3r1i)A1>3PDr2Rux2E&@_ojH5lpZ-_`gZS&g4V& zCH0CRM^c7x=`ulX>B1V5z_66<3!g%AbK!q?M={Bno&G_;68m@C7z{Am?Zg)9V4<@$ zCd@>F9aJ=$UetyY$VQ%qDWKWUC%)k&i2-IJQxUEha%j{aHiO0R33j1`*DCNU3)1E- z8VF|T)0Ex?<}oCeBI)EvlLzaV8U4X7&k1uk;okYm2pN>uphHlJ1~5}T_j&rt_UrEtqz>RT4R4SixO#-y?vt{R&-4@yyT59J;JCsapNM^I zK;{MnkO%EEj%lzR#~~nykF_#U-x1#p7{2q@Mcyx9=)lAQ9z9>^Lwqyk^RgxzMaZ`; z)e$%V*{f$*Uk_CtjT9#&gn)6!4G@GFbjGKJGTr9#%93neQz-+AsXud+by3v@^btZz z(!{>Eo#%{lpO0Rep1iK3R-G4+D`*gQ$gqI}BP#Ey(J*I|Y$GlLv1+k>;K>68vnFl{ zb#OxFD)Ue^kJbH4$xKTevKW(9QcX-mLkvVj5d=g8L_q{F5e}g+0f~vB4FNu&I@HbG znW=ElQdBR+b*@egkm-yvAlWJUI-$;-1s<|Alv2br5e!QtL`5C{FTwPO%cW~M7}xEy zCQnhPh5@$l?5!9#I2NWbrdQiwh2PMp*`@Qj+lj+&RBvI)6ciC6!BJ5nlA+BSFkrz= ztHt7$bPnBv@C(!KZ&V>1Ao3Duhj%I}2G~b+cBfa!UVhyV-64-&GWn}27R%k;h&Wa0 z_Ox)JN-}ElHJ)1fEYX;Bl0cNv%7#JHr!n#FAxAttMG}r{!D$MmrWc>=Q(SU=S1@I& z+9gNVh(0CkG9$b*2iSo;CE}Ov^!vU zVL9vzEcm#cn|Qn;eK~`O=NC{p<~kGRmx{#Ul$<_&x#z>;jV1?g$T@{Y6vx&Lkl6(f~pU>Hg{i>^=gMQ~;Z(Q8y73 zE;CQeRKK_S%t`-s|Gn^m-gH3S8>vt157rnyf(MX&1BdY0Ny>P=YSju32hLdOd~Sx9YHdB(SW|t9SgJBb^0H<(aJLb zyIMP8nS}cC9^}XdVho5Q;QsJbgBX18nZtPx-$_CrI8(H=0Q{jU0Z?yb`SZ+NcnDN zx0lev&~Q0$5VzB(n;Ez9LqztzOXZ!rJGo9t5GcH5p?+f!gU!Z+} z{c!&m`Mw`h<+9|=nUAnLtxK&1)~2-Vsp~^*crYecPK};+hq(xaELg~reBJn;HGWb7a?y8=X1yNv@`-xmDM)&y52SI%h1X4_y8Z->?_`>yuJ0sB z8lg%L$~k2*)tSR$cOmy_2T&w!ASsBZcZ83{r%7pbh7+f`AJhSX1ma+0_8tNO1Ktsf z5%8VdybXHi=>YGDhqiUf#cRK*lD)eG17 zHHq8ba#@IE8p{6U+2;eqKT(+i1dL~nK03#Xb71*ML*9N; z&SmgOeWnfu&ql!1-8iP_>^uz>AJ2Ztp7Hg4s1wjLWEjS1AMxZ?+NeHkj{8A1w2T+#t*p365%%Si5hCE@)Y&OP24HK_= zGp+q%*sBmSk-vF(#&RGEE05qkCyeR?PeIHu$KE)@jxo1@WWW>aBO^#LlM_gqRxcXW z-!98a(z%8R8GzMjD>f+jekICKZeXR>1#Eb4LNkH;499W*4`Lr_VtTue!;bgi?GqTx zEW482L^ZFN(sm9o{+aATMFi>t4$)y@PL^CW2tdn1yO7X~fxux$VLZ>P2Hy9q>^cC= zer1Y8I2EQC51m9h{7!rafp8gKFVKIoij3p`v8ow%pRu|QFcLo0;%C+Cl!OTx>BHw^ zeeJlJBE(P1De-A-L56~U%+oz`V#8yx+Ug&|cDwDr<^S)#ZOw6LtK0pU`Q(yF5td@l zuvCTYqS_mE;?ZGmv`+HsaC7lYuqN3yL;mdFvBD4J!66FAb7$6kbe;Mm6AUZ zhZv-YIKha=#(K{Q0QHPoL|!sv!ho4j<_D)zF@VDj08K<;N>vliT8G53KZ*Xw>aap0 zWbSvAC=asQJfVUliA8!sgWW6D6MGjXgk+-(pTkga3P2k-dY>mxbP4-JiA(2#3PXFJ z#^0Y&_OV@21xrT}`?0t@C+_(_j+lOb-xIL^2lD=p+54qT=PEzTXN9wT@V2|Gxrl#e zFOA<}kd^iiP`3)q3&0-u~I6}AXrJR#@-6qS(FQoo4F7w&!&GRUwGAVb&z z`T_{+0ZpJl$OKY?14wlr66)%`Pr8&q88Rsaf=`rE9V*EsU(6UuU!iOpB0+uf2GB%> zrwC@#2rxSibj(C496=;hdrvucyn2Y9(Dt73;}0=OGq`ca7_9e<<%Nf|s3;t9ME8dk z#mB-@KvF9hprk1nuz~mt8O9dFX^BZmxN>F37S?DNlp9ORPkf2_jF0A2R7j+}fZqrR zT1|$7Muu$$W3<>sI{*(+yaVkZh)9u#=KR-bu}vJXWApZMyoo&q#s=D=Gmx{2dCb5? zH5Z(fM3hw>$0zZm2rz*W4g`Fk5yO7Z4keD>rx)wgo>y<&YwQP{#(|o|re)kB2V$v` zY#4NQupoSgl$tT`C%R(IZLo%CG>oY3y95WndywEEUzF4r)-$3nTU9n{jz;0SyEo|J07fLPD9{;nJYwmxhPD-WK6_9&7XM< z^JLs0%KT|1Qb69;8b;-3J8{U^1N4+++xqV z9OPX2)6suS4AN>Qs_>G)jBzxI)&$L>5v-UvOknDLd*mo4R;E6a!klPE2i*_WL0UmP z*(ots^}J37(owIcQDAaVr$0ey@#{7gQIs$h^Dr~eWg*5u`v`DIT0+e3?YVnX(N+;3 zX`x~LoY$DaMaU8YOs^nzjBgk+1BkpaNBUSdhF4p2dkYF7mO9H`sXyn|v~(+&q52FI zLt(!q@gP{12R;w#Y3eB+4cb7)qDo!lgxR6IECI`yg$TMEOASKe@H10=0w{q9*c{t7 zSpr}-9L5F8YcFmp*d0X`nMvwR!I10`<3eN^sMz1$@2s>=WLiNNjzD52afdSn_7=0D z#}n0f2^Qi~NZ2`G#fNaimDq6%mB_R#CNRZ;Bt$DBdjRhj5F#;=uyfuRw513wXjiii(Q~%xcQY%L$PfiKyB`P(lqH21VZxlb77_ zv9yhf^#m8T#1q&!0Tjy8W9F)ZUN%S5dRh{Zs*iCB={B^9+Cgh%QZtea^c)zXR#R-+xLSLC-ox46jysqX{sOwRs#CL$ z&QKIJ$CB>x%!^i}w3QJ>d~qUs<3b0t=qOFMcEc42bZt*D%it+B-#PV;4^g;dyfL(3 z4FW1DFd{@@5;(|?OymqwDZGwBh@u7~99Wb|2M{pKjLe;E2O73?jz&V4p+y;>;A(l! zi=rGuT-q^+pA^WYf?86Bi6qD|2|uh4$=LQ4o;magX3@*@lpBU38<9Xg0&qN=iJ5O4 zqnIcW^AR=-U)qLZ1P`FRaF9@`PX4eRh?LiV7>)jleIqJWYk5w*`e?L94vI!O7;A%? zBdifC>mKz53~8i?#nN1GBU(ye(Y6Vy=72MCcqK5(~V8>^?(Tf;bf(h90-vM>NS1M{)8L71gNnh9SAk zu-x|>aAOvFYNYwjf_-TZ4Z}+k*p7f-wSvsiDSMl6e_LFXKCyA1+??48AKU(pO?=9YXT z5ItaFY3Ik(6p+t|=a@_gW3u_!P;1Y=b#hNxhU6YH`-G5svXw3%dN z(1$WGQE^Xmg%qxw3p@9Vvw&Ypp^B$^P*Ou2gloaE5rL1=VU3sMV%aw7p!>TyqK70r zgLGt)#ALBZut6hPVCP{ZshIqyA@=@WMnT~X4ny4dV1*F~Fw8iXG((i5(rTA<%v}JiRGos@Y$S;=#0y3abLTjsmV*NOR7OQ*#-I`?=Cx3$V9iitkQ6rAQUE->*yw$u2ZGM#OoMb?ip>&a$&w0V zCxmx>*x>=NicbNMTj+SPw6B54`To#79Cqi^tJUk{#yhJf3Zsl}|74=Qo~iv@^SJhX z--9Y9Yk_z?pf#kOn3}%XO>7S!`nm+kF&G#X3gCdtak$MT6AM><;`|h-#{g?p^cWC2 zi>FfxK&T7|s!<2!) zaJ}542~6~CVzCw}hepp(+2E3n#|41|87RSrs!8J}N+_fq za*b_WVY5chpg4Owcj5+g;gZMc30mdh5R_u_&(lkJ#9KiGbCxybaJ@<JF`$Y#7K^09DyTGahR&C(wW>k1K063X!J9(u&HDeMYr}RESnxQM3=N13Stv2U zVuMNEcGcK|K`~}gwM?>9O;#_FfokCUj-PSpN6v{M9ep{1qXd7ff<5ChNL`}Y$~ZfY zbef37iIEwt$k3}GBHj}k4vvVRk%A<<0cP{=p)gRm1B;i8wgi4BwDcQ^B#LA-a?G7Q zy19*Jg8Po8Vd$i!r0pqz191wKCB}ub$2j0UK9hm^s!1f0NhFd<~hlTVU6KQXp1b76EU(dB2Y)x z0tK&s7kuIkqYr(hg`mZzL_z|H5C;s!;;1P0BpOL15l4cWi3$vao}oyS*zz2W>X>ia z5Mu@o#*B6V!GXfY*<``kqcFgu7|K;jCLIW9((|5Y=s*ao&NAQzq!Y^tB$4*?9SGn) zC!q$;Qb#Pmqw)CpXP@~0Z|M17Q|qdVs;Z)@ilBD1c57A{*QAAWl zMNvn8xc2)`kkRSoL^>SExR64MSymxe9F=`h5z3g+BEulbL%f+#v#nf;I~6ci27ZVl z1Q-ua;M1gV(FY)GBT4A!nkj@-O6K!VQplwrgY13UU_JGIK{KQ@Rf@dHoTf~Xc z{LcScMArzJ7KEacZkua)oTj|vsy|*jEYjD1p)*~1e!2vg(T!q zQDj18fy8N@EDjQ#-SAmBgz46DmJJ&)>~%I56^AEdksp`ueb+M_%yTNLs=lK$12U?# z=2khCj%8I8Rh>+q01HamQa)z1#a4tGyZ3prW++*F6q zm+Wui!}$tBtRi`j1_(Yt?hJ!Ke8KpfMSluC2l}Sje~vy91H6q&(DN_bf#s10 zfk~Jkib5dZVj2Pg06d3LMT9|Djd%I*oI8UFG6aBOuDoXo2;U*mnuPcixDQF%8uPe; zH3ZRf4|hZ9Wy5J3f`nsX`{4tYCj8nM9n@X3cV?S9 zCS*Z;CMewuH-&1^JlR^-_wY!9a}{d-rM%@x`P}!}0rI4S=)-_~?Re`2vy0@c{RcFD z8L3dlc7Y2Ou^u*%2o|+@i5({eStjS{lNcC}YzM5c)>KH^aE3aH;9`e!N0xTVJSQrV zIYmIBsKXsi2^7L-J$lE}uC@l&Vzv23iq6qx`Codgo6-`NeqSmcDHM_!)|>BzO+olr zW&;e<#Ai~uHp^WYs|+P@`bJd|hmSpikM#h7!s6*wR2oxUwM9bFqXEL7E~xJAfU9E**-<>@H>CbM8{ zT=0Qg$FDgR4@CsWG|4`g%!zF(YuAUdbYwM3v~j=GryJ_U)N7WoO-T@gWBj*h$v1;L zpOlVdMjHb(Nalea!@FSEMmuoa; z9Qy~5;O!nsh+{lG_T+$j%BNy}@i~}332#Ux!bQYr_ZhXC*GkqAlWZ~v0;%*61qEyL zlO8S}co(uU2x647431#bEbb{wiLv?1EKUR zV2Jp48cmVEIR3*gaWcCl9iHtF4%vbLXhEl$U4(iE!(PZ_q8J>ofu&5I1>`FkQN8bC z!ku+}k_wYlbT~*a!hmYvK>la-TdNMvuZ)l(5ReVw4rrGFPZksrRE-*!BA<@J2ruCw zd4scW4H^vA2vVu5B*+I0CCHj3CWR2AlMFTKJscD7Fc3NAdcQJcsxdT&ZwA;+w< zI0}*wk%(rT(Gf6eo-ISYnq&KSctM}4&5Ub`Mn7NrUm3H{poc76Z0`3kFae=|VTC`g ztq<#_2mG%D3_l6*n-5>Ydfj6*!*hd+7v)q)J(+gZhZCle4(|uij1I^|j6=&E^3S7O zRAKEffuqO%cp6rN`(-o=4GQX5jjcNDgw4P5Hu3-c3@HZ!?gV>M4;my!N*v)+NBQ@ znDW0oQUoLbNJ+MVs6I2S$ATT71lF(g{=}e2B~S>+FS;kxso+a|sybyUX{Qn@|AK)~3-Kf$1`N}J4i;t(oIDT-4= zt*WbT)m0Ac(Sh-7sus1{igOC)OZqlY6fxiG%}Iq0=3;_WlO}AV!za&I&H6y|4gbIp zK_LX_u`C=gf?$}LW>QdMf*^tX#9%^FF;qZIq?0hU62(*uNYX4oP(+AKI8PP(Mj9jc z2o!RXMML8#)`r4>u&0PXDk<0yn43dCXlSibQIxdYqXP_3h=n7+i4GxP3ZJO`2l!j8 zk|78LNTnhDC-48o=lq_pUC|E$>`M8=giI8p`oS&*1Puj65JW){QjsVS5Q^Z!7?Ook z0|OBwqa{e~LU>}zEb zOOqVr6>!W58c+@xQl$8TX`Bj-#0Uigo?|c|q=*`U6e8_oxs!?4oCkZW?LGpKeL^0f zOibT%^HD>3=Q++(X~`hRklQs$kPeb0Ih`D|8c(X{Z1fZiAc$5f0asiJ05DpFFb*Or zrd{e%YgCI$%1p6ls0y$t1?$_#m=I$E;9Lu3jg61$^6Kc+PCecJSaOD(lygAtf<3qx z5JV9KL4*N(4ll%LJ?lWb0AS@9OQkVUpfP51JLb$-Y%u34V?|_kwt^e@_G(6fAIi?1 z)ls=U-^|T>H9@I_GZ&iA${&r^z*_Hg%g;iX)}FxbTM*1s1_n@HYIImkl5rJ z_wD}{b3;d3EocC~$G@{9y^tx)ZW}iL-a8ah_TQV8NgVT zEyP6TML#=CV|P1WAhYzgPl1FB`hr?2>-0cldyguf6P(?)KGn~8(w`!BxvGjEyT&*h@2#xtJ>{lw~p16u-{HQQym&l=h8dqf*|7b(oo=7{6ny>xZG z8h?v~st+|+jW;RUB7UPqydGzILjxr}sW@kMS6gl28 zCC>MEW|!-0W;Nec!N1nu3aIpJ^SxuYqBiLA@aF!cLc+VSp1aO34@661J9garK zAC0{9H=IqLkk;mRflgzv0`0&fE69H`CX z1x^uGjJ5}qqEjGXP*8}vFU~x40w^3?$i&?Ok&i&?LhYdHH@d7=VaIA!d*$wr(py=k zlb)lYBjB zdc;LktR+{tu$T5Ks~Fe*c@o!0!9eE$Vu%$JBq~j0gf%1sV`gNfc9v?0l%BD}%|JN9 z=q1E9C&3{@0L^}rWcPA8a8hp=i5eP}=O|v!qT{ORK%{cvQaT8GhfES2Nme;~QGu;| zYc&<<9Z?aZ%ts-HE7dpGXiI5fUkO)kIs_&mCtWl|D24NZq|MmwC_Rmtx+Y%m=f1oC zD%q188--p|a%&L>K24ugSW(8Do^>rlau|iEz|_P1T>8xGVF&T?PNbeaD^u#vnB_-M zKL_!{`th8ZHz&^>`071~5Prvk(^I9dna*oacP+V>bqUg8H}D+6k(vL5OmWzxA3i1t zE9^Tz6gc$EIQz(hkg0cE?n*M&HVSB zR}OiMMTY$te_vO>2H4|fmyfEXGOv8g`@zQs_}?ilT(HRcEbPU)O_R56*B24P96_Gy zBQS@BZogCS_mANXA|EP35=ia}}%xL-ja!Iyo(jrKo9Wk#Ewi`a|v@5eXx-&q)s7@}GbG zBS+957Z_<6;@{Jv*?w7jjR3@wGPoPcY}vXb&LNN=xiHXkn54?~v4Q^#jz~F}1KvNY z5j4>-O+V?AL(^T`e0UANpfP!c>iwX1jk{wbBO|baAH^TF2nmlE_BLOPI6uPRG2e?0 zDn}T{>chG)AnoS#pPUCEnJiiz_uj`TPpi#=!TJrA{|LZuzV&x&}{_u48q{$QTWaPpnpGU}ftT6{wJ*73|#R-4WnemEw&(b46duW_E zl1U&iVb8a0dB__@vvCd;P=^zV(C>XLO<*Yg7%&@o|hv(^1))(6;}!V12#h%Ztq z>-xZ*A@cs$@n1me8a4H_I>t=}F?GA3)l~$5q|D_OiT>yJf5I;qybsVpM$%U0!%RKH)XZU& zu8$lmXY0zrx2!3>>YNp0Qd%+4PFPVIoYAWtB(@r73Nsj_%oigt$*W|VQ$%btZ5xPG zWl*K1#2lhp@ITe7JoB2W`%M#^^p*hp1@d?rAIQ)46Z{ZFq>>*&AV@-zG7Gcf1vq=u zbYu+^F$fGql>pN~(5XNa1yw2(DJ+UGO$0J95-^1vupgv@0sw_&-2s-MC-wyOqI-SY zkHcjIC`&@B2S9^o>N26Z5tt|{ECK}ajD78LFTk@PI7X&Mp$Fwpfdd8im#*RXeoRU4}6dR)ykg)~4JbcV8w%&P<}s~mxFk3^xpV|2p|%+Yv6 z%s>#~q&KJn$Opu6aEYX;FF23oc6nXLu@He64#7-dLO33t^bttfdlW}z#Ql(!QV2qp zkRz5X20AEa?s*ShzPR-}vxQYf2qvfsnlPX5r%;EOASi0YbX^;7GsK~@v7QN1tSixd zWa)VU571;_Fg<5OLA)Y|kunsYWgc=TECu6#&LLsUTR>D5bAal_9`N@Vy-;TAfs9#) ziBCwWZpI^zvd9E@fCP>ZpKaE|mdjHpQb(2Xg!Tf*hv`SDfeqQ3BY4O%#upxFEz^K`leAOAgRX3x)!V>ij3}ACxvi>@LC|&OtGIK-dQrLv$UA1L+;WF;jNV zOjmbTlijQlbr4iHq%I2i}A*o@ArG2cbSE@8X;@LW{}pU|>f= zaM_-2xYA)eqH#~n9*NY7MjG)E+5P*hG8Z9~2B70k3@qgP*i0~xKCA;xGgX6owU8Ips6vfeqia$e5-a`n}uC5dKpu#=@eW;y-2<$Z3@m%|qZ1+%zrJ zz?CWgaOv1!_g{8qeQC^4qt7UaLOo~{3jiSvV-`~TL!_LaE9>%k_lIgg@tRgL)5nqK zZ}ybCDVa9W6UcOPzs20w@|LnZ49T66Ivh+)@J!OMKn4+CPZHQxV?x}4gI%yKFB&jy zHekXG*yE%c1p+HG3Mj(U6@XfjB#9^V<89Z0F8J$F!#Env=Vy9cHesr(tcNEP6e#|7 zMyofnzbO`jmrrEin1m}h*=gzQ-4(F=e@(t zbVq|fpwYGS)gFNBEQRiQ!*_Fa!<=k;8)+x@=g@U@Yn;;D{{&@D2q;m4i6JlNJO`1?E@?<3{!_Z4om_N$!9ONs< zAt5@CskOoPWAl=27j zBlC5A{(6VPosgr$ieUHM+B$-SQ3)_i!P7$`x{pLgv=?JAbWC}cnp(q?&_LQ?&@%{> zAjn2^JI?B~(=`rN`5$Dr4T$VvI0Nkv(NW-nqh^f2F;Ma(;3gr41S?_TrO~9yj|=@Q zdZ2E)Q@$5vCH43d54jiHk?=GL-g}Vx7l4-cR14}pggf={sURM2o%LS{fEOXU?sx{D zOm=(2h0X^6cmd?7$sk4~gw`R%4ycfd2OkErY6BbKFDOt63pJsVj(?0bc)<*@wiUWf zHwgt(awrA{wULkrdn1aD+I5&yZ6lQ58_j=+R^JUTocmk?ni^svDE0uJ@hzvJAx|3y z0r^MYonmt;Dx#{6y2DgF5?xu^QR*xTLO(FZG3e@g!;7zKpn07SFn!AD@Ly+DI1fKA z=!`7JDvG3oOTrYtgRBQ*Lv_U)G*~-u(b@y|Mc3#$4BnAbkl2S|$`l@Fx1L=E5F|Uo zJyr*rJ~2;FWeQO}j2|?yi=Np8XSZ| z*j}e^q8%j2u|8_J+X_Pgig#wUnb1NRxyVWekWm6mEwHg2zB@2Z4zR~VsH4z?#0=<1 zBhfrCE2-Zu8p*@q$c7}B#__SCmL=-tcXV$3YH^WlFruQWHiLT}!|?zo+#vV59wgX{weEfbMeO^>If5Q@;0p|u zP$7c_SgHhNg_hASg3PFc&FBC-9tFT)AKl8J?;wzgbEFR;o-wE|meAM&kWX+rfq>RE zscxujHm2y=f+^F~fk*|Yv?6+f&;rG$Fus0y&NOq~L@b|ON^yz_&{Aaa*lj|EHW=2gl@V1{#39*_hEVx^p@G&DWb+3s3)n7_#0N$u!=z)P z15neahZX4vES+ai6HK%~6B3eufh5$>lh6X9ROvMd5RhIJ{6IsIqNoT+F9|jDfPgfm zS3waF#Y&SVC|v|ZdK2j&py2bpc{95+J9qcr&g^WtdrtpB7n}{rEUo#F93pRfn zP9?Cp(ucD3Yq~s8pnz8F{M12vS~6gsV9}~SVj#49m+k&bcK2)d3f$7)2fh>4mRos$ zN83DB5@(Sh1sP|~o|Qqm$*bmfUHersX8oL9Ejt<=*`4mR{VAikuU%A;0ZY0uU`7fl zGw@rd!E1&igAH#>)ObaH(-Rt%*1NuB6{+uAw}i1BjwWsFES!#nrS}e(V5yd%l3}{EQ)3&j=_69D$o?C$D6~?C?14GvR|b%+(6l~`~=7a0BwXM!cTq0&b z6^|oSC=Z!btl}fAVj3mMhVA62D*?C6gv&XfzwG5>XP36BX#b6nC&nj(Wy#IYgTu~!L zVrTYLlm}uX*Qw6t_55ILhlw@IaQ(6N*MkZ~VOw1TQ=dB=na%>|_4<^|k8|Ne@DuI} zv7sX|jTsR*VM(X7Sg;KVg+`@9@+F>=y?uLkqAtd=+zIs;yIp~vwiPMicDVyza@MeR zc8VuPA^WNNLnd&!`u+)6ZN_)-CuX%uc1`4Rk49i@SHpdGC({BZx-WE5zC#K^wXTw8 zv54~+a-=pxTOLVJ^9Aj?&r?NIT5V%k|8Pj|l!nzQ$tN`9EplSO?*l-{FFC9cFb*)I z=w*@iuT8uQO17v1VSFsHmImBil&z5-G9es0iFnve2`2Wo^>yg={>Yj*}>&vr0uua3qc{mMT5`24^~&lTGDrgZFVVTVVUuHo^*Y z{YFP%Vu~#*2&^$Iiixbq6ogL-tqys}&ny|IJ2)4tNxlV0GQsV+W^It^O_eV3{q`dR5!c%;Mgw>Z-%wTlyNYmZhwE z*+m`zZ4UF4OISxI$Qce4j%ck=O0Xm+!=nX$3$lx?w=@gN#6cq(sJa@0^iY>#&tfk@ zw&!^^9^XXN#p%vn%#D1|oWjY6|BQorxEEGu$&6SUo16r_shK2%tQ&BUWCpc)B?t|V zErYTuxyuWaZKPR+a|r$k=-KlMV1qph#C*OBQC_xm)uK0JQ1)JNPJ4@&iu(c2jR_4X z2@mLpSEveCX+FPO?9eRvka|~wZ72gi>Tk_rBOIwrqeayL{1dRo1G2AYts*}so|ORw zLN8s7Q2jbtVaf@ttc>ctVLPx7u@`uh^>9E;rL8dJVwn#n@|ZHw5-1xXrDfGIf{GN1 z8!g@2*u#=!oU&J}hc<=1Rg*5rumQXGN@XUUpI&NTdrkB{1RQ3dWaEvgnvrsPX0I0b zkroHCcc0z2UkHYxIW7RDMHv~xrhu_ftJz9U&*|b|^Nk&U_3+4US^wMAO?K0d0>bW2 zP&>9X-3@vy3!RqtRZYfL-(`9dOF(fq^s4m|_1YSKl~0%$Y-|cy1GKghIYN zw1W_fv4mL?oKXANQjrv3YN3;y1p!8sx=I;nWuaTLYWB$X95Bjs%W2(jr%OZ7=fFDzhNc8-#K8$mMeqlbqxu+^nIe}7-neF^EFlI4`OBPqQ zBnc87m|%xK0=ooWQ}03uaopbX{!lKTs-SXKumeO8E$S4+-#ViMQT2$+nA|*_?cV!c zEQTwMBzKC@yB|N=puHDXTXFoO%K9a2ud|)v65Wj}|{uuoxA^1!v7M5l5AQq95YTBZ`QiaEZL_k=u3S@GQN1KWeP+8o5E|CEc>KA3CKZbs@DB zL_R|0lyq=A?w`ZnpIb=~lG>5#I0Zz@RXyXhe}8-Jb$m*(e|B8mNkvfF^bL@P9f8Th z^^$>SbffK7!mmdy@qh%p2e_CK`l-|$I#A)w<3@C*jT?Czh@o5Ag+fz5dHJh-_Nsa% zR5Jc2!#4OQ_MN7AQ2M3~{*{yErh;qV?F70V$S9o98W3efbn9)hObfGOv{F0$2D4@y zAN=xj_ACGmO4TpSX_^I)G;7+T&fUroY`%4_x#Y^f{FQdq7jKtsIQbn@nGDdhY-QDf z)P~xO|N4wwLhq!o-Dc_p3g`2tc{|U-V(I6U@ZQ&%4EAhrgD;@+90Y?Im)Wu?J0;{` z;VroyHcvGxD83Z z1N|VgUl?3b!|#k2g(=OUM~2cO)2d(nV&#rSrN-}b5vRatJoDql{V)1g+VD(KC`nkc zmvlNmA*qj9c&^*BG44xc;X!U-sHB7ym%J1{Bm+?yMNIHJa!3X8E)@vs(m$jO?9qc$ zEz|&W!p>)kR1Hoom6H=Jw7+{uyz`-{yxlz8L|CmB z9T^xaFNA!*pZ{-ZZo#qs4(jn^s-`Ep+!2VU>+qgHW3PRBx*c{p{`c6#5yUgRNfAf6 zd*zs*@7DGZ`5C*WTGYu~NiG9lc2A|2zp}pz*(SUF7(aNbc5rY|a8uyoV5-xn7vBfm z(n^ga2qtY$jhtLNRZWxTXL;td3&vykTjRkCOTRNNC317LW!vz4u{Kre=#)>U4x?-C zl#5;n;hQtk8J|I2@xAn&@_5_TPxgMF zDcm-sE26z$L*Ip`-aUEt&G7g-o2kWhXouU0O7fv$0UM;id$8o^<6}6i4(6$ zJTHMW@waWC+1KlDvw+}r1q1Jxg44NltyKdYS|@1g`T)VLfGwt|eDK~w&+ zCdaCHKolF|yVU5z%ivm*lniLTVP&@Z8L5Cs`Kz$7g+pS^#8b;z3%~y&TZ}MC7>&;1 zDqeTRK9VMzkh!jZj%#VhaQc}9D<)$suT$r}cg{YV><_m8woZO&skE-IbNaeY&)*Px zozk}Ac<+nlT}q99Pd4><2_h&nsTF)+($yQ7Vdh>WV1>)Yh!mBU;AlHi({c7S50~@n zgV*8(buQkgwo_XpksTF7s-BpK5^+V1y2HjSFFm9QBzZfpV=3Cpw!Ice4uMf|?i2bGpfW4;f&Lql|sd5J$BB z6Di^_QW)hR)W7V%6JG=ua!I0kA|435cWvJLnk|6yg6wF}`he_%u9?u5*R zV2T)3vzVd1CIUn#$xs7!j1l&b;ulDn*mz`jv<2IzaJ;x#@f~*Hrv8Q!v~IxK>lv@? zG04#L(M_43))3`94mucMVT$9^ZZ9lPw0vU>UpSNqQoPwydjrg_mR`WQlS84x5^*U!rFNp{SRvMCiJ#X# z?6W-c4*a5!!C?D1Cz%$PX2jsKmOElf{U`&2MC(DLZdfy`_SM5ONMJB)Gi4zA9f2AE zY=pspQ_;oKpF$*@(c-Flj7AYZAAC=)*04dcTL~QAT`gUCAyod3_K(Gxn|;h&+mKnC zaOQAKz$2E6&A54Mw(O>8bGacpgY;|(lpsEI>4WF_JSEF(r$|_cbJOAlC7wPsMw*eu zO+w(M)lPt_+3e6t*L1^{4t2o<{~zbX+7t*ftw`E9X5|mNh?=0A;HOt;4ZXd0s)17V zuIgX5SZ{;7y?mTC(z$fV?Hk%J1m!!NE%w7@Bk9$J1ELItof&|KW*lRgBEI%b>l!W| zHNw+9QRQNRPV8kNEqPhcM~q>3=f#vj<~Tna9cld1fdkt_7Y z&}%FDRm1EZ@=WGbXwu8;pVquT*f9LRYL;`#as6OF{?8y47@Ynsk!^7OCxW4;yNy~8 zi7H~2X(d_PS|g+N!QIw!9ZEChZCoL(g&e3fn((X!!aJ0SkBHZ}TBwqk1jb=8z*dqX zasv3-EJ4!cCm^tUsK)sB0;h9Oe9!rky-QrEIja@7csnUN#*HiL4PaMrRJRahLwvMi zu~Bg&wHSQsEtFq5d4%sW#-x=w54M31D*7vWr5`&eFYA69tul2O2j*|mty}&v@dA(EsHNf| zEyRwTNV{a_>|TBx{mSiUU?PlJSbtZmE=pXvm6ELW;eJlp+Gv-T%3)MnXMR?sQ_?($NyhF?r-A7?CE|Xf_w+1Z)+@3yGFl<} z?D;FoPWCxb*Oee{Y{|Jz$+@5}CJ%JzQ^6N%JjVA5FGLXXIf7E;#k z#R!?zl{}75rsN5qr^R`*wk-bW%Im@M^Uh;k(RvO|cwwulpMO}N7j0(Z-(`G#ZxfHY z+cxV!wSJfgMh1eqKji+-e%@?aC+5-%0mBr60qY9<&`#i|)ecj4saYn8NW|IVA?knZ z)Sq+OO8*(Yf(8uae|X}uKnN|>Z?+X6aG4A-_4|9(^)5dv%kYMdj zEc%wghmE8a#vG;9)@FF3ylTm;8>xhhTj99$*1W^{>3Do4{uQv?^uh%nKV{;CKJDM$ zv`L65T9Kt6eou1mXtwC}jLGJS*a_>Bg!D46wA`)lxMkm^mL!@rQWU9V>3vb7*iPmqSWu4Hmn7d+J zV#>^~Q|WAo2JsTTCrL~1#RRDablJYz>TUg9!-tonhPXt)8V$O0<}W!!-fD0ldbCQH z{oLFDe3^E3_*Ksvv3@BCSyB-JpxJUu0y)rM%l^lLFSF(#E>%Jm#s}m&rB=Qyf1GH8 zWi4jNf(+385=Bmcieag{(J-}F^nnT7lgp+2^p;K!Gy1t(gN0mtWxB1;9WI}Df=DXF zJ<%WNPX-ohhRcVy*iif+E#CkMNj5Q;OS!&kr?y@F>^JAK9G}}OU0qdqSQP(`)Apje z2ym4>8tOyeRn_0!(7uMRP`x3refWyvHGB*X-DkZ3yVWn6nzE~o+&;Q9JL{xSBSZ7Mks1*0Hog78ThSB_S0b5N zu=OWJ4F(*kL2fE1{%3N-(Z-OHPzo}_(7BowI{@ZEMSof#RkTfOV-)5skv0{;%393i zfTf3P7$Xx4uedsB%}>yh!>cimt6_8&U$|KdGophdZ1DaA6G z^XjNIS|s`~<3=`RbP3*RaXUOkM~FvEW%Dld;&so8#nFRj_0Ipj-vHeaK8xePIi&1P z*k>!tqjUogw}&R$q1nW_Rk%vF5Rh?87M!HV8MM3FYn-#ck>@6x$bSri<&=BiL>}w&S{+GRF2^5ENdL$0&(H=obosz&#^a* zz|c$Tx^sL}2OYK#qCh9d6CH}u6i4?lQQ`N~T+0)Kgk$IN$( zF9eMO+Wp(;>guV+ln;W{*&e?9w#6%p5%co4ArdVWxTuur7b}kC=Sm%MAiD`4c$~`v z4=YtlQ;S~rGU$HnYN9g-A7+>}T_Ys9Mcbt%oNJDy@)b-~bH1no?D4sQq5F*X!C%nR zVNN3Mq7`5b8}+dnnCd7_dKEnrEO3pd)r0NE2h;>Z)17`hUsVta6^)bvF2zMSM2kgl zu~V4G^lawT6;tC<1KSleDeaR|IFu-wr8oPrK;l&;<8_?Miqr+LR`l7j!qKeMULx(_ zDYtJc|2#g%co`mK&N3CP3nr1Fa&H*Id!}Ip7_<*<4HS02@evRf)Kya1Is*So>J@y= zii)bVt`NX0>J8O8FtFUMd3w;>mvAo>X`EPvR(P?(DRO`*=7LA$t;-YU8E6TuTl_fm zKW6}rb8}6A1tg|b3iGg(*?D&!tQJ2~A@#|Z#>vAh6m)6q)3b!_@uhAOw6T5@UwkFH zR?y^<4|t8z@bYfUHH;rL(2f6HHb$Q`Fo;Cia|+co@AfYkYZRUrO+cnxFEx47Gh?(2 z7l?z@w>++F+yPsYd}1dn-zaK)7Z}hQCD@yup|r+au-#A(sK>FI7f2;k!yN#$Q!7%i z-v{0Kgb$vNS*ziOo4g#UYiAa)h>m;m!fz3Ff$jFO+@``Hqp|wYu!9A+|c6 z$=UXD*6>hXUJB+DhZDTpCFa|0Ywz$$LSQZS=ETG4!&fAb$8F5bSnNx2rK9$?YRDnC z?W-FxA_NujC^^%G=b6H{_i4H?Zq?y>s$>EoD=ThYQmbTW<27oM0?l z23>n-t3XZfC@lPiQ0_6P|Gv$E!L&-Ou?`Xqo|2g5o`SX0v-dYjg^Y?Sdq_>E8SDD; z+pD{w*Jnu@Z3_JDqyLanv+QYgGsh2az37v&wVlsG)MC1jEKOv0g=L9WzeCklf z0-Uz_?q>|mSm-b(Q1rNp%~dA8=i8X_G!lck7jyl1kNr#MUH8}%^6`)TaapP_Rt%O- zV(9}HIWghmET3`thR!#dA|CYm7B4{GL8GH_&u5F`0x26Ufv@_|EtHmnF&>8)Bnix# z8=1g(EtUi0ejdY(C82=KTwJ!y|2kkrV(AZPiDxBw#nNwsi4U@&l?k=``HTLXFPK%u zn(2=JPGHP73aqbm3$0p5Od~F0>UVzx6t+IVb~7FgXmkpfj6G=m zvbpr2l=j)U1JYIq^p-)qJ9Sskz=grTI@aulCJBE}?7s%Qc+_!i@l(Wu!tCsqB{712NL=Y%#GZmgfQIWG#hy$6bz zm!@Lr-WYf!HRF-fgRdseQ#Phj7bfa|}Z+)3s__aEk>6O;i9QOp?`!OkVKi5HC}RNGmM z6-+XX3>B{GeA`sB?ZD&d3$ku_8`*x;-u0Sb=oN@b$)pfP-ziRWMsXdihDW zPuJ#7#Dian>o?cWPlPaEAdZz^jhTQ^kR~S5?FFg7gMkq$q{U?1{mRhq@*!V1gRT{&+D6}gUex=Jc#d3H-}#aq6|((HUMSHK~$LQlIhL?$1N8~rRs3|>A&gnJVg z`XT5g>*MJUWld6w4*|ER&9|t}D{W*7Y=124i9(=0H5FSFpHX5r2QQp-6dUGFbUksk z{6`}{yO-~Ej5t1EjwX1v${R>z$w;-TyFuIph9BU4X>U_R%RVKTn&#H|eBMuW1;)21 zXRt;xub1`@V|n0n*&Oq1e@t|)mA@}L-j;q}^Y;Z#C$vTI>f*b2!LV=NzMTFS+A2Bm zsUGSu_FC@(*1#}S;BlE>eX(kBb=%*PA-U4OZ?N4;GD785C48L3DJD6;*^bI_`uv@m zoZZs7?aJE<&k{1pIzv@up`UoyHnyIde|VQHO=N6jnw_8fCZ={?<8^7dFo(TO73;3r z=c7K8t=~rK87^jq=QUqhv&-sth(Vrn%F?6jsyJD2ocHco>z~`bcOPb3JD-0?F{AM) zv3B%|=HuDQwkov&6dJ@>u2&aY>IOF99FvsO3diXPkRtJoZj-F!2>$uuCbdS*ta z!F=SzD1(;OHuxh>GOlzF#R{rChC=p}#NO0B^gW^Omjs(6}ge zH=R8GxWvWlI?G$_slXtOlT^D<&6i^icYkuEtW_5N_%ZFfx-wf-T&V&WhG{@c_Jt{{ zgiN8WkCJzdHU5iMY^clN&$l%@FkJIhYA+c$3@=E2VuTytpo;}RLB2Y&7HGGJDMat~ zNJH;Vh2I&&yVx!ft>l}OId0s?+T9Ef;(z#~nSLYtJMca6duB;jYyZJU+p{qfQ|>9> z^$)Db@sa4#FaCL0Ll6a+?c8b{aiCpS!~w~7(;bIBD${w5Vm3)U&! z!)eXYLuf)s_4QljDpolm_y29vrr3HWcq*@h+UfLVA7o(5*EjREz2;UUN3*VV# zF7|y1501Fk{?15e;6X!$S*<{T?|-YX*_;Q;<@Og73l_|>?nWEgHJ7ShK4cSllKRys zEdKqgViNri=tSqk$xc&n!EcM73rQ?=gpFeS4-uziKFg(q}{P?LXV5;XXq8wq*`)0eouT-Za!Y{%i__;5r zGgNYOV=toa*YvJ=w~;7dBE*iHN)t7xx-;Q!ZGai*Fo=31bFx0LRlzKfl&>RsboNg)0&9O{RL4-e zath`B6;WMqU@rQ8v8v$9?`fG0)W17{n|it5c`K9~0!Czi^3LE|)qv@w{gsHN_Xtpj zW7y0|84HG$1w-C^Bu;8~>h=nFW9IzGoxcOt?ksO9$FTW!LW9%?Alkp0JNp7CE!hwUsZh{+x@>CTeunXGwr+U|U*6~7k% zud?t9EBVvA($v#4kivR~;(0E)&Nu20lig>@CxshYT^!An*v`nd^GpMO7T{QBy50d) zgD|)byGOXfg|^dVWxW#o>vebIwZ_68UlB`qhqVHB({oexb-}MN5vJg4-~H5Y?*MiB zBSL9+?*8x$hPXwI#eS?R{)$!(j43Kc`7{F43|l00^xV2W(l{;jn=C^s;@=+u{xT{E zB3Onizi`X0dsK(wp81d_U`6PCoro2sLo|MO^$?w{aCkfWo7uojz(E^S%+jPEdbRO% z`1G#9aQt?L-MJ{dT!x`sjl{J{_bAZ$eHMj;g1=?is1kkm_m3y99yA}{xSDz5`+^&P26^z0P<+}ld0$iZ__ zKufHE`{*$6t_bWlcmPb5So~{4+-=C#Oh$;_Vt)2l9r?IMw{Y~@88+*myi~B3p3D73 z*5GjkhvjQaPD+SoO}=!!Pv>1yuK$dynm;-EBpNRB>H4$z;m1mzzg8w~bx1v^BgD^Y zoB!CZtZi(DiLjE%sS~R#Vxr_N#~u9XHcBf0l+BCFdS}`Z{6)HGN6_$3>cPd0>4ky= z=dCs06Tkp z|J!mLEIk-2_Ez0B3BT)AaQI^IuVrbg?bU0a1DZBqYbS5sNr$ycR}OXj-Y1tAt-0Me zy7lXi?B}}~YOOQ2(~8$o^QA9-5qEbT+^X%0-u_nT9~&KNZt!cLS>C-hD9iI6e&Dx? zFTdg!bp6_~5+UdqpVDNjcp-UMWd9SkEnqk+OeHVi#@g&~gwBVD2G=h?8qL=4%ZY)1 z-+QhA|7+N@sO+(J@VD%m$j*&e^`(oM@fY^my!tHu>tTje&0ghl{_-2X|FfOu5q6>} z|66CKK*aWJ*yyg=*Tec*_3V-}X9GVxY@YBk2>$r=#q?1yB8jd21kjZ(mJ>^qzw;h@ zcz8wkw7F#0GydCX$L|zPZHZ6;(R*#q7au(S{(5%wDD~ya@Rq&Sjjx%xf)X@u18{696GkJXOOT2$;_yvI9ue7l6iUp%&u z@oeYz{9MD($aUYhCA02}j$Gzk!gqI%50iqz5w(%mF26DvI?^g|2$%X}I(>G3RO*!D zNa4job$r(Q)$Ru;zFL-@{4&E&YTx9&GfPXY{glJ4_2sB~X?STXj9>J<|E{_Ft=7?< zF;s;%J^$-r{GY9@i-`|QW+u&6|Jz^8l>II}Ps`9jNZD`xr)R+L{v{}xXMD*48!+{c zAl$gHysYA}WxEmgx<79Q7f||>y>^olfOV&95%H21RUlFxFoW`AKh>zUWH zxWI3cvl%XFc>gm;>lfed=7ye($I1VtI2p)ae&8zGzN|gX_cbSW&p;$%3o#-sqrhyT zP+b&{mAVpMvVB2!m3YVXmE+Mt>Xi>Gr+NIG>pJKG0D<*h9q7eA!S}65|MtBzH48k2 zyl&kkt+u|P-6-(~%g2+~0^c)sH#fgX^LHMs~VXXyGui*(vOEqC&yD)h=tExtrCf=z=2HX{Zbz&-;!0wvPsQht$(?e1t13 z!>6V%x~`@&oe7r3TFe?*O`sv`+NBj0abS}KID@FkI3~kpTCFQ;QsWJGeFb>Qr}qyH z!Qn1PH&~^s)`jjDzUeR$P_4vQSG1UeHLXD`pFzuOzal&ryb<`Y+2R!;)CqC$E9Wu7 zts5u6w9S8oeX;dh6)^Lu_2>gZqoiaZ?xKs{EgkJ($=HH|K1}Y&EBkq(wx^0%k)35oAvGCZ971o%pc=L0R1xZh#e!gAm zHo1pWiYNg=wsaw1LX(>{_<87qO>#+|L}BFg`4@$zqN9!LAzYsgn>WK(=abE<$Rf3(#ORqD8}SMC&)vJS0J~p|Y<|k2A>Z4DypdXQ9-L?n6?h zaE)xw5Y1;|3}EKdWlI|gReL6-NWBe?s-C%8){naGtRQ_T}euv z3x67R`wGY1x0)@5O9c;Cy^?gGZ>460_g0ywWgoW%k{LATqd&N~Yb}f@m@sDThZrGk zy+m!%_r&EyFRI|bHv-I_mjeSq&ajwr*h}6Pjtq7M-rW0N|4oWH?H9uMz1(j@7AsWAPF+SKg%q|Vi$ROr9yG6g9_f`)v;O$> z+aJhRQ$M0owirH&mS~HobZIIbA^1*sC_&>!iCQeY{Z>o#J+}*;;-Xen<&{6p@(nEn z$k!qwZcg2tOMc$;VuhTDmKHyOE_i>DS|PB(4~VNf7>3yL2NK;G5rQ z=Lfngnj?B6b3Wo&6X*l@xB*C1)J?!q*s>g5*EgjBZBg^9FfhuJMLFLQZtSw~lZ+S& zExjDRS*wOOH)6$tvLDQuoQofR-e3`7<;t>taHL)*Yz4-FFH|fB3U(B0f;@6Qz|K5m zzpGo1A?`EdE%eVbpXELP0nSA*HJ+gqU__U$sY(IxMDeA|dBkJgfj3CQUWyiQE+;xZ zHUVEwDJ?IKWNM~~TUYIE}rTiZFu1x&3w*DZxPqj4~fq6*VQ_rY# zAig=x+10XVBMvC)c`m5tJ&z^x`XGHgcoDX+S4dxoRXIm#Bak z7U?QIxKLb7VPk2<$r;P(;RV1cCf#+deKyJs#71VWfmoPMQ=39P#t{j{kv+{LoPT-T zi$$TH5JRnymubJiJS;JHcWOvn_L)K4u9rT5OO2-d`R2sD65W24Hs1V?s|ZKN;9==7 zKIU;DQ&3-dw+T@1H>=I24Y@boIDVXS>5%xoj2lIMNZQ?(1!bHrbIp-4GDb|^9hGi7`-?Zs(LwMWu{2R%@w5>h?)e)D&6o!FHo}= zQV2#dW_EKk*=}djXwu~wzbZxA4ipCpeKHDKw8q&62Fwm)56jbmz$metTBo8`b}DU^ zz*dNww?JZHK<7GVp`N1LA6oo~-X&@f!DTadstj@`=DnrA|q#6Q~K$gN&LwuE9VJOpvUgNqOJ z3d1_}rMVhl!L$V&g^fmk`j~nI#mCOn5o75U*}{f2L)w-`%&uYOD6#`2b(YHtpo-)3 z*3`?%jkzx>_G5wF)$z#HRn|OU4Ljnd9q4=HDoT_2z(O77XICbOUBsYo2*QuXl8Rz3ZqV0qJSq53M!(Z%hKpF zK!`-F;x97$6yiQ_oZ6O5(f<7oTr-yZ=E zaN0tV;AqBxY8d*C?Fy&dnuc_CyfoRliXK^-2_h%1uE2{K5$bx&ytAguEGWjk#(Q5^ z-)La+vvs36f&+AW&H%jKe$v-$RVe%4V-t9C*|DWq#puYpCF%}_=M_rD*t(r774SFC zt5%|!z2IC4LcMrrLInU0Pm~d5TD6B;BQ@j3Xg$;Vc1HX^EO8`0(M<(aC3fR0(3Z8l zP0WpQYa89)F(dT0)~lpQXfq>cHe{msLP~pym?5j1s&J~_HWw7or{JF!J!PUGGepyk z9tdKfC|K>HdFt3X2-w4ExP?YX>mg@K+B_!mU^qK^F{Y5}jEQANSPA~ryep~l*rAxG;_gqX31o9@tE28M&WRlBJSO1RU0%I; zQigVWdo=_c-zHFanCk7nZ*H0H@5$v=J84(MYRiaMIe9Qy6K}C)?L1Ye8{!2p4Pc!hd3di_mbj)D%I(sHg} z&y1B5b23qcXcgGbs9#g8)5D0$4N!-*^$NY^(2>kk?B0vW>?dEmx2Lp+1VJToM`o(7 z!Ki;Is)w^*>vq}g^w*)0KyMg_Ms`?rnNoFIARt2%D0Ez0Efk-2R>J%O*Az^Sp#ej; z1-OpiB<5Un5(TBf9U|M@s_vM1_eJNH*F5I585D$a#ZNq0_DYf?BP*nRK=(h9VwiOw z8)mCe8ES(}RQ4FS#mFxNw;y6m16N)GL!r~jPREPpm4T##hb=w;c>q=Ty#yIq9J4Dz zmW%6_%r9fJvLexX{n)q6^iwo!!HP?gmX*!C<8h#t{ht=@EE|{$Z%1Qdv87hSSg9wf zoKvEt(F4cMMKjcpo1%9G>`97IV~2s$BJSw-JLgDI<}c-!Coycl-2WQMdC)0z3B-Re_{g6=9t zuZL9)rjnB~J{-jeeBjL*t|~|OF}eTVO^^phTO&NeR_0r1Ax6yW2eqm=lA%GXODRk_ z>xZAp6slQ6$y$d(Dc;HyGu|}w!X&c9)z`eHEMq~9=1_uzR54)Lh?>g~Q<~|E&jkE^ z1`tUsyf%wFAEZieiF!#@YCuC-3$O8r9{0t`tkz1t9Pxnbig~o7GrLu#vLt8^uI zJCt;e6^Jgi=4sGErNFctY@B2xRs4OxkB?`-fk0z+Vg(RvOWQrs?s{#)t~mROK!1$BerZ~AiTXY~C8tNvG}1*T zR!U+4V)6z?+>n_I6#U5TgHj_E3&v0DPenq7YhhY>{QPI{uS!`qFiXeif$qD+F{z8) zErT;Zf-_~5-d=b#Ct8BI(h;M8uU`Y<`-CDXFUIzO{yEgiy0`4TQolP*n-^-@en5#Umz^ z9rn(PnQvFSZ*M>J3pKyp^O%%wAG|mk#c6euIY~~Cg5!b9A(WyfB-hN?pk4galk?Kdt-k)c-S0>PIZH8_R0zFu^*mbg;hO_&zG-{W1XF3YGskD)v-$f~)HH8~xa?-o67#vf9nG`RISe|6anpiV+<$0|Uu22K_moiFW* z?gH;K0)^nYWV($Yh>n)%j0!RsWkl)Bc3-_!BS5V}*DARt7L2h|(N z-F=Z{`rl2?OM`>a9Fb+3JT9E}S!GM{iY661qzzM|ZBxE$cOCCY8ln zlsjF_?Nd~g>+5R=u^=WB+-z?(O=Pli^L(_;dVK5BMD6qcJgSWUK~sk^%KjIe`mg+J z9aTqm>*KOeJa`T~2Z{q_*7W~lJ*PUS2`X9y_aJGW!x<4>CPXMsGS!w-c~4> z5PKlBQ<-OJYV6FBfwV+8m9wx@mr8+H`zhzt0fLTshnyC(&bbFJr1Mo+Wc97A5Z*zQ zdBD=%)V`eV$yPL#)nOteiUR$Z^9-M1bl>>G=@Wj=_TN5K3-JZuXC!T53AyrP`d&8t zily!N6>$qfnmDr((gfaX5>Jkpa;7MdNf0`Xj6@hcD0;GvzhOb`*t!*ZX6R`bP&g$e zqBDJlh6!|LmAJ9aV&wj#)<~h~J19Q9qC1~dx`%vJC-3ROEoPE!HW;a&EvV1BBDyC; zHJ{W>y2M1rVzh4P>^#~$6bbZ!vc^Jyr*W?jkLByh$k@T6C%$zn*pIyoLkO#7v8^8g zBV0e^AxEwh!t)c0at2H}v7@&z??%RRg`eIZC@_Yw330wuA`((HFB*xFFeXYv0Im*F zBaI-AJC6@FH2;1Y+((ud1}7^fy>e3r@wbt}K2%-d41Ol)YL~)fa0&GS*g1s~)O)Hb zo$&QdJDgOffGch5PO9v4=stt2?YmP=zt`yPX*T=-qp#D0lk8x;L0{cevKTD;zNEUn zDJ6D=z(@DM6T~?rm|*r8I#u&?<&qq9EW~hpqi#nDE+|Gh{Sl-^2&tZ-05duJL5}Ki zqfYsNIX9fM|LgW#mCT<&S8u20H4vNp2BB*+CqiupGMvV&*^3VqV@c5VDfk8`pr`sh zF&{0G8?n&0hAfLa4@yN+9dhO42NW2zu()3gMV;&jzjYD5O?F9oXemq=+Z%K_E})}e z@~5H7AS7a(#QHO4Mt}^$rMV!6rdS1v(n0YeQX2}c&6A6H?YofH9 zo^t(=?PB7rsw7`HuWBZcb3y*fYe@gPGh@87Ntc@8W$_$r1Z)4s%Jl23#+{WXypQYj zXaIIL>7Q)9Wn|{FrK|wZS%6O>aXjGBz(T=$#%20lRwOI=&9z1rF!o?~SqaE6V!c!b z=mUK*M9XqtXdOpaH$72ys32+G`${JlDtKsrJ)Os6JG1F${w4Xg=)1IfZ2 z&-|zBV}^+5Q?n;E?JgVpOpoXyH^RZ=UQH>M195?^xS3Hl33B%bzA`ug&w+BY!^G3O|NA- zY2<@QY`(%bi~r>Ql$vUc)JucusT2C<6NHwN17;MKkdX-ImnKSs;fza}$ZC5Sfo!AA zHAsKo%oJY;Mp+Cj1R)*^HxQM(`e_`uwXvncg6 zf$I@aVoOfd6L+Am{1E>vG^U+Zv4lccjqbnsxDSJg@yqt`!lE#L0{TcIWhJ+byF{3r5 zxBtV`yZWlR0n9Sv3rEY_nnHd?=)HK9qzcq}rGnIm|IcnX^(6NoR*S zlT*p5awa5nQm^X$@%{erxqO~KJfDx}U+{Q7?~m*4cBMwRJXopwVU17x?dh}-ZTm8S zeSrbT7BdWryIE~Ev@e4a>Fp#OEUAqv;aqm39&waXuOrZ*1WkgIMOqx5Pw^O^i; zBlfXmy+1lQL0|c`!!yl>0YM#fOL$r2bRiaNc8WiWl{bIcvn^|q$++eWzzbqAkguNk z9dGKa1Oc%MNejT8kUbUwDh;Nj3Vc_+sqm(4xmZl3VraOZc9MUbbsA{Q7qbR*(j~-E z%Opj{fP2Xu5)6siH$7B@ZK-&=cnhajoTRc6eerJTYoPPuLv;)N416~0v<%Cb?w%c@ zSXD2+anyMYkFpe))Jx_h@V{mi`uwf_2BGjF;a^u8LmQWg67OzJ9^%9HyN(iU8(cL} zkJCv)zTx^$Hp`+zFq3YaF3HTn0zYMG|Ib=r?kvcBd&O7018_zxt{9w1pZj9WxX?m3 zOg*V=IrC1jeRunkg_F*`^UlhBg%o@VM(b#1En{EpI2Onm$4s&tCJ)+`UcWRw(S^;d zl({cHVg-QzsQ)U!sT8kO<0-zT&LMfrg*pIL#iF#z>rX|Pp!QJ<@}h`C-d6>$yU*^V zy!)Z_AEol&`3g{`-s-tfL$8bdBylU%?u}Mg#@&ktUq2i3N1qi*K7XeMqCA-JY2*du zbjeY{105%w;`;aJ1r(8<*ma!E?W37x+%_?92LS^iU(~Bp!l9YA*ueJJA^tR@KM_Jt zPp}womxs2;~#!aO$~%z5UO;&I$E9S-(Y}8?b%RU9}fn9Pq9zwx0xgV7)F@;vIF9BXwJZ5?54m& zU61QfkZ`uZrdZK0lX$x(IP#3xgpS0rO*EJSgFVX>R>I~rp*k@=1mP092l*hcam~@j zbY-0?xwB9r#i2vW&$vSu*0oFcI)ZRI$I?;f5C%P@OBiLgh%D>PzhP88P;hv6s8KE? z0BKF#-!0z(FW`P)Z+rFrjrG|fSpJM4((LHjV4E@v0T+OI)AO-4+|pEgrGXG(P!HFW zkyI^z3TqcusFW40+=Q%KwUN{xo`K!lbNal>jR2&1-`!2 z>UET7I)eKnOkQYo;~g8(=NL_EiX2p$_W?k3Idh^UHVS1cbh&P$~!oFXN~M6!S#`-e}8bx$lwyPPLoRaOZb3ojTZ^Zk(sKm88>`M$ zh^nGFa$L+|wwsd@a_{BHt)b0rD}`WMvEb`%k%Tmnq+ zHTP*>{+unA@CBNnEB0xwJ@lf?1cC!HpsN=WxU_TYK=e)8H4XIhq@>_dY!q^5U?=)Q z<}Gmhb3eQf#PtU%S?R?y^Zf&tln}e%Ay;DkI3Y?tJb29DI(GwXK$3%NJ-=1SE3*NW zT(|B%-Y3!M<9vrZ;n&**qlG@VysS*~XgJU;X5C3S><+i0Ob74AL<{d+#+kCbeirT> z{`cl@95ts%L`keSLh;K}r-&q}tyZ1GAF~}lVp8gpN9VOw-v>VJ4NF!tS~DZb2df8R zI+!E4wB%6qO30qsq(+se)Zo5_D~N{E*x5&_?FzoAZg8u`GDgo7Q z%smK+72mU16bW$6MrI%_Slw2XG#d+P8c#fsDHH@irshY(u`J>ovI9D>&?E3tY?!Gji({_%v6xSO>c^a(p)LCMr$w{cVfG zlXrX-M9Teom2Py=oNnKKqfhzzZbz--U(a9v-#xMaQ<8pmOu%O38ph+`?N=SStka>^ z0xxx~HJrXV62aU1g?Q!@dE&_xK}KNV2DZ34V?v~IQ=ElyX|rfpZ1~+ddl@vstt?k$ zHKbAT2f7$^U#x<{p{-T$1I{_I{FU1coB)YBIzy&b*yhCcrrzW~7zC_BIh5=AdW6kHg;@*7=sA9& zWgqXG>(tCTnH;kBWJ~_0imF(%P2b@qrcs7Osa}zIF0Dvu9_)zE=sJM~^kAX3)2F6zRtnVcLaOlDqhUi-L&#`3wcEsqma zL{j#YH~V>TDq#fPF3s-BDeg?9CS~>+2vjtc5(*#1N@Tn`(Bn4iB%9_dd3K~1<4b4` zC(V)kVpKDv3ldsKm`ybsLH}zJl@II}iumB)B^n#`UNNqxcS=_rel&>s)xt$Oyz854|q+)2w^j-sd~@-2epuY7&n)2a`kp<3hJV9_0Ww>mnG*& zMu2+M*;01b!hZ5VS3;Xd7okf-0WY6_IU;m<(K8nHW8Pi?+xeBn?Y@9Q~_TglFLO3$Z67*H*H0rPBY)@$_?gQ0qtfzcc7Qe#^01bD|rcCb;3hyYrx4uXrtA0j5&c1 zz5w}p!&fLn?m@RB(h>t_Lmy?ScUTMg(kTR3!||M6vbX@uW($ z4!;yOhKl}}USxN~@nS+~g>SiO`Zim8u7%!_N7KNS*owL`3o+KVMxRwJbte9|D*LAY z6?4EAVv2{yI**>DcT(TN#j)oA9`NpCR>E%LSd@_QwERWPY>`w|SGh+T`F50bciA18 zledC!*pl54usjvLDux_&R5uuFTrr%EGxA)(U21%8b+n$34Zh|@QxT!%3KRI12$pG2 zN$UB>AG|Kp&k~&PNLga;TpK*T%8WGE`7;s!{r&9tN!h;-H{lm-0u8IhmUT{AToiJ- z)KYdLEEM%G=%bj$ZNe*mymNb~44&|nYA(cGH&eW^@N#c{*Kc0>bNpTFt0*u@z263H zZ;lYMG@z8^y*TwBoRTP{W68xKMtQ$WxIZ;I?KK;<-jQM54B^(>Z8Z77T%E)i`abVowc3r;lU zWMk%tL3ybmPMV_q4=>_C}^UDwJ(I!Je@eJm6ZXtB{E3I68Vnx%+)ei*TYy`g7l2#|8p_@5z3=v*@LS2vn;a zv1~cUtUjOuBqu`?l@gV3oGRoOO~-bi%#FGY8&k?MdYd8fE`jlTxGWM*+%yFfQg1y* z3dPHr6txo;^Yi8|Zj^l*bkD?|)ogTLj>qThN1faT_s=$!`c(FpmhR4y&XVr?_x+du z`}qIY?(X{)egE&35V0rMz3o0_a{0Q`8?YTM$x@_CQ0d&z$4^+NTe2czsOY6A0Zp9s zU1DXE$CmkEr^qeCO9_&XT(OmNfY8kTP~bm}gNwVV%`Kt&@FwU7tUtEX!xF;_$;V84 z(iu3kM4xz^uex8l!GH*rRwT)6)fwT|+G;fLBcZN#Y4=g1g7n<5EO7vD?Y@{L0sS$#UWu{(`V^Et$t1C*sBn*D2#U;j(%~ZalZEQ^1N5|#X9=-HVRBO~w z|27eyZ&d8zA}R15ACdjw@}7LHYKId}#3Ny7?Ko6PNn8U9N;JqTCb;o;164R8e0A>O z@;CGoeRw3G5<8RVULas0UwI|C7{l1Ub>_dD%j8# z1ER%ck%>Gt5ceg7wrHuZ!OBN9>n5j>zv2aHKRVYKh6~%YOV#{t4rWs%T=8($i_s4k zQs+VG0)LiF99EdFPmU#cB6srR}V3voaFgh*-i&l^Ie{bj0!55X)%`G}2@Ciwv z2~SD08kK~gtRfLXJQrmg(i&=m{>Yk^{;W|m~9?bVK^|b=zYdd5Boy*W{9~71MHEt-)2K>UK!@KcdHdaZR%n-}HsKx(`-X zox-|kUWL4k4Ebj^(gkJ8NvS{WjV~iV^z#8EX7Ap#l0Az*m}n)GA@*lYElpcX`~)X6 zabhBgPip+{`$$RepZ1wCr&wKeh2~kyoFC0))0VO@abZ7Q9MJBl&Am`>XyAxexyXS$ zS?e-gQKvRCOGqT~LeTwPXg-6(nQ*5D-X;2zl#xq9t3*mX=trTNh3V)0f-zc-KouPV zb69Nt`)MS6@^Uc$`pqE=s(SbxDg=5xgefFaqXc+!hap=S&l-eG#5?Bcecm3DnzLW- z>#X+!%cJiP{z@(!(dnMjlSyz&3Q=8xi=_tu^zz#LEx`ev`PMqg0~Js4zk+@5!_?|e zD{C;{HP_2vin}XjdY@ByG6U8|QS!-Xlj=_up`onQ{#4xe$_kB#){o4F&276@)?EZ) z&@{r>#|QTWSg~|*Spk9rIzxv|_t)G=`=EChME5x)T8=5<#uxhLB+D813wq>j+YFt7 zmw*W|sl4!Cx)f*jo9f2rM5xbq%qC{(%*YRKgwbjtBY?|B@HNWCe0`rifugsGBPaBg zPk>$bTV>KjOgO!q^?$PaIUUm>3{I$H7fGcxx+;?XsX3pd z`6C14RIXQ&N&Q^*8kv1oov9|l^wt=Q;cvVsMq?Oqy=trpgL;BB)lG1OL&tttGEwwh z)#4(F=bY=5)VX50!tIrPLIDeza~V356;!ZZiAXWt79{IG7ynFyM4txt$`Xdkqas^N4f=q}hxE`A zdWgbrhHv7QjnTWL7n6K8F*_=}lge5Spq#l{3JAeZVI6#_$+JXI|%N^hjOdxu0KePo0< zchup;iEe+7Q3!wfk6L?*BzXxM z)f`pW-9D3eGeDt2&SmaApjxOVZ4DdJ>6VHO+xWh8LC98%3QP5E3hfo5k(KK|1c&E2 z!%3;JcCZWydAC#g+72C(s5Q&`f^zz^hXGwjTDUO@bf=j%Hg1Z0tD?$bmo-5`p)UC( zO$h!xI$-K8{*BCd+mQ7AyCr+HU;BwVcA@P}A|z3sjW(@j1CVklNoOK)fl6Q>a zo@@}o1@k(?l@USDmRS+Wk|~*@*TZ~5V{r#7PUP6%8-Ha59p%))Mlsn@OV0BND}QgT zzs!=b9E$z*=Z|4fZ%C%8xbXa9xuDD`aFU{Pwp*?Pm_>_bDY?uR8n1qWED+<~q1CM7 zgkdFXP65*$uN!%z-g$XoK@(sb4_4KHVnonY1fp$_zS0GD&J;HuxjK8leIZSYQ!T1% z=H4a-;(mP2lur>(ZD2WY@YP*P)P^}B;0x(>e>C|FNfr*=HNEE?T|!YxdjY8(F%8bH z=3MrrC@_Y<8qdah7MYu}rbFiau~n3S_LHTZDc;ugUsMv5np8f?p*4LT3VbUKwtGIK zJ2WYM;n3T!sY?<{8V@z*Ff}0#lV(aa_lRbn;JJNevG@32ynA}yCX9T)gAH-K@uN@1 zvqMKlVpXN;Sv+-px+IE260$9e+nVbXaUEy)3|d^*LpAAz>tn$8i87Buy*rh18%08j z-}uvmkT9XNQSjTw2@N}S@pMKaocDBA!`W01*-#dsYJTKJ)u_t_WmdKzwjJt3ZCd_( z&UrFNL;@%m_MeHOuqbX=G$GRTly*Rktqdy^#Qpj+*|`lH*CYdKiw|{*P~R(@*jbEwtGW>AlgnUfZ7@ zf*-rh1X6+IUphyG(%pW@>V*MX(}iJntVBz$_~gMxT9}{G1laHar7`b>`yON3g&yUf zY=`4yVHKQ8Ah}!k!-;cwX%_(fXn7q6o|}F24KEoNi`QX*f(U6$g}WsyN^7{{{++do zK6P~8{~%NP3d@dir)6G}YV{mns#YXYM>7Y0dJIT2D9AMBA1W~@h{ll1c*OFXVG>RN zzR^tjiR2lMZf)N=+Lm`}fIQBaew4-(NzU#SrG)7O0g71qASb7gqrdIu&#V%&s$pFc z<(v}(Z99RbM@JdQ((*&sdVa9!DDd8 z&Wp3s{_@2aVf!LZwM)6r3f{$-p0aP5BkY8bE^Z#1UKK<#3wUoXvM$^&Mn?@Fmbg+} z_SO$T184D_zLZ>VYM+t2iTV&Z@_i9kO=?#~z~$3RGtlG!Ye*CnpSumuX-|3>{ zzf@8#IGBrD>QO}KDX|;Jt4e~wL_G=Fk#HCNhY^HmfnOyUr_SL+%p`6n&=9TA3CEKnT=-6SJQA;99U;oCzs5YN+V6 zSUPQ3nPY+ca9bkyd`xv%>BrhdxgYD719!BZVy6T#M9(Hmq%^7`0BNHZ`I>EPM<6Nl z<;@}PtUq68(l-A-{M+1)jf#jqi;1&UXc}4nyY(gbb9~aAwuZ@Mx7j%}6VI9T%a^5p zm>+gHnH3cA-MlCK{j_U5@nJp~tTWOwix*wx%ihCEd47*TT{uazq5o&nYaiFon^O9{;1O~jB ztt`izJ(K}1-~=3G{r5**xot&b*}Lah@T-r{hTRg}|Bij2{Z=}R_53*;I$`uTp7mM& z#rc*aFY2_D%u_Ah-A~J4w*Mz_^A;55TUcM;qeJlLcMWTHza=2iKW^Zt_xED|KHVsc z$m8`Z*B`KFOQ*ok>ZJ@H59(C_wUPG({PNLOF7SF=`yRgYn(^x7)Vir!IwMA=eYz|% zLK`F`lnT9sYBf_{!2RGZ?YThZHbJ3-_N{*obq=@F5uLnWhc_UqS*e^b&TO>0qd+!R!zcfU zVqDg!*8oUQ7?bqfIts3Ht zmS!4vA&@C4^l+)|Pb>EtK74@q`HRVQ*T>z9?shIg!Q-T$ zsGY!GhsY1DfhH&4Dijx}$cBEuDSL&`d1dy?_I9T71R4=k4DKLDj|to1X>JvEDPyG# zBNanZYf0x0b6@6`Wu5<&HBx8(Kd;LV#TSOJ+;h3ylYVzgu~Jup<=O>yC2}D7=D=Jt z`r*njcu?5`Z_3)wXWGW`pGKG~4z}1O*DBXQ*}`I7F}KhbHIN-QrG0p4S}Yxw>-OEe zz`XIF^&}xyc)U1IwOxq^HBGnMPKaacHMYoX$vmc?fx(b}b0sIN zHp0dL&x>{8$$LrkCtpWt&JkU2mn189;8FKy?$)s2ZR)6IeS|J2k#(?jq@bqvoVLJ& z+!mWm?kcl*Lw?7&<=_qkNu+CmkIbcshbTIKPZ$5jN(;K3VJx0Iaqi8#hqXCKHP!>r zMHPZB`9XAKVEkpxkEL^AWihFE+OEv&1{32WH&Dzesc&=zDc9H+` zD@j=L@+&dJQcChy3lFd-=p2a%QdY`Mj|hvqenCSEb&_3UoUJ(mlnq4GV}>ycst!oI*FKBL z*Z%2xFaYgMP$@0bDxq?0fI;GUMEiE>SWhnXb1;afaCE z##~I=BZ^S=!3K(U9X7ygnE;TA-cc@(D8ZK<rLWl&k7|Y!4HUx))1* zV}@0HPOX*AwO>5nZ@e(+GvqgIGmE@&Hr+Vh^wh&njFT)8RS$1;>xGF<>%~MpNGl|Yx2OPr}J?PO0c??@o z4>rtJ(aEvoHFOl;d2l@YWR&LM^IT&~w@Z-7mj=MgR%`10EZ3djWL?7>cLjY_4>}P( zFZP_4(r~Svec$Q5YSM=udpH*47l4&h%8ZBv`3l)E#aKdX%0*bLlGD8o;YnR6KSB*# zA|YQ0nAHz6KHIkJ8*0=!d|%cXn9_D3(Q5EM@#;Sr2g3URl3ldEM^W*1nq%8iT~`Z= zV8|L7n1yb6Hnk?+6Qxo^Q;SA3IS_ zS2TbQY|usCRCB*q_-VLCZ~^hX>?pWeGo0%_(sUGJ_Zh(L965r^p8G7bQq+9Gc~qC& zErPRRVaOvl=dIq%#LvR2D;^l%^HFT3BYKR^95$Fpus==~By>yoYp>8ih)0V)$348W z&=W$uO{Pf$&+vLy&^-sdYM76V-ou2KUS4CWz8ww9xW=4^H2vP^Knw@F(y>3LH@XwX zrL}Jnqy%-_p55$&k0eEO8a0K5zSX(9#923IuS-aPFJ141i(G7sOG-nRrvjf>v3rga z!e*jjOyT!}?Kq&rNf&0xVn%3%o33~y-+o8Ab8D;s>7#+0ju$aC`!mh{FJKM2gnW)*`10Sobe<6Id(^dk9bGTQi~*D?%F%02Or0My>!*ja_0 zgvb12LpnmS_C05aI&t?+-rpz2Zk?~V*KKX{N5LdYLWLl)kzNYk>W4>cNA@@oh4^Z` zmQ&A@dW5zI%~RyA$svuUr`n-*pfp^{Be1StOY_CfkPk*iG*N6Q*KBi4>6L+z&5eKU?ouc%+Da54;KCyn~t z&r1n(+66aX3LwzWg>!)+RTG1lzeA_DE+&))+03 z=foC{`Hm~flz>=^J_%r?>)i6?yao)&Ry;cC+_y@Z{_h5poD53w7xWQrX==y`Ue3*g zB4Q=|qkX%14k_A+3nC@JjH7SvLl0#61xGzM`0AxGjv=K+h=I*hUVlvL_wn40Y;Eeh zh0+V73Y^0Zf`f~UMu%A01tbZ)4^Nxz^EC`7iDUf#!>!RL<^HQ^1KY3|~M zyUxK7He+s;@l`y=Sl6YUXc3Nm9HSz8BPMr*KM>mGjriTqBrE8pf8{7@t0~!ZWW$#X@Q65#d%pvHW`@;$#E7)6K{ zQC!mqpD;j_o{&*qf4gR9cRb?Ln6?bnEj7fzce;s^A4!3C1oScdK_qHL4>vu%OYadR z@`G3`Ec3`kB|qNWy77k&oJu}{ElhgmogY6PxG}h+r|T6HBB8ntLqW{aHwHNOef2a4obbc!^TLk}?G5Z! z8c(K3g&qr3Xi9W7^h-sy%brjx7qPHo+uVd)dOMD+8a90S_ftx^wbV%f=cjVELBo+l z@83lR->2U9R#Zuai1Lijj4olex^F_ldd~ekWg0nxDZ6JvPYPRW_7R5PEM z=ZA}EQP^IfQFx&Nsvoa(lU^NQC_Wdhu{f>PKD6cAP?3llI}wWH9Et_L2>brZss4w+ z)n!N)eWbHdDQaGzY)OelOIg zCYoR@;7~Vd+_FY_Emh|qn2%Y zxY9VJ+PGa^D3hhoVP7xwhMCEVDk>qzr)GIv(R9F#Pd+Vg{&60#d6O^ZWi4VVKWy4O zKQ*O`>^o3$UM+!NoMU7w}P7UHD6b=BZrH|1Aj!)F?LS6`_%6>J)+-VDmrc%o1wwE0ml zP4vf)TM_fSIw>ahP92&&!PE)_6(^}iYl9uWbRpsbJS2Ss?LWKB=Ml$(K@EH-QrcF_ z*n&C?gCAEsxah*~v<26=YjAGX{Q7uS;n*QR@?MmD@qfo#3qRslA_A&9R@gctJ~Qrb zyfvK0ebyJN!;LMwBFo;tfAsRRj#2;TDw6T%i}%+)=eYu(D8DRIGaD==l^A^rA=N3?izt;e}RBy)yr!hQ6!tx~amTtaN7O8S3&_ ziO$JB?f18OQEz4Fi{1a7mc4bt!tIdrK;(&)TSeW`#3v;~u2otDn<%RgUix^TT&H8; ziHrW#fc+K<)p5M8fk}K^gs$!lhfvXlJitSes05Uv#BXCC_-r)F>I!iN_n-0gE+|%c zR^!{)o(dPw;FMr@t$`77nZIH!S3$JtH2RcHQkYkxk!oIwxDb~ichRuRX>GPZF7N!| z^h^5HX`?Xgq&C-ww`V6viYW~`XMLWUTVeQUY}NT;$LxIi+W}8AzkUNPlLZ*#kj^_p z+(p#D4eazfOq9wk;F$!fFwu;K&ca%0A1L+mHc?;8|QWiyE2^w)>M+c|&5GJ|!SWec=YBDaD zkco)))x}>p#zE%kTf~J_Iq7pkZqTtcVe)eUm+m!}U~XjtPLe-Q%o^)+tM zd7N0Q1%EP{E=tYHTj?~s@i^+?yTg|FN-y@BsyDNwiE!pj%4Wn)oNmrZH)(4)2+?Vw zv*4J2&-(!H>FwL;9YIvVj8;9QiRxDG^SvSL)EkopcTCv6%2lJIlr%QkJv7N>mX;#m zpd|gDufszSOFk=BS_v=R+TL4veY1OPY;3fC8J#Fy@#IMJeQ@)8N_Nu9ls(Ks*6yin z#zxT1_1+NSPv=(5_Id}-%RP|eehfy=jCo_NkQRxWb;(t6pt4OFWEfmT7E6I9<+t!h zRwxupL04NQlM|l{g5t8L0k}s*Wkw-3kY?is@R9()@reIcYRhV#r$2;dCa(y|C)`o5 zL{tw|gdVpwb9#Twpw3pqVv?D|1>Pu}KW4NsY4AonJVC4zW{{Fwi?ac^2kN;y;Y|5RKJ!MqXMy1-L1fgyc zZq1hUG?<_7rZgw5S5uJFPP_2@H!$lt8zKxZCSiK0nY($I9UQR#4r}J59pyTqrzgTE zqq6vlRf}1LRljn{1jPg&Ausnvwt079P~55GZW(~!9pGYL8oIXDt8cl}*PD$p1Q$IAMBj_UYB*4$MsuIGv>i zg=rjna+F$b&;mV4+@jXSXz(~R&Sq+mqiBm=eBtZae%pQCu_P<|;Ld~0%74-$Yi9{F z+=1&=3QFIe9y;rC{uaD?gm>ytF>HA{7q$Y}b4Z*_lh%EY4)GO?_F+QrP%)&b9C_Q; zQT=i&ecC)4xAblCo7JOt$g5L2QXP@ND8hJX<&9{;x^y7hiojx@5lG)8s zzZBE$M=$>-{Yz8dcvTSbWU8IbkzQoYtsXQaQt&8P@nxVejmDe;C_Vh7L@$be*-^Pn zG!_=FLfo&3Pg@!bz2e<6iJQLkCB5=-k2iX#q(m+xEOfOsG{v_gy{_fd)&U>Qos@82 z`Gu0QTT^R7mM!qc!+PwtzI%_&3m4l5mtJ~Yz0e;Sf6-O@MnbN*-$||~^_UBBC4XG% zoF!3G2R2mvJ|hIDo~EH47G3?Lm^Gg>5m^#oF5C|#<*~Xz;%^1w)RcB1(8Cl?+r*qo z+0$xpUt_ET6oqWolthjZGj{kHeJ08Y=|0!lWlK>${^@O2KHV70qWl5Taw;uDK7?%kVF5(AAoizn}+K56*JlI|CmzD%8nG(KwctTFt z(a3j9mKBACXqgI2px>(cpD_!_w5`F)`$+t#N$@kl0&v)5C1j#oxz;Pa<_(C~v}sdS z9B`UV1Baw%6g@Q!gx|C>6@C9dZ@;HFj&WB?V9FDsDt9j*y)7B#<_EPBQF|(aQ!;;s zzHIzosJ;esx^CM7-CSpz4i>sqj}_F_9koQ$`>|shjh3fGA#av+T*i{|A36bJN-4zv zZfPMCdpL1Cdrna*l;KDMfMlrOux_Nj32Kqh zBP&--QnabS?LR_+Mc-b!k<%@?EIC=g4h4aN=(Su&a zZ2iWr=1ro5A-+Mr3!XIGggon1>eABn!9{i=1Nl|JH0Qt9dVuyd!w=RG5WAnZj|lI* z(&%`O0_VMz?-NsV8_LP^3H!xNher65Wz&F(*CF#FO!E4x!)pcxGrtIrKVvXgd@5{7 zb56mgmQJRr4^6onrnIe{TO}IKn&R98{lI1j7=t9TsiAzUX@rWPKr^&tUxerx@fUN1=D^ z4EugVdagTkS8X!~GHdGi)Wb^GC4H(8d^+AFH?dmGP*1}jQ8 z5_|gbi1Ksh)z&l(_&1^$IMa!4hgaVItu<{~qQ}v&EjXdSb`8~5c(fH+$KEXCD2+WujM@_C_NMc;WxHbTSI(62W#T0QXqFo_XK(HZ8{)TSt&5bZ;W~^kZu`+eRSRC zL47#jjAX%zgDR%g8Fw^AwM9(e?-TE*LPBHxVlGG@%7lqgdrC$ew~|^8juX zOCjqZ*C;0vXp>9PXH&AfZdrJ2cZ(dlJiBrI=Z2>pS+AimMeV^;rMt-Qs!vXq!gK;Y zDx`-Q^_95@iE8*F-2A@2Sei1w_;~bwGoQ!fPvHxpR_d49BXs@aKdMM~UyP2alGzSu z?~bvJVw1UZg7@b2TdTv5>mpC4Lvy}^oY}};n;Z*5pgF`;QTTT@@bBg@q{6vBix2KCaGbRv^eY4k&l zS~;O7XA>VjEzI5r6;&;qs!$Rt+I`4QOG#%7Be;kz6UxP412#3Wx;EBulR3xqtZ7jA7;(9Daftl~)kLZ6uZN z{;8W&0Ult`-o13LK1V94leg46Zr}A!F2P1%f1Dv=`o_GC8v|o9KmY1R^z^FHU-+%m z7@lD~^DCnRZgi7(Q*RiV+UHx}(;^!|8jTFpmKis17qHab7+PzBP|7m&n)Kq_-p{zs zLaKx1DZ_b5lO|3;Zbx7<(~^iiUC^(`Ft{j1skfiv-3$UQs59#QabLPlF4%$J(c4(8 zJY%KX%f%>PygSJ!0-jb)+fb^)38vJRCs|7!Zq|it=Y9c9Grv`dwnJEZZ{lC~ExlO3 zZ{wFvhTD_IdXt>&;OAX z!g4AZlK1KNmr?JVZCqNew6EhOTMvITl*1E=*g8FV@h(Yr>-*zBdz2e38yW+MvE$7e z;RfBXoY&6%v^bNT;w^9#PVI!8+&m|CSf`1k=j?GK93i%SlVh?l3Q;prjf+Bo4wXO9d_H8z=&>@ACo zRvt~0H$gCQrPv_fXty?<=wf*r=QDNz%q`;2*#oj@U1!AFCWRlC=urBrJQH(u>|X7p zs^*X5)NCx^C}u^l2Ye-!Vxq~K!=5#u{0~EuOiGNNNDY~shNAB zH8BYDO+i|Kj9ptdI!A*>8ym@<)ZqmlIQIQsmRWzvQ%>s+vZn!}EiZB(CIVxYX~U^L zM9vsmv+&n*$OPEj;7&As0ZkMV+ssaL0F*oZEyzt*GaE6>`6KsBgne2`?zH&ov1BX^ zM)06xgxe+YrF%X{9{))&akK9NlVO>Hg(~=mD&T9Z0j17Thx{Fiqj(%^3t;d1rTwx* z_c6FXGTO|l!I7+LvGyccx_wuoXKCk#9tyK-OEHT#HClLIltReeW^@Gx(=C2d;u|yF#Z}PTG}G<_?nPeWzjy8t&>O zCSdB2;`1GPAW%Qk4LqkcXP{IA`cld=vg=6|o;igv^Q+B9|0aF@rdWkeMe~367QH&J z{YtogI^fDe8^T@OnwA!N^-n(PZ}zBSdhZmoMHUwzQ(+Qf9>Ic!0LlSYH6J#nUX1=3 z-iZ0e?kEj!eAvDq)Zl<8XS{HFS(YHEHD;dcq;|w9FCpdKGOE>85x56KoZw_Ju|*1U zwVEg&Mtt<13%{}Vy1IGAl9;W}6{q-$wXCpziRdH3FV@iO2@mQA+vPZH%HObgl|5m? zUYa_8Rw3*c?QoC$6G7M4Hs?#quSyU1ubU; zjLIy6B8{}oEj*QzuHHwr%8@42BEixzMhEp^?DDN_YY_9T4)(?e`Spv!N=RaIn-2=H zuI|(iu%KosO)CRZR{SoFW_8%>bNSiIo*MT;L3AEmPziP5jfi-^MRr2jNpJii57;yPAQWxonkS6w$1=>B-4IWB`LGA5?LzC zkh17{4lm<($Bx`b2-%sEt_xmB0jHg1T&f~UfyOi zk6T@5IZ%c=JWEub5%tqWQs!bJdb(ymg)#s6%Kb74r9cD>2lX1AJ$vZ4YOkq_8KF0d znxB~Fs9qa~mHWWc=Zo0+ky9fZK{$*|hP>S4N(*6Z%J-w2IQP_pF}qxy1f#o? z&Jsx>>02uDYJ{^ZOq@kN4yAzPz5# zlLD5~0oqkAGfZ7FvK!Z^rX?2U@o-fZab;)DCoH}R-eE2C6!z58FXNxt5@ctiu6n$^ zj?gbI6<F%usm*c=OSK( z#4fSTdE(D{5L?(1i*)LHPdFX`^ijSXjDmwG!9!9b%^2uAO2ac~AnwZD4UoJhV)_tc zOjxTrIADQz*EdJ|di7hfi^E>cwRlyv+*c@qamJMu^o~(bq?I9cXe=3BP>WHEGHV)w zSzG%qykRzIRPN_3=HwIFvw5|*V>^%UpoVE9vO%_|a{$ZYOEopEfagard#L|xq0jc! zA9E9dG;CBfhkSv4cHnN{`c|~33ajdJG*yGcsu`d^-h~PtcNQ*}d#$r;>TSZ%XFf5m z;`ePM;r?rV-v7I4&~ZHw-+N5u`Ma;RDD)`5uV??koEm57ciYLn!OS=82kpR9%tz1} zo-h&UIO8~qWo?6qy2?g^J$Qr#t5W07_vHN?7N=nML*)M=+52IhbB*paD&z2Y#lYW? z@wX(4>^kzzh4xdHcZugKD8}pF1mt|NNF14|wlc$$cbt!|@Y6n%pQ!uD-OK0Xr*A&H(_l>*9vhKJtv#%ayOZ&18%>V9m!!3-xN?g8R66Ql!iHvyEF z)UYVFkMQqB$5z&lIP>Cz^Eo48lY3cwt-5iWPI9dSadw>g&v8eTV#abPpG=Zeh*7Tr z!}`HhC4vL8S}{$#38DBoprSu8LZtb||IKE~wU}*wkkAXVZ}vATa(}FBazfgE2q`$q z(BClL@n1IhSFfGww{?0y?ia;=T$c!q@oFr|2)BBlOY-5!;7R3hF9bD-gt<$h74n?e zN|tpt)-1N@q8g4^AU?mdGV|KEzO;-_!r%D^Z{+_~5lKo!*Mmth8)u&#AtcVq^!*FF09Fx~4~f_b;S$WCT$w)V9aF%0|e^*JEfO(5Lr z1Sh|~7XQhHqk?gN3uG?dUvtG>@Y{NQS7Xg-HKG>SReEF zHT5XkCx6j5POylSB`KUV9(i?e0jJ z$|@;7B`J+1m45oN$*#;Oa%%dIH!q5H5|Qv;yu>H^He4TDzlUf~2`*qR zll=yHh4A=_NF(d9FD~{-2OWa2*+>%Vf#*v99mb{_iR8PO&%U|a|lN_O{n16Zl48!++3AT z*rQqR9Pw+7&e4M(2+q0cWA%i#@7QwjvvEmA@Px)m`COhb1(PRtm*{%_9Nr&Vn2P@| zQ?0P)@t3YZ=d&sljo%Ja;Ro*kws);?_MsV*=D~uBou0u5s>$^3AX}4UQBRf_WaOOs zkMo=k;hsT`Tv#n)MifC**h_(3pcBuirel4$>5IJ`^AtK-)f zl-Sh%axon^Wo*mz4f+05Fm;Jk;~gTm{9Nj6#0?<$RUDG(UjN7H6W&DlfFle-_o2+7 zc>!F`G=OzrXTaS3#{;yr$>MUYW7h%kF>Bn5_BVDXbAgkA-{JhVsTgIqxidj?GUIW_ zTfc*{s(Tb|nEHJh6`yw#mLqptAOJ@7uzk!Z&Up57`O!B1$iFn!!%%Bps*v51k-Y3y z6=1!^!~R?H(j__N%E@Mkplpi(Fb{B#1Q_>x5MIMC_yFE&BF)I}u(wxd(s;Xgm3I zJ2h_rALgV6z@rX+D>sT!J(C0~3)6JIIG%EHdfNGYoaEkq9~S$H_a%$@FFs@2UKYmJ z9<&f>IbfqQ4Ffj3sw+8)791bOX+1#?OA3NvH1r8rJ+**4(zK(bAKj3j?c>t{diIAM z%9zOh5`P}`OzSGcIDI1pmR^&6*|m|A&g4J~;9u)-$FxI{Qr}3x>$s)6jU$^T{rsn_ zeIVXaJwTmr@%i08pW5e-e{60IC2lQ=dn3pS*rMK@=UDnAlDE+SrR z+HdE4vOGyGu+ERa?02ZKW+mlrtH|@YO!ZVsD!7dmi2pVHDLdwbV*WpRk5K~caw&di zs02(hF18}v2OjOr8s^U=%eCSb7ibRls98+jE;#DZc5PQI6dB|A37yBIoxwClD?NF{ za0+FkJoyQlW>)3TykTmwVIM|Thk<&lJY1>cB3jdv{d2MoS|aOV^&u1f3PUcIYa-qHrP}-!helqKBq21fG)=uAG)N(J1`d7&=bd_WtjE*vb3rZ5?|5f& zx@0G;gZOjH?$+gXz*8B~MQbls1ABybZ#0SEo9tj|%wC!|rfESwvdT|(;6Tg!Gq|B{GlsaJyO%2xQe;ME=8^Hk>fa8+n+69?A|8L<^mw|5U{CI4+|l0F z>1KnqMpT2B76#%-@)z74f&%-QWMO=aU-@i2GQWmj2Y;5+2QsBto7>^^@ROy6CFH73 zsU~OqJ{%M&j>8?#oUFl5MxBj?uR#{A?Su0=@*tl5u!|-3Pq;C*-NlR^0cE-ar@RQ* zN^9KQXFiF;m6}FW1>wA?wGV_6j4JRpdFFAVDHFL+DI=GfLXlmD;Bedo&cJRPMq|pH zRw-}q>Q~8$;9_3e)YvhV}LgYyszm#MTCi@mCQ9i6+VCnG(@|8)z>`i@A+%_ z)9!pH7k9Mo=h2gvTJ*c#-4;w3{>fiBY~1i0&GFy7G7EoE*uj4sy^1@HCeFk zA%BmHu7<{)K0=E41-P0G(tRSnE&_%_OX6q{gQXFyU`uVQh9$Hd6qW3zvj??Iny`Vr&4rQGw3`Lt#0CKwCQm_B zsHwt7t<*f>6&Q|44p3fDW96vPA++XozR+e2(t=+fX$e%5ib46d!(;e8UfI&RS|_4! zIkrz>(R)uKAjbn|bGD4|IC4Lv*PQ)jGNd0!Hfn;E*oFj=S1iAQF>n+qxK}9*rBl^F zBUBFuJaER4y`rNj8foMmnlu9)wj>NF5vqHL$!&g}r8R!Ww9NnRQRupFDzr_k`(%Ot zxz2THqUrcKhroZ$P+VuBn6ldoNVB8?mVG#b%&M(g>M3 z%6Zp`$7BVrU2NVEZ7!}cBlt>$qP+H|hM1ZfatmLNztudST^UW(XOk76PyXOCp?x+T0Ptg}3$KC)w3seR$U#Ol0v9)puJhR=S@qEvl@~h=W$TQ|G@RRCv zBc2H8%EgJEHE1I(k{_p)>ty78N)(hX))$nOCUG&BoVu?$TRpoa|Kk-aeC9kEi?Q{u z1N_poYsPrS8Hs-$NrtPR6>1~sCPSX||Ls&G?w&p+|Ee0f<1b@uHV@P}hA5USk-av7 zDCmzntUQxA?jhZ_q$B$~seLT%iCM+v9T#;B9Ql2##sfx$HTC1{3H<)Zt^7b)=P%HO z9miTmUyqdP*<;^8-rTdsdoidpvBXGX39z=YBgFY>7XiGO zmF2cd-=#a|_p=I;ULQzm*qdq`8M|v#%dB+#+?3R_Qg1mCafTZd*L~yT1b4F*_p9)z zcy5Jd0k?W&yiS8L2L=ucD|c)KBBhFTxP;s9HD7+<>_$NzH9%)bYnkQ~2^r5Tnz_j` zj;w$QWo226yuHA40_ez|J*)|qCSupV9H9;6$U(nk?ST&-b!ZrOD8?Ri`Y1?lPYyw< z74yqOhy;*a(~}==9Of56bvrEm&hm+T#y8&P^rUB;@If~q+r>eogk7pUed`i^MLL7T zxSj7D-``iaSfIw+TZG$5vbBrRKWVy?26)anSRP^qw)BB`_E4%-b+rjYRtpTdABL_d z={%i(u1@gIth4DIO3|9O?OeTE@jYXY?mgai*^S7e#7aU$Dt}!(l(P-E&K(+rou5;X?ZUvKQ_I;DZgSGUCyo zJ7ew0N0G>hx1fP1S@+~&_#+7mlaK=Rp&2No{7{T)>-0X>`g_yjl2{+RIw?wcWRQ%*~6+ud7xMQAu-Ze$Q>jwFGu)WrnPmrK9y3U@@FJanckShi)nR<#A3<+o3-~el>6N-dTvu%dx*b5CAo`^taJV`bf62OGMT_Vghi~OJzB3 zXJW=2we1Ak1-=AWH_@CR)7!M!`i8U9e-SCSHWq((hJN@E_ix(N55HXvRiDzwS z1p(K|wGl7v?%Bq34Tw{*c-VyUlW}0g55o9CP3Wt=p3afKJA6rFmUs)NpL50Y#KOVM zVffPqSyF8{VClGM2Tp6``4n(`#;disCwE%sUD3m+UGx%$ivx@1^s&a}vSEmOhCOrj z4pnN`ZJ$*p27Z=nMQk!45mwO z6#}kdW1p(nOMh3*f`O#rjF>lcgXAhiTpu7xdY6A?)+J|_HT$ibWhoqw*? zG?S`Yr`dnETkDy1j!`^U-K8R@m$^w3;PmJeU!dd)M)w++^y5i z$bpAE@w3GU)#*|rq#+YP$*~lqdt$x}uN!TJ9D6JL?z87lbd_ zjvgzy^Fq|&n=-uhbdil+ID%G3kKnODP zr{?+}K*hJgbDr?cV0hBZsw6!(D)u|Gf`_oiJcokH0X?TxJSIJ=c0&5QyBp$FD0;iI zL^*GJ5vor=wAD`5{H3^+S`M=)u*>yGqgP0e`4Lz8)1Q<_FUFU8oXrrGMQ&XhNEB$v zrhV-kj;5dgHU4-7HfEwlmMTA}mtR9JI4)*BA#`UQbBPkr?DslK@6(CP1eJHSx#4C7 z?&e1?d5HsWsK&Vtr}-{^op&+iaLDPT_z+U_*m~H;8%^gs9^pKS&&_wDmwP4bo%cFK z{t&0{acyWq=Qp6zL@4(TK8rO>XgnVPe0ZmG1Hg1*Q$a-`Xd#dG!sOQ{T0gn^ zANh6S@WcN_(C|Uyl$AEy_0ud){F{`)KkQ)2}1eSf4d+*#Q!1X2=V~Y)Sv^=uDADKlkF9^IM z{$PIsT|B=Z6(K$p!c2go(eQS=E?&}5j3fr|%isWL;t8omw&BZF=IKLwJ}^H*Sc-3D zBHQC5nyh`QyV2HavTV;@Z>u+!#L!9XtoPP?V=~QBe$9m;1l`iH!4X z`@kx>xA>GHOTQA|z>-EahWZLNU3KB??so3Jq1qSzE0?&JmZ=|toEd!eX_H013dRBy zZRq@Vf7QX<%664#71(3v!cy+WVYWjyc6p7+3FG;7F}q^@VR{7#o^PwxLA;8fo*yo( z{}uhB@V9*a9|w(@bkj}kI(v&K+Wy~Tk(H5u#UYUr=<Nl+@!XknjCAX$gWpqJPYq=D zQ@VfD#G^!|9aRcC%iw9w-}wx$d4CX~tL2&y))o2kKyiIN2r*W=-NT0%-K1BQ^aG&l zmH340Tz2ok`itKoSCe7f`>;~T82DP09OCikE z`O-DN7AWzRM)B-~4$`eoF}oXO{tuKEY-CH@gblpp%EqNl)x=;KGMt)p$|E!RrYcU` z8;+b0yQ)wJOz8xyKV#UxBPNP?`j*!*3X>y6#ISA&2P38tp7uFkogR^sGW&@{c)VQZ z(f9A%SA>&maBNe6(^u}Wr;Q8o4=f}kUG6&P1A==c1+0A(aT2V8|Ez` zpQ=20`&%=U9LxcxFsjqn0XI|X0Q8FC(Ji|DR>--q5-c62et-eM4qSC$pSeYyLezjX z%M@xaoyCAEzua!*>WO7ykPq$OkQ`@sqnrN`RBVYEx=MxCy%1!>C*;5S4T`-7^Pyo} z&YtIseILy~Et?>LD|mzB`M{M;TFCk--3$(qc!fkaI(8J+|u!J_%nh#G!mbDTgNBd+!mM{-L^Y67x8 zvbjWDRZXajhmf0PzF|J0znViSvaJH17dv>Zx~Nr(h@7T;B0*7uHOrI!?IJCMZm&mp z*q8rFeO<>GoA2#o@iSlIXJQBjz1*rYvzAq>55vrSK59Bfc+{DmKtH@mTshE->F{1= z9OCF{Ddj?Em=Y?}wiUpve4%pSmWQv-`yEO8O8;?X5oRXhz|q8DTxaHyz5);+D{$jJ zXMf=A0RybFy^6w!qtg#N_lfyQKF#W5Na*=_7se{{H|#a{vsA%n{(B$tC$DLv2BB}s z6g%$UK`9Ald&%n+<~YHQF$S^;)DUbIi4GH)lVo~cYN7@a|A9G~LaFd%hrk%V*j^gz z467Qz(<%i5%Mj%0an4W&)xUZI?_W7~#D4t8iP6If;I8Zq8;gp*4iEoE>uTkw;Y)bl zjYmZnzSU|074y+kp>^v?SBTAe8oci*=8mPw5cwHbez3OVy54k-g}tm(T^R@cLHoXL z7XS6R%@NKm%VDiE zx%w*K4sjRmsbqFqHiZm=$-{ccEdgJ2P(%KO2>`GBr!EO&+4FtubUfBmLo|qdc>z!+ z&mu3b2hI>l&M#(%ypzBY4O?Tj8ZPIM((E_7}wozRz$w4nt}SLuPKtfBe}n z*Roq;1s?VTW4!1euJJf_)Kl+k~W*}(v!s%Ww%BLAjAS<;f9a#TQ2%ziHh z?jUJI9DQQ3A@QW>L-Y59MO3@f0K(i<<3)H6#D~s??Z1n`2Wf+x7PIc=j3*A2N_O`3 zR*z`WNC-cdZ1CAa9PQ9ACH!W)Eh;3-9@Cp}fJA!>22fG@;EeV%dbN;2f#o{DSBoFh zz5*FBPAVB$Uo2r>ziO<)5f;Y~6tN7u*}$!dXoZRK9HjKl?Y^j-3tT#E_F<>z!ltC} z#nTiQ9BuX4z$@2^5EDt=hmU@c0iAw^SjmMjq}3Sct)>MW#Jei!Y8@n-ZOJfJuJS>3 zFq;-To&!0@e1N#MD;D$Yup2|RHB_;%R3AKZiPpI8=zd4Vjn)g82lBe+>)eL>Y6>8iI`DR>zd%BMnNya;jpU)_&cA z+@jhWN&XG)SPFam-$Q53ub&QDL7#<^^o*PG_Tzw5$bwX6&y?nZy?EsW88QSJzeQ=9 z&|325+Vyt10UEiqrX5(?EwQmS8U%+wHUNH!#I3vB=Vq8Av9y!H#&94 zRM+TefxFz}?w-Yk2(R^KBb$7(nQ8;T!N?4>HOd?rVeFlu7D+wMuyfZ;nAI60(!qQ% zqeZOhN07v847O_f#IVbF7eKGMK?cU^kK>{3tAhtOIs^WrYh=k37k^COW-U6_$Xt&( zwo4eE5;g>2aZc+yGF5Y`ZKVb9W>&rTtlXfKMEyKE<5&~9-KesZ%pi28sZoPuNre?{ z!4Q(EAc>C;!U^`_566hWlboQ*{R@;g9zUZO6M=J8h!1${AS8m%IwG-;(v#`C;+bauMqaX9uI40Xc8ldQmQ?u0os?l@g zFsHx&dOkCR;tbW2Hwx~ykM6n3lPM?i&WDDE$2qawo4BWy2YbcQ-5!ZJVuEl~{*Q0A z;;as{k-$w)FhI{)Ue&32jwz9c&7-w#L?Ka7RsT-}Wzml$Td3KCf@iohb3XD~vw3h8 zGt!ii_)Ndt42L3$gL)S}KR?(A$asAQvIZ+313V`UK+WBjqz5K_i&`|10HM=?;JjLc zRR=E%Z%Qt8Th~N+E`FI9aMvA%T}ZlN_AZxFSJrsGF=1S{V9e03N><~G&Qb1pC~6n?6(qnpXkS3V|ZeM1Qk6oJ*+KHSsd=2s78!| zU#X-0W7mL|7S|YAPs@eQlKQg_d~^NYh-~Ak(EhV>jY)e3Dy7D$yb!q;(wp{a>RxTy z5Bgg|A<}1W7%#YtFYACUo4a!Q2QDyMBMUTLbzW(avfVzoI7sT%@|D*A_<^`*#Sgp( zm<6$Jsu0{rcZkhREySYmVFfXm?fpZ61|1gIsefUPs-0 zF&3y3W8{iZ&!5^W*MXoOs(if1(8p00MtSNP+jh;T0af(RnugV;;gaE}z9AMs8plKv zUFG)7GTt`8%RQU3LBT$Hmw)`;seZQ(o8LsATRU)I;=gDpxdz&Po{p48p%j5n_4pxD z&lz@B51%GN?^}tjbP{UB&4ALY8Vw@|8Skq03Tc<*i2L^22D?7t`=Pk6&59XAac%@~ z)#C2y!_>fxHICaZb47-Rrs~hT7Op*U9uynRR!0SFd`4%=Qpc5&^8CaBruWXU)e0i6ylv>VIW7xa!dD*q(Rzl8Sa@ttnu4Lo&gSw1(Y zeLWpw(vIGoDZ+WVT0li#i+5;;i|eI@Go`Js_@?A!YZ!j9~sx z`?G+!7xI-=wPgV==50oKYYMT!6bGCQW*>T2bs3G`cn&@+NFi)OK~4mS?)PSQ zu#hkFtr_OhYoo(+URHf(MXGqCp=!wZ1WrMd?`Xyr7BN?jVtz49mUdokpO%IIOH@&c z_o_#NMNLVX^Z16{!q9S5Hn zwA2A?75C;=qu&FyxQZOe2(WgeYcgs&Re14uwU&9;-#oMdA)r){?pjY_4nZ#pWV~DcL zGpL7!dlPvJ6Ot-ss9&!hU&aYzw_{)kR=yhkG;te73~?^4)I&~dHh}?s2*3qm zgp-a&UjHyxbPV9S2Dav|8*RyH!gu29SwzU3A$>UzNj~+|DYt5CS1^%K)4_Q@b{6cP zz|VUd+c$Mq|HK7}E1`nnpeeSaIVBE6`PsBdZCc?Bdhg8(c;HvUeVjpL@8^>H@7cY* zTu8>gX>2IwpOhy6-g)3$Q43`rBD+pNW+T%|`iUSj>~K;A83pbW*{X$3mmqe&)xC)RHld(d{cXj!v!HJ<#zpfUn=P(ArN4AcM?7 zzZ1>G4=kTU*fN;x6QT?;Krk4E$;nZe$7!KgY-HYb(tzwm!}cT>45t=Y_Wk|vSEInq z87EHUO_r}vMnfW{D%))goDPi{+yVUuJLE@_;R!MY>&^_33#wAKM3MWx$c9H?sw|$o;*A8D!^5% zmn9jSGQ8=gwj40}ZS5Y~4-CU^s@zhZ+IjX&RrrhUX99^^rGp(+38DeLBWc z)9FYI&bX0{V=2-Tl8Q_jTHe@#hFEK^0)E{xxa~M@kM^`7Ec(CI{gd6jiE`@DV%6aR zxre`Vh>@Q1PmrWPxJEfrGZ@y~l(#8P*c_N)7d@2D)lP|&XDs+_#of|usY5o|=s6<& z5eW}bT>GI@tE!4;b9x~gi3?(BIs4fO>qgD6n&csb%qp3^gP(Muq1TWFgJetLrs6`3 zwjK;U-j;BN=%ZFhD)Ab^`R%Of^KYO;F8A6tl(F#L>r`QBA=-JN8GylLa7z0Vkpwpr zxBGpe3UDA*Fw=9uu@ImdPSa$W1EjKvIv;6_1%Kmsk}y=w2S#-KYI|gbxfo&*@jI}r z<3!&N*x_QIXpt63-w?R~F3)@Ln}kO3y&t5ph+FMmKA4Uzu>cNqg zE}ZP4PM?ea03%FMo}m>%Z|x760{buH;Qij|c##r78ubGMJgN3pG&<(b3YTGvwUDpp zdhl86zL!O3rdaR!se)>tk zaMh~D%+PJo*`++aW7crc|UlO*hbucF@4YRQ}-19!U_)n`95ODY<&CSJ>yY_v=HK z;XNFg-|&?qGx&p$QnbsVuqad>@2X$R?X-5aL&R&20R5|sbmut2(2?V2BE>ZukIM144x>7S2ZFNe-# z-HTWu5)nX?9lEq1A>(lGwl9Z9R>0f+H#IRBB@RvCJk-&k%kO|sKS4**HDfN_8ux!$ z2;Go?lrSHD|I>0__V8XnPcQGyLAQSj?KELz$#;j-wzpsEYG}Wl-=(&RUqES9DeHF6 zu{?Isa`!Ue#8XV$v@2V{m0=`AoD6q);|^Su#6wf=9@E8E&; z3$d4S{YC3yF0Fn6~Byn`6)9D zazgD<4dAMN@t2bWB4R8QY;?o0<3nT8K5k$vb$ke^0eooJl}mqV4#Odva7P#f$QwWW z{#;^zd-7po<@9a%pR z_P${&rWda9#Qd2on(gBF1M>PObUgY$E-uL+1iNt^=@^RDj})Ic(PStuDtKygSfk`q z)S)UZj`tlRf#n^Rsd#9O{TYJZJ@S4V^~3beieT2dyPe2&(jjw7BA?&1hv*brh@G@F zbrL{TVEA`?I?Hoeq0TBfKag;MV->Fb5oR;)T5!-uDC<9HCjgdVc2fM$y@7Rhk@xwZ zReeQ#m?z(2ir(ey-36NYgYU%**R=pMnf>L;XYTzvo&{lrX;6t;L%+1Q1QB6Ul+GVZ z67N>R=vF59Bjby|oy<=To9r2G^=5b5SKBgbE24EFr0Rh;!*9%wwyI5L|IRSc?yUdT zxKMCP{peKZ0Dn`a@yPX?4=a!sS2GR#vK+I9eY+Bin72>e@-G`Z^ljgQ5iM<}aBNoe z8g~A?eJQx?_R6IzLXsl_rhoU6j@8K&!^xYA*jN9Hs005f`=IadNgx1NC9>LbH@Gr? zU#Oz*s!_WBM?yyfGL4}NXI5c*XUr9CD1FB^0?Jil8eTs(~_T)6NbxdwZOZ87)MP+p4x^ z%$gvoeDA{AVv$^!5b|__B_$e15LYeYbpWZbJ&eNY3BP6GA$@MDv!6rjl~qz=&-R=j zn@cn1n8sV+1GSDA{j=s2KYa%k;5!s*)K1TUIs&bX1dxuGYaJqonJQK^&3&zVBlKabJ0j?46?iE(bjPWj z{c{Bi`qCz?yR-uuB8)H|aLRYvFVw48lzn=BE8 zeN?V$ZyDQp;6%6y@H0{v;)z<9F?=FV*>Ax6AH=;W4cG%JM59*UH;Gotty)@-_z0E> zxR-0knLU3z551}Xb}3X7Q<~DH?g3Arq+BrMx-}Sm-Qr_rHyKn-TF)6o=oRM5!@k{w zvx8#$G52#0z~v$HcEa_B{^rDgwMp)ZPjbHz0&+riNoZKMtou>WG?fBhewUo1v0srG+maVYzOO5Os`GJe_0CdaO zba~5W8rQmV4V<>Q*W^u-p@C$bc9$=ZeeDa%9cUnAXSd7WIR@QZpYeXc)6^fCmu^t_ zR?Zc;qi5=w@fD9XiQVRP8u&}FM=xhnRmt3s)=M8RVLs+Gwq+erYqv-->qY)@iz?&? zx`EC0h)r*d^J+&qoAlrsp7vC{J2I23S$YtvX$ihQ6$yZ)h%EIOjI4PF0e{%z3<{C! zu;*q*vE_k%r7Db8$;;{u5d^&cbb}`P#&}tY;zyxBqL`A!%uOqQ8O@`^`tS@#t~q+l zF+g>BXxLJ%)pr}ozps9dLdnZ1j?6n|+dKd>9De6HoLqsg!o$pS%<<&%YKE{u@|p?* z$*a)S@@ZfJOGGN@RM1IRoFbuQsvS{ILm}l&@^yAUN&3jymhUs_l6U>8EGMR~eK1t7 z1TDK`8huc8ovj{3bPo90 z{pWpqhns|8WFtbnZve5t+;}r-!k914G;MMl&Ymtre~UDhTpK|7i%3VEt!*F;WrbmN zpbrVJ>9a;}y(u)O6Oi5+Cqtr9p;`hI5!p`puMQs5{~;vwzDh_K-ZMDKD@;6BER+_s zopw+fk_LENujFtpJ0*<;aT)KV!`{*zC0h7+6;9mh%=z0Us#$~>e*;)JBG5~3)5Vn8 zR#K$$9%-dgK(T=JBU%6n5 zMEIeH$_`x0A2hgZKDbUVOdH>E4r!#fee)G_>o7G9))4nAzoDwQrIzW1XO9tx1E5N@ zAJeDSwL~Pf;pqt!P=(QiDPe2s9b8EU((rX0y(d-wYGdC0JPeqw84(TL077huAY$ zw}VnM)`;jgM-p__G@_yB3J^{W1Ez5+8pcmCeY!>0Pju#}al3>E-=eTcL9{1gY$rTV zSR)+S$PJ1g)|6z!kQ4&Lmcdlq(zskzuY)4u_vj}SdO4pqxD0A@bnw>Rn78*KlbY2Z zc(VpPSy``VT&luAl(Nl1g zXRP^)h>52bY`p7%aSt(+_iyT>aNJ;(-1L0X3O@4r;9>tZAoPcdzS>X~QdsW3`&Nzf z-jay{O}DFV``xL;#PAQd5Brz&*nj!ipC-KwX5MYjlSzEczbcJ50d37?WCe8Yv&PLK z(T`J4{z@*a7g`2vGg!Qy!+GahPNE4TuBC|G7mGAwD{>ks2-S}PE@o^AEXRqOlCM&zMA_zx zA1(O$@tXW!&%*hZ=z`CdJH~YaU@u}54 zU1WCSw~meb`0b@ilmUh6{BoTDIY;A>eb>)vnEFVqY1(bDGBaZzWIrrBg61lmjx~4! zVyBWc(60E|s}^3}_+i8a5{SyKK;Y|J*Ax)d6zN&Dca7}&w#U$*wt3(oAV6aah$qBC zIOy5i*UiXhLP^?WP(^dCiJ**TDK3VaniKx{DFb3?*n)(}JXpAy%?acv&QTnlciO6r zC@_y@YnD0s(Kx{IF?wo!QZ+hlvo}tO`;cu8uIrtau4MSIf7iY9WXO?Hv*WKRjxiTk zVUQ#~T2pE~>0n-EC=|fNhoR1XEVK%W!paHm>7h{{^q+lHifiYDDmzNp=3eA5pUoG( zNb2ZK;G4i-SKEu35v61PFqA==%ZQlXU!6y^s}fbUFN;mQ=NnF6mzhA%c!+YVWS8Pw z&3d@s700NJzW;lrvsK_OVSX-45>Btrbq6lGv-=A&gH4^_P_1C{p%ucfwhkn2mXq)tj{Ix=Pml?AA#sA*FY6G`@m38#1 ze|{yd#{Y{3hEecwI2G5nxM0J>=ZYu*@uo!M8B?Mz;IVgq>6w)ri0FbL-8MJ}s^du& z8^EfAKoww>0hJ*dr6P{AJDjUcXTyC}phBT$X59F(D_wo?@)18;K^?6!wjPLYJZ6oT zLueA~mil_9Y&gy1LWE9VR(8xCxKbn6q9iGVF)MR6Avj^L90_%&f<7JO@ zT0gz_?VA16?lXug!GD=rON*{|OddG@I{k3z$0?F&Y_g(P)7k(u>^O^tvBVEY>DtYg zjwF5YOfpmLXmgKN-C~KJ9RA-J^0hhwJU#B_r6=A$8s5w}mHw_ughpPqh_-Oj3jxbX%W%Bn3m(;?(a#JM%JH&zfmQj&bTF zG|2{Tt>6)e&BPm*ES}ubcduM5*}8Q1I-3H1y8`>qa?^z#p}^@OVeEe=_Xk~=>637r zIYeNGLu(K}3v?aLIr!t(HydiefB?G(omdN##y)&th{zo8bXSWWIxIWHa{zQ|ias^Q z!e^t`ULgp+A0l@`Pr%ubu>w-5TvW2=eLyix_EPXr?)N36J&of7@)+I%4J~d@QZtsH zyKI|!N+P;w%|;q}{JA@+d<#1=F#@3@PiK~ZH7q*TH-0ALlinIz&X?B}rfCFg$`yH~ zKvwsn<38$;m7|&B81DT#)J`srfykT_9{eW~Vt%==3X@+bW-RF1(sZdw|NhW}Z17$U zwp!qft28l<#Bqg&5N#E5?HHH!JIi1HU_+&Tv`+)PAsh&NEn|^cc{_Z#<&;frspP9R zx-`wBZhy*Ja7#t>o!VOo#QFjY7{3osMGzdCZXwp_gkDa25aD=ML;iMzAGxT1v8zKz z;|#Eh3@zbpi>$0sd%z8*RHENclsUyHOzA{M6~zan98FN(G3VkFKu} zQ^ECm*Hj!J09uQ_%^CdXTwqQ;Hk`12*PS98d#vz%v?WarF04AQmSUX<$#w*AYf(OE zl}URu3F=$dmQUF&sw8%}I^&Lmd7c`2Z)!x(ySSm$0H#+fy!U}#z33+jt1R`QhWlvm zn(A%(p5JgN|3v?52wmhrbKHb#JB~T93&JP`6{H^~V{pP+5(Co**uK+CUJ&&(X9P{|X=6p6Pb~+M}y>S)cZ-Sr(v7SFQ zv^GM_wyj&W{+q!+A=+X66b3U6A8+_ZRJ95s&4E-Zd2tBuwqkO+RK+%jaw?_3gf<|{cpVXCf zU6m8c?ZpmE>GUpph%P)=PBD1)5Cl$QcNkIo6%^^H^=auCRDSUn*mo41KR0l|RJ#>a z<6;weS4(yKj&9;H)tPi#&8+TtO1~)0o-#>r_T;dB!xdi2cXoAwa{t(=G)bMxrlWna zWtqdy%vj&cymFxgi+!%-$yzl}(4FZk)vaeABt#kIzpyQ0J@>@z2L;=}<~o$`$!a3@ z;~3#TiiO-W_<2tcruLQ;vp{vrhfS;Byiplm&e(x|{3Z{N$*y_xz%6X24srDG9LmIsjg%Lb;A3YC;?m?Fz=^nyhmCuPOY1o z1j7Zir^fcTE|Qf_X$b!wGui*rN`1&bFWvQGg6j&8l~K`3EVY*bRKG|@P;Dl#Tf+p$ zZm2*XQvQ=Gv!Q*+MkK?IORU_`prMu89Vs5e=0e+|i>B1`yf|xT>N}>9x?6L;xt*aD zHx*swWzi9HegCynrYeXfro=Pl_pTY5A&laDYy8n)mii5C@bDJ7bgt$LS7*(mza4Zs*)9PhnV|nFv^|OtOYtm@*UIu++dX5vz^zY8l0n;Qf2ld+EUR`fS&bf(*s_#_DEw zeO>$Z8RdV$Rf-|E+BZxtC_mpqh=xq=k>6b1sc=+L{u9k@noJWdtygW2RqI1h4RnU? z#b>bez=v?!YL|F zwDS_zlFBT&&>`iG3RtcL1pHdfB4s?nXREn50!LKAm)aLyh6IXt7T*TM0N#GkBYld2 zDo6!T)Eu?58IGj27Ji6`H8-6Re4VVf1b*69=?o+B!fm4~{+C~QT|m?fDjyKg0C8dJ_k@v{8PR?rqWYyYr3DXJVrvQmzQsT5evL zUjt4!-@j-k?HjiEP;gudwkq*l_>jo@H_OG_8wCM*KmPpsYHv}Om=zE}%;+~IEjKGt zR?Y#K*5q>+?N1y3ED*mJZ>aQWA6JK739e2>ZLt4EM5JRw5B{zK3=jwep}4N<4cnDK zJna&mCru;B0~)h^gbAKYFFwH+$q3Jpl^NTcorsu5)q6tHmr7K)X*6Fy7krU zwZ$O9R0)$xxlGDcVKb3nn__RggL@BPss&qwV)PCLv5iULyl7;>&Fv^c6ncT)w;(`J&|V-Z5dwEb~f#R?_wkJ9ueG#oz({n30K4`O8BrL#j7tB1bjOMs;S zdxIvyV=M$)A^thj{Utrz4g)yVp*ZWzD4(ogY5=_7%m#Oz6PA zF-0iGHkVQ2CIBL8P3e66+r@@Yb8hz9j>IwbLCk}p?sHt#R|WYFp&G*HIUO)r)GRLV zY!gC1gzHdsXg&CWio7x0DsB5*zbL9$O8qUKy=vb5xzAf^jU26*LZ}8dhzSihVBI9r zlyGj)`_sBzpgK4mMUozXDPovMeS>7d7}{BPj+g^ zCOuOgRsQ1Gph>Y~I?zH6;ZVbXUfS^s#gt!5^W#2wjQ(--Xmc%63pwxn8LQ9%kP4ZI z*Yx~azN*Q^HPeB^BhX-Kqn{jJlrm{>kU|Q1fIoVUmm)Tgej-Fesf8K<93F-R7dqjr z@QQb05Wf@dYWR*eum_Dvu}tYtfdA1&z4(Eu_1&S^n|*V1g(qi63|+R5+EdslhS7(3KkgwQW9Swc%1sk5}~F zLU{$@rWge@Hqh6{gcG9NaU$v$I>)*@n!SvZy81@_8w7-d;*T-J8@eynXxy<3ZfWk0 zMEw)OD^VDB*8lU^eg5@-;$m~V;vttlqwYJkRsL`~{;lsxjh7i3H*?Uw=wP7HPm;gn zF7D%lRIG@&-xXh6-zS_l+b&8hqadJ&*iG?iPlAZg#Bhcs zHq{gK63f=ckg)Kz@UKkwntW6rhAqDXlWx4USFag29WAV~zd~6F$t~%mA-1{OWp^?`q%P&uO zBRCkiqZ>{}q*a!W?0w#_gxlPq^YCq&e5G>g>fVwk;AD&=w(rU@v{NJGhQdk_-^e)ojdYEV5^c zRd(}YIn>2e`iR}Xo-JN3$W-m;)A;LzhiE=5{38K)HK3aogR)Zml! z%2mbR&&&Go*B}2Kl1&K4&eGc*4SS)kHyM%=JL>&cJ(|RmPnGtY9J=vzfVN5&6`qCE^g243RAyhBOD`-}NqT9m7jtQ<9*$Q%}taws~w z&k1Ke6W<;1TBLeiU--8@GVbV=!)DV4NgovuZ|^P2*%q!|*<%0%{2i8}&f~6HlZb9r zrF5m&md+aSi6vK-p2nT&y0jKsq_iB?q_HZ2bJ0_H1WW+rmWtl#}D!uCN{v^f7eg5 zWbMe`@P{8n$vltuVg)?R7Zz0e(nl|-WsBF}xwu4hQ3>aqtnIIoCsK+AC|ET?`Fr7p zVmOOjiFZJW_|+KNOAc^cHGhUi>k*f%&OR~q4GdLQ5K`4WxlcQmzB&S@l;!U7*Z$#X-v*-u?# zzVCU3Le@x$M&-2{WeI=NMY5N#E+4Dn9LB%^Unc`T_fs^5Pz>H~^Os{E0|&0i@s0Gu zpp8{c9(OG3+Oy4Bkh9J@ig_mv6Zlh&vrf00ijcum{PX+s9#xKQyR3{kS*P&}pf|ikp@n+i&t;YtFu8yEV3{R;v@2X&ciQMm zQaDrYZ@9kbw(I}sYPnmB0hcn|gAY}cf_?2pmC;~VS1b^q&N#X&XTM(^T5ti!Q&T<2 zyl{K7Onn`{r7Q9c?D%ER)#Bv5U87{1UahA@1kF$>X~KxBip=+$eyncFHQ>K}u!sLW zdI^nKxO!A-Q#KA)-)I&?HUveuzEjs{Y7!1rX|vBlyH zd6c7aKz4kIXh6tg84fQ^W)X)Uyc!NcN>9s{N85jf_D6@86o`lrQxUT`Uv3CP94Mu} zW;mRYQxOQ0EQ6HZZ-Y|VKHVo|M+&yaXgLuXKijIKHuA~IsEMekOp!`%epU8mWe2xn zw}8(h@<<5Tr@!zl4oBV3P@K?>wVDa+9^tFhMDR@!6A1ocQik*9yxJ9l?cNI3*whr9 z7!HY4y%CwvONlnPODXXzMt*2F+G7W!B=~D|CkM1xf@*)2s`vxt?21#k{-TM4$qL6h z-pu&zK+~Pb(T=mjsR$0vSww%VLEnDC@45>`dqLLa?}-o@y;P^FL%SJC1VfD=vvIVb znav0=K+&kq@r4)#2rA(`*yEY2;e^Rbx4@nH7_4iTsz>hs(jh743*qYMMXZ0#V%v12kHTp_0rP1VDpNK|vg8)1@!|9vCpk4Z*9Zcs z#fCFCHKyMc54YImN!CM=4&mAmgwjJlIU`o_4FTKLtA|UN-X{fe z9id&|Fj6%6xNFK`>4A2pFfS$(4C|57;POeKFVar966-bNOL0XGBhvz&xnoZprmCMN z32!N38j4b#^0C>W6NV8!Zk6*Yazb-@dY>)RVmKR^CAh6gwj7+K8th~2)FZ=YgYD2j zJbh3@amWvRwg&KN9Ui<4TfLZ@w5Y&vw?SlB;MO?u$7Psg8(wn^6wLHP@H0S2o8~j# zR2|R>!01z(OT;+s7PF#WQaWr#I9C_-R^x@)%_H5F;Wk8br-3589ih-LmHs_eq}N_0 zmwQb3UP!t7vCIz@4?bmvB)~-78mXNvHF7F%pAVNkK#dga0arv#UNfzm1DY+FtLGMH z=Wf_=_8rz}RzHk;x#J+e)<=9R>fwW975k|3=mhXVL9hFL-=fIWMoqEfw|$gD#Q3@Y zyBpNyQh5wD(MSw{$WkS$FqtS6N0b8A=MQH0GYh;`Q3cYWIG}M<4#xr3@Ca=YT2 zoz47CpaKcD%D_v3zMNENwcHKdpblmDuTiQ_>D6NvbIXlQSul)D zjt{-6moX`r7BLAwc$8p04Ss&htS$3%i-4tEEu@FB0R#mz7rR3U#_iwk$ae3&31}WQ zCE+epdMadu0w8))Q&~DfsIxnu}K6%tH zv$ry}!%0DO8`(!e7Qqc&i{N%^l#g;ou<+{FHkO}1hu@RsFPMMx;drGZU_=-RE;A~0XYi! z05YUm1M0r9Aa_a8Zt<_>wGJoG`9@z3UMn&Uh1JJ1 zto2jH(?Jwc5q8+lULF^~=ui+ad%Ddp{BLOT7^9NliXU?VN}*Kp#YmJPF`*EKDGs8+ z+NUDK(kS9zdG#gQ5Wja$s|EefEJawRicZ5UkraMF;HpP7g9WH6|2i2?}uTCQVx zW@S`ivhxym&0k*L`0>dP@-L~cS$zCuT(V1%4fPb0VD?3+; zxV4WRy<$?i`4G=RyIJ=wH++M&f0c_fi*R{wS+964*O{( zeRCNG+WeOm3nY1pmvC8R_1dDJ2UWg@eWiyBaG90oi??y0P~4fQAj_mg1nG zcq5mIpe0R)=OoA{U-EhXF~c=GB^bR$omyglP8kzI2te)3RXm(a!nmpopaOd0Rf#^Y zDqoWA{Ljr_r7MW0zfc+aPG^U`SUEc!Tcr|V`F+Ri@$5r|CQkawyfs6jiM5p)X|Sjw z?t@QeSpW9)J08tGj?xd@k&@MR`}g<@PFM#3jCP_>elAxJ{|~%Sp$CFN z^CmSU&mR;HcgY@3SqH*}^iqOn5+`w3srkYXx0 z#v3nro(BMHT#OG+xc!4@rJXA=e1Bq${(+t(If9MDId^+m-5mv7E;^-vZw^FjoZqXj zIdzi0(iT-p1*(;YC9}VonnLbgL&a(p5zkpF7a0hFTUo+ zscn|Kd1Rr#d`xP0=Ijk7GFEjGgi1}o$6yW*Q)m&z1XUz|@}F(BGU3MlMBGoCsOW?0 z;rgR)xy$durPR$SyMgg~*tLGU>b{zErEWRTZkAeAO~8iz&Yp7;R}3?54*(-niWrq# zBx>(RAU@pGL$H%2YqGx91LR&*ostJ_Nc*2Dv@6em7E3b=#((hT^HcwU0Ll8Pr>rd} z0WcYSmMR<>xB~tY*q8`5s?UC*6vRPgVT^Kbv`M9gM~Trw+(K~i;R@fLc=!Kr<4Z%=lJ*F@2$5D$NE!$dJG2AW;Rb3OnRCW z6aYGW4vij`B&`qct67>ODy?7&+!!xdy3+|Uvdn3?SCwJvI=R^Ns)V~L&WPI3J0r`- zRUtefwOJz0!dLsKD5)~PQWC2GLE;Wim|Bl%2MZ|-huaN(w;Mn}#+V3FJ4r&G-GJwo zLdpX&BLjv#hJI`#qAE45Yl~&60x1@N<$D&W^hVDKyx+4j^?&(JZgAv?g$TNUp&3$K zZKDU*E6`KQ7SV&+z?P5%hs*lKy3p@_8X+)Qwf%L6>~*iB8?qRLmb+IYBFrlze%j<$ zzQY&mXLwlyy`oR5CZr3ZA*+GAPuJ@Msvp#M*yXlDQ)+?5xV*5UzvtB#IX{PVsL*-B z*7vs#7xJ#(8Tkw$s1na8t}JS@OWK4clRw_2tXz`7N{9G3kn-HB9Rl_|b+7Ik*sTnQ z4*_c_IMYqs+Yv{YDjOD*X+tS;)#CVa^jhxY2XO$6t33SJATxwhxfdGrV$@POLCs!1 zR|r@UREW5H^jgmg3Vu=&FU>H7{bGJiUzCV>{$~77x0`GIrhKu!|2g7iv2=N3J+`9t z;GiX>wb5Zp|EGVRU(_EH?JFBf=ZEC%EZ8FHp-}2yi85z(`hC-@G*e^m!ztU7FuBWY z(iu7BUjcO)iVy026XL4R2;)?K-D&Mb&3Iu(S6{L9_qn~qzLhBE6Sg$wLw)?trHmIo zlDT)ea3pst;izG5Xh7|g+yhTsoNmV$dXE~4j&BMzlt3BZdST4hw z!gRMY?7h3}_YS&PG-&(^5UjtF-=d)Rw4Hqqeu#C=veY*)OJ6D}+)^y6|L~lo%%!=V z2M}0H5bTHa3Y*wc36_OHW&F_7G4HOp#_3h#KZZd8S%x%i9r3W915KNa$l+M@Dzk1P z(2xs{7dRybP;TGX?+lo&M*pW=VQ0P0k*3O~&L}w*z19xKeVbnbo!aU&LPyKMs60RypmrpL^gotY^qWv6C{9Q?YO> zqk=OvVWx#%SN?8|{c>87QrOC;9u$^k_^>C227+F9;bJ;Z7e{q)*{lt;%h(I#AB;<; zeZiAxlUtGL1Ev*nVHFx(RXC<{V{QZUvbUY@{EGTOVd_xy!JG;qveaIHVd*2F9+!3*%cSpk-7m*59%@kx(!bg?sd_aZr3Bj73Tu{7xL znv3A^d)QMXGEW~qu+kEJwn*bdG+~pieo4{(a1g^x?RVN-OZU^5Q9RB0E&ZPUmb0Q6 z);fy-twLa)XM{gTWoBKkb~2UWCz0G*+b871a15M$D-^Iz`)p9XWN^(m93040;cBJm~d zVPoMx&B8j_t&u|uhYiE)?DxDyoj9#Un=9<<;BP|#&mzkK&#ytWoOZ%OuC&|&b)I5xGx` zJsGTf^N^c<-1@_I+C_%L@Pp`+Wc^b=-gJEkA72ZKkBEZUBXx34ak@opGzDz)H2&E$ zmqMpj+}ceZ9|*3#5=5=DiCx)oIraE-#3|K3Kg}L~c2-U=oF7Y_#+^|e-kvwQaUogf zD#-uvf5)Ov5;IpHTp1tdF^Z%<#Kh)vrY zkd4Yb{VrhTWR7zP-M^raOnRU4w0}VC>5U-&r;0gdU>%dGH;u3LjSTgT)Nl-)1K}TZ zC+v;~$IYAVNbv%FeT`8b@o=J~Z&RR8Yw}OhaF@RC?IW^F^3>&G8ZGM7L6MH_v-Vo<>5Sj5J8-)Sl>;dIu2cmy$aTD3pde{h>b-EpZ}?*`74i69=$k-;e0tQY z%(*j;&{Md8r?-N{uiR@3g(+IpJQq%HX4(~hhv2Z^PmBZSv7mw_b4P zpW5eU4}H8U^AT~bfmc=e)1k<|z~pE&Em(j=-2RnE z@51M=<9YY;p6W$E0$uI8gPA*1le8-QcZ_LRdFg7)pV7wac~%c<&%2T5X#j@G^@Dh?B=Uq znP{>tUH_;D%2ldlmmvpXs2urEm%b&E&QI;}5dRmVd}PTikgAoN7Wp?k8BybtI~;GziU2LfBq<3;Z?G{&cG`)d+UmQ>rw z$;=uA%PjFX2%*&wfGcFNTMP;e71e$<9Ao|;33Bot*S>x3U5p*?{3Y&~{>w5o(_Q1O zKfcqA9B{uMOzofPd>PixGMWvO|9xXzkZ=K6jx2d>dbDSl#Ar>w@Zw&fL+MaQ^H=kw z_YsNYs-0CW#Jt+|Ag5<_WoPh%+D0x%TMuL$E*}fVEz(bGOn8l{2oe&jaARk;OI^!w<0!qT7IZ6^8Ri*eH7eS)NcC2WU zxYjmUmP&SLveRI&Us%xbb`*G{dT%k)c(1yCOQeP13OgwsSfc3=r0{0EDOr33brv;3E+vx^0R zu={F#;j)%Vf&u^yjM_-aQQx)7M1o$9SmbWb;;ks6T%L1esmFBiK zJyAw`Bex9F)Y|73ES%VkRMe0Odg+`~={|5+8pR7nm}4~V1Y0k|o}fXwFiS!mi!*QB zV`P;1ovcwJo6I`A&u|NfJ^($?#96H7&}BxCOr(_?;o@dzAYTDtvo>(TCuOI6eX!9Hlh>8#FijbH3{_~beX!-Q@=j-)BiL4JU{br<8pDmh-ab_BKq&r!m zSpP!U2$?=nG^w$ZgFTijW1YctAd0ttHvj6f{HW`^O#Vs&K!N$O8^dtIUORLF45mGX zMp+J8bIKX}*<4?bWd zgTZ?Ka{WjzM!Ynv{206%6l<-IC_4KHm09%g6$O^$qUWwv-d@QhX&W>8sGqVnQHn{&{%&*+LWX*!XyR+Y>*rbVDrnMU^2 zHYT!iIyRUIKtQ*tyb!D#wHLa0P(^c4sMJ`&_s;Oai5H39Erc-qAuHXdgm-W6qc;iY z3Q0QEUi0oH*a2S&)VsDVi-tSuQwV!_`Dp|032fj1weH-OhrKQKfRQdBi{rnf>WlrTIaSr(MX(-+Ep$d957( zqXzIWpZ9K~7CT#kVeV|XOyc--z&Uh2FPBE9e%}pdKR}uC;VjHd?QsrEd7D{LiQ|GKcE1~Sl; zMiYTmGtAd#FP&pl{vdwQ=>D;lqR9@KsZP6?biSH~e2#I zt4+mc54y#h`=bMqySGLPv9ddN?(e^2o#fC*y6t2C9ZNqwN4daBZ)(eTtBK-j6x47z zwLDot^q9OgGq$N)#8xg_H81-Pj63*mFi^vNFn_=xEgZ(_?gJ3qz0u9Rs>hsT+9Lda z{O_(GDEHAGCFITXs|5$}F(u{#=_Ye0V>BwH$fbZaWqK*ylWiwz>;UNe+^h9ss<)F` zxgn4Y^6AhFb&D*+hJqXPdJPyDas_IjbzGf?XhL~lU8jTM)MTjG8Xddw%&QJ#2Kb(a z+xFWR&KqW;vp9ZtfE_2O!u54T zqALh)f8v~_RdRsd4)Kipkc#~`>xOjUAQ}{98n|%gr_E1m!R59wh@PW<_9!MWlZF~m zU=~k?*yjEji3*1Nli=EV*TOi6rNTHLV${Lj;8XI{t&al#mv`DbP z?i1bFSdMZj1;p~~#t5fD9KA1r4kIA)Fy!~3&gq8KbMP`21u--)NDg$1gjD7)8$r-t zP{Xj16$|N8Hn}zR=`P@vqEJvH@yBlB{nD}jBn>ngu7_4>H550NUpRJ4!RoY2xl%xI zoz2hf{>2$pt^kVHw-H}#vx+ksi5P+dA=kQ}sFfXsyU7&J_JW+dBit_N->0k!pUpXm zvJ#BR%<9tTz8eiyJ@BT&m^E)h`>*Bx(2A{BQQs7#cVQgd1MmTdZjFGW=97B?!*vWw zD%)75vc`@O^pQEiBJjG1;t!+&2ebJ`eFwv*qMyl^Bq;lyCpO;yZ;5Pt+6xsmH9@bqz8epR?K^?(7hS_zRYcQJzw3e#Dt*>kM~Q~p zd9Qv1^<3+6Y%?vYz^r}8x+>f-?T{)g6tra%ymVgb!AezwRE`&!U0Ry|j5?YzQy*|V z7_b->!b+4E09 zz>SwYXh9Ouu8rKr61R7ffI=jI;*ql7`R7y(LqD7N@QU&rx=u$xmqR{mf-F<*{Vl!& ze0~<*NDtz>D9(FFXv=0F^tZJR{LaC5zq0}R*awqjjOn;v9-iV4%nvv-Q)~h*e8rB4 z$|y|biU1ZG7|tbnB?hJn3-U2TiAKP$e;)(^hmJ1Aeprl$%ICFh8W$Xo)@@$JME?i6 zQRd-PzrPkeZv6n%KQ_<;eS7Ao7xzJt90Nrh|DWr#l&5y#7Rg4>IA#elVh$l`+pk_* z2G;C4f2=j4=8mm~X>43|v^o0fcJ4~VXP15xlUtKb(QeEUG3V2lj=SwuJHAv#WGN`3OMm?(LRB(ngh`-*#hX#BfG4!t2Pwith_|8I*HbWaImzruXt-`o@!h&F> zz$kifb|$7*AvrrL#301eFaAI3+$2$RqL?Y9f?7s3Xz9My&u85Jx}gIg@uS1;X7{VU z$Rm9>c2ndQ%!BQ@S2;}M84DYw#;tD68Pm^+msGkAymHhWzF7yHNMR5p1Sd-s}dRS*04P~~6T0DqQ2{U!wCJNlkAxtl$1N*c-2}?9) zvRea51}wOIAy>>Ktp(Y-dzjPl z_gJh-5pj{xx5vLng;dMW8_a!~R%rUqFX5E_^F2eJ-t87-^UJrL6Jw8!2IR=edJDl& ztd&qC?y8ydSR^|QO5s7p8eES2K7kB8jFoZT$I&JM%IhN0?muA5}2P=bX8H{uoK-oCH(n@_ck%=-S80lWB6@r#4K(lYA0Rk?j%~m6e#s zj~Bz513q9JE83Mkxb{UizK=P0v2%OQ-%!ZQc>P^iKX|C-$HtIpwDCo|ud0KZ+uJeo zz4JKp&Pxl16$76{18>b91m0NekG7E8&%Jlb*LYu{zuVjiYuJTBJ>N1DGZSMR_RM}Mf;+Mqpa+e_6N z?WLuLl?TSPj)phzez(<07;^!q3#T`#5oX%iB2PeJErs`D6xqk`EUt1K{lP!*Yf-rh zWyJC^FEjY6!cg;C4?-BZAi@T#+GSMrzg{BsQCDvAC4y8vVrewA{=`H?!O8ri4<&DyDnJay)4f0!g5R z6F84bgVvg2b4LRm@X)}Tm+6R1d!>xxxp&1O=Q82{h0cx--+5|t=hg9dJ;6ubsM=S{THbo?%!#`D7y~JfmRa66j8Da$o0E8Qo8cK<}JdHC2}iI@a{ERAB}CJz2?RM*+3K55%%~sNm6&fZ`~P z>i!9k;v78uK(*ru8-~qLa)!N6pBBzbxAC33$DCI5&yrCttUg5(K1|u&HOi3=_|V*f zUr5fFug!fv+_^nJI{IpPZCnkdFG1>+`bj#JfB0UW+9*exl+m z82`;Id4o7tMS7!9m5rL~oX^&muux+^`r;^^T~|+g;D> z5s~YEtahtUt#qPaoY^AtY*Q9>&q(Y$?>4WGMIFDL7#`HqaH-o z?|69J5tD-wrtc!pt?%R-yukbFyo9~psCyART4r?WN3J7+WY}@$un@UpRQndWHy09| zD;K@Hv~zq{W&>#vsE0M&yX5=Bj?f%O*l(SiU#|Bd37S&cuR@)kXAF+TX*GN29M_rH24o z@j3?jrBnDTP%s_XsT>}=1wWb4xzpbyH*w%&-R+@$eFl2NwHi!Fw5D~?GJ@UjQBn9t6CTEA+VCSvH+m`ptPL_j3a; zpL~6Nz#!Cj3~Hm&0=IxuQk$xT=V7a$`}-B?;?h}KWtZQ-9#RRDm($Va%6^tfPI>2S zs8?Gj<^omMb(e1OzKh)iup8@(&(%$jLQP)(rjmybMcX+QMdc|3HzgGOHeCu`F@reQ zzzY#hEH)ASye3r)oG7D7$_6BMsTz2BNzyUSGTqI%^bm1W63VCu@Uo;xAX=Af3Y6gc zTKfaVV8sN}y6E)ia`a4721o-^eOiTh7Xpy45ktbjQTTT_Q2R-Ox`0A3+1wMo*|~X= zJ&bvf{xuMbMW<^$1n%P{;-)2rMPkKMLCoE1u13_nI4=&U7jK{{X=4uKJ}G7()zLjJ zrEahHQb&_`otiy)E$cO<_qVWgo8BG`f6bvyI!055bn31)k08cuEomMSypD1ohaVFZ zk@*xoklK?vm^#47(^x7|2@~#0H8^4w6aSz8lh;puq3s&!EykC1vbfy5`_P3D=ve8# zJIEv*I8p@_DGi9%>}QP_Nr?hno*Y+zYyAbwR{@~EAE+uXI5+#%y|ygMv5@p<+`?kZ zsz#n=oxJ_(gUcIH*8MsYiA zDsg4xLLWK)waRG{JNEk|8XunIec5PA&`YexjfQ(aKbv{8rf!l>_u{{1@oHnboz#X! zs$2rQby|%ed%8x?@tY?!2E7?+&hM4sSq`OQ_%flUjCTJwgNyIU+u^(nb?oZT=48-5 ziQt99o~6AlnC!qKV%F|j5dL&fy;d~gF>sJq7ts%Y&yQ3+3&E%l535=4^e!eDos3tj zp6S^U8KTM>KgUt0g1u~K{p{MXcl1u=xMXM>8M+_|o)LDS)5R`jjU~tGwLYIaoV{O| zF5=kPr!$#OIE_{GT3g<-$@(Js7S0%9K9|K++`ktDx1Qj*7n&0l8|$`i0PcfDmi3 z2Q>K>qjG#({$IAlJLDYWE6s;_y1VKp}U zSvgEmMZU{=S95ZT02O zb}dFD)*d*Q0J^2&?2Y|`<;d=`)WR0<&96Cu7v~-DDLti6+{ogQW zG{h(wG~jY-UK3M2%5#eeUCbm73*=Fv;v`}Yp7qUc-`m&zr-y8`OMB$B0lf}^@czm^ zQijz4(=)Xpz^FTwj&BmRVTQ$=P(NCA^_{U$rYM>9y@uWf)sjng{LunR&>yW4Ok7VU zFy5oZVedB)U_a2E*n=V38GRZS7E3mGQbpQ!JIP~vEmveMX`i|1499W#>iO)gHm9|CYG55K!Ehc zK@FTeGO&*rjSSf{SyY;kgRH@>Ninz$X~2y|Gc%6IL<^9H!68(Lg)0F>p(=**l!-DS zxmaPC&Qmf~MPZQfV8mz{xZpJ;A|YO7YT}EsI6E2@ItNhz84Ysn5a31@6g69rt3PjY zbsYeuc&B$zgz}V#S`!&Y2?>D4MCs6IIi_fkhfZlp3lfkmQ1+h<7eG#Y=w#BP`2Otq zllNwr0LDISPmmiS6Wa@HB_o4QoCRBriL2Ft-4k+@z3Eq^H5Qy0kAaumB9|=0c zRY1^y(t<#-$;N;WdT{3ZeKmn2>+$oXAjnG(8Tk%C=8l`Akt^yPQomDWS~iJu@&=LlPA?g;hT&8-hUT`1bcZ(1Aq}B$5ui3{ zT?CHlTs3uoE67{DeBNltn?L38EQL4|V^4w|h|S<5G(w4Yg9gMp1t~UBWUQkO!9`dh zku4)W%FJ5ZMq5Pawlq{hmwh`s6p)$I38JklaRX7=$+BZ?P~B*1=RaH;^7AL4}kD)w8B?{7#0!;}MK>G_XUZ+kr^! z3=LfV`$er2M#0+g;b&=-DFHiP#ZyOd#FWmB)zpTvn7347kZCe*RihFL5J;+IPDs1| zlA{2}(-cSf{0CI@bw$Vt(E@N8v>3#UM$a)H5!|3D?IcsS!_N~6rcG2(YQofF372H& z5#kzmmJ&fn1SPF525CuyRwk3s0Det4B9RddybMe?1L=Rc0kkM>4i301gEKi z!l1y`NLCO#3joA$K+cjCtPH>ttzBXq;;Y!bNf<@YE+ydTu}y^AWBriNfGuEf#{8aF35nun1K6(p*0=Kp3mwr z0oad=)PQKB0fvFnfuWBeQ`abH;5{d>m+cWUI7^Uv;Yv7zK;W&0*Tj16!ppfNy{XO} z3W5H}sR)7&iKr<>>kw4q6;Jrr9*7=6U{7ePN)Grr9yF>?QM~FC3xMqS#LEs)`C|5B zYcnDXKr(0L9NXTQexGrJ{^#!@*2Qc)3HZtWf5ZMdux7}_V*z@PCxKJQj6@BOpe!Gr z$HdsU_G1V>IlzNzL!3OwpCJK+S0ddY9R5M8cnT7b@X~q8z~p>Lf$fTnAZql9nCL^p zR8dtblgj}3l6d2ev9Bc*L1rg)RjC)Oht(b5?}z=V{GU=EE7nMrh@?o63Pq4qG|}lD zXmXH7L?oRcbBH#Af3(5tI~jdOu;vch#Db%26ub_HK^iP1!wDdS;{`B;m_8zM2nOJD z7F1$MxY1hfI3L$lC}^IpVFV<+bmlQ>8}MUiNX zWr^92bC@KUm0_roEOuJhx+6}=Ahyw~7&b;s4M~5vn@x?g(qNiHOv4o!TO1(Tk&zAo zBOyvHG$e;MJBF4@1|$$-BuHr)mQ)~^f>cfes47N*Y*=PQB6McM0iiJ%7Q2WokVRj; zGIBIcJWp9(ponZjL?@^!$f$9A)LrOYuP}MT-w@K{;`Tmw((uWXGbOogt>!I6i|^0VbK%fNJ>

>=53k+YSw|0sD1t}`F`0z#kflTL8W;#k zlK{*L3m_!OLl!Yo4)>GA1|SGzVIY0;@1LNBhDK!op5X{R(OV$Br&+|eUmThMd@v2- z29}iwdSIja3^rPz?}Gy+0}X67Dv=052%0YPB5#P55{U)i9wt4bZ#W?s_thzcSGWs4pft%0ghq&zWU5C;+vN-)O=eEsyb5CgbPh;AXooD#GU*$Pf~An9OtkzXMbaKIXy`Nlw69Gls; z28^O0W9C_8l3~(DpYI{4V<5)Co6zb;3c`}1eBxM(8vmpK&T(oO=>=h40ZDk+4k~#8 zJmi$su(Aa~^O!3xSc`u;cLt!)DzKnNw24Gikp}gb449*cCN!+SH^O9tXkidPbj)2x%cyi7g~EqmNYwudYcQ#pDr`^4Mpwvm6Ez%$ANS;jOI=IE_oyDEiDClz_VOZrVd@p~IR^~# z?qWhPFbRVC0YVP+(x7fnD00X^rjm+EMuLDS5dJm~Vn7dAQY8+=Qf!TXbAw5?cLV$> z9)t)}+9!`sz1NKEiK#GBe92!Ffq9aZ+z1z#eMv+@NfQK=6DGQpZnj~DJtt@e3(V$K zLPN7q8}MR>Y!me?ra+X$0=}44Vg2Yt#QZ-mr1a+H4UwZn@7bpUc;cF`5smC#U{h4u zDUcgqVh*BMvdun?js@idIvpCOQ=|?jK}0wx0|8CYKsuETiL^_}KqM0pWC;Z^2vz%a z4wX8Luap=3YP$>_Bg^fMM7(ZZjalseuQv77l?N zoSSq{aF}S6`+5v;B0z~*gb$Glp+U2{5JvhQ@A*vf=>D~W?>2Y#_x0qhC^4yu3RL#l z7+>+sXfPAg+eU*kzt>Zc+Z@#~$^O(v3{dPH48gV?zduma)S3?LlOSAA2CqkTK~2QgLa0U{_`pFhjtsEys& zWq|?6ts$#n(Bv6G56Uqth(A(Gf_8*e5vYoq3{+B$=itwop35nALCrXtsAhn)-6ALs z>Y&6^ihq^xZ^+a}lWa`UQ#9sE1na zlY=m_T{d@qz8mA$s#2QG_>htWEF@`2y-hn1aMIR>=Y_34D7IAbmKng96ENU|Dcd&D zi=H@G(ZsSK7|;w&p)!&|$nX^Ao{~s6g$!pW0hXM`klI!owM(*rRAXAum~*a>b#4;# zW?B=x(E$FdAqfd4hAgt!Jqyl5p3-4~(2p<*Q>h&cfTDbT|^3AvKRc z+0|&M<#j5Itc1|i`!_L+;l=`LF<%AGY(O}^`C;D|XWOU|%c=lu=`>}S~Cz)8z)^Eq>@e`AdXr#!C+y@qgMuSL&nI< z17MtqiP-LgBd%^F(WV9=ql73OGB9Cfuu%eo!0Pd)#Hzv&$B3pFOW`!CX>}SrTCWol z8Ps!xNsLpkUD!KzrfdmI2yuXK$OtfvE;>BtC?lIsnnh6+#%qiN@SzTxuB>IeC~`o| z3`D2RSONxY4G|#jNQf|US8$dlN`}uDsRc?PgAWlOQ30?+ z#?etvNl{4%uz%>5C+GsiLZGRGq6fcS8oW=?XwVW%@dwbS{E4L8FG(6knURT5i4zg- z0E6?gR*?3G_h2Fvj84OO4!)r6hmf8`|CRB+5YSi#oq8uXt2{?@n2rKj`exnq2kOWGU zh`mF}6ehv}HU}!Xf&GI6Q)hafM_3;Sd3=HboJfVAh{&SfaO+J-UluB!)B*4j7UX}e z(~D)W3|DB%<>rId_DP6GdR3z{9xTxF2o0!*&k_WNqGbEQ2Dgq7)lkDS1V9Ej_`+MSwzTJ_#Qf@NXH92>^~W7|44-=!2Mg+Khb< zpYc2Qy}s;`>xeM1PUv+zbS8{MD08~{Jb!;P!vB<;v^mzFj!?RJldE~B=H@LVg$uks zIDD&HMBB;}=02{mJg#ixa@8*B_vsM}l%2}WMyc6b-%%ggUaG56ODitptXty`ODWb9 zs9DRC%bCdMUGW`f@j;YEp9%ZNdaW!aIFBm{)2DH_B<%eznPh}yO=5i4r+r6>adTd~om@O-dm-t> zDMoUhJt{GJcZs)c_Qo()-*KF{`lyaNh*Yx=xp={~5%?UX(xTlz9-EG@A}`N3uFrnC z?+)%eB)n%h;+_0=th8N^d{M>xh0Yz-FB#Tutd`nK#OYFZdG=dXJGbA(=}MIAvgf8w zRWU3LhhN~CipSxrxc=4&D2Fi~qE=-^{8RjOcKF`c#Nu|ht3$@&>O`Iv-XpFFjxUeK z^+lWB_}PuTXFAVM*7+L$I_1t}=XuOdt#Msr68Po!o^xGZ zDzS)?INWDA&2M~3^t@|MYB!DQva!Ww;vx4Ft{(ZF+Nz!nOUXoWBhGQd#lxkgSIu^; z^(OViJ=@kbJdX|l|#|pHu1`Wp%In%!mUFUNd(6`lN zddD-CgL#|9-k($|dakCkokOJ^x759FtSwDSg$ib#IPIL|tHR@*XR7Upfn%xTH=H=J z#(92MS&bs|vk%j~DShDMP`S*+Sm{dYB(k|!=M9)enc^ZhlO}P`G-+zI>G|V=-;&x& zR}5fU#ZzkU99IiR8#LKX2H-C7Ibsdn%}RNU=+&*+2)!KjgE-@P-ticsF-Ch&E8a#V z{~8%6{<2VBDQY(Zm$0D96$0^!w$wZ8-ss4l#`@ja^dI4b1=}5-dnW>g>l~c1&~a)a!L^n)cQs zn|+@4PZ!4zjyJXMF`WA6aAvm(A6(UQipBgc^7=DaV~zl7P$IA+BC&}TeW!2rhw`-2kLY!ObN_t9?g;ybkTq%f zzaOX0xfiL(BT7E!{NF+Udei6l{B)F{_=Z{MIkS933|U_^OmL+NGA}7@a-sZ zB3n8JXgf<0mn9 zdBC>vqQaz8acL=l;|0!@Y-{=F_x?eYKT)77n%R;;fF=Y18^#>f%oB+*E(X1)arrg? zya|Mo*f0UqIn^-eB?)W>lEOqF2Ngh|!SN8@TKpu0k(p*T<|5zr8z20iFD=-%EsH}# zLubv)>m7!}cvBHT;za-;!5C&y*3z^nLO2W%7)b9bd2n#f9X5w3K;T-YWD?s+yhAed znTPqlBkGKKv=P<`5JCimfOHa6qshbN2cPgiz3Tlpq9!DXX?;KSybmvfBJdv^5H?DF zu|=Gul@u3HJm=9~{`2M-Y!&P2JW01n>h+t4>KuXchj~OIFgKxv&y&d1ZI7b*SkioS zxq(2WW@+n#wuot>pI~5pTzwzS3NU|Q6%aj!ZGXE%6zmy{h|mLAG1(KT&uLKz9Jl+ifbKY)@vd*7&`!rGXX($MkN7;%5 zN}ev)^eD}UK`s26M0s(x+X}!MZc2xqT=)#Z@NF5pq?Wqa3cJ^f;uHAK}peO|? zNPwQR=EwyAkx;5s3ZHEAVDvtW8yz`)m$Co=_W2#=?knr7+wZ;G+hyB5_m4A>0p0Fv zzOm1~`|dvbzA@dl`rTCm`)A(a=}&s|Zdbm2^`2{>0jsU{tL|slbE&)D;w2QFUgtZq znS1Tt-dwKx8Bcr6&i2-AyKc-%&=IaddGWC z?yPmJo9mZX*?9W*koxy;w>wAEc6}qO52M~|+OGSzx4U)T-1hGC?>Oz6!LM82PkZR~ z?e?C$*T>D`C!c)Y9*bbtTkWIL>nFLp$+r4{1YWl6+1EbbcKg)@Da!NS=9e|;ZOvfI zWr;z%W1&wJk7`qrAH_HU!JH+M^Om%Z-*_U?C&US+aShRlcc60B6_dT?17uFSM+pNg-lpWshdEa@@WlYw2wU*7cx!qhgoLt92-8Jubd$GH- z-uJfN;nD>tS6EG`Xxy_x5Cgj@towG(*PTq(+F%H+sqLF$R2JR4>*rW~@mkwvrJEVy zl%Sox+0vE;?si!2Sz2ttmroPhr3wy!eRWd$FTH6??~1olp5s-vuL8>TL7d-LpgIZ^ z0MX{7-Oo|$w*Uz34enYp=W~k-4P_dNq^e?Fm5y03ZZ303$|# zA&>;XnlbcQqO*K6LH9Z=D03|dKAcO=H5j`{nG|*J`OpP?qYI!K~5w$%d)WiU2 z20#D+2?U6U1vJ8&Au@VY{ZsKxih4?as+p&V(Ke~=QR-y&spSobdZ(g(sgZyH5Wx)s z6p08XAPootWW_MhjEy7JH>tFqlM^OUfdK@;00IhriIRG!`kJ0m>QnS)kkd&I z^pw%+4^YvdGynhq2mQ5wtN$PPf5O)P)BV5e{;$vTnx15Sv(~2D#E>9_<`hETXV>)o z`qB1%lCOJUJEC>#Q~V7!7<0Om3x0{{?{36P0|iXWtv!dxVFA^JKW)d%O3 zPe1GByWszu{=b)hKPL$Sh@Px)LWjtbpk%67lQ75}q7$ki{|NanPJi>l_Y5oi?VNC@ z_QW6OVT=U{5Rc--(#YuS!D$MhDv=Ens6$c-kU0ejLQoV^P>5uzP~;{-N>bzkVI-AA z0$aes5Sk$tuO=x@MZ89xNsxp5;7nUAl*qN78o*yZ%tcNTdCR6i3RD^e4hd8Zr26GF z5lCqyLk3dZIH%(NU$0sY&*%SEuljgN+7#s<{_}xT*8+(o@b|iZ<(8BGa%Lt3(m$rr z#Q%7&`B@E%RU41`rGM%9RjnhE+3B%_|EmAdO5KFHB&abZnQJ36oRN+Tq1bI6U;9B5 z_X{aB-DzPzJ^5WdclnQ9_E^^eCf^1-Ll;vfl;-MXQK7m+9@N9!lC1;auT6*b`VB2- z2rSscX@9Rp+l!}t4(QTLYILCv?!q+InF&0#!J72ucu6SYVDH@0Tax+`y>R|Rrh6qu zny97(+uFw8<6Y=-CCbKNW^zwD8sNWn+#fHBla%S_uNMkUU}8fW|I*uV7+geUMpI+G zPd7*{F?UO*&w@0T3Y2WWdTrk!tYUS=o}y5A%QgAVELFroRTq15PMhh*RppN#CHGEE zHx}k~TD2-gO}CifR)1CP{bv5cuoLwVW z@|vJ=cWp8d*m`Z%lq3?{8`;NbKNlzGJxAw`yK4}usdy~rzOPg~`!pn#D5#c&Wp#=d zI9xr1Q!~KMBrd0_`QDS1^LgvcPecrItaP*)$r6e8QgOorjK81P!O#C>(NEw{98H~D zF)`MbDCN_ean;zJ?bN54tAqsw9U_qy@lJ1d`#RED#=)3X*fsju2T5oZ*z|e5VHM?S zHD^+yE%dx`E?`Ps(;Z*0E0qF&#|?(^X881Z6m%vxd6cX8>_YhtwP{Ke0%btSI9%lI zB3fcAM}IfXq{r=>?}7S#moOWDVBsOeouX9#OdBZ8VOG&bQ*3cTFtKYXIt^qgh!!n5nB9CRW9Bz2f18^+Z5^Fb5AlD|<5- zJxYSRySbX)c?i!&JJA+yDtym|ol9_-V7gYCBEI&|HqY%Dp~)3riDaaf8Gm>8d>s&t z75}whe~PBIowfgsGsB-wV@B6!ahOgEozWUDdiDT7!kp;79q?{} zBMToad$qm3mot)2cE-)y@-rS$e9*=Z5eTi@eNQ-ArQ`$Fp<>5}JmdXWJSU`g^XJeD zqrJydT_|hI8vn|SG^;0xO2qW&%^AvBn7S3ii(*H&Itl*OMO5un6I^OP*$4Kw*sAI9 zN*)>%A3VAx^+i5Edmh~f!nC}T34YA5;t-Q0O`W{`u6-5qZ93WO4mTpcZ>moSH-$^! z#^&evo4Pr(9R@u!yTL{Zl=b_M)4a9mk4+JUa!D>y_r6$aqocESdTZToco$eln~2#e zJ$vX9YkAJaq?PhOe8)OdGqq zK5frSb^Ca#uj-RI=e|oxN7JrraXj@yHfVjG@Y5IKO1VW^zSaAnqqIH#PuqO&ZyTCD#@EDwOs8ImV?cu2G6P{EmG(y=+q|1z0MxY^xn6hA7~xuZmF6ZgTA0!FALbA z2scBWmvj`!P&?c7cVjBXaLLj48Wgce*D_Zq;<&OE3SiElpJunq^vZAyBO+M`K%(fO zI)3N54|JIbW%ReAVyQkk?FsAnW6>V#=MBQ_qBpm>?q}kSc4A0#3^Ak)qiow3-V=yN zp1qGWa~<{7XDjQ?`}(0*N9uv$=j9YAUJ(Pm=iLq^+SyIt{7>D}0$g|@4$2%^N9tAU z)zzx@?Y_cM_PBE)Ica0F=#1^HwQR#{4C%b&(U+Dim~+#Y$?5){F4XzE@$}Vmps>-r;unkS{=by1wBKL|T|8`lQolZ>wFRCtjV8L!i&F#)j>za0O-0Y@cysXw6l9dm_`u= zS{e}6fgp5|l=SZ6PHC}ic8i$h+AZ*S5=KcM@xVtN0`Xa0ii@mlNzboUagjP%mL@cE zcs+kj@uaCWX@!tzGgwxFkyI>Bcjl_6^JXV#XH?j!I5JVK?1Iq4uZHrADqO`N7|K~o zK5IYWZTGjDE#1?x^v3FTvni_}GV@WkUa~jt6*IVPuK;cNFDK@vpzfV>QbRuWJI-A3 zMG0}dRBo902HEVD%U zUM1;vv3u>|!t+Oly(z18(nC~T;-7Y6%jV@nD#EPyW`zs?eV$yw`GTfSwbP;6A7^JB zd2xyqoQUpMP4+6YV@x!HGfG^IAm9fIY8aC(Ln30#KK{G^UH;SAp zAkbkDj|Zj-u{hnhC4L02lIQm(}^UF)I~X+(|j-x$hKfXjnAxUr^} zrPn3l!x-+mMVYP9PLEAb+el8bn7Z=Cu;7dq%v{4=_|7TqpQoZc2#P8%y8G1xFGLId zyex3DrStXbqHAZ1ArDHv5PV)9?>o`z#AjKJRpK0Krr70e*S~iGpuWimb)54J<{HbIx?Lkza6TVeoLD=(|(62UD112jUrq~rc_WIYZEkVx zkK&DW7nDbMdG&U9E79cS(BvfPiM#1?%j~ejFoJWe{517)16L<_f(HR_9y-t0p)IgwRN5#Z{1n=!af2LE;nBxi z{Au(hySnkFiHfuRMpZ+{p7R7Smo~%c^Z(Dc^TXvM|4*0pe$Qv;R0Ef1ic5sY2F(AGiIge;9XryPx+~!aIDa?hF5fd}}TSLAX`A z)snV1J9|vb5TjcUoLRd#WAOjV0#d2|uWdh)1t_C$`B~__AH%Euc3oU3Xota(N&6yd zfrVGLtf1BT8i)BLcz$Sx(a+PD?t9!6OC%6}X#Iba_j`Q)H9Xn8-&1^=h5KkTPMb8h z-E#T=96o(k)tmF})|TH!5AJe*z?5=C4L|XP-}2}@@W<|!id%D;2X)z?G~(voY8=-T zMAT*fGJwy1J1Rmn)omZ9_;W26(_5^Ydgp`~K!l^0e7_cSKrsESQ7ZMsGvfV@Z+HFQ ziM-Iv>t30EMBnG%?=k$)tr4&V`tyI?%edRe!HcSEfZ?OsaB*mjV$dR&r}aHnIjm6cBwbxLP z+M^ktR7e34(_7Nd}7 z%^!DqxkCK%tnjt|j#Ydyw#pm}uxfB4lv$9E81vO_ecWv><< zv|d&?UIpOjcRzbM|QnEQXYbNLCS1f+*P4< zD5`?)h12iknN;<6b6qV!f;TQu zGj@4A-Eqpv)}CmPQo2!!tQk=${}w5|tCX%bythLL6QY})Fo6nKhM9Vvfp`0_W`0X6 zSaiEni?)U#NgXhRyTp>R4s}ZjB<}d{)SYr`p0Yx1W0GcY@=m_}+_Y)-(n2LYR*OTt zET#6f!?d!gxVvM0c5`)79OtLq6N>|S(kp!`G(`UaBnVK$cK<4FANKfs|Fiv{;s1}D z_)-0pQ#s2C^;&YCjE@u#QU~5_KLX!RiG@D)Wd&6fQ29U2#)Agtt5!++A;_t#mDlO< z*QeFTzsUag^O`!qeM{x9gNKVQ)73)!oZWHq3EPR?o-lz3LL7_A!lKqQDco)@3IRjb z8%u$Mo26C+f&OufN&p!_MPulcX0^}c(3FqsrMP@1bZ>$O#&?hyVhRGwD1t!ag7`EZ z#Zo{!B84D_Ac&6u@4zAf>>rHy=hA(TV~Y_PW@2UaT7y9(MFlVQsfY?7bd&Qj@8gMK z9=~Kt1W^MdNJ1b0AqT}N{wSK1iE0_3h$12cp(#j)go0_HsD-aRg&+`%`>-ZRJ%J&G zQ7uHPN>BtujR`Q4q)SN<3=u++DMd3i5dO|#6;Q-1z=T#gkc}k_Kt!!15>f#WlnD|= zOa!t~G=xZ$F;X&+q>QO%0f_@lFcgKDAGfRxL8#Fs0)F(UWB`Ar1f*9AkINZR6f%O$ z3qlhJ0Wvg&C=`_tBuf$mLWKfEg3v^%MHLkhOo|jUL{K!O6HzG=g;Pp2szm+B1Lq_F z(tk7uY3GV*1o85wqJ;CbKN<67-)=6U`u}B~o{D$IJ;en_l|4jZEsz4@r&Y@1L%j|1 z7!TJQiV8zy84H$5WtZoiqDA+IH(IMKqb0%$GaL#`!wk%#%p78m3``pKTb)W#NJP{| zLSbZK5FfB>fX~q!2LS~CTXeAw0+3OIaFNLw=DnWG1-2hDe{k?1x*U!S_Z_h{8gYyn zA{$Cp<*`AAR4Irr`ZbHD4((vQql9fWtT5H15X&aNABpd%KPJx(co4|*f~tyI4uz~W znPa5XC< z-z$OPsH@o#iG*s(vok4I3|yiLiiv|PoWiif11eysD+>fP4hY|JbP!Z6G)4{45(qiuyjl?GCoNJd2v zOcY@v{=(p9bN=}SV4n;gxF8+_{pYo9H5{8!Pk^b8v>+&X$>uzp4;ero?y0>f%xC;w zQo6!|bi+MSDnA26QFQ_hq(U%t_cE!0EKV;LxG9Mr1e(AF2m2bc<-m@sMIcRwEtSu}y8Rk_d?*KBW~<$sVOlESdiJjB7+c#=lQfpjZkb5=o~LPbT%&nAj|q@(kt1I##;qrNJ7OTmy(?ONy&0 zRMTrNW@fvH$^n>B0fAbq9BV1InySkLzG<$gn#R{uI6Bi-<8I0rwsspHU|_H`#e7dTZ{ z01RymM4utK6Zfy$Uz?2lrZ)&z8I@2h4TOgL@ir~khAJW+%sft))No{D7&6xps21Zs zm=yCoc0G1RDusRPJUq3xi`-2Me47HlpW|B`JP*4;=`F$Fkk8!Xa@tY`>$esK;D$9hjTJ(du zzLl*}3dNgqXf&D4Y8MuVmy(qbR6?sRvFPT%wq8vBMC|I?(Bo@kb-7F7JhTSVB#HNh z0wA9AW)4kR8qJ*N7=1>dAXG>U3&Dj&DtoqK6fhoD^qmJu?dKFnj$xUa1GcX_L~;14 ztAjoMv#j`nB;}7Ea|cF@3Mim7)MTc#L+LD2e33FYjCX33cphdp4neoH&N-1!Ct2{F zv!@=MKZYWI1Q_tdSMIL+HFGZAP%(rc;MJ$SG;E&Vyjmd?l9C;%^C3}U*ljlz zCbLOcNV1-NbVP_VSIwAypVaT-oOtu}{>&%1DZ#5Fe`Qv-+ikG?Nr&PK{Mh^$JI>(_ zV@V{f+2JX?LSL!el9yMR5#;HbxYL9bO5{u&Tdxex$FTj<4f_5U+XN&-hM|dx__+ZK zeZ8!F=_O)xTpl1KW%)@xxcU+ty0cHN*X%e>pmY;OK99-1j60Oj?Pgn7QdmjnHkUv4{# zY3;(S;Qok!YKzYS+(q{V?`yu%y&Sm(y%xNXeXtL&=A)O^70_^b)Y^^s@lK&mxhk@* z^v95M3Xtxf=j(a{ygG7xRaQts5>M#YMrMi3Zal&51Dn0kN>&i~$2~mgft-JYV3mll zjS8b4B$u$t)3F0Y(utulNdmf^BQT(_N(R+F`Z^t?N!Qkt`-aM;?q%-=C|0X*W+P#5 z8wWQ({qA02;rlauYk0u-+hh5~Ce$RN#v+VhcKNK5>lFO4f&%5qJS{(V%%y##c z+s1GRue)8m#e$iu1rGYFBFCcvkQ9bvi*Q(S76F|JBC4-#7;vJV5OVCp@@*Z-=mT;U zCytl4tP)5>^d$^$QNDDkPQ~)H|0^JzaQNh79Yid&2*MI4Lmum5bHX?pOZlEx=PrB( z_@0l0rUp=2HZ_SD2`Fqi8;&||T#h;=?NRSp$eF}=Iitu(*7JES(1=8LI^@TWp9#~D zl6fFvcZ@?FUQy(BoC}EU8;ia!w^)vMRaE%N$kc^A2@bds8(|pRD{YZRm7mn^y@NSA zPmTErodbZ7g+atp8O$41n>g%o&LUVQWeSx$dy0@DbVz8d=AAp2F%B^Sm!^nFX?O>) zhJf>;>H@IBkois&5(U#cH!AN~eMC$HR2)GK0f46hd`G@}+&>~}ZjV!@CrOrHP9EQB zjf$+)?|w3RNX~yKd20PYkRtvVk_vkcr-*of*hJ`(8svaDpdR=NY7T(r1_viL8Kx5t zyc>mRSl97%Y33f|?C1YgRcEw_zYnOtkUpQ_!{9HDM8G}}>jJv_kg%}w20^ICkMXTC?5?+&v^43@n~X$4K5dp1BS}3UF5WI3XXwt` zGvVE@;_z~|dpU#P@R$T(LJT80xJaQGwV9LbljZLWM zYHl?eI6Kwzl0hvkdf>@u2PY*o;e+fBz~~rloSmI3m-CjtFxUD;Hso4emIJ|UAd3hq zVyqiI!Ukd(c98c3wmvvKxe5(~F?aog^%WFH@XRUYiKbVouF?xLdK#xp=8}?g-hI3i zpRY9>a5%GVgbCis8OHK~7qH+b@@JcsCmg30<`uq3RrD~!{kozGr2TMY3;Z2V9W^=C z99Qq=YS9IvWedkCQA^@O9wtGIiTl01Jo<4;d-a^e+XBpWXA@XCPt<+XDboXn?~NRe zQ`CNweT~36{M34WC;Q3OB~-*cpHIB~p4&WB=R%}Q#r+Q@rD@BZUu(V^80Yh(#^8hB zC8`8yrPY*-C$T>gT0>$cj10Yvw{P0@{Hy;ZY@g@9#qGj%_@dlTB+m0N)4ID`Fh8GE5067iu}i)+fYYaQWPy zwzxRu-$rEnKeNP;fy}%Op-#4HnIZegHG*s^(Dd0hZRh6xb0x4BDI@q7^Dova;7iUt z4rZ8bzNb6U0vpj`Wu699#Leqq)e4m+sR(uw%5C0Z&90*qt&rDg_+15YgUDczi2#X`u?P&4 zPo3GsrEW#dBna~RJ+@C#RPJskc<}JiMv7rhtl5u18UaL5P*6(~6jRU;3hCZ>E9`nY zS8Zb;1;!}DZ6fQK!_VJVu{E!LJ901hx_4#z_)X{cG0zJdKB7=|W?n?5_qMU@?)YkB z4X*V*#iT(is7#UYjbq$zvT4X01k**L@xhBB3|q4?#87^yRVtz@nmyF&9vr7KDy{b4 z9>RM}#BE}NOeIPSL`3}1!R=}v(ucOwE;Z<2CTEvhIhf_A^R&o2aKn%~IbcexzVoNt z$uJ{@8ikS}*oBjVDj=eWylFd4^c0?Ill1?Zmk8yBb$6UTC*t`0xbV^QC%>-8UJqgN zZovSNHpX%&J|eB7pXBpfS8I!<0OC(>UynazZ~)YJ51}@zsP4y3(0bI1aWjseX05so zCGS)uv)SKZpXzKs-2+9K?zfD`xH2kv5XFA$bJDKZU6s6Vw6aE(ifM%8 zFvEtpp#*~Pw9fcF+Ur3>)kz98-GZ$t`aoR~zqx%slTNmI&pU^e)ELmk8f+#COoBeJ zc?AwFfNJ_7j;I9RF@Xq=(3`^`LBc?mu4C-OgCORO?eM3{=BbObCq!eGBI_N1h zw$V2NB7?v@Bv@Q+(*e}lifYj$aS2z8^7<&yN+^`7B|_J#tzt`E(^XlapzsJr;im4i zdil@ayGtGx;9V8arqIy9yiwxEuzvX5s-yk$z2$v*w7n>ZC%RS|9E~qj5YRBr3rSKh zAx$BhPH9zT+l^}KF10ShnN?L)lM;_y&$Aqv_jIvnNO@jnR5hEtJdZC6IvQ26hJO8 z6j4DzkaNI!PJLJwmv9%;EOfT$+xR`WI6q<5Ym)cE27v1+-b93CWQiFW5GODPZv#yi z!>7|#pT&`^j(GZXoBE0`#6zQBO}rE8jzp3(?vQRnM9)X$Pq5X^xix6}lH?6CRUcks zAy3~vlkQ!&_6**$M~m3QUxV*QoYUG;jrT>Oe0r>c0*Wfs%u!>&p$mHi8PN1;*JJlY z-4EcuhdaZ{UYS{xdUgKJ0a9&4P!UyC6;(i+cR}fcs;(I4d*u%9?*_Qzl77>gls)R| z{ZK3!o*x!{m{#M^AFz4F%z^sTO@#a>BQqd@b81rlfUr>9qrM*}O;UW0G+E#D2FKIM z`3)W310DCoG*3pK+K=rAaqIbTp)~itKHE}u#jZ3bx;hjxA55#Fbt39D2p(VMj(-|^ zK%cK-OV2O8H$g|k7OUQ5&-XBe>Yc4RXxmR4aMOb6qI7G5kXN3TyIlo;Ej7hea&hz$ z_}hw)x~k1K*9uChw<}#!06Rd$zpTybm6%EKgUx3_bNmuzxsGfZ)owd4Y2GULIgm|%07 zvd5%$>0{R#M_o#mq~d?-=WZq}-L*el)tiRl&jS5>mOHvsbGM>8DsJq%Ni=n?rnQ>9 z3rbNjMdmzh+#vBQ-j?D{DluaZ3>&T;GuH=OZWTs3h0>UUoW)odW)FLYBt9H!#)Xch zAZ(1NNV8z@Fil>fTe7ytu&%npeo!BRzte`|n{29_sXHc~r~e}=MUCr`;jZElyM`Z^ zkqc#rU04V<*fWS(;79HQ9Mq3WD?U6!`ad9sdri=abgEw>G% zyOZ`F&SdaY_J^v@>aF>2&$g_&xueln`ci`??Tz++pFX?u99GaNh{`JFlS{I4;pAC5 zibj30Pt7DkBg*<3g<)B>d?JR-3PIIzB%e*5{Zy(zqP=*dTf_g(3o1G;o3kwm-AIo;v&APR~FPfd)NLD}rY1_V2U)Zv6Rcv?(RT0xZ`zVR4aOmc?gS94U!0|@q zTRI)e+G`}9idmJ({dW2>NR&pPWbKscnb_pdPt{I1cX9Gzzkf};Idvd>9xtPDJla#H_MAHivQjmuW>hn8yQ;XF3HTi9IOUybiQ=y-b;N1y zGWz0Wp3!5BCbG_{>cy}izYK@MxzBVX6d(?$zF&Pyc_B}_dE&mkk6fP9UVaXb6nYJV zCd#tAMvvnd#x~Sn8)(;yb}7oJw6v|l5GJ)May4xmh#DVNCJ{PnLoooiSz?b1c)Jj! zb|Ds?gFy;yTT6GKYyH>#cI%5qoz+3Ydt%ZcjkW#XGh;<>!umFQ8sb=vGHvXpm02>Bi0YLA@B#*Km@`zUFkI%DGQ8 zW3owG*F(3d@Gjc!DL|st&(EQ%!JC1#n*0TAVkUJrIRv^a*9+r2#Y)ZzUWXNTSy3?p zE4l6u5UmQckBtlvbr!~MCds2(!gO9fO^W)Ht+dMUGDl=p7}smx3xu9fTzENae}A=) z3HN!scZrUAv$AgH!+1;Ns@|0GoY8#j7+idpEx$e)`YWTf(CA^wLxLHhIS!CMVNXm$ zG}~o{TlbzDPh31li;cg+&}w>1^bNF%bI9=rdAD9&In^^;LOItRJ#<1^$Csvi47U0= z#3J7RJX)Xi9vAV;HFRVv7?E*TSWvOk5BhGN^qXj^p1hcz~t;FqonQmLl8T!FPT z+X1A{M!K5BV<_j0qCg|Ed%J~Ctq-(ne*vW=4$s0S$2Mgj&2S*>7BT8rO3j7IJ3?x~aPB$zmN>gAQcwB%ZYae@{LKPCq2<15%)$c8nHhfv`F3 zp;IN-MeF4*bXTy$G6N{=y$GKOz3Sc|y8H1$&Bldvx%iKWI|dlWx3}kd*Bjwb*p-sa zcCm3C()~uk^gzeq{3GtMXvTEk9{T2HySZj&CXuI#w4KIL9D!sb1v@K#IwjUtwg{YP zq5-W1Pm2G@tT`c$gi5@O8SmZ=3 zWl>70vlwH?OnjAuVAb$YF~u4iDm9%dD)?WkR7_zl!>1CbCCM+*xMV^)bBfOc5!QOv zXl7Zk%adk#-3Q{Mfj*-(`{yQVa!40KUh-}!u$f`;d#oqp(D$dm$~<`E#U2WMUH1HC zdbVzMo~$PM#XS6k5R$*dJ0h<`?Vr9}!*sXLr|~wuKzwd=gecUe@3HJFGN znEE^-QDhe?>54g1c!b)ZqKF5X*iq#rk>{!q!##a+^gg_`+U`Sp()WKxf%QDHM zE&Ot8N~9~z(=i8*F)QsV%ZOD))#j%mt!}fl$_u92v%uHju6uEPS9x-*CyXOd0+=HT zl2WYD`Xi#^nzMXuopQ9TN4C3Xp8;m2idw%{jyKxKfO%0$TlH-z)%Rsjcir^ogsV(Y>7=s&26J{?{c<6msjD`sL zTAu=DC`~|^bzt~ATXZf{7VDx{$qOsCH{qunD=e%?QRu1z{&cw+dhH~atX7Yi2&MiF z(z1`3Om2a-X^_{repM!>sH-IewY?VU$lwUVO;uPhI4y$CjBpahU$(5M!6>cOKO}!8 zINTDPJ7$)|LNb(Bd(}=Ew5O9A>ML2;GJ!&oD=J5nt$tlFzmL9MCW~v?8@)8fip+3{ zz6ON~L}l~vXCXw&@bA|8(tjR0PhFrgz~47MI{9pK$on>Y5%5X2Gb-!7-By-uEZ9|y z7{<)RaEtNN!Awa@KgXqwYbU~O&$q?bzV*|^#jd+aAp%AbBMDm+aJ@B{{aJeWdbJl7 z+40_GZ5B9QD7VyEGij)!JRa?P3)Nl*tk|`PO1eEzxaViKHqk1fdmLY8%r3VBU4z@h zXt$g%r}fk{uBos~ixncr^PVT2zbiT0IL>QR+1`fefh&y?H{8$N;p-_9D5OtL!l)|V zxn3?d)%pi#lPwBK>u~{K?+ufDmLcficEBM~(3gwuYJpa&sGkqM|8v^M0~OM?$d0|Z z6>HY?v*KgMeaFjN*rP7-A`ADv?0rY*al$ylF#=h%^wW6tFMVNp(~~*Y)9~~?uZVkk zFx5oEIr*8VB>q$Q#L1#837!1)_x}U@ zefb%xDbD&JF-CcW4~VQ$sc7b4rBJ<4Vu7c2ibG0=56s5trRo?^_hW+Kv0Kv0MFlq2 zEXp7nL(m*Ti?VY3zi)`g4S6;-65{vKy3e8ywP7<8&xfXVp~lug^GSKh?1AjBvw_F! zJU#x3Goq>-=rdkB%NRywODam0DR%6lb(gcq)4v?hzNp`cI-?@1dC;7swYKXPp>f*x zZfab%n)59rd8EbqxxLr#M@%=Dd6Rk_hvd*`s$2w9%wO9MMRYtN3Si=U-|L#!pTyck zrq`++g5jEqk&6sPuhw(l`!Q@MnubPfg5->TF*!jjnyCq@vIWXq=J%7Ngk^IfTO}(* z1=qSf@TL7PH(;}ieCK`~zj*!UHPAybWZe<`u@J@3>XZm%{y6uW1QFkx;9ePzT$GOa zK;mR5qoiFw@S3p+ZAOksRlhCOEeeQkj+OJkLY*+xO&5`L$4R$Og))u%ZoeAR0qMsq znD^mAQNIDfXE)4t5D}_U1WOC?-4n@6D^bqx=L` zC^gT+IFqR-#NHw$;>NVkgvjTVqmmGoQyQVO=qTTG`iXUr={RF3Sjp6bUP70%kN{fABWoH{rFc$JU zJJlnW^HdrZ3SZc9)=PJ1q?)?sxz)2CXD>rHyMxqQ2_oC|2&7lR!_&)i&8t-q&WBb_ ziJmOePAFw?T#Pu#*!*(i$LH^cD2_b%YW58s3dct~_nZhHnFDyVonaZHqMnQRKq*S*yJ<=$F0lUWyT%#?SSys(9Mi{$)Z$i4C`+ z3lyJgCQ0-=JJY)PV5aA7Sd`uW6a91EL!2t|w~hp#4+tToEr-;?FmYB8|gGAzyv#ONbEw$=-NaD}h_h;v>yU}z}a(R!l%?iXs&2l+|jIm93pyJh3{KvTOP$oETCq5kzuH;K$_St z0Bbkuq@(EtlUv>6Ew`Z=Aq+U${Ac}Z#ZWTLodUDfFTng4;RBkr}l@C%* z%(ClhiYn)@dL&4K>5T2yI$-*&R-}Yf^SdR@U{01&h*~5)noZ_;yA@BBSkiQA>@U4VI68y%GVj8 z#1k4ZRjKKPU0hN)X8IB5I1+tIke2q5TSI3gJ19mZ#>;r}$V6b+R61ojY}4H9%?WK(pd8yv37sR+?5Sb9 z2g|B9F#_)ee0)Du^i21WZ_2>8*DPwh&=6uHm!B!*&{RcvlTI&0ymcT17gXA|=`o>cj@10?l z`MCQ#I2+S!gd;F*GQM)iyH@?a?Q@60chG?~!^RJ5V7XEqJccK}{&uSPx4W7J*r+RO z5yYj(%?GCsb_MBlU*w{~)D=Sr+@`9R*P^nlCx9rWi8|nzYi$y{*?E_e$fX=!Y(&Q@ zk+l5_ojsk$Uq1(XmHdzeWrPG+NFKHWOh4W*#oW+l@SvqE!N{T10SVCJ9Wp>9km3ha zbi*DTN`t@8+x34xSY~HkM->I98)g(vS2+^VYyUp1woggY|_P5 zGpOovamt7}dvs35vT+GR4Y4Uq_IG96)r)Dyy zdt9uy+iRS3zYBvMB8Yi+Oc0ncTo+JUk%o=*^{4q2*N!oL_PfV1q+h7I!)>!$3~u~G zS^Ou6<7PS>=Dg;ZwObvsO=SNYCLj|w83;a~F4KMQ(ygu5G^}_&Fn3#0&nvbyy>X*9 zKJOb9#SqA_=P{VktX|j3e!OrH&8An`n@-Q-bbCu=_gfq9&k~oLH?oLV8YItNVsXiu ziJ_I$HZhwR;M88^7wxnzIe$#=tpawArs!^MExLPZHN_|?wRl2!T{g5}h{XLyvzhSe zy?vcHi{RYjQNoV?xRuTys=Bn9n(wi@$k)r8(XQNNz1>}&{Ey7Ni$3oCy4PNg9Sa;0 zt0@SjiQ8Al0oKzLbGD+)ZN7V8BKF&ik%v3jr8{o;H;eVFPpyDss%Btr^vsaUt0qD$ zoj$DYXSdNcTki()IT_J86_xd8AjsW2rv0lA{EsBpi9PZ*Xz6fweo5zPoBUYmlWjP` zCAC>orww$k7&FG(@15XTd>h{OzhX)i>YYuZn9Pn$8ad)6r7^{MZY{ZRtWHHv_)%Xe zz@~d+neTgFYR5Sd5f9%A+^0oU>ZGu)tpiOivIsguabhl8-0=eV2gf5rVPel5&&#}w zUf|_Gkh$87s(bfg;kjlDF?h;$izpJkIz*D#k>SK0@lo9n7pEg*1a*~;`|8%pcYB*Y z7D=>_wQtj{9<^y^qY+UHQ({Jbjs~t}axdJ^>{gyxP=d#SzH48l@#i(Y9L@YTDfd{i zw_@q3$@g0Xls~(so`q2>dMk|z?x@zaQN{kljY+(elk0uMyPQ^SAJ%HR`53)e(@)HW z=vze0>Ts^i^&aheZfr1O!@RBjY2~#%1|+yJVR@IORVm<&+aZmbTC)lxtTU^wrDmG3 zL@UuMB+9VjCjlm;=Tg3&8P!Dhi&)D2beoB^2b=ZeoWZ*?Kt?9_W(&dg#^i3js|t6v zfk{Q=#q3Cdm|tN7GQy1VjW|siX55)8S2EXyd2N$crRX?>Uqi?5;iY{U?@j4r zXR~uTpAigr;mfvDXZ(%32o&VNk*A1uSEYqfG^%D_7>4$e!a>)6m35K7K$H~Y6m(IW zLr0SNX;x5-?i~nIDBvM3R_h^dDm+%WMJR+Vy6FC^Uj7hmA4ET-)3I$*SnSy>keN;J zL@78HyfC*?P7s7CO;l;F<3FN#PSv(q?T;Z|@Q)fs@A3#)MJEvsJM@$H)h04-=N^A= zo{s+~Ov@X$iD#WVIkW0&t+FxSdr5J_7`xb;y)->}*M+wEWZLHJrRBYwx~a zZ^buUZdxVgq;8ORa6OOBrejo@i*5GB=$Cj;8_z%8*uR2rf3ro#Gq>4#MRCmg4?}mv zY2BXuT2E2XKFtRO(O6fTwHfU5PsBk z_-U$a*_SolLJb<5Jhqs!F`15sb zs-IPoct>ZCH%BG%qMYFzga~D08T>)6g)ff(!EMovid6wwxYTtuV9P;&=%X}#0T2m*}IjK2ha?zi~r6xVHi~W?Tr6YD^#6vDR^{cuSCUX($hP)ZZ*cf8Kgb+O@ zbj5=G1#-GZcx<`_h?J4nrEz?5pDYdT;JL?jf!gt%#@6ENV1t5fBX z2j!gd#DTY}Iv&48$N}C`!<@tzFH6WA>a!?P%qr`Brx?ngNNZ!56cb&(Zv`(&{C=iq z83Yf=3Mc@~e4oWxRY`q~-*MZ~x9=ddDVr+}uB(dkEZxPJ^Oe?@*rlFot0kj zuT971+3RarEjWe`x8(Y~IA`Fhc>8L%zasR+r8ckO-vfAmU@-X2Z>O*4CaR{xkpxvS z!1D;I@5;LUVur|X5z+po%5K%$HSpp+KRUjVA zdh5e2Ik*=_uRr>03MEf$(~zgMiQ1Bz0`2d851)Y8!!IM>fyU9;zF=^+kwlxLw~1a5 zbyap{q&`G9ErmF9@;`KACS=$5p0qY0-OTS3IlyPizfqgI=7&P&(f9@_(YJ|Ge(i}} zv>}Khmqdgs@#51>Ck^~Q3*Hobw399#X&kT~5!DD(wo0NrX`f$$i63Z9>K8xF`TlN) zAK-(S^URQ;KRg)&7K!C(7&nZM-%A(VT!(C4uB}4 zq6!PloqB}4IMr1R=AO@GCZ#zbC%g04cAdvnUR(u?$K}%tlfoXr?GJ!EO6pW~o2I1_ z)hhV(5Bt1F=Ihr8gmqK8-o?RC;-KR5c+;5@t>Fn(7~dZ#j&t*Vk=dOxXG3A5%xQomQ2{`o60mu2$JmM7a2Netl?Zvo$B0M;#(gQP zmC2O&_Vt@Goi^rOZz{&5Z=2+!%Z6BY9M4bet}-{5oc!ItAh4@aP=O^bWXY0HXAy|} z68^up{J**V-)H0N?oYJ;rlPkg|JnlM8^F9A3}`M&YEXZ7;b|5OYz+)gL`eYma*~)f zITU!$TWYGRs;Y*ns;a80sH(Fvsw%3H4B^X+5Z%SR%-Q~{LAY^Nu0&YRtuiqIa^49w zOs$yE#*JHX#@a+7h{=eDAN+567d%7@janh=Ke4R_n16`T)S^L*d^LkmOJcobS`9Qb z>k!tXY8H&QAi6p>JEx+TC2C^G)=}Xhl4K@k3yO?di$jU;Gk6-S{o2I~j-b?fSnMLl zU=gd11FbH5HfaJ{a~s|1tzn&vjdIL-9B7ga*QP9E)|+~^$V?UvLnVw^a`j;_h{Rc^ zwuDupX_}BqGGxN#Mmb1GT*ZiUGMJe$w`eOI7i+8|ZMNHOvgT2+ZA8l?J}6^tSr%A1 zH*RFdWD4=-M_yxY76ZmdAXG@P=B}IO(6&; zyP-al+;zO2x0;4|7%op#(nKVZ7RHz*8|tB__4Vpxn8@;6uVH<`ntVQr@9Wj5BLsAp zpg?FNBPGcEq%V2kn5QVz94CR4nfXnnp$#1jK!~LOdIz=) zjCCT@xHrG}rV@978};u)D0u^eV*_wUsB2=}d23Q!t z;35r!aDq@^|7aMpPB<{hyTr9}wg4F%deL9O_NGh7@4OePFvu}KxkR?2~zbypid zD9+vk@t)vh%E=TV1VI*)7Z~mOqa`8?GBWNBr{JUn(|Y0kxyeM-B;3-t+oLO9c^QxR zDP7a~tOg?L%O5Wo8-hPUeoXq%H?y8b9rlHf*JAP!^yjw@`x9@r!_Z_+{pq2UjglH7 z0fNhkB0UBM2oU?^5hl~jpAXVT7ek2$4)AD}R04#xBr_`EoWiY4_8{(j#Sz66A~tdF z2SCn>G`bOxGh4W*m&3uEk>B_ z=5u?z3?A2%(JF@mKt!VT+OEnKb?xckR=0&MwLSQP# zBwSkdwNnpuFF)~8_@V}wh;Kifpm(HGY|nW_hO!k>>}-wicEF_&6qh(x+ra#WCcuY$ zBr+Q8(d#!CIS(qMVuEH+;F{Uv?m*QD9YJGrGL2Oc6IqyIA8r$DN^~3tSmxFnH3TR+ zVGR_O!yDhidZES>yG|}7=#>Z(Y?T6OvPvn!tcn+ZE9Ygty4uG&ghfxmL2_#7%U|=C&n3#wlmLyUD zkVue;hA46fAG2RH^4}om^x|8Da*uq-q>Nb@UNsQ){`5tqMDB`tVh4mZ9+fyjSr8JR z$~bWZ)kPHH>Gkx#+B-pw5{T&eyeT0dL}hL-=Dx#XJxoepd!;n7#O#MtMf~mecPcPD8SyVggD10 zvWSN(wTCRLM@gR@617RIP2!82s1T{_!Dn`vR>H3#`1u8{Td(AyB8cV{NIfu-JQ4% zf4wj`cT16vpF$8bd0603&oZslMujCzoO5AENoqvKTKqmV4@V7z(L5ceP&J0cJB0#? zH+Z21QwJ<@m-{k+86oM6ko^#05Qv5Z6)Wxv&(G__KL5L?WbyuN=++(Xet%cDR5R_F ze7{l8`ZCsBy}u8;2S+o+F;Su_C%<2D?epv4OtjD4)zpfIk5oHp3!vK2o|5QtCgt+z zG%rdqs8k$PPj8paPHd|4;rjIDkM;e#w|+0Lf1A(p>JwOU_)C>HYX(frlk;}B#6^Aj zl7=hr`@$ue=n4k$!|jKsoAN!!!w=JzzHG(zrY0Wj8AktC^ZR@)!cR%twxHP+6rdcE zs1}JI8G(pI1tSD#F!mZSF7WH*ZxGNhYt{Ut8(&YW^IQDK_TQ1y^ga9=y0C`?KR05& zXqoVw2*?w;e_#M5av=FwVjd1J1$|k(dV8(Y&)>I>I(%>A@%en3wOQ~U`hEx@^QuSG zA@M3NjYC4BBjBh@6h4G6Pk=schs+uP{(&!FT}e+UzhFkxT|Xa3dekdO4PrjHZ*her zYxY0o4MHv4tsWpOpucyB-rbzOg~sZ;p+TM zq=cJf`DY$sUAGy&_BBPAP?v~2hN4vglwdzX5(B6{P`xljfo}y@!6+ZG;2Z#(0Sgfd zR+f+ynRaPx9{2%@vGCr5_((beYYrHb(Iy)MxX1SjBSA=qWg2`=e@Bx;G$1OUO$9sC zY_;1oxtgQM((D2hbv6oxf%+ar1%h9ZEIE)f_Imjmi;yuY0Q^IwFoz@czHGj(zBmb(C*;o9aaNoSEiP^~by7dF33M2a?`R$@%rsWbpO@w7{w^Akf07vE zrpJoum)!3Yxyiw!8<6=YbPi{ObiU^5<--{taqDq0W$%CKl{@K@}vsS7+ z#YQ~=eJ?`t-u^jp=>x<+k2|2I0s^KfnqOR*NRT~xsj^7Hm^2^QfGJ)N zW`6uRM2|1I1D3k6w)!!71fPN&Si|5fDuGE)e!m)UX0h2%dObs$¥DaD}di0#>YOWFs>Z=?C=*)x&{ zWHdo{dFlr%R8C*+Y4A(dEWsJaA=Sv?B-qHsN(nti7esO^r} zny|WjHu&@N`7dmMNL0tTl|;S-YtniN?<2XsC=@95Obt8~3K zGI{WcyRQj!#QfX%Z%rBiQ9GHxy6Sl|Bvq686D=Z>b*=EC{d+ns&X^|f!@43Irf?ew z=vKY~@`spcCd~}uag+!l>)I(?z)}__Ew+6AJGaG>Qm*ID#YZ=I|QbcuPAp|C{(_ zl%9%r`zg8l!`I#T`Y}vM`C?lcNRp){*bjmyfr1W?gZaE0ZRh*zxcv>HPao;?AF1*N zpX1g*4M>VPAjBqDbR7AlU~jJtjOem;YCV=Q==P)L)kt$47M7gCo<#5J4xpV)oNpY+t6<;!?NFQ8X2j*2$x?y7r$@-vMks%aS?#$k$Bys*m7CL+;PU>Wa zi0Sg>e$`Z1cCrr~J+bk9?BCNTTBx~01;>0P(6}zR+ZLPi z=Y`O2s&w{KTXE7`n_Xo@FKHK=3Fb}8V+Jpr8p{b)1;#qLWK*s6Q?FFUbvbEE>BceR zZ0-6(zCCBZ&&#*B+VK8l16G=dotb5!ne|A=9j;Lw_qkH85@JGGTDbK>?YIlk%0zg3<#i%v}@IJ5HA(lf}rBT!1WFrsLYvWbM5A>lC z3`9UA5Z?$p9oPJyupQRDTAfLHZ-qlOqZTv#Ez9_9Z5T!@AVLo+rvJIO%zmyq%h~u> zMx(lNhELBp5cma$;L`pe`R0!q9hFBxF$cMMjg?L?dvs z>-K$~z{$`b^oQYzwM}vNG}tU#`w^&tXZdlTqvJQsr9TPshmVh+HmSU%JSNb0!Mrg< z(DGM6Po?1vR7{!&@tYzQ&984#*h%BHK~{^{)QBS0=;Pq_LYL7RL=C@pHz=8ZMF?zy zNGni(Oe*w;)2-9>-&c5K=2YSOU+3YMF9IRgZyD^o#WV)XU^=f-Ff&xYUg^NY!wg(n z^Y_No?2tOf?%S$*H?>w=eb$s+FgcO~0?3~+NfbCF#si7FPAY~Pv||i3Q+W}z=R=b& z5vaM1%0LbSI}=U`xC{kcBxDl^0wNxoEjF@{7!e4mf{|`6VWl~sM$jU zicrhXZUnMw5fH@#z^||L-ELeNX7_(5 zANY2kIDM)0qc>O71|6b(pne#rf_}iE>|mk_I@hQsEKhR%#*7w|t6Z+sN$5sKu2AgQ z2y8{09UPEJ!fKo2yI&18?(x?x{Pyn4;#!`0;)?!Ve6+=DLYts@l>)p4R21X%CXXX% zT%3pD#*>+Epw(3|Mx|rbsMdS*bZK&4~bcj3>w=qF&bs|#`U zJh6bEWj%CcmZpG~^K$$`$0wY|gHZidaH>aM3zwYIE%ValthuLLle7X1UP{ zvU@OEGE3g-v{1Fz$n87i!m8J#R0fyC_`R`(FI%BZH8f*2e;Z4hHS9s-O^<~TsK!j5eS zE>_Idqkk#tsp#Ri^9e_&r^-p??5VnKxzOoYZ?iH;y77<@j6h{!i!s zm-PQVXm@mk0zxQ6Bl5y8^hkLNxg$}Kc8nqH2!9I`Zq!s7Vk-vdGPC~{MWp8629uCa z;Y(u&J8)1?(Cd<@IP@y38W2vu!{mt$K3DXwqm1gt2AQHi^Bu$sELrf#5)rbs05<4e z93cduX+jyB&)e?b5BD(s)UQFN^ujsBRCN1K&YT0X?2JZ#sH#hTz_6Bl@v+d+m}iZa zpp_T%lbU^79#38Yvq!Mbf6HILuh;rXTtl|%nu-L0oI}BwlxBE}HN5A%)*<$vsK=!F z2!5}}Vx@fFllrX@n|hPkQ~FL`;KJ?|L3v1+T4cEXN5J0l2(?qPsXOa&BP@-PF8 zsO*_AQ(;4lRF#SuNQ{WJ+Mpxs}2MLZe_fSfDy#WDH?*hK6D=*7O1^an1!fXszC zHVQ6(No{gN4$b>fnGf?i%vq7|C5KLof|8Ye@dWH~-g9UWx9%qJ+?bw3*|dnE{U?Po&N83tBcSMy2#ZKiRYp2mIfn6;2R6DS+tru0uLZ?@8;oe zj`t;zxI{@sf~5fd2RZk;R;F=7Bu-jhfvI&gR)f%I4iU@?!vL6a>MsjmXry!~7(_(6 z4S*mbpf7rQ)AA;Rm$J&h(1^uBmQg~pf<^ER3mtJp z&@2uzNFHe5!XJ7Xh73qV!5V|Proh@J-aX}}kc-K?L$rCd+dhCorOxl)gp644D_izWblFVBeD}ob&Qlw+6HnsiGVX&mvY zXIvLfvnm#dRM4E;o^3&nVhz<7Gp^fVhBkZ}+6xt(71TPuYjjX%_2W~o6~YCT+Knx5 z;9qt0IXUuj!p$w6bX`kR1(p0zj%o0_?A7f~GBf2-7(9Kq-ukz-XO}z|X*B+AQuO1f zc+9?VNGUcE)7mROPu2| zT;7dtf#UDVnNjzr$mv^jnay;sej^v#oE|E8M)t#E+w`>1uDKJ-N8_$0{zkbCne5eR z7Dtn{H$hA8gd(e49A3?DpB0yUDznPXxtXPL%Xw64tx2t9@HU!tGv2 z@qV&VhG^u`gQ|>t8*G1`JQNM3d-CcC{T{m96R}zI6ajcJYM+02Ili~Ta)U+1RQ`1TZJVAu9JPrIRy(v$$FF0X!Xw-J{mHdIMHsz6ClG&Dq zj?l${z#_9USpEC)XAkcxh+3Zycf;4_efQ)&<`L1l(a`gMgw)Sy#w8hKB)IQpy~9eYnt3BolElCwAafd z%jx`g`LAq`rVZ%$y?ZY$wS2t?^wVgi%#RL&&_j zwqI98H^A3o5>J#(1jwN*#$^S9xcTP2I?;Bj(|%C-ZEaLiloU}Y(9}}XrbXhon-Q5% z-+yJTtQc`|SST{z%eg5j>k%)J&ZdN@=0!{GaC2~IG!97hY+V7)bBDltkA**vw{Bpn zeznhhO~>;80oopy6WpAL^VL5KcTr?K1UhLt0ti|vZWR#)6e6H{@mhWI+-`cl_Uid0 zC&4z~Ln^9FKfl<1H4o&#&)wF9&_1XI!$b{xZ{&?zCw4YQkI!OhrGp6pw&6L0^PRn6 z@E)|a>Rpiud(YQcs=+1D;q}#Kvq~?c=seUS0v-QZyl~{{ByzAD@}N!r4X2!e# z9TN>jpmUIQAZ7ZF;DfqYo`{kr)e3Yb;XVeyVyAVIh@8mNH2QK_KrB2INqQPcC>v&i zt+QKhZ-}_CFf1-Y9o+!%gRhQv_D#VvF-s-;hpfI`cMPr1oL@Fcf+&q+T9z5PA+5cd?P%bU;$MlxYBXMEimYn~>QH%1}iqDeFIWeA|FG{&9qfF?hj4J#t5m1@IbUlgFe0>jQCuhSKbc|rK7+%EN31flU2KyKELo=+q zaD!8}dSU{^uZrRR{thpDu|0DM=f2Z^heplRouJ{(TBRm1MZH6ubk zQ<`E2E`>AgBZPx;>A`WQaU!5&8OJ~+&M@8}WC{*HI3uD1hHVo%Az-o*V)2zS1jiwT z6BbW*^(Q-{s;Nue;zOkjo8LH|*oLrqckr~L7-O#SvdvHv@kPMr)-+oIGl-%5@JjD} zfz;j;`grHy;|1Xf*~-ePm?p%SWJ-t=cLj$k+7JZUSG7Q}K>odY{K0r}z}0DVQ^<7# z`B3gh2H=)hwlcBQ)Y!oPSPUGpNGQ1qoS|Rq6SY);%25n-AWTD$6ko-K9hX0`NMq@w z=IyV`%i#?%dXJ~;0?Jevv-}c97#{+kHNPmIj8A}1$|tN!6M&Q^XM|3#Paa{+DRK^T z)My_5r)JO$$G!!pcjEA!M?Ya$arAQ9h+a9r>xX1xw1_bfzCYh_z)$JEMTm3YKcKN* z)4fH_B_6ek^hreoZ3%n&{<8$p+jh^F>Rb)}jkp~{JfJC19U_8FK+{syKnYhOjPFR1gY{XupxNI(>AUEbSt(z|G_U9-(x8f~wEwG@5R&_6lUf%f< zRZVP&lg?8S%}#)-Xb?-GQH_#$r=!=@^n*B+!^;l~Q#{sO;I(k+Mq6=@&-syZ5*s0sK7oe^;Q^K%K-5)uzi8i&Qu5i2D^0WSiXg z>=-=f7?cl0L#0|pmmAt(;p~ON2~$OsmET}^EK}@pmDQ1H3j0eVla7$!N3er!e5*Tg zoHk4|!REMJg22II1_8hty`0Vt3Zg2e)0+iTHsa8+a>^Lw-z4}3Kx4aVk1nvg42xs1 zMKzBo2K61g00X+zN)-=MpmndSb)ULCacOvdZeMv_vi(aot}Ol(4}OICch31Y<*bT( zs*yAP=0b96i|+J)Ma2u$jDknyYoj{bBjo&)Q%vbRPAH>@l!anTZhUN?^3wv#9-TkQ zKZ)@~shb1qMKo%sCBEv_#b2AvO>{J}w(DkqlUlv%^G02iUBou)itTAzMbvuvM50TL z)r|mgC;IoWr&^bRB&<5@3at(IbqHH(C*<~@K|!uQs)YOpp#$bX?9G4`{OQwQ_oiUl z=Mw)58smgGHC%@Q!B-R-n9kZ?!bntAnzWy|sL2|hzr)!tGvl0>kA_wrh(F2w{X1ii z6>i})pN@;-h6&zYGsa2!K5I0wA~;dBw@LAX$Huj2d>&U)B5a~W85U>0<`hGbWUNF3 zMN9X_Da|*^YY9qE6-FVyDuNE7V_-p{5muAGtlT=RbLovGR&xw&=f2FaDCTPf0NXa2M zEen>C&mvD!IUKR4MKMHC1082#ueq+Dkuvr>$mz`J3v zYMS7PyR>&$gT0x*3RuP(-8jQB{YP7G-}Jc^k{qpKF$X`A6U#tQ7A1d&KDk zXz`g%`;%|UzoBT&)VAB^2ZqwY>EyI+l>L15psW3C4j?}@N;*S>I2NT%<-A@ETQsjK=isP0eY`&x z$*__OYMizx2|qy}MyM{L)&}+=~jV z&0OV8?CQ$CRkH7d_u-Y4&c&*?z$nL7rGj&E_?5)vlfpHSdmw$#+)Z|*+fAyh=}&xf zn)LsLwa2s*`CUE^0lwb-nJ2h513>+1K}Y(Sg+>AQ>3$R>;WnER6IuKjqqO*A;;E^jsG`wQOIw&ySbQ9l>z|+fW{K2sY0m13K5KB z7{*EcQP%9Et=UEzQ0$`tHX5*uG*LieSrl1@MKn`Q>%%pMS!M=Bm>HNE1(47<43Q9# zNXQ?a!DblG$s}tl1p>dPdpU0XvcijT$_+o`u`8&_!O3!?7>(u?F%F!EHBqcGrm9II zDww8<2(t*#WQXCjcu@F=XR3c1_ zs)*ZO!(rBU$UN0w4+-{eDoO^@#592epM4r&K>Y}s`CUT-J@KL)^mXPY*V@WcN{PQ- zNSkzHm;L4jcqWV+4}C*|;fXOBMWvW545(5RBs7TSD~+`X>?DdcMecpfFl=oXNB8v_ z!@;OHAwh{j%%Jr%1bGId=qypAG^NsKIVMH7VVQ2J0E|!sZwlp_Ispi*bHTDgE^pkH zRHq|=7m1ei-@kI;Rpza|B8N0hsP~lZbq6E+gQB*)$*@dEqBbZgg2MjhYt=5ffA-NAh;-Ci<-=L1lo!9M>M1bG3d{!Gi^h#5O0s4hX=E6&tgLCj6=Wr$RS5TH6k_kI6ZeyNp8 zAl=@=@&Vc|$RJg2eCm)eoOc`|o~SF-jmjY^m1t`t$29UK*>(U#nr#4s$Pa`Ml&2%x z?XjDIz}V{2!GV|&WRRCxr&^BF6G7Kl3EcrU|1Bn`k*49YIEz&ZLr+bt1iCeGQPl}D zG{6b>VYy;!t`2Z=u-0>nPC*fHe;#-pz~T%?lI|Qv9$^{^=CRxOlMhgp*wc6+#DD~d zBM))t<5~&DYr_Ku5;{)G8GfadC^JBgiA2!H@K<7=)@{SZz`6Fr>bES5OtSLTa@s92 zaDOZba0qcZoRQ>Qy~XWn z#jp`3CCR(u*K<+iOkfv`?TA}TE=(A$bDfD-$B*b0Wy0eK8e2cig@AfhXfka0Af z5l4(fJTs;s*`I`oP(nkjf#^K}PCAb!(~k*WyS*2=mvvg#GzQbMCE*8Dfoc#DQ5RB~9AIz=;SI))i!NUa7g~`He>!93WlNdttqC<>T3|IkPcl zL{XWKwCtul14H*8YN6WtAJ~`A(x|E`A}Z=IoF98W?}&VQwr^wTwFJmC)d!oVCgeM7$hsKAyY1?suE5VkZvFl6Ci?TtSg++!#WOzE*4nG zQ!KiR_art$v!rz@s;i7H=8I+;7gag0`?*bqvOs}M&4{Wd*_>nPR0)*5L z%Bjp_VW#dKxn>U_vveclVhByqH;N?*iyqJ55EK~2#DBYzw$Y*|kRyi}pqB>_PdR{* z0E=wS%VmxqCBDy%qp&UE284%C!5MA=sdt6D2rrLI^K?l(4U$eZ00w{F9e^PJLMZy?UUHlZ{K;0|DV0J4f$X|EZ>hO%(+U>LhJqYT{}_G5*>@RL9XAssAE zasIQNG>pX91sNVAirz2QY59lC9pm@s;{%a6;BPI%@ z&{YzVDF_Eg1o!7A4Z<3ZKD_~Bf*9!&P&yZSDRB)HVvG+SA>?UfG69X2GZ51ilv{R~ z^A%UGfno;fh2C03O`%m=8g=;qL>~96j7e`;M2P z@rkoOU{Jo4`EF4+kt7PuYv;t7Z z@yB9u28a!!MghQa1q{MuY7ZTPfqmd**i}jo2B?uC5rN1sB=I2I@M2PNKQ49eVDP2~ zFezGEbso@yePjVFhCk&uYCY_ygJ`Ncy&lb(9A_46qOK2!BHekzTYrD z#(i=<1OwU#!3V*eldOO{;JXZu5!5-TVD!gC44Y6uCx35%Y&JW6$Ix}0A%>!m?X1yh z;*v*y8rMGojE_C*8eXZYT~84zvkpzlO5gVwKTjCh{g1%PgZKi&`V z{GE?|nGOtL`KcSc0vZRkiRyg-9bkqLO$me=0NmX}<@lAM4%lkfNNNyrc27U1B>U;% z42k9lx3^{DkI0=*NHaAI3Xl5OC^lz7wH#-2BU3Hh0W_dR} zIqoU5P?1{>Bhqym8z*}Qngk$psM+zboAY)26*Q(-k?sz{YXy&6tTc_I9t$J7?+c-b zuQ+LgLL!ZpCZP@9LoQL@E4k2U(!Qo~WSDI*Mx6p<;!Z2IkzxWD97ZNPUqlCBFg;BC zLny`gn0|wxZjkU@{_FKQH&Da2C6=p?Qz=k9xXt+m@5~z?y6VK3q$-$a=rLZh5ogO^Iu4tn zk4QxhK@oC4X@Kp7`f~}YCoH?*`Wn9_`{bX3d2;lBKF`fB)7{)&|9{PKc)`VzZP|eZ z&N2s*f@U0lZaDbG1>@8a5p8UNNXt?STjy06hg zAmOHN5Wzv$Sr1p@--dt7nRp?ofxIki6UIf*^a>pM4SPV~JI;b?6E_A7n|33tD6MM6P>*J05^4+=t=!<2SG(pap6eMW;GZ_yta)k-H(>jSW|3@%x`p?eQleT$_I zG9R~S_%viOMU&=Bdn7d10m$~C7HfNllul%DXJaI|&^IpG4#`2u>GT8AN6peuy$;fz zojZByb#7?)kV_EhBF_CgpdW$4iecLt7zhQ`7&x0lSs-(SnhF%fr-5RTA|W#4}e`K0GKFEVCxX;h-hQUm>CE;=2S1;?Q=2> zfS`*3+y^Bi#qCpR2zCa*T?DDY$?Q|1WOl*IGD?bI6Nqw7!nqOQdnJ2Pz!#N+7J6q6#NR;z6av4eJtSh6N0M*Vf zK!KA``%<_8GX{>0o#W2=M83~X+X`wZaygG-bb+9574v+SR42*&HaMWpDI<^#s@))0y9#6CX%OE7)3k5(nJ#t!pD+5 z<3MadxNR8d9DCj2cn8?$a6=UgB~qmsW&+*?>;bkK!eFx=;f{-!M`lN(X>M0OOnV~m z=A0)c1s#pRItP+q#lu7ccJHXs6TsEbG<<%uFFx#rd1TGFUn0$u4`BCM(Bxq#Y-!d; z2WuwNq!}c3FP;XT;snW2{fTgo=71llhhJs~+FJ2&dBC5YWj=7Dk6)nI43Y#P@(^O> zgSy4_ts0Dzk2KyC4-H)?v_n+`{jJm_;jMuJ8Iu8EcR|5WLqHXrkk*xdWO1&y=c>eA zWDj9{jE;O6*&i6oyzA`RCLek2*T-(RVS9k;MFf10Vk@2m6m^hOWDI%0F(YMS5(r9D zw7(93!lH3KXm8Y;ET(*NX;9EbO}d*FR51#67F~LZT_>j=fe9Fq7{JlEIs!v5AZ9s^ zMzb^|0oi=KLpL-uKtQC3k20Lm%#9wt2a`6@ zKMPP)l;2Ue26(6=|3W;U@naouJd%D$v~wTO?ZP@p|IgX@DJQ^rHaME3~+ z!X~3v%@@TLOT{~)@v3dG5ac1f1gE%H;{kE!BB9dYi5^4%vUDboB7$_Lv&;qT!F3yO z_)h>G!h}3qxRJg&_xyBXz|o0mkn-YjKrRLgkCZ~-a<;M8AL2X}A@~l`gm5y_gg)B& z3l;3eEckeYNb`b%GvSxBx@G7(&7DmM@`V$|MAVFz9iZ?cXcc+~VbXM(w4QlUdEuP2 zT=?&$_kjSG+;DV+&D@~K4$@d~K!-USn_uKBJEi}NM}02;DUzX-RNJs=L(>A+04RM= z&O#HNCX{^ubb-9_XeP1N$}B0MHGymp*@8pFfuomZD5woZ2lm*hv(-)}59UZb=oct< z^~ojf2xz58%sXMFQV~d`fZ_^!`57UkN4Vq$$wbIF0Ry=PWQ zweK5gvS1A$9|7S5jr-Lq=PZ4Xrey`yve*_4?hs$q6(M=`dY?Did{f7 z#bg76OY%CvLt$5Ao_IA88ssz^wno{ZaWW;Fy0}RGGvk)!1~%IT?yQ3My2MNS#lIng)Nr< z#*u^06%iN}krI1nBlhCn^2Xa~F56T7)L53jaD-1n?bTJI8d1r^pvKr2@1gpQf~g14 zVr2?eK{YOaG4L*y7UcddkM@`T*#rAapJA-mhr{y*g^3Ws+87=#-3hrdp%M;{#397O zU^_nYw%Pe-Tp#(;LIzZ2LYD-cXS}q8vLX<`(!OCVw6H*+KY?Jn$s9&_bFY1%Yea7%x%ENY3WWS2{!`%g#z_CbjsoB_f{taF(c=!wdq4Lw} zl^SaHSNLuZ@$EV_#Z+D;8jcr7(#$FMu}YMDPVr8EOZP{R8}6p)*~6vzSuM_2IDE5b zH}GtYza<)d!Bu{dQJ3vjk%{+P$hjKS{A>7CKfPaZSMRL-yXAL>;VEir(%N{|T%V1r z*d2sFT4< zk9{uFlFpskaPPO_g}-P_;F;rVpHL6uKGy+ls8kJiuDYBf7{2{|Ba()C}B(0EZrzoMwFs#^Lm$}3!R?JlOcw{K?3wA$9uIvaOV8&*%J z!b)Cg(M~dWE*4oH*&!`yj;JMfcX?r@4y^BPb|*oM773|8uT@0$;a367rqPnH(uts8 zH4K!V46?okv3iatuFfW6(eV7{A1%`AklF8__nJMUfarhDlq2${Xbm>VTbpjuQ(_r$2uQ1tTGW1-=mnIB1p1xSro?D2TiTk{>{(F!R3 z**W;ZNS79!=A=YU1J>Gj!G4@V{f__osr%(h1xkMOBL14h9)8?akYS)#P+(z-7n|`^ zWG&)(H?W=R|1XC40c3;o2)uug-XBiYKW9ApdH5N{|9x zbRV)GfQb8dydeR!=^LKm2%K<%AtNpPFOi|YnryYHo8V!b21t;fgiQr~SR(}Xw`2CV zK=5kIqJ1#9LItJlnvx;+%y8D(EBSSfDimhBnAw1zVRq0aW`xlZ-Z6DYACLZz$4NJs zJj@Yo%x^8nWnBjG%%Z))qk-(3o82O^4^gCU(^NmQ+>L@kud6Dms-Z;H+o}Q1p{?&S zT;67gqe!ZRbR+~+75%F(F|}w66Nn^+pf(~35Fkeh%mN1hct9j-o@NV1`-f4-tu;GC zBT1+#z0!YNirsXGW3u$Q!K#4_LYm;GFE2Uw=6H*jE>${YS%oA^E>ty<@biJ|GOQt@no3cloY2bJH1zeDu*T90t>xOAKve*+5H|ah z6^pb?$pl>{F!HLYvuoL2{ZSRD4QCtPQ=KY{hCp^Q5F~^L)5i{1P4wm*uyHYM5!F{@ zSFa~IFBNcZC1D6=zO`AgeHg|$z02IS>{`@Y3d!VxSeGhHT1K9=qa+_>d&QR?Vczy= z-s9euWwyyU*_tIQ7}<`JcIif!@w9n^@PYjU-bbYR-!GCf7JOoO`zSpH-;4{sB6&l` z<_3i{-abGV6WGHrmyF*wAr|9(iRREaG?lrt=GOTBSXF2_pQ%Rl_2099gRUggIMZ#m zB8T$g9@n74te630*vRaED?!KR3Neo|P-`+@Hyo(U%KlZirsNNPgEFy9P{LvfWT3#A zV<@R97-7@c^gXAiLn1-#%TSMluqnzZnx<)dp`)4|2~A_Bi|sNbA+6lQSPk$16*i2!h)~clB@Zqp*8l`ZLQ#WS)4uRan+M}2 zsZk=g8*Fnvz2kM<)=mer@W!JfD#2)$){Zu+##- zOXo;H4>zB2Z3qMr}Ujk66$*y9Q{HLS{IW3f@-<1_d_aIs652VG`AN4bAX;a3}zPE4)lM)NZ))EH|6 z5?Kf(p?PD8OhqvS5)`c>P-zPW19%xLQp0a7j$`A1;2Fl!LlV&Xst0f#5I{x1Vu1@6 z9f6i$$eVU%#EgpvBh3U?G40?Gq}kdyqL~a5l#x)(-fA|Oeu3Z{J8(eHu|UgMLRfAM z+u9h_1tk)MjaCs3W0z&W+$RGd-Z+V+{f#2nGEkw3D!S)Gu&3V=n>U;ai>S2b;U4d)Apy|3m;mq6ZVZ7gNi1k}2UsbB zrXd@!Ikbh|(uRdF9>L7giIrrq@DqVS!3|Q82LdBQ%`L#**tL{{OH_N4yMmG<0m!7L z@o6Xr5q-Un2(Ry@{^Z5>=%~u%yi$ zbq)@45>88&eknM@xy!Y*MTr9LSt<~rus7TUBu^M<8tCp(Dv`+HHbX20hbMmqbI3X7 z21aVRf(Amw9qgWQN@zNc>Fn=~9{u*w1k8YP-V#MPBuj6EAVzFc0HA@fD@>f_`@RoTjvfnmL^8)O^sE%etZN=ymcp;}K>+{PUp>F*sZPtG z5bv~^V!IC`!O9rG;4#ggeWY7M}tspqiM1sVIMjPgSeB<{ha=To-Af&`$cl z+_32_6#Spm7#ztSIpCbCitWHMB1#HQE+{A;z)Q+z@o)Bpz72&8iihz_AQ|F@Boxhx zp3;2Nwhy*c2l6Pd^wQc6?2pf9rX!>=@>00W;3pWa7|iWZYKlR$647yppPmSn5W)eh zltD~6zs>LU8|J6y43p9g8HexH{Ki4(Em2ZxSRtg)hy>5=O>i&mPUJYZdDmkh;_F{vWy-IC8CW6qA_wt2o#uuC_9V>#+Wt*6so9?wLhD@ z5%_$+-6WD(O#lnuj3U2Cg|PZ~H+p(aOOALQ4}x(Ch?A-Zg!dhN9jydiNAq@PJ)9w? zgGoYmypkkJs$=nYdKMsWAPuDHUJP{;$XPKii5N|VZqob zS!MFDUmQ>|CIW8_F-nan5iLZj%)ms1AV}%IX4AL= zY+`PARY5^`T$rj5HmJb0(1rL+D=NmtAv24XMg*rV4|i$P*i|24Vi2|HtG7Jh`V34A z*T9Ja2oVj@?j&eR4}_5NuvFFhe_nAQP&-x-LTM1vc&DMDeF}Q5jL0?1-<-+L%ELOn zVilybt4yfcDA?<>REd-*_m-EC zz>_6-2EJBD0^LA8`=R&Eh6rnK2GTj2R7Mj)}xFQZUwn86gvhC>r$5OXG$h^xnM^5C_Q;`b=fre9y*^USnq?mAh zejK;g&j*h@6)}L9+E16+Npl9DU(efN(wF ziHxQfWQl-8K+;9Tm5j6|LuJPpNq`@zP%lZF!X;nq!|3i94cZ5ikJQv2LMah4P0VGK= z6Qn@{|QUw^L@_g;xNO)ARc(IRuK{~9%Tj=j{xer@=|_^@9=yh z<5-+Rk%U?$4%+McsA$aWEYR%DWQ0@{C(Y~Y6X@};Sr6_YNGOpSS{OwR-{lHWe*9E_ zK>!ycoTu#87+81J3K)n*3mVE-co0N34{^Jk>2oX7Dj}MovQuGtHA@AnSV|B%+JD?= z#MbeEX@R-}xrmHP3nV8;`56HC|U4%a}A-5!nh2T!jK#cKof2$qNp@!-k?zTLcuXXdb6Psc^Cwb z8TS4wmb@iUEr@O;PG@rYI+XzIfiQ(b2o#3>VZqbx4?=kZ?^|jRWv4F<7jltz#SP-7 zPv8#c%6nY(6k#3OFy0iWk!b=UAo{y;Pst?#sownl^Nkr(m1nRVGaQjJPD90#IAV|) z=zvZnJB4Htpp=&Z{as1#iV`Eg5{cc;i^gVmaYC`*ZN>v_s?v=h#7G(7DYO9ohFjYDfGVMOxmeJCYtnemtc^3@*oNroFSiAEc7 zt@1MF6I0ybwn1Xh9Gr?wq)|DLVC=X02+MAb*Vu-IOJNm2oxBKaK#^bUWT&+jz;k`p$HMR z2}Rou0+(`QmJkoi{k>=X7zjmYp7wRx*n4#5|pepDGaw zsuS29#0CI4Ip3BtT0JmtOzsy(n_?Il4F=S=3#u*2hE8cEp(s6mYeb;qoCaWYO5y2|2a@MA+0AXSofoMAbgU4AwjKC>|?b@?2 zr48)Be2}Jw1`r@Tp7@+dz0e^%(WyJ>qW%I}dWb&gyr4y5?cGm)`Y|D~GEi*kiOCIl zBT!P!<-xtsglYgv5K!BOXo5gC&YU=4GqLMCPU8_5AYC`@c^#1-NoH0}n|DRBNGO1% zG8{rofE)l~N*bdKGIIw5>LEQHPo_U>`mp%p@?M`*R#_ zJr`1;5!5I=m@De(Z+{xeH=~aJA1P1@MlDZUyTr7~)j( zn+aPd>8xyhxLlE!XU$@cV+x#L7%)ebl*U>NgGI}>8^roB9EtWo|Bbs&=MS-vG63Qp zq+m54%`^oCIc495Y~wMq1MY+#m^=IM5blZGPhE-w%JLB9WA|{n5*J1!OR7kCg%iB? z%TrisJ$eHuN|qGev{WsjfnTgqAp{u7MiUnI6$_UP7P95_L@5(rIbrezz)k*6AtR#p zAt(n?0n5irlCKa=fLfq)n!lrFA?8hIpmrv35rGrpfsLvo6(A50IzUH@1H@>=Ffi^t zn6PR*@akPk6zZZijBt z&Vmu&%f#f=-fUoAmQIVbXVj>wc_O`ke;-vFvGLX>p`^^m7MQTi!)&}oz9v71g7pEf z1;~g75s@Mc6ln8UBygBLYKd~r#Y3qGa$qBaaZ~IV?9A0!c+cn$+xsDmSk1>wCO;Ad zt!~7Kf^9pYjH6o^!HQBLR+|%GD$yC?js-;o?y$o;vsK-JnT`}iCoItD+j1oSI@w0i ztN@pXH@JoS>=xG1b%}I~ixf!2?JQIbJCf{{ox%mA2C9o4oHL^~-jXIrBXEe@G%`~e zan)j2(&2%O&aNN|!e|B7$Hk z0f2&P`9d7L=y#Up@;$peae|HWurLX`rq;)`tFd1Y(0nXtX(6_gfhdwmL+djgQ3iiq zFSO?m(P=iMUh}?>_JS0t@nMuf*M=XB)W;*ZHa>e8h+qK0Isf%&)PFX~MU5u`o}U)H z6VRXQYkWLJ(HSJ3x&YClRZg>c{`&`V1%w$Adp7P5j z1zA_t!$1r)H{=QKjY=t$nvk~|=7MqOKnl^LlAOmt5%@9Z|5v~#aeP3|6qF$V*~|l@ zfymp(MXD7`SlOZzlT#b8Q0byW_j*^m+bYRcZSfQOewn+2jI5UrTTiQ;bj?Or-SCK+ z+3bYl^Bf4?d?+M`YM+RM;4HH`GdmIgz2n8bI4T*&%bzoY9sri215FxIuJV` zRFPEN1$>=-*dXHob{KIt2TlmRv4&5iEYvjx%4(%1liX5bEt6q2JlMoYdUvL4VLVMy z%u0NN(pv?K(b!3CdNSr5QnOi1hHKw(0N7R+2t)#mYD__i6T~!KqG;gu1{or1iZRAR z$3o_$>yv!qNzsCu24)*`{Q1TPl(LT-PiHoBydsAtzBgRyLlI}m^Va;| zr11D(3A4f+X5Y)@vp7v@DxH|p!JOoHze`*1xh#g=Hk4)GGC@e%&Y^25_+NHE9sbU{ z>sPl6cy4*mq3`fV2^x+Q5a*OdjOtr!L$jiV@E{5*g*2}xEKZ;@)dAKYHowU_p~EJ zLurgi?qMmxu!_bO9eLJ9&Yj%0_HV52duA##9BL|x1-l$Onh@~!LN?B3z>)n9W4}*r z;OjYo!lP+m{nLHgGl|79m&g#92!cml&e6u3RfK09Qc4`nP=+XXbC}K_P1Z(In+3BL zxps;tbu!o~-XfS7qNHwV>{rc!gVK=4Qr$-H*4;*m3MB7%$oOX{W;Uvz5)kqr| z%BThQe+g}lm(gsdZiR+>pn>12His^TVIan0AqQygj<;veE*&!v5iuOLcf8w%>&J@R zX*-h%3!E8Cw#~frITR*a0@4ZK#juxcUx9IF1!0G*%b1Yr$uVNkM80|E3-IBIGXZ|w zV%on&Vl3IcN}J}Zh__DN32Z~_n{$b(Zk=7~V32c-Vgs`ykbRVh5UrRR#Sjg2GaOl> zHzP9ycC@{U!C}~Z^4Ui-(#?z3tqmtPE?JG-PuAw_!9zlaf+gr+iC9Q`Xx+EVmqnK< zXEzunw(G|m!N(&?7|?@TxpXlVyfa-usSd`RE|8j;q`|zksze*k$`jxo!tl`fLm_nK z^o1@Y$U@!S2K#fxsq;g|gi^X3-4S}cmJ;Iwvq)}+Nt+t!t4iQOqf!vbn96n~G3OC= zoy?UjmA^-O^kVT@?cPgQM{VnKo&|o~?US8F?T%p8pFKxo6IXM-<|}LizWwmhGea1WA zh9g|As5%!IEq3JvCdvb;x*_0{gDyJ@NF9oHtQ3Nm|hL1NPMw;Ok@syV(Vh^*fQ?RunTI9y#>_LcF;C17XUeDL%dRbBoW)NUsm-~$PaD;-*K+(Jv}wr0on(3D@q@XO zVO%-c#w;mUW)e*U9QQ~NH#Z*%*tb?ZaWrJr+rF{UyIHFbC05Qc)tVaODs3(cz6B#5^7#hJo7zgaDrF7mI1G}Y88 z%?M~VK%L4hd66R>3p^HJiE+%EmfC5BXBv^ZNWDJqFj@IeyvOj^>NNE!6}S%5Xc#yH zVVOg6rq9s5?uZGMJ$a{=bG;OPTu=dFqxfmlU;wjYg%8T8A@zC{- zU^nsStCSZyTZ0`4MZM_~Qid?>K&j3G{VDRk5bKWHU z;fGXi?AFr47$jTiMjJ&CxZWn$a!IdKXu>9gMp$U$deGUdn>!o zqzmt1E(oEET7!Lf*0<)?(Iew*gCH^oAp}-m7-t+L0}iaTY}QB1kDQo zTrnyb6oHChO&$&~T48#@-dE)vmuf0Nk|B@r5l3xNEQlW2R8tr<1$$` z+;i&D(!DRhx4rm?8+t$okpSlw%Jx7{2^0gPKUD}%-S$DA`&TWsW5|FW078v|>_L7O z@Bv}~4Tx&5cu36b+_d-Q%$qDTK1v3=^5|{ma}2*F|m0?eJ#rRMpI zcl{WrJUl)6;&9#(1Q#Y>j1^`!mp9)ZH^a6h(#p>*%LAQlTqB|Lt>+Zvx!GN^IJ+nl zS>8y|1mqp2slzy##fBg(G7+?8A>gRf3?TpzgJi&UMg=dIhGQ%VXHN{XgmI8!VO}E% z6VDWFD+ScG<-t3;7>e?Tu5RwoZ=%o%9e~X(IM~dywC)vOC*+ zL%yT6by0RP$g81s)`+) z(0^nafF{_LHe?*#A)zXvA-jO#hdN{kze-3_)Au&Me>cgTbto4(5TqI@gqEci0RkjB z0v^13O-(egP~w+i6M%i~Cxj<~A=e(Mei9-vf*yebaMFjT*BvYz4&9BLbYz`S8=a|+ z8V9NyVs&NO@b+v>y5N|u9S0)81%V>SJstTXYd*-k^e#Ac{TPj4mkb|Ap5mCmOM&AT zqc_OGCkCwq=PinX&OJ$h57Qne0DVFFU_EXSWN{!T!3v*jtDlz<56E1QaEN;lXEV{f zkSObihpOdO9Hu-M;n2|Gm@Y(QW5H?Fj#C-pU~8rciAHtW=mhGLX;&22126|c+(0`e zF!*#nJXl7EJ9EqWeD?)ReAEvZ08{{|AYB|JSR>6;qd@Ml6k2Jc?!+xT!c*PtlJM4n zrZO9)5emt@#xy;`urncoT%J5Y(>UBoUP0RDk+K|D-FDj zkFayg@2_yi{H7gk#)k{1|h_&7ALzBO`oXFCmDr$7@^IWAL;x-bLM=dT;Y-C$4eD$zdtrRC1+%CB6dVgd`~=*mLMs@8iRl;3|%@>#|xtNXTg1Zju|Squ0?= z#Op2Bk7Vn+k5H%hMygs>F@a98SfD-=GnFA*sZ&apa)X=?>`4%j3}86wr5@p;6Xdb$ zq+0IW`5xyIsdi3g9V?wNV0c=?V44_E1lU!=aWtUHVUQ$m^KeBn zG_5Y|c6J}b9a{^5qOlcL%wzZV%E_?sQ}4a1Ra2^^!}cLIu3cHo^uzDgwp^vBX2tpt zfwn_l+SU1@>zJ*|I-`ZY$kW8Y`;hst&v7|rm}@9wQ!xDV#h1y$m#r7*ZN=_G8`*O_ zj1)a5;TLPwctu5)o;wrBnAKYGiClow3=Ob0w|A*oA6_w)Bd=|Qbaz}PI>Em9;?4AS zSA=zPU>{^d38FgcNv0j^sl?i7+GOpTOeL3X1)P%4p_m<;HF8G^0}B)cZjmq_km;WB z3L#11Ec${LR?L81Bk%X%ey9c_Oq7Jmr{x;W|Dk1BZI}j)v!+2;Z z9)^!MrbOB#rGUa6lA~xa4Z19W-$X#GQ2O9~;(a@0JEP5WA`7D`M8LfOeR6@K6=Wr0 zAUjRH#;=9VFglX4U58(Le2`CLhAm$YEog$bU=yDnS}a+b{FQ!3jCPe#@)q}xP5m0_ zZY_3|TjBg5txF3cfm^#ahcvUcamH~`7 z4Qi-E%MwE|wcLOfeSDum)G&N7tsNB^yiORQPnICNYe70WO+rZ6&Wg@Ob@CGtLZ_G1 zW3r>vcF3I0xdXnuB8QM;_(lA7=MP@$y{xh&B}U5jo4a$W@(^#fT7?VM>Ir$x9Oq# zrH&Y6lrZ`;SmqjyI?!K5->p{-Afg5mT>Aq8VkfO|gd7J@3}-XmmRcR5kX`po;$sN# z;2!aQcy0E2D5O$qU!H#6>iU*73ehghBzvEm8_z$9|Y_H+#c69VlFf!GTeO*@QN@}x;C_1-fG=0VPX@6P|#?qaBE3& ztKUVYL%k-Jeo@j8j95XIP7!pRI}2y!qW$j2)jE#{2CjbiFG%MB*n#-yM^iYc5mc*sE9ZaEGOjmjGVm=wB~ zDPC2TCR}1xF}blmJTf-u6z@Mro5XA`QzmA!Xh>&s7Eg;N$pE0OM3Ia`o`w`qnr%iw zljGmUq5-i4HqBp7t|ywEQe+{=o0_Y=>s(at21q+7F~Omx1KyG7_jsD&m?Hqf)E4`| zv$L3eKvF@Ed;4aC(3=AzYY@0sa+%3Gn(?7`l4U$IyTJ|cOvsN^MW`@|_UYX}xkE#lh)|6@V@L8ypH=22 z7~9qRE1=ssPN4{(4#%Hq4=9hU=exhLC@JdZa|U>nM68HB1IMta^*x8@!k>`9@*1ss z^FMYJ$U`MChnIE-mZjS~sqjLcT;ag7oFM2BLPcanUC}E{FI83?QuVB~U{t$$pI45fEfreBEk|Y3D9-l#alFcoqGNybr_QPNRDJL2TShLgS!LqOmyq8)^=K~#Ox!icBi z3`~+jI;2g6XgSF9myR(`AVMSqBpx-1NR<;n=6NUYyEQsE#2Uba3ZMe15UC0#k>G&H zy13b_EHot222HAidcah*LbLCDIZP@)KmCzsf@n_(yZg^9D9psfDMhWsD3Vbf9NPxj zK_p9n`<#WMAYalaS%KR?+KG(0Wt>dlA-HTz&5BKcz<`u6HX@iTa}Wa3mAqrV1#pG} z1Ym51o1ko%NID~N9w?eT$d5kg(>4VD?>89dpqM#CLU>4FDA1o6nloNJj;JUPrX4he z&y~kKz|pFZwsT1+Ndw49=F4)P;`HD-p9P*qp-|pF0Bc~KFH*=RT(P(#g1ca$KHUNZ z`S@|TCEUOXaZD}emT$2!KIAk7?C5sANdemc>p>QPpBP328=QgjYSYtygVuEI1v2iN z0b!{oj{kGFvj^{oy`!|u1SrpyF8B%Jp5NV#_h3B`9mP}l+Ha&uRIO zfeZFig_9zqhDz;FNAh?fM2L|FX;F^>iD-0Dq6esvF|;*u-WrTCgmx)YfWfBZASS@# z2ANR^5FQYWHx3*@jZ-c{?=(BMAxtFhAmf7#5;VZlWM(u`l!Q^F>5!;`Ax$Eyp6L;w zZlr3fV|yTs1l}7YqH`Fi&Qdrf#s((-T{%1=7JLVtdxF#AprI*gXb6%dB2)?~X^C1+xG|BTDOP|Y z0Hma5qy(j*p=kmlr~ru?sz#7X0Ky0#6Ot!0+nHW`cuYuwBq@pk4*3paig&>JROipu zX*6n{NS)*?LIjeiQlUV!P)XsLOp%n#W)n0qqcN?QRy%?`+4a}4%r$LdS(jdJxs$ZIO;-;hR{yXdrbA7>8{l{e0l-b4M#^gup34& zU_c~NF*OoB^WH@iOob6LB$Ck4RD{$OH8250!9htRBG`h3s1C?m^j-GqY0p*b}n*1abP zLSVdFE`k>&UP7ay^G_g#A{Ap;@pjKun*r;#7Pn zu|#pOn;L#v3@K?dTIW%y2bxroTo@dqkz|~Tn1VPmB9kS;Fsd3DCQyMQQdwY$V6o++ zka4Ww#-MhSiWm-5M+ms+(h`}RYua(MikF{fFr-b7jy?=TB-r9YcAWoe38lKajbrE4 z-Y;VBzy-mTMk6_#z~WSpFUX?{HW}3zRAPS^n&|n3y)W!u&sOQm>8CbFY2ahJu0tL# zdB`;nq&WAGkb|r?djK8|SjoDjD1ek6%rY|*BqWfe2__&Je6Lt{5>Q9g9=@pf3cf7a z^}Mm+f{CJvq6#RciVCP8iE55%uiMPij8JGlrKqr+U0E6@I;k2MqcSIu3v{t#GcFXb z3@&48To|1#`)eS06Ka~oB2UVF()hjME8Y`8Oh}~?u0__E&YK|38kBjbUB-&8Yd@m# zgJ}Xe(4Jg&4Wit@{5t~&ITUxFNysx%=92g%E3z{etmKcX5P0U}8B_4y!) z=uQuj_7C~7#q%O0XV-0AT&lVz|D65V9<Zd#a4qP{e!`T%1i~O0A z5JRv%>E5b4z^I1+2B;(lMiC)ox;2InnJ#6DhGC15iAY%)3evM0U@~1mI7&pRK#T<^ zD5Agv&W4plezbtn@|74MQ~R0@MM2;{P%S!K&c}gA)cMFG~yPciD*;LI>`9Q7J+obERRw?;r6`xi)X-?#46K;myOqIQe9wRPOT-|BC)+%5(7YC zk_zni2tnYg6<5N{tB|XUlih6IxFN_qU*R33ndUQ!-x~a#_`IHuyOM0>jDwW>R`VlG zL$i2D;fFC0nm5@F)iE5$Tpu{!QIlV2j^le(Tt@X?33SB-M*ev^{ z8c;Y~mfI9e#iZEmZL`b2RI`SNl_G4AGRm; zgkX*QsJVVdbZkRCon5_1nJ2(88e;oe$M!SdX@|(kkGZ5)Kd82=B5-DVOe@F)O!XV6 z;h4%MFO7*Fpj>HgL#paSjB-UiJtdGio4Nijm3)et4+-N)29Wk^ewYuj z_9RE$JQ@L_7HENjf|8b!nMtW7CZZsvC`g2qA!v!J2`H!lrKpghN?J%Mq>&-1rD&k4 zX=wt0p-KR%82bGYk{!@JF#{k>Qjm~Wz@eZXp9kFmuu!0gDnAPQ4P)@+W&oBXW9aBT zUZU0mS-@O?J}lA^DG=d^8{kxspo@@+(hO#Siles-5~gXAfrMft7>Hn%BX|x}5`hR& z6iY!0K)_H^7GUP^G7C|F1tV1i;1(r=FmSIyK56Sy#Bt~0Bwqz?ENTrNM?isNAP(Cg1+2;ctvDLiFZUF$_rpayxU+?N)Wng7FE@@X_43mRFLXBPJdPr2GEKp zmc*8jMwOr_1@yn8!G9b32MD5j1C-KF4{V+AW?_?uh*(LX&kn)Sjg*cKHeVLD-LNqsq>@ZnRrahT|N!XW8H?syOEBLVH6hW?`12sibp#U<#4}fg% z^$V^=0TI&&1PmsHGD>n*gywQJg(W?2S#St@xtxJC7XZRwESO-p!Xg5Mc`#hn!{@_g z=YrAGSUJ>S?smltLq#FX^6Ou(tU9E`#)s?D>5ev^SUFk?2^eYg3mgqV>+5fcEm->u zQR$!6lCcbI2;aehIJ}Di8b||o9<4P1*$WMHsPR&|0GDC-5fZK5#kBwbsw`y^bv16G5 zwm9sKjIlC0^{opSY1ani)2XKV+Ep^9Lde_;nnI=_*~#6)WmCqhm{c0qWL~5a^uydq zXN)rd|9WO$5r239r0SAk5KcIh0~jH7*DHNcZ{{(*_Lj&?vL(c9MO7=&w*^{&Ee8SG zSC*{CL(ZPwjf#tWvA#H4h6w{YwHz#ghD_BT25(~f$GPI z)+}c8ph9LJe*qr+1A|y;O&qQkQ~KaL71uP?1dzmWHyM?Ydc`w{bq8=D!mgH&eiK4q z*PUxCs1@1@jIa~vjVw#$ngHSvL8xIA;wjwJG3li&EhS_VVC}LyQ?zAg1Yo{^mxBPM zNrVjJEg;2*LgJ;SU(GDCQhmzV?~YHx)v zcV(!Af@re3$lVWRs5j9KF)^@-!)~&L@?9GH8W!Wd0NxfS`Q^95lA^yXh)@aL0owwi zP$W`G=z{`Uhy&4?R1GZ^MK2>U)CDI;q{~uQL&9OjFbLg@3dm}kc=m=Fp^AoJ_rqgn zL4}j^#kY54E3-*K+5*zaAi!cu!LFbZkbt3*HV`Ru z+aw^!CgkJ(+k6!`7t-b&r?n0D2z(2eYK`3Nl4v-$`QIP-$1X2wC z%{1yfba*DGeQ(?hq7XyI_FPi~F?Ki^Vi)>D+R)&H#|`ll1BD$izC|42-ysv!K%QEt zrE)Sxy-CR$DiQOlnS>skG5Ts086r@7bf|-7GBm=G!Y0@`2sk-e4=RHvS%sMdW3bK$ zG75HKNC9n$O@P5ajUt$cfoU=MgrFi9k$@NhvJ-Mpyy1dKloJsmKr%=N8>CY_QWXs{ zJ_n~4Unk2AN;_mD1J?X85ch2I3rDIX4uPhPzK-Ll)K`09oFH6#;=?+5tom$J~}CsddpfUrXK+sM#w$)E&_Gk+7I*Kueu37Di=t}op++@9Lx-y zlL{s!T2^Xu)r5`u*isJ40kmNi0z@8>B>}{UZ{ki;%tQfC1QZo(}C~Id(WyxtkojpZe3kKj^k$8H+`3FJ#&{? zEYR~M(Ae}L*di=wPQ+`3gciX9B4kT=6C7>jT~NJFxyHDQFu@?ny36VxL_L1A!&=M? zw7N(G5gXl_ z$oP|lE=$I^7bD5p%uZk^n)G!h^rv(HsyZ2ew@Gxg)njzTFV+H0FcWAh`GXg)Jw*eS zaP&PM)~eKGa?^;K0>RaI4r-{6h> z#Xd$g-+nU-8^1LMGDUjFEOqlMyO=m~y}Q_B&QZWpg7ZlqQmZO(ye5Fru^=}zp>1bQ zgBC-8VLG2c7l{gT1?B*rkbnf}PTG1>GYTF~m?(XW#zcJ!;vBWioD1wFKFl;)g1~?) zGw?R`2tW?7{x3kNn?+41WO6uqypah68_)rvM*9CfiePXb2~eBNY8r_QxF?o;AaBBk ziZ5=zlS9x%uwku9lmh9a-hX<1chrxI-YRu5%IS%f@z&|Wh zv`z*cu;}vx@oX*TRR?ZGcYhDp4Tyx5c(q?6CgUnA$S;p=ZWC!?cB`;RaS61 zythlYiYMVJt^^j2kgYMM@PK!v+|(x&PzbUspKKrK!GO4A_JWs9s(nj-@Fk$WzV!u% zLUY;9d;Ye;{D2 zLfrgmXd)UFGl~hh!0>UH8bhctBRWuMM+@c?!V=9NUVBvTv0g6Gdm>f&q#Tfw*X-wn zxoci;Bi{DQ#0eBfnWGUC1`2$#z_6x-Vx5dev)BtoRh}Mz5HgOC(qKyrAreE#HAIY0 z(YE}zgQ%F*Wpt7_$5N8Uu=?2mOWG0$UBNDvT(bd(n zK{^8%*-ZEt6%sLQz`|f9B3Xikl0}j#ipH#hBRlN}meA}irQ$Vr+z@lWGH4%Bw@Ch-wrqg^!CiAVIwga zLv+L#vXrWBOm8zKGFC)B%mX7LSTtm6q&XsmjFg8F8H)-K;nJ|ulESl2#SsP*U{j1^ zvNv;{HD>rUWCR)(Sz(0UGYNsZomZAfFm7%Q$Y_n&RN9V|utbVT!H~78gISKYnsO!@ z;IM;sqh~%eBtk?wOpKgL<&;uUQ3?#qnD-u;r;TW19269B7(A-kB5j|rNXiRdMOsT^ zLW2>rV_X;)q{!DdB~1JHr>+eHZLy6b>X9*y$~6tZ!x^J%s((7_b3%GN2YwG7nDPYi z!=EbvcNCOi+lEO24KPgHN+SRw;-a+Krb{C?A)Esd*Ab*oPice;f@u{Ap4WmDR3zw= zVq=hgIxaf#s+>Z|P&`B;rq?@&m#?5WFEHBDl2Cj-3>8j1J2@{&DxQ;Nhav!cNI;KR zVbv(RP0>fk#ty+T=^RpqNZFI^oMYW_7A#<=P-ryhCs-I@CTmu*M?xgx;xDp-K@}=U zSwRef4YiP#w1()gD+UD)#MN0`op z!h2vF7h-!$B_@xHw&j!1mazMEYd4(SNs5~g)`~V5N}!{ONsgpnOi>f87_lC|&SHY; zL=un$;qgZD^?>0?Bj z&B23#u*5h;`JgM7<%}>sDGt=o9YAPM;z0(D0l2{WL)<`tN;YZS35Q&Gqu=j7UGRd`OP^J@|4ZVTq`6RAkZ|^)Gs5GC}c!OEfh%e~I zqBmQmb2EhKj>cd>J^uzr&>?}qdf~OUhFsfrYX~B7zRm5OtwZXL=`bI>Tu2@E3ep90;k7_Y;{J>oRULpO&pHRsF zgc7MP@kbD-rUD_Ezp=^8<%3l5IvPWZ-VHJ7WUjc}Nxx* zn7>tzQ%%APY@LMU#{iH+cc7FjCuIrxY}Lcdx=gPH_lRw0o{hmtsSOjx+;;(#$&s>g zkkp#iJqvQYq~R@pen$iiR%GR25`H>s)3MVuHO`G=azrsk(I*C%3Q54wVYGZ5;9DTs zHx8sPJjYbbd1OwU=kT`_(wfN;v>>?#CeZ%t+bP~=U_DA4yf;?!BaYxI1c8>#rgzopVU$FON3a@FAb*TWG612O36LR$ z5!DE^BRq%TXT=jI?24R*8iw@Yogkdh)*fOacEmv_Jw&M=0e=KH91y|nK`9eb9PmIM zdMk(&3qYaXh5xz-Gr->vGftD&>y&H><3bM7L(gHZ;$ym;1kt@q*3l6(R_7uKf=VJG zAhiUb2r*g>z-|z}@H+HRnZ70q-2z5eocNbn6<1c1_2dD$brHx&BLwLM%y{3N7UJ^W zb43D0BvwH{ghZCo1HE5VP;o9$G-VETLu5j72#CD(CP9)Evt)X62e>%W9}xjd13?TD zAuU3LOG*(z6(k`f0MM!=NkGt1^c#|>LY4^vh?F2JrWi6oM1)mSB0(b(^K(08Iznou z3YwxLVPg;^ixQARU`GOd9}$XCNu>jk*NKvLi&FHGgdeZ&m>XFn{*GEigaPCpPeTpX zk2xxba%5nXABMm*6(dT}-1FVOB7wYsi>xAm9wiQ3Jr;zt6H&Bt0P{ialSK$*FI$L; zZ-}~(*u^u1SctYdd;g+NmYE4Rn~m&J8$>+|^W0N{mR^jc_pZm*ovZ>fN=o+5|P9%PQLZD8O0oj3cC9@`P?kw7P)Es#xdIe1ab7 zkuOkqo4c-_*-6#OyHCiC9*0X7$gY)1WEzqNc~y<)%m%qxP?%;QL@}h zX*$Od)F&E@I6MxZDyX7@i6n1??BFqy1%uB1p1RM<9vv1|Wtu(DzpXYp^vyYK&#%aB zN?(#JrAo#9MD}v`!=2R;9lZ0By@(UQfOVbRr3FDMtg!rA0*t64P2NhAQz(%L5<%3! zfIvtlV&CPK0ES3;;nx5I;3P?eA_Gtkv4hTjXNsqY!wVP#)71}^;xcf8f|8aI?(#hj zue_h0 zfDgCL-q+o1f``GtgX%^k5YxNYtY^IG?BCIKb&O)}SrXWS5(6X`ZfMuk8;070C3yG*VsJ`?&Dq zZ8GE+v4(_U7@;0wR6zzrEU4K;$`VK4Em}{ayc%rz(z;EYy0fdobUZj&TB*iW7J8ZAL1oFa!s5#$G~_6oTG!>@*dm8% z66SV0(7_t%_%jgfJdtjaRUC+5vAM;%QvpesLKxWK>h=whxp_AByA)-iR-??9bc>iA zRASP>U?{|)5-wm^R-p6gK;Vyj0m>g3YCRFa9B^<4CbxO~EAB;DLY{FWvcM*lW@5IZ+~X8V#+cw0n-+N9>nXNUhmP z?niF=h4h)7M^K8b@auc&kYxeWUml-XX6~k!Q9Ko11g4VkUb)$DDw67~K=MfL7i@$` zM|fj|9MloXJMKsXg%pXX9Rpdh*!ooarJ!Qh?_fXF*@K*3X)bqT>VRv7_<| zN+J)8caN~N54b#`%(Z+c*HlS30f&VB6^DQaH69L|+F zDI#`aTEZB`=uOd$AZY)P}R@18j2OhinB4G|3s*5*kMLL8K; zf}*oBf~g{toq?FstTI$qS4fLvLy|PwYK)1G7$}w-(&!?RAqlM$k(f9}<75mmsELp$ zX*t?};@fD9UNJJ(Vl64|xa$#w7{gK`pkUZZ6oj`p%_$~~4NB{9*x@sof*FAXU_%H7iG7+pPrXey6kc2GhW|yA^ z<=)%^<)F!n2gE`;v1y46+VnfUQ$f((CXO!vv0>8G$}|{p5)#u25h3PACJhLrU8|l! zkzq1|c>Q#x&C;S|KsI8KlO)t+SYT-tI8qXzNg>og#3+~={FAaHZ`whmUm*F1U`d%V z0Em=iSjbl5An~EJlXRuzD$I>KkR&9GQ3*j!nlTI=A%dtC>X!707uL@78^(0pMSzi9 zLvrPy13{0p?E6fUMFW5zcXkk>hP#-BIRrsY#RthC!3l%0Q2bDUgfY{-AP#uFJ$*{@ z2$@RD0!pB15P(sO5ucmorr5BH=922crw-n zUd%=rl0{WiRCH}L;|mo{fnf?=GPPMBERH)AHDK8jAs|7TAq3Wp0<|3m*xfOSX*FJ! zQ&*Zc07=Z)oWoilf{{{G#ci?>|n`HG#-cAQ3OO$qSNr8 zhp>TIfK24W*#P>B+#UpWR7vonV9-2tP=xXix3IU+BssHFl+=W%(m}G~K;jS!Sy+0y zkn8u#FU828aQG_BV0yc0#N!d~kSy_bq2DeYUGQF_0u>$cQT%oq6+5+3wLR~Y7Xrg2 zer(X)2}l$*LAeCUOnQEVNWTw|I}QNlqZ_Q3p$3p>K;V3}4K$TSP|m~-0JI~a^{@2J znR8=N^B5hERT+ZVKZl?{e4fZ6X+wNAr;!H3){Ng%&)GXH9pRsQA4QwL1zI|Agdv;& z^hx$D46vsytAvT&hEzU-0F{Du2Ih_anPc#%L(1MET|q9#rp_}q1lmdQ@=hhHFt?}bj+c3hpS`7ByJ8RE zQ{wkH+8NhWAI_aOZsGYin9p6x?YPD)t~HM?INtjYe)za{b@DWxuC_vHs0xUJD1f5B zb1|x#p=oBT1Q3)=Yza^+VVGG&qRB*B0wN#4$Qy@3N$=x6Pus*g;jz;Y5y8P6vy}|a zo36!#kl9*|$VB5BUKGOUU07}@;XN{ekogE}@{(Ayu{mZtk@M8G_8z!QdSE2(c5zT$ zk$ELEbb9P|>*e6Kz{fy2e9^Mrx30{&tGXrD^)yI8<7A_qVQ-q(Tx;+7TE=#0>1v{6 zI!?;8IX)ITrf*#rF@HHxEetd!IxMC(Nb6%{N{@swgw>ZjlNajDIkMlX+sNw0LLDzc zZp^#87UY)T6K~R>UR2Jq zE%VJtB#V!n%y8gWrG{}c7B$#;X$$HOygO#*AIflcP0<7(Y?yYqx>PQa(!>j)ebm8n zvg)lkhRZNRuvrhP;<;88wxdydSY$0;HED=NCR9W-ZW8R0WfV2uE)`e4P8e z+tD00sNE8`wqcNlm?AHwoJ|{D-fY@?k3DWUD=DvH}|t!+UU?G^QLFr%i#ws-T-ZR757}7~!elhC>Gq!Jd2(}SheW#;oZ?!cN+4ji`#!4U zrj2=C(6`QG8GH9T&nqnu&)STwi#5`1l0+}Y z@@g{>GE~J(uw-((9*8w~Gbtd(F6z$7K~2#eGs78XTEj{gfhb`vwsXx`H|qbHlIr2% z?#|<3>w(;Tz6C*z9juJd>nj*Y3XqOv;U~QSbP%X22{Il&ZrVGa)R#;2XfM|F&D9hn zU41*=dQMlJo}b^|VKXWt8)F$33*=qNcsiH42P>y5nD3t~)dbjblqp3cSrlkEQojRy zJ&R0Qj~Q7=l0q=ep&SejSPi5|q9a6+M;u|lR?RM_WAs^pgNOr_#H5+s-I@Q7UnJjrFh9)~_Jxa~JD)>@0v9n6{hUM~bB33sWd zHl850YVjixjp6c~x}b?r%?J|8tXc=5-N8f@)_z3Doe*&D7@Ir6B0Y*53lJ?${!GuS z4&V*8(^_c7gvf5YJ4i_X5Jm111Y_xy2GM^06rMvg(M;-2u;f09Hc1H^<4 zMs5dQMl;$Zah(*9y2o_Zv}17SfkL7NlflG9iKh-QPqHn71@%A^sM*uYxl4#O0c3T8ozVha zQ~=kE(vNRAe373ba4nd3cZZ_XgJOw1?BwhrV?Mbdk%-J`QV9g`Q=Blw4%e zIGNz4=c-LN-f!4@br%UfW;jUn?dZ9$V1dzuZ7z4nXhn_(?+QEc{yI&9HlN=Tyl6Yv zNDz05V+(vK-FI~;B#dhMoQm;ov-#Ih5nN z{|QAKYrUVV3v)^@R;iXr{j<$=HlfjUGX7=7>L?H-1WxwLh(IGFBnSZ@eVzsUNWd}r zdTK(B+>!0}ZNyI$2DsMgt1UW<8LHn4%PKqcPFE2(d6h}!^~5W(%0pSL5Vn2mw(>}( zh+T-$RK?6$k?Mgl7+;tU(rFK-6FY1TNMM^@9%Oxj8-=d5Ba>3`*|*_>&LA zg}_@ho_R_FONJsmXiOGF02A7_w3oopY4MUAJUAQ?@tBH=_cW^6DOD!$(968n^NE?0 zfndXLi-j{l#M1~kMRYt_yP*>0#l4WNqgIs-=o>~f(BoY6C{c5Drn8Bg4V+Bm*iyFd z1&&mKV@OSj94r?a60(M*AeD}Rob()kWI|I*28(327Jx_*IGhYh(h8;&Nzb@0;7JWQ zC32zpE?jnwqv^#mj;1<^x69Wi)0o0~p0v$4DYF*?EZL~sF)3mRs2q<37RPS5H6>HT zL+^w+#CM1WII9oJUXto70=ul}xgZ}gMTriaj3JFCaCW542bya~by7r< zz-Oq&EFlKriw|uCE!1+PpRQ9PY=;6a(gDnIfnN^FP66B$C$ZkrVH1kC9#CN|T>9

8hvh&2fq0D17I*+&-1*)fSyk|8H*uX27LA7;}UJ5PXe9;{V+#N-Jo#Gpuc5C$sZ zxH34Y;D)=%J+d0Jc^ri#?GugdNARObB0QU}LhwnSRh{}N>NDu&0_|u%FkraTY#fbA zG1A95ls$*z`F+HD1M#0a8OWjM?wKBcrq=O4L5>$LE#U{gN*!7Y<0-=C5z{jAR$JVm z@pr$|mZj}6o0IxgmbaPrV+JPt>x-=N*<%}QH5d?u878=ZnZ*MYHWZBrhk?$BZY%h` zGYDqeBQeukS0V#;I*PJ9u!c-TGAykE6q^(Za5O6?j7<@>lM=xjPb)*Gd?!qqrD@%+ zHad08V}d+Zg#$oTm&hwJk)L=qzH-0^=?wA?u3|1}b_X z!*wpU6J$Yn@H2y4E~$(Q91xt5@?l}g&J&{WP|uVQ(uGR5eNg!(*%=oS)?uYhwHP%l zr9+&=3NE1N?pYCBt%`gW>DLVg)>QWu8@|c3f%y>Tm9)8h0^cxid%sy29_;hQhrP8~*j~+; zY8k|OgkWxJ^5+Pd6bj1Pg**?)RNBvc?)Gam)2lg{en=^A4oFKatgnU!wUaq*BP6q{ zUMq(rmmzFS#i?p0pHxKx8q0`K&Ne068!?`7 zxXqlbwgyg^kue)OwD8QXyV2^JTDUxVWJWVih0yhWw%HA3VVx{zJXA&ETy{t|Ly(>@ z@fBpm6iai987AP3uwYKJoJ^T4>|`&hPQg6fHIZhJS)s!@gNU`-P=Q^@FNRc_Mpi+H z4vb*S8Q{eNv*34Ip!6Wk(}f`*N^}li0O5%o5u)&i9ogGCa$-l|H<)qPD`IC?D+!05 zj}~ohXCARz4rGz0PI$qx>lnHx115$qByGDeb>j>m0;_`~kTB4reqJ}TzP6_$jcCK9 zabo5NOkg30Nn~d+7MHWuV`yg*74S{5sLQ1H;_?`*%DI@%Vjf})Je1eHufniH-e(0+ z%)(4DXpWq7t#1Q_)}(GO;wBaxKr=QI0!?#W-BFuuo4XR(0)U1M0vKkwxVs!zsD`Q3pj~eY z2y1}Ofho-f4xrL!3SAJz#uhoVoQjwvm<-HnK-mCu3Ug@004Bg1CQ5=%AYg;AmAFw% zT;r$=OoHaA71j_(;WRUuZoBPfH^d8^QyXp#hd1Vd*zHmQ?2#iE_=04V7nZy;JYDye zc@fCGdTc%~MkR4Gf6 z$A)H-5Rwp_ccpNKW39u$V&7kzC#Q#(+%;82q4XVV{6wlJYwDL3wkD7~_&%Z#C`1kc zIY^7{mf;r!k4#>$sM+V-Ar4$9fslk}(1+I`wxIw~EuuIfn%LzSnT}zG=IL6uBXGb> z1k>6VX{E6pP_eBd4IfRM=3(sAW<3!&wvbtdh7o|%AAN$mX93I>J|5Ume0&WZLk=2a zTnI;uJmHhx1PFzV0ldf=>T6w|lnW(fGdwr9?jyj0ZxlRaT*JNTQNUv`Pz=dTrbyKFjle`4=5;0#%ju4N=LVLa=2$abT zxc_7^I{=V10Y~5<&sGR&SPZ=#Sx;ZffyslJtlYGlkE#>jcS0S+a@T1AqE#|RArF|t z0r^Gll{f(IkKv3jVISWM0wVgW-X8B^0-p(Zfcwyr30R0^sXL_N7gAx0Q;jz>1Hc{P zCX6$33{xZ-DZOBl5-SK2EQAR4A@?BkLZ}%b=YT~r0dfUhOOTI@KYmp{s6nOoK)gaG zN}Zm%>A&dvfBCm0Br4@5FOv#|MvEjSERGd$=1CIH-;m6$e&s?d69qM;bC~GGW6-R5?XP zgL)z{G&VLiv_>_mk~$YS<8L<@<8aW(-nXrYGe*fAg?5ohGV0|b$Hli05|I)zGjdoB z#7)96Q3F&Yx`A#&s?MU}^brjK!)%k`#p{fMkI+Vd)ds z^Ui)B0o_SNA?6}=!p)g%GPbNKO{A2Fl@d@W9xwxtAwaA^lth6*P?U@612bwG)9gM& zK)6nz>nTv`&A~cGK!#-_P(q^u6;X_`e*-Ut9Dpz3@C;sESDGyu<(OYzjdNbT$g~tY zg3SoXySex8^%qbF;?urJ_r@eoXjwmsbsR!fz-OigvA0i2lY!SY3qI$O3jZ(i|F8VN z>;L!uzxKb^|8M(j*Yk(gN+Ojxs;6@cAKTI4`;LCenP=rN>&qCpFKp|08Bf{bt5^^L zl?g&L3GQG%(1YIbpwKz_;BHu2S`ri`cq#Q`LV86L3>OFFx1RR&+a4a+J-~$GagfW+ z-uAbnK67~N{9QAg>3Mc>nABz?aJaS7#A^mz*1FV#dKn41LJ==2*Gw5`;C=RB&t%W@ zzk0}hCoSU%9pOwP0n9m>M&hzCx^;yQnK=hw92L6EIF%1e*#v;a$OWE!^tsvF;8VO)pE*aaaM<;edO%F>Cd}K(et$ zC`X+WHTrJY6vyyCl=Y79Jku;h0Cgwy2SL(&FtH$Z&ESx@8U2;|Pxsz#ka6Nc9tqEq z66+UeXLT&jON=s0xD#pz0&^)Rkr$l(kPVQ7$|}GJ`oz#F$btY+hK^}V>jS{T&HDm8 zo+MP0lcWKVP~uVT7qU@^h$2pe5*Ysh#0ES0mj_FrhJzEubfgQZtN_*#kO~~vd@KDs z7oiynC@KJKC82m+4+q&g10XO?4FVBG{-IvL#PU%927x+Ip3BgAy;Vk_C{L(m+4)EZ z#xVB%e!C)R-gC#DASL$!3MO_|!o#TsS?-Ecnyd-x0rA*oEZM|cQj8;d1T-Hp7&HM3(D_5Dyd0xh7^21e z&@;yQj14m=;M$$UEj&OzVB@qZQoal^8Iu1dV?Wx%CJ2!B!+|&NW6eSb=8_>t-5~EQ z0OBHfV5Z>O{FFV2CoUhE^dbGl6)IGOJy4ZZMS694c6ecdoa%8nO#{2Qlt8AM2_a5c zxe=9N_F(7>Mr#Kl(1b;Q0#r)kV@fbmIN0QQV8Y0v7{(A(RC)x30P6(mZ1d&sIf7sr znT9rO(ZSv5Jfd}-IUOu+v_FtSf@rA;Vg%uQkkdgBp#cJ~VelU7S@`?^ws8|*_x7@J z7enG9BT)lrj*dqdK#66NM&U5~3^|&J!}6d9&I8z#Ap!^H1G~7u(3uI}K|^AN#5qI8 za~MB}eH|Ez`teV_4~#s%wLX{awBnYt21WuFcrD%^aIZj%woZU`{NC!y-I;O4ojY2G~ zfU$#>h#GPhA2I1OzGgFhRac>pshAIt`@Mf&o=1>3@%Q+(JCNdXD0O8~Q%k1|2N4aj z_4|w&1B|URBfNd;R?xr!zse39r#NIc?~LCVge4Z;GM_CgRygeO>9 zDZnlpytr-%CQ5N=9dM8j1|>x}!3UfM*l~7=mjlotMSA*XomKYB&on3m(CiohT7iDd zif}pXYk6XCIt}$-m<1A)IsOpaT|=Jo6NNlrCS+b6geV~r&{@+$Ye2EKydTnIxN2++^mWIRu2&DF~3gtT>^Q8BDEWe`*J*>)0= z-L7P`qn8-&sZRP|?;2qOVc19q0xTlK&He$@JRCzEJ6S4K2Bm0x+(ag$ux84%R-m5)sp=sy^I&Lg!5Vjz z;DlitrW;Fh-1vB4$M&YI@`NNN{vP~QaXYBC$XVz%s!QO)0Nd#s18k*~)S?toDM`ej zJ1-V4ftui7v{XC2aT-{@vV5zLskhw}E(&KIgY>};^RHI@m2+up^8$Pb0R93fDb6YV z%tR|m*W>{B$)y0LPQIi1qNoJ%6w-%8nxK@3)KP>)d;_F*!;hP>QPw_jrGUl#a6F_S zfpQyVczt*Wyl>j2DO8CLK_m*J-Zp%!d_zG%hQ>Q-9WVg3hy(iKAtDNwrGSut9}oF|`2VN=S>u2IKlA^V?N9!>A(BwE6Dbrjf#iWq2_jG_T2&$v zLMUhp^M2Rs|FZkq;^p>#StWaZ|D^I0>@dR#F%Qan4G-S19^=)d2g4RbKMVu$$9Gq1 zVi%1-w3HOBYHYSkoA5l}0sfpXaEs658}*6QOY;`E6!x9~amC!B?hom$I6nnYao`&R zH>^UUkLmKVR#LaThl`&-uigrP2qK~f0LVr_Bw9X`u`DOy48f;++n3Z3_T6=uiv92S z5jj9=C%3}KXksY3f&hlZV5bN01N@K&+Lz 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 header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the 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 + +/* 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 index 0000000..3801e2c --- /dev/null +++ b/regex/TRE/tre-last-matched.h @@ -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 + +#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 index b39907d..0000000 --- a/regex/cclass.h +++ /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 index d3504a5..0000000 --- a/regex/cname.h +++ /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 index 19b4ddb..0000000 --- a/regex/cname.h.orig +++ /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 index 75590e6..0000000 --- a/regex/engine.c +++ /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 -__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®_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®_NOSUB) - nmatch = 0; - if (eflags®_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®_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®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OEOL: - if ( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) ) - { /* yes */ } - else - return(NULL); - break; - case OBOW: - if (( (sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp < m->endp && *(sp-1) == '\n' && - (m->g->cflags®_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®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_NEWLINE) || - (lastc == OUT && !(m->eflags®_NOTBOL)) ) { - flagch = BOL; - i = m->g->nbol; - } - if ( (c == '\n' && m->g->cflags®_NEWLINE) || - (c == OUT && !(m->eflags®_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®_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®_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 index 9946732..0000000 --- a/regex/re_format.7 +++ /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 index a84a31d..0000000 --- a/regex/regcomp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regcomp.c,v 1.36 2007/06/11 03:05:54 delphij Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 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®_EXTENDED) && (cflags®_NOSPEC)) - return(REG_INVARG); - - if (cflags®_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®_EXTENDED) - p_ere(p, OUT); - else if (cflags®_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®_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<g->cflags®_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®_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®_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®_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<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<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 index a22066c..0000000 --- a/regex/regerror-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.11 2007/06/11 03:05:54 delphij Exp $"); - -#include -#include -#include -#include -#include -#include - -#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®_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 index 9364bd4..0000000 --- a/regex/regerror-fbsd.c.orig +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regerror.c,v 1.11 2007/06/11 03:05:54 delphij Exp $"); - -#include -#include -#include -#include -#include -#include - -#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®_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 index dc3b5bf..0000000 --- a/regex/regex.3 +++ /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 index 8c0a49c..0000000 --- a/regex/regex2.h +++ /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<= 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 index 38c7281..0000000 --- a/regex/regexec-fbsd.c +++ /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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include - -#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®_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 index 4e231c9..0000000 --- a/regex/regfree-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/regex/regfree.c,v 1.8 2007/06/11 03:05:54 delphij Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -#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 index 55b5b71..0000000 --- a/regex/utils.h +++ /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 index d65e093..0000000 --- a/rpc/Makefile.inc +++ /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 index 9748566..0000000 --- a/secure/Makefile.inc +++ /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 diff --git a/secure/snprintf_chk.c b/secure/snprintf_chk.c index 4fb2fbd..ef45ead 100644 --- a/secure/snprintf_chk.c +++ b/secure/snprintf_chk.c @@ -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, diff --git a/secure/sprintf_chk.c b/secure/sprintf_chk.c index 62a2a60..cf4a956 100644 --- a/secure/sprintf_chk.c +++ b/secure/sprintf_chk.c @@ -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, ...) diff --git a/secure/vsnprintf_chk.c b/secure/vsnprintf_chk.c index 5c7e2cc..f9e6740 100644 --- a/secure/vsnprintf_chk.c +++ b/secure/vsnprintf_chk.c @@ -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, diff --git a/secure/vsprintf_chk.c b/secure/vsprintf_chk.c index 72a4004..a2ca79b 100644 --- a/secure/vsprintf_chk.c +++ b/secure/vsprintf_chk.c @@ -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, diff --git a/stdio/FreeBSD/asprintf.c b/stdio/FreeBSD/asprintf.c index 5e089e1..90c5617 100644 --- a/stdio/FreeBSD/asprintf.c +++ b/stdio/FreeBSD/asprintf.c @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index bc41588..0000000 --- a/stdio/FreeBSD/asprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - -@@ -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); - } diff --git a/stdio/FreeBSD/dprintf.c b/stdio/FreeBSD/dprintf.c index ff5a864..22115fa 100644 --- a/stdio/FreeBSD/dprintf.c +++ b/stdio/FreeBSD/dprintf.c @@ -27,7 +27,8 @@ #include __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 #include @@ -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 index 43957fd..0000000 --- a/stdio/FreeBSD/dprintf.c.patch +++ /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 - __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 - #include -@@ -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); - } diff --git a/stdio/FreeBSD/fclose.c b/stdio/FreeBSD/fclose.c index e80edcf..91df68a 100644 --- a/stdio/FreeBSD/fclose.c +++ b/stdio/FreeBSD/fclose.c @@ -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 index 7e5eef7..0000000 --- a/stdio/FreeBSD/fclose.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/fdopen.c b/stdio/FreeBSD/fdopen.c index 4d106c4..c49e36e 100644 --- a/stdio/FreeBSD/fdopen.c +++ b/stdio/FreeBSD/fdopen.c @@ -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; /* diff --git a/stdio/FreeBSD/fdopen.c.patch b/stdio/FreeBSD/fdopen.c.patch deleted file mode 100644 index 466abe3..0000000 --- a/stdio/FreeBSD/fdopen.c.patch +++ /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; - /* diff --git a/stdio/FreeBSD/fflush.c b/stdio/FreeBSD/fflush.c index 2507c79..5db1a1c 100644 --- a/stdio/FreeBSD/fflush.c +++ b/stdio/FreeBSD/fflush.c @@ -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 #include +#include #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 index 7f6d2a6..0000000 --- a/stdio/FreeBSD/fflush.c.patch +++ /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 - #include -+#include - #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); - } diff --git a/stdio/FreeBSD/fgetln.3 b/stdio/FreeBSD/fgetln.3 index 4fb0a8a..61a3391 100644 --- a/stdio/FreeBSD/fgetln.3 +++ b/stdio/FreeBSD/fgetln.3 @@ -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 index d134522..0000000 --- a/stdio/FreeBSD/fgetln.3.patch +++ /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 diff --git a/stdio/FreeBSD/fgetln.c b/stdio/FreeBSD/fgetln.c index bbad594..8de4aa9 100644 --- a/stdio/FreeBSD/fgetln.c +++ b/stdio/FreeBSD/fgetln.c @@ -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 #include #include #include @@ -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 index 035233c..0000000 --- a/stdio/FreeBSD/fgetln.c.patch +++ /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 - #include - #include - #include -@@ -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/fgetwc.c b/stdio/FreeBSD/fgetwc.c index 1570178..ead24c3 100644 --- a/stdio/FreeBSD/fgetwc.c +++ b/stdio/FreeBSD/fgetwc.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index eec75c7..0000000 --- a/stdio/FreeBSD/fgetwc.c.patch +++ /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 - __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 - #include -@@ -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/fgetwln.3 b/stdio/FreeBSD/fgetwln.3 index 5a8119c..c38fb39 100644 --- a/stdio/FreeBSD/fgetwln.3 +++ b/stdio/FreeBSD/fgetwln.3 @@ -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 index 7be9de1..0000000 --- a/stdio/FreeBSD/fgetwln.3.patch +++ /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 diff --git a/stdio/FreeBSD/fgetwln.c b/stdio/FreeBSD/fgetwln.c index 49b52af..43485cb 100644 --- a/stdio/FreeBSD/fgetwln.c +++ b/stdio/FreeBSD/fgetwln.c @@ -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 index ee02383..0000000 --- a/stdio/FreeBSD/fgetwln.c.patch +++ /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()); -+} diff --git a/stdio/FreeBSD/fgetws.3 b/stdio/FreeBSD/fgetws.3 index eba1bb9..49c9d90 100644 --- a/stdio/FreeBSD/fgetws.3 +++ b/stdio/FreeBSD/fgetws.3 @@ -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 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 index e170d86..0000000 --- a/stdio/FreeBSD/fgetws.3.patch +++ /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 diff --git a/stdio/FreeBSD/fgetws.c b/stdio/FreeBSD/fgetws.c index eaaa0f8..278e809 100644 --- a/stdio/FreeBSD/fgetws.c +++ b/stdio/FreeBSD/fgetws.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index b16f5a7..0000000 --- a/stdio/FreeBSD/fgetws.c.patch +++ /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 - __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 - #include -@@ -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()); -+} diff --git a/stdio/FreeBSD/findfp.c b/stdio/FreeBSD/findfp.c index f370d7a..6cade0b 100644 --- a/stdio/FreeBSD/findfp.c +++ b/stdio/FreeBSD/findfp.c @@ -36,13 +36,18 @@ static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $"); +#include + #include #include #include #include #include #include +#include +#include +#include #include #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 index 01da320..0000000 --- a/stdio/FreeBSD/findfp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $"); - -+#include -+ - #include - #include - #include - #include - #include - #include -+#include -+#include - -+#include - #include - - #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(); - } diff --git a/stdio/FreeBSD/flags.c b/stdio/FreeBSD/flags.c index 17d175d..3b90476 100644 --- a/stdio/FreeBSD/flags.c +++ b/stdio/FreeBSD/flags.c @@ -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 index 1710d8a..0000000 --- a/stdio/FreeBSD/flags.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/flockfile.3 b/stdio/FreeBSD/flockfile.3 index a8c9c26..924b9e5 100644 --- a/stdio/FreeBSD/flockfile.3 +++ b/stdio/FreeBSD/flockfile.3 @@ -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 @@ 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 index 7cbffa9..0000000 --- a/stdio/FreeBSD/flockfile.3.patch +++ /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 diff --git a/stdio/FreeBSD/fopen.3 b/stdio/FreeBSD/fopen.3 index aed0511..3bb0c0f 100644 --- a/stdio/FreeBSD/fopen.3 +++ b/stdio/FreeBSD/fopen.3 @@ -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 diff --git a/stdio/FreeBSD/fopen.3.patch b/stdio/FreeBSD/fopen.3.patch deleted file mode 100644 index cfb6e0c..0000000 --- a/stdio/FreeBSD/fopen.3.patch +++ /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 diff --git a/stdio/FreeBSD/fopen.c b/stdio/FreeBSD/fopen.c index af7b71b..df3deea 100644 --- a/stdio/FreeBSD/fopen.c +++ b/stdio/FreeBSD/fopen.c @@ -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); } /* diff --git a/stdio/FreeBSD/fopen.c.patch b/stdio/FreeBSD/fopen.c.patch deleted file mode 100644 index cd254a8..0000000 --- a/stdio/FreeBSD/fopen.c.patch +++ /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); - } - /* diff --git a/stdio/FreeBSD/fprintf.c b/stdio/FreeBSD/fprintf.c index f061bc9..76bca94 100644 --- a/stdio/FreeBSD/fprintf.c +++ b/stdio/FreeBSD/fprintf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index add604c..0000000 --- a/stdio/FreeBSD/fprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - -@@ -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); - } diff --git a/stdio/FreeBSD/fputs.3 b/stdio/FreeBSD/fputs.3 index c0feb0c..4c4ca1e 100644 --- a/stdio/FreeBSD/fputs.3 +++ b/stdio/FreeBSD/fputs.3 @@ -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 . diff --git a/stdio/FreeBSD/fputs.3.patch b/stdio/FreeBSD/fputs.3.patch deleted file mode 100644 index 8f929c4..0000000 --- a/stdio/FreeBSD/fputs.3.patch +++ /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 . diff --git a/stdio/FreeBSD/fputs.c b/stdio/FreeBSD/fputs.c index a521685..163541b 100644 --- a/stdio/FreeBSD/fputs.c +++ b/stdio/FreeBSD/fputs.c @@ -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 index 94ddea7..0000000 --- a/stdio/FreeBSD/fputs.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/fputwc.c b/stdio/FreeBSD/fputwc.c index a26cdbd..e835bc2 100644 --- a/stdio/FreeBSD/fputwc.c +++ b/stdio/FreeBSD/fputwc.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index 7264139..0000000 --- a/stdio/FreeBSD/fputwc.c.patch +++ /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 - __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 - #include -@@ -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); diff --git a/stdio/FreeBSD/fputws.3 b/stdio/FreeBSD/fputws.3 index 096e349..d7326b2 100644 --- a/stdio/FreeBSD/fputws.3 +++ b/stdio/FreeBSD/fputws.3 @@ -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 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 index 3b0e069..0000000 --- a/stdio/FreeBSD/fputws.3.patch +++ /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 diff --git a/stdio/FreeBSD/fputws.c b/stdio/FreeBSD/fputws.c index 6c4a333..1ff0484 100644 --- a/stdio/FreeBSD/fputws.c +++ b/stdio/FreeBSD/fputws.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index 4b2e29a..0000000 --- a/stdio/FreeBSD/fputws.c.patch +++ /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 - __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 - #include -@@ -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()); -+} diff --git a/stdio/FreeBSD/fread.3 b/stdio/FreeBSD/fread.3 index 4da3569..1ba5005 100644 --- a/stdio/FreeBSD/fread.3 +++ b/stdio/FreeBSD/fread.3 @@ -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 (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 index 2b00f38..0000000 --- a/stdio/FreeBSD/fread.3.patch +++ /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 , diff --git a/stdio/FreeBSD/fread.c b/stdio/FreeBSD/fread.c index 2430dab..544d94a 100644 --- a/stdio/FreeBSD/fread.c +++ b/stdio/FreeBSD/fread.c @@ -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 index 7d38746..0000000 --- a/stdio/FreeBSD/fread.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/freopen.c b/stdio/FreeBSD/freopen.c index 524ae6d..3451106 100644 --- a/stdio/FreeBSD/freopen.c +++ b/stdio/FreeBSD/freopen.c @@ -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 index ba84faa..0000000 --- a/stdio/FreeBSD/freopen.c.patch +++ /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); diff --git a/stdio/FreeBSD/fscanf.c b/stdio/FreeBSD/fscanf.c index 27b6849..2db747e 100644 --- a/stdio/FreeBSD/fscanf.c +++ b/stdio/FreeBSD/fscanf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include @@ -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 index 4a2796c..0000000 --- a/stdio/FreeBSD/fscanf.c.patch +++ /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 - __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 - #include -@@ -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); diff --git a/stdio/FreeBSD/fseek.3 b/stdio/FreeBSD/fseek.3 index 5a25dab..edf7791 100644 --- a/stdio/FreeBSD/fseek.3 +++ b/stdio/FreeBSD/fseek.3 @@ -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 routines .Xr lseek 2 , and .Xr malloc 3 . +.Sh LEGACY SYNOPSIS +.Fd #include +.Fd #include +.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 index 91fe9fe..0000000 --- a/stdio/FreeBSD/fseek.3.patch +++ /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 -+.Fd #include -+.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/ftell.c b/stdio/FreeBSD/ftell.c index a0849d2..8bb5716 100644 --- a/stdio/FreeBSD/ftell.c +++ b/stdio/FreeBSD/ftell.c @@ -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 index 528b85b..0000000 --- a/stdio/FreeBSD/ftell.c.patch +++ /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 { diff --git a/stdio/FreeBSD/funopen.c b/stdio/FreeBSD/funopen.c index 64a56f2..408f0f4 100644 --- a/stdio/FreeBSD/funopen.c +++ b/stdio/FreeBSD/funopen.c @@ -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 index b7edcfc..0000000 --- a/stdio/FreeBSD/funopen.c.patch +++ /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; diff --git a/stdio/FreeBSD/fwide.3 b/stdio/FreeBSD/fwide.3 index 1c1961f..93163f3 100644 --- a/stdio/FreeBSD/fwide.3 +++ b/stdio/FreeBSD/fwide.3 @@ -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 index c3c54ba..0000000 --- a/stdio/FreeBSD/fwide.3.patch +++ /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 diff --git a/stdio/FreeBSD/fwprintf.c b/stdio/FreeBSD/fwprintf.c index dcd6c38..5fefd4a 100644 --- a/stdio/FreeBSD/fwprintf.c +++ b/stdio/FreeBSD/fwprintf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index f2c9940..0000000 --- a/stdio/FreeBSD/fwprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/stdio/FreeBSD/fwrite.c b/stdio/FreeBSD/fwrite.c index 0c40b93..b1910c1 100644 --- a/stdio/FreeBSD/fwrite.c +++ b/stdio/FreeBSD/fwrite.c @@ -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 index 5dcd790..0000000 --- a/stdio/FreeBSD/fwrite.c.patch +++ /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; diff --git a/stdio/FreeBSD/fwscanf.c b/stdio/FreeBSD/fwscanf.c index 47e8550..4fefaea 100644 --- a/stdio/FreeBSD/fwscanf.c +++ b/stdio/FreeBSD/fwscanf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 2b97333..0000000 --- a/stdio/FreeBSD/fwscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/stdio/FreeBSD/getc.3 b/stdio/FreeBSD/getc.3 index 26a7022..b1c114b 100644 --- a/stdio/FreeBSD/getc.3 +++ b/stdio/FreeBSD/getc.3 @@ -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 index 6435525..0000000 --- a/stdio/FreeBSD/getc.3.patch +++ /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 diff --git a/stdio/FreeBSD/getline.3 b/stdio/FreeBSD/getline.3 index fba1461..ddefe70 100644 --- a/stdio/FreeBSD/getline.3 +++ b/stdio/FreeBSD/getline.3 @@ -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 index 34875e7..0000000 --- a/stdio/FreeBSD/getline.3.patch +++ /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 diff --git a/stdio/FreeBSD/getwc.3 b/stdio/FreeBSD/getwc.3 index 0f2fe2e..d994aad 100644 --- a/stdio/FreeBSD/getwc.3 +++ b/stdio/FreeBSD/getwc.3 @@ -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 index a271508..0000000 --- a/stdio/FreeBSD/getwc.3.patch +++ /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 diff --git a/stdio/FreeBSD/getwc.c b/stdio/FreeBSD/getwc.c index 34a7de3..0128a77 100644 --- a/stdio/FreeBSD/getwc.c +++ b/stdio/FreeBSD/getwc.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index f6594bd..0000000 --- a/stdio/FreeBSD/getwc.c.patch +++ /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 - __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 - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/getwchar.c b/stdio/FreeBSD/getwchar.c index 1297cbb..f5c2dd6 100644 --- a/stdio/FreeBSD/getwchar.c +++ b/stdio/FreeBSD/getwchar.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index 5b5e460..0000000 --- a/stdio/FreeBSD/getwchar.c.patch +++ /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 - __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 - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/local.h b/stdio/FreeBSD/local.h index 0cb856e..88e143c 100644 --- a/stdio/FreeBSD/local.h +++ b/stdio/FreeBSD/local.h @@ -33,8 +33,11 @@ * $FreeBSD: src/lib/libc/stdio/local.h,v 1.33 2008/05/05 16:03:52 jhb Exp $ */ +#include +#include "xlocale_private.h" #include /* for off_t */ #include +#include #include #include @@ -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 index 2024f06..0000000 --- a/stdio/FreeBSD/local.h.patch +++ /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 -+#include "xlocale_private.h" - #include /* for off_t */ - #include -+#include - #include - #include - -@@ -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. diff --git a/stdio/FreeBSD/makebuf.c b/stdio/FreeBSD/makebuf.c index 7d90164..17e45e2 100644 --- a/stdio/FreeBSD/makebuf.c +++ b/stdio/FreeBSD/makebuf.c @@ -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 index 970a38d..0000000 --- a/stdio/FreeBSD/makebuf.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/mktemp.3 b/stdio/FreeBSD/mktemp.3 index af2eba7..f55ceef 100644 --- a/stdio/FreeBSD/mktemp.3 +++ b/stdio/FreeBSD/mktemp.3 @@ -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 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 +.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 index 03cafdd..0000000 --- a/stdio/FreeBSD/mktemp.3.patch +++ /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 -+.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. diff --git a/stdio/FreeBSD/mktemp.c b/stdio/FreeBSD/mktemp.c index 18e47c2..30dc901 100644 --- a/stdio/FreeBSD/mktemp.c +++ b/stdio/FreeBSD/mktemp.c @@ -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 index 1c3da0c..0000000 --- a/stdio/FreeBSD/mktemp.c.patch +++ /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; diff --git a/stdio/FreeBSD/printf-pos.c b/stdio/FreeBSD/printf-pos.c index 2cae4e6..4de7aba 100644 --- a/stdio/FreeBSD/printf-pos.c +++ b/stdio/FreeBSD/printf-pos.c @@ -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 index fdbb58e..0000000 --- a/stdio/FreeBSD/printf-pos.c.patch +++ /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; diff --git a/stdio/FreeBSD/printf.3 b/stdio/FreeBSD/printf.3 index cbafaf9..031d7f7 100644 --- a/stdio/FreeBSD/printf.3 +++ b/stdio/FreeBSD/printf.3 @@ -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 index d34b422..0000000 --- a/stdio/FreeBSD/printf.3.patch +++ /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 diff --git a/stdio/FreeBSD/printf.c b/stdio/FreeBSD/printf.c index c1ee178..e65851a 100644 --- a/stdio/FreeBSD/printf.c +++ b/stdio/FreeBSD/printf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index dfd8cbe..0000000 --- a/stdio/FreeBSD/printf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - -@@ -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/printfcommon.h b/stdio/FreeBSD/printfcommon.h index 01504f9..27141e6 100644 --- a/stdio/FreeBSD/printfcommon.h +++ b/stdio/FreeBSD/printfcommon.h @@ -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 index 38db417..0000000 --- a/stdio/FreeBSD/printfcommon.h.patch +++ /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); - } diff --git a/stdio/FreeBSD/printflocal.h b/stdio/FreeBSD/printflocal.h index ca7e05d..f57e8e9 100644 --- a/stdio/FreeBSD/printflocal.h +++ b/stdio/FreeBSD/printflocal.h @@ -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 () + */ +#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 @@ -60,6 +68,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 +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 index 209dc14..0000000 --- a/stdio/FreeBSD/printflocal.h.patch +++ /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 () -+ */ -+#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. */ diff --git a/stdio/FreeBSD/putc.3 b/stdio/FreeBSD/putc.3 index 216c1cb..b5370aa 100644 --- a/stdio/FreeBSD/putc.3 +++ b/stdio/FreeBSD/putc.3 @@ -48,17 +48,33 @@ .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 index 613d138..0000000 --- a/stdio/FreeBSD/putc.3.patch +++ /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. diff --git a/stdio/FreeBSD/puts.c b/stdio/FreeBSD/puts.c index 4b27733..511cab4 100644 --- a/stdio/FreeBSD/puts.c +++ b/stdio/FreeBSD/puts.c @@ -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 index f56c66a..0000000 --- a/stdio/FreeBSD/puts.c.patch +++ /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; diff --git a/stdio/FreeBSD/putwc.3 b/stdio/FreeBSD/putwc.3 index 47b728c..84799bc 100644 --- a/stdio/FreeBSD/putwc.3 +++ b/stdio/FreeBSD/putwc.3 @@ -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 diff --git a/stdio/FreeBSD/putwc.3.patch b/stdio/FreeBSD/putwc.3.patch deleted file mode 100644 index a4b0008..0000000 --- a/stdio/FreeBSD/putwc.3.patch +++ /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 diff --git a/stdio/FreeBSD/putwc.c b/stdio/FreeBSD/putwc.c index 0feec5b..e854309 100644 --- a/stdio/FreeBSD/putwc.c +++ b/stdio/FreeBSD/putwc.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index b8cbdee..0000000 --- a/stdio/FreeBSD/putwc.c.patch +++ /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 - __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 - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/putwchar.c b/stdio/FreeBSD/putwchar.c index b983995..bc3ef1f 100644 --- a/stdio/FreeBSD/putwchar.c +++ b/stdio/FreeBSD/putwchar.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index 6bcd527..0000000 --- a/stdio/FreeBSD/putwchar.c.patch +++ /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 - __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 - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/refill.c b/stdio/FreeBSD/refill.c index a7d486f..8d42bbb 100644 --- a/stdio/FreeBSD/refill.c +++ b/stdio/FreeBSD/refill.c @@ -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 index ef4573d..0000000 --- a/stdio/FreeBSD/refill.c.patch +++ /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); -+} diff --git a/stdio/FreeBSD/remove.3 b/stdio/FreeBSD/remove.3 index 618111f..5f10003 100644 --- a/stdio/FreeBSD/remove.3 +++ b/stdio/FreeBSD/remove.3 @@ -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 index 8a24b15..0000000 --- a/stdio/FreeBSD/remove.3.patch +++ /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 diff --git a/stdio/FreeBSD/rewind.c b/stdio/FreeBSD/rewind.c index b5204ed..3dc282d 100644 --- a/stdio/FreeBSD/rewind.c +++ b/stdio/FreeBSD/rewind.c @@ -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 index ffdf7fd..0000000 --- a/stdio/FreeBSD/rewind.c.patch +++ /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); - } diff --git a/stdio/FreeBSD/scanf.3 b/stdio/FreeBSD/scanf.3 index 5f424ff..4bf7240 100644 --- a/stdio/FreeBSD/scanf.3 +++ b/stdio/FreeBSD/scanf.3 @@ -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 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 index e8501fd..0000000 --- a/stdio/FreeBSD/scanf.3.patch +++ /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 diff --git a/stdio/FreeBSD/scanf.c b/stdio/FreeBSD/scanf.c index 7941499..c2992ec 100644 --- a/stdio/FreeBSD/scanf.c +++ b/stdio/FreeBSD/scanf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include @@ -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 index 1462320..0000000 --- a/stdio/FreeBSD/scanf.c.patch +++ /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 - __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 - #include -@@ -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/setbuf.3 b/stdio/FreeBSD/setbuf.3 index 8f4ef0a..466d8b3 100644 --- a/stdio/FreeBSD/setbuf.3 +++ b/stdio/FreeBSD/setbuf.3 @@ -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 diff --git a/stdio/FreeBSD/setbuf.3.patch b/stdio/FreeBSD/setbuf.3.patch deleted file mode 100644 index 4ba00dd..0000000 --- a/stdio/FreeBSD/setbuf.3.patch +++ /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 diff --git a/stdio/FreeBSD/snprintf.c b/stdio/FreeBSD/snprintf.c index 61d9c8a..55f01cf 100644 --- a/stdio/FreeBSD/snprintf.c +++ b/stdio/FreeBSD/snprintf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index fb74cf8..0000000 --- a/stdio/FreeBSD/snprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); - } diff --git a/stdio/FreeBSD/sprintf.c b/stdio/FreeBSD/sprintf.c index 005d300..f2cb3a9 100644 --- a/stdio/FreeBSD/sprintf.c +++ b/stdio/FreeBSD/sprintf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index b275aff..0000000 --- a/stdio/FreeBSD/sprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); - } diff --git a/stdio/FreeBSD/sscanf.c b/stdio/FreeBSD/sscanf.c index 1598562..16c313f 100644 --- a/stdio/FreeBSD/sscanf.c +++ b/stdio/FreeBSD/sscanf.c @@ -36,42 +36,33 @@ static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index 6ab773c..0000000 --- a/stdio/FreeBSD/sscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/stdio.3 b/stdio/FreeBSD/stdio.3 index 71488a1..1cf1be6 100644 --- a/stdio/FreeBSD/stdio.3 +++ b/stdio/FreeBSD/stdio.3 @@ -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 + +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 + +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 index 06eaaad..0000000 --- a/stdio/FreeBSD/stdio.3.patch +++ /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 -+ -+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 -+ -+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/swprintf.c b/stdio/FreeBSD/swprintf.c index 190326a..698b6c8 100644 --- a/stdio/FreeBSD/swprintf.c +++ b/stdio/FreeBSD/swprintf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index fb1425a..0000000 --- a/stdio/FreeBSD/swprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/stdio/FreeBSD/swscanf.c b/stdio/FreeBSD/swscanf.c index 81ac9f1..4fc850a 100644 --- a/stdio/FreeBSD/swscanf.c +++ b/stdio/FreeBSD/swscanf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 21dfbe4..0000000 --- a/stdio/FreeBSD/swscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/stdio/FreeBSD/tempnam.c b/stdio/FreeBSD/tempnam.c index 72a5e60..adc2adf 100644 --- a/stdio/FreeBSD/tempnam.c +++ b/stdio/FreeBSD/tempnam.c @@ -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 index 7e1c8be..0000000 --- a/stdio/FreeBSD/tempnam.c.patch +++ /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); diff --git a/stdio/FreeBSD/tmpnam.3 b/stdio/FreeBSD/tmpnam.3 index 3392af2..5f377d9 100644 --- a/stdio/FreeBSD/tmpnam.3 +++ b/stdio/FreeBSD/tmpnam.3 @@ -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 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 index 24478e1..0000000 --- a/stdio/FreeBSD/tmpnam.3.patch +++ /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 diff --git a/stdio/FreeBSD/tmpnam.c b/stdio/FreeBSD/tmpnam.c index f3ab680..6dad888 100644 --- a/stdio/FreeBSD/tmpnam.c +++ b/stdio/FreeBSD/tmpnam.c @@ -40,21 +40,35 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/tmpnam.c,v 1.6 2007/01/09 00:28:07 imp Ex #include #include +#include +#include __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 index 5ff86df..0000000 --- a/stdio/FreeBSD/tmpnam.c.patch +++ /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 - #include -+#include -+#include - - __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/ungetc.3 b/stdio/FreeBSD/ungetc.3 index ee280eb..169a02b 100644 --- a/stdio/FreeBSD/ungetc.3 +++ b/stdio/FreeBSD/ungetc.3 @@ -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. diff --git a/stdio/FreeBSD/ungetc.3.patch b/stdio/FreeBSD/ungetc.3.patch deleted file mode 100644 index bc9668d..0000000 --- a/stdio/FreeBSD/ungetc.3.patch +++ /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. diff --git a/stdio/FreeBSD/ungetwc.3 b/stdio/FreeBSD/ungetwc.3 index 5618253..726ec65 100644 --- a/stdio/FreeBSD/ungetwc.3 +++ b/stdio/FreeBSD/ungetwc.3 @@ -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 diff --git a/stdio/FreeBSD/ungetwc.3.patch b/stdio/FreeBSD/ungetwc.3.patch deleted file mode 100644 index 8bf0a85..0000000 --- a/stdio/FreeBSD/ungetwc.3.patch +++ /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 diff --git a/stdio/FreeBSD/ungetwc.c b/stdio/FreeBSD/ungetwc.c index 47e84ae..37e6402 100644 --- a/stdio/FreeBSD/ungetwc.c +++ b/stdio/FreeBSD/ungetwc.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index e9e1c3d..0000000 --- a/stdio/FreeBSD/ungetwc.c.patch +++ /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 - __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 - #include -@@ -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); diff --git a/stdio/FreeBSD/vasprintf.c b/stdio/FreeBSD/vasprintf.c index fd5bfa2..d872a9e 100644 --- a/stdio/FreeBSD/vasprintf.c +++ b/stdio/FreeBSD/vasprintf.c @@ -30,20 +30,27 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #include #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 index e08af0e..0000000 --- a/stdio/FreeBSD/vasprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #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/vdprintf.c b/stdio/FreeBSD/vdprintf.c index cba376b..5625bd6 100644 --- a/stdio/FreeBSD/vdprintf.c +++ b/stdio/FreeBSD/vdprintf.c @@ -27,6 +27,8 @@ #include __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 #include @@ -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 index 519239b..0000000 --- a/stdio/FreeBSD/vdprintf.c.patch +++ /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 - __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 - #include -@@ -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); -+} diff --git a/stdio/FreeBSD/vfprintf.c b/stdio/FreeBSD/vfprintf.c index df992ce..28673b4 100644 --- a/stdio/FreeBSD/vfprintf.c +++ b/stdio/FreeBSD/vfprintf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include #include +#if 0 // xprintf pending API review #include +#endif +#include #include #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 index b3ffc42..0000000 --- a/stdio/FreeBSD/vfprintf.c.patch +++ /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 - __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 - #include - #include -+#if 0 // xprintf pending API review - #include -+#endif -+#include - - #include - #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; diff --git a/stdio/FreeBSD/vfscanf.c b/stdio/FreeBSD/vfscanf.c index 69b7297..a3f9f3e 100644 --- a/stdio/FreeBSD/vfscanf.c +++ b/stdio/FreeBSD/vfscanf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include @@ -46,6 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/vfscanf.c,v 1.43 2009/01/19 06:19:51 das #include #include #include +#include #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 index 4dd84b8..0000000 --- a/stdio/FreeBSD/vfscanf.c.patch +++ /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 - __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 - #include -@@ -46,6 +48,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdio/v - #include - #include - #include -+#include - #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 diff --git a/stdio/FreeBSD/vfwprintf.c b/stdio/FreeBSD/vfwprintf.c index 5e1c059..31764a9 100644 --- a/stdio/FreeBSD/vfwprintf.c +++ b/stdio/FreeBSD/vfwprintf.c @@ -38,6 +38,8 @@ static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include #include +#include #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 index ac8b4e2..0000000 --- a/stdio/FreeBSD/vfwprintf.c.patch +++ /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 - __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 - #include - #include -+#include - #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; diff --git a/stdio/FreeBSD/vfwscanf.c b/stdio/FreeBSD/vfwscanf.c index 79b5469..bba07f2 100644 --- a/stdio/FreeBSD/vfwscanf.c +++ b/stdio/FreeBSD/vfwscanf.c @@ -38,6 +38,8 @@ static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93"; #include __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 #include @@ -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 index 7a22303..0000000 --- a/stdio/FreeBSD/vfwscanf.c.patch +++ /dev/null @@ -1,589 +0,0 @@ -Index: vfwscanf.c -=================================================================== ---- vfwscanf.c (revision 55443) -+++ vfwscanf.c (working copy) -@@ -38,6 +38,8 @@ - #include - __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 - #include -@@ -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 diff --git a/stdio/FreeBSD/vprintf.c b/stdio/FreeBSD/vprintf.c index b11af0d..894cd79 100644 --- a/stdio/FreeBSD/vprintf.c +++ b/stdio/FreeBSD/vprintf.c @@ -36,11 +36,21 @@ static char sccsid[] = "@(#)vprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $"); +#include "xlocale_private.h" + #include 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 index 5616998..0000000 --- a/stdio/FreeBSD/vprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/vscanf.c b/stdio/FreeBSD/vscanf.c index 7792970..397382e 100644 --- a/stdio/FreeBSD/vscanf.c +++ b/stdio/FreeBSD/vscanf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vscanf.c 8.1 (Berkeley) 6/4/93"; #include __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 #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 index 26c561c..0000000 --- a/stdio/FreeBSD/vscanf.c.patch +++ /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 - __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 - #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/vsnprintf.c b/stdio/FreeBSD/vsnprintf.c index 1a20c99..5f9a295 100644 --- a/stdio/FreeBSD/vsnprintf.c +++ b/stdio/FreeBSD/vsnprintf.c @@ -36,19 +36,25 @@ static char sccsid[] = "@(#)vsnprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #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 index a765aae..0000000 --- a/stdio/FreeBSD/vsnprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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); -+} diff --git a/stdio/FreeBSD/vsprintf.c b/stdio/FreeBSD/vsprintf.c index 6cbc368..9b85352 100644 --- a/stdio/FreeBSD/vsprintf.c +++ b/stdio/FreeBSD/vsprintf.c @@ -36,23 +36,35 @@ static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #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 index 1a59860..0000000 --- a/stdio/FreeBSD/vsprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/vsscanf.c b/stdio/FreeBSD/vsscanf.c index 86a3837..7144259 100644 --- a/stdio/FreeBSD/vsscanf.c +++ b/stdio/FreeBSD/vsscanf.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $"); +#include "xlocale_private.h" + #include #include #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 index 1f13645..0000000 --- a/stdio/FreeBSD/vsscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #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/vswprintf.c b/stdio/FreeBSD/vswprintf.c index d2911c5..4227e74 100644 --- a/stdio/FreeBSD/vswprintf.c +++ b/stdio/FreeBSD/vswprintf.c @@ -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 #include #include @@ -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 index 9e5555c..0000000 --- a/stdio/FreeBSD/vswprintf.c.patch +++ /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 - #include - #include -@@ -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); -+} diff --git a/stdio/FreeBSD/vswscanf.c b/stdio/FreeBSD/vswscanf.c index 1c2648f..d688164 100644 --- a/stdio/FreeBSD/vswscanf.c +++ b/stdio/FreeBSD/vswscanf.c @@ -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 #include #include @@ -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 index a0a7584..0000000 --- a/stdio/FreeBSD/vswscanf.c.patch +++ /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 - #include - #include -@@ -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); -+} -+ diff --git a/stdio/FreeBSD/vwprintf.c b/stdio/FreeBSD/vwprintf.c index 4390c06..634f06d 100644 --- a/stdio/FreeBSD/vwprintf.c +++ b/stdio/FreeBSD/vwprintf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 2c01963..0000000 --- a/stdio/FreeBSD/vwprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/vwscanf.c b/stdio/FreeBSD/vwscanf.c index 6e103d5..3b2fb28 100644 --- a/stdio/FreeBSD/vwscanf.c +++ b/stdio/FreeBSD/vwscanf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 049cc49..0000000 --- a/stdio/FreeBSD/vwscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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)); - } diff --git a/stdio/FreeBSD/wbuf.c b/stdio/FreeBSD/wbuf.c index 4f1c4aa..9e9b59e 100644 --- a/stdio/FreeBSD/wbuf.c +++ b/stdio/FreeBSD/wbuf.c @@ -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 +#include #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 index f878a04..0000000 --- a/stdio/FreeBSD/wbuf.c.patch +++ /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 -+#include - #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/wprintf.3 b/stdio/FreeBSD/wprintf.3 index 39713e2..d1c3498 100644 --- a/stdio/FreeBSD/wprintf.3 +++ b/stdio/FreeBSD/wprintf.3 @@ -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 diff --git a/stdio/FreeBSD/wprintf.3.patch b/stdio/FreeBSD/wprintf.3.patch deleted file mode 100644 index ed363e1..0000000 --- a/stdio/FreeBSD/wprintf.3.patch +++ /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 diff --git a/stdio/FreeBSD/wprintf.c b/stdio/FreeBSD/wprintf.c index 4b5596e..42deed0 100644 --- a/stdio/FreeBSD/wprintf.c +++ b/stdio/FreeBSD/wprintf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index f4db718..0000000 --- a/stdio/FreeBSD/wprintf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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); diff --git a/stdio/FreeBSD/wscanf.3 b/stdio/FreeBSD/wscanf.3 index 21d32ab..54fa5d6 100644 --- a/stdio/FreeBSD/wscanf.3 +++ b/stdio/FreeBSD/wscanf.3 @@ -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 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 index 744d3e9..0000000 --- a/stdio/FreeBSD/wscanf.3.patch +++ /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 diff --git a/stdio/FreeBSD/wscanf.c b/stdio/FreeBSD/wscanf.c index 8629027..99dc48d 100644 --- a/stdio/FreeBSD/wscanf.c +++ b/stdio/FreeBSD/wscanf.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 4843b22..0000000 --- a/stdio/FreeBSD/wscanf.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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 index a22dde9..0000000 --- a/stdio/Makefile.inc +++ /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 index 6ed2784..0000000 --- a/stdio/_flock_stub-fbsd.c +++ /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 index 90c5617..0000000 --- a/stdio/asprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/asprintf.c,v 1.15 2009/03/02 04:11:42 das Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index c958cba..0000000 --- a/stdio/clrerr-fbsd.c +++ /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 index 22115fa..0000000 --- a/stdio/dprintf-fbsd.c +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 -#include -#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 index 91df68a..0000000 --- a/stdio/fclose-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fclose.c,v 1.12 2007/01/09 00:28:06 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#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 index dd8386c..0000000 --- a/stdio/fclose.3 +++ /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 index c49e36e..0000000 --- a/stdio/fdopen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fdopen.c,v 1.11 2008/05/10 18:39:20 antoine Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#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 index c1253c2..0000000 --- a/stdio/feof-fbsd.c +++ /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 index 5ad5a2f..0000000 --- a/stdio/ferror-fbsd.c +++ /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 index 4890b6d..0000000 --- a/stdio/ferror.3 +++ /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 index 7c83b75..0000000 --- a/stdio/fflush-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fflush.c,v 1.14 2007/01/09 00:28:06 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#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 index e6c2eaf..0000000 --- a/stdio/fflush.3 +++ /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 index bdb4e54..0000000 --- a/stdio/fgetc-fbsd.c +++ /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 index 8de4aa9..0000000 --- a/stdio/fgetln-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetln.c,v 1.11 2007/01/09 00:28:06 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#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 index 61a3391..0000000 --- a/stdio/fgetln.3 +++ /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 index 331e98f..0000000 --- a/stdio/fgetpos-fbsd.c +++ /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 index f32d128..0000000 --- a/stdio/fgets-fbsd.c +++ /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 index e9f5002..0000000 --- a/stdio/fgets.3 +++ /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 index ead24c3..0000000 --- a/stdio/fgetwc-fbsd.c +++ /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 -__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 -#include -#include -#include -#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 index 43485cb..0000000 --- a/stdio/fgetwln-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fgetwln.c,v 1.2 2004/08/06 17:00:09 tjr Exp $"); - -#include "namespace.h" -#include -#include -#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 index c38fb39..0000000 --- a/stdio/fgetwln.3 +++ /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 index 278e809..0000000 --- a/stdio/fgetws-fbsd.c +++ /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 -__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 -#include -#include -#include -#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 index 49c9d90..0000000 --- a/stdio/fgetws.3 +++ /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 index 45ad009..0000000 --- a/stdio/fileno-fbsd.c +++ /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 index 6cade0b..0000000 --- a/stdio/findfp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/findfp.c,v 1.34 2009/12/05 19:31:38 ed Exp $"); - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#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 = ; */ /* 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 index 3b90476..0000000 --- a/stdio/flags-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/flags.c,v 1.10 2007/01/09 00:28:06 imp Exp $"); - -#include -#include -#include -#include - -#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 index a04c54b..0000000 --- a/stdio/floatio.h +++ /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 index 924b9e5..0000000 --- a/stdio/flockfile.3 +++ /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 index df3deea..0000000 --- a/stdio/fopen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fopen.c,v 1.14 2008/04/22 17:03:32 jhb Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#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 index 3bb0c0f..0000000 --- a/stdio/fopen.3 +++ /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 index 76bca94..0000000 --- a/stdio/fprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fprintf.c,v 1.11 2007/01/09 00:28:06 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index 87455f1..0000000 --- a/stdio/fpurge-fbsd.c +++ /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 index c141df3..0000000 --- a/stdio/fputc-fbsd.c +++ /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 index 163541b..0000000 --- a/stdio/fputs-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fputs.c,v 1.12 2007/01/09 00:28:06 imp Exp $"); - -#include "namespace.h" -#include -#include -#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 index 4c4ca1e..0000000 --- a/stdio/fputs.3 +++ /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 index e835bc2..0000000 --- a/stdio/fputwc-fbsd.c +++ /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 -__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 -#include -#include -#include -#include -#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 index 1ff0484..0000000 --- a/stdio/fputws-fbsd.c +++ /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 -__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 -#include -#include -#include -#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 index d7326b2..0000000 --- a/stdio/fputws.3 +++ /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 index 544d94a..0000000 --- a/stdio/fread-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fread.c,v 1.16 2009/07/12 13:09:43 ed Exp $"); - -#include "namespace.h" -#include -#include -#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 index 1ba5005..0000000 --- a/stdio/fread.3 +++ /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 index 3451106..0000000 --- a/stdio/freopen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/freopen.c,v 1.21 2008/04/17 22:17:54 jhb Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#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 index 2db747e..0000000 --- a/stdio/fscanf-fbsd.c +++ /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 -__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 -#include -#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 index 9d9ddce..0000000 --- a/stdio/fseek-fbsd.c +++ /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 index edf7791..0000000 --- a/stdio/fseek.3 +++ /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 -.Fd #include -.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 index 513eb4a..0000000 --- a/stdio/fsetpos-fbsd.c +++ /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 index 8bb5716..0000000 --- a/stdio/ftell-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/ftell.c,v 1.27 2007/01/09 00:28:06 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#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 index 408f0f4..0000000 --- a/stdio/funopen-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/funopen.c,v 1.7 2009/12/05 19:31:38 ed Exp $"); - -#include -#include - -#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 index 0d1067a..0000000 --- a/stdio/funopen.3 +++ /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 index 82b857c..0000000 --- a/stdio/fvwrite-fbsd.c +++ /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 index 365b356..0000000 --- a/stdio/fvwrite.h +++ /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 index f72aef9..0000000 --- a/stdio/fwalk-fbsd.c +++ /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 index 76245a0..0000000 --- a/stdio/fwide-fbsd.c +++ /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 index 93163f3..0000000 --- a/stdio/fwide.3 +++ /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 index 5fefd4a..0000000 --- a/stdio/fwprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index b1910c1..0000000 --- a/stdio/fwrite-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fwrite.c,v 1.13 2009/07/12 13:09:43 ed Exp $"); - -#include "namespace.h" -#include -#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 index 4fefaea..0000000 --- a/stdio/fwscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/fwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 06a612e..0000000 --- a/stdio/getc-fbsd.c +++ /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 index b1c114b..0000000 --- a/stdio/getc.3 +++ /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 index 776594f..0000000 --- a/stdio/getchar-fbsd.c +++ /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 index d0d70e5..0000000 --- a/stdio/getdelim-fbsd.c +++ /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 index 4ac67a7..0000000 --- a/stdio/getline-fbsd.c +++ /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 index ddefe70..0000000 --- a/stdio/getline.3 +++ /dev/null @@ -1,135 +0,0 @@ -.\" Copyright (c) 2009 David Schultz -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index 4810abf..0000000 --- a/stdio/gets-fbsd.c +++ /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 index 2cb73af..0000000 --- a/stdio/getw-fbsd.c +++ /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 index 0128a77..0000000 --- a/stdio/getwc-fbsd.c +++ /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 -__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 -#include -#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 index d994aad..0000000 --- a/stdio/getwc.3 +++ /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 index f5c2dd6..0000000 --- a/stdio/getwchar-fbsd.c +++ /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 -__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 -#include -#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 index 5f05123..0000000 --- a/stdio/glue.h +++ /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 index 73958b7..0000000 --- a/stdio/local.h +++ /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 -#include "xlocale_private.h" -#include /* for off_t */ -#include -#include -#include -#include - -/* - * 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 index 17e45e2..0000000 --- a/stdio/makebuf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/makebuf.c,v 1.6 2007/01/09 00:28:07 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#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 index 5e288f8..0000000 --- a/stdio/mktemp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/mktemp.c,v 1.32 2010/02/28 13:31:29 jh Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index f55ceef..0000000 --- a/stdio/mktemp.3 +++ /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 -.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 index 4cbf19f..0000000 --- a/stdio/perror-fbsd.c +++ /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 index e65851a..0000000 --- a/stdio/printf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/printf.c,v 1.11 2007/01/09 00:28:07 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index 4de7aba..0000000 --- a/stdio/printf-pos-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include -#include -#include -#include - -#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 index 031d7f7..0000000 --- a/stdio/printf.3 +++ /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 -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 -#include -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 -#include -#include -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 index 27141e6..0000000 --- a/stdio/printfcommon.h +++ /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 -#include -#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 index f57e8e9..0000000 --- a/stdio/printflocal.h +++ /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 () - */ -#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 index 5d17899..0000000 --- a/stdio/putc-fbsd.c +++ /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 index b5370aa..0000000 --- a/stdio/putc.3 +++ /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 index 931f024..0000000 --- a/stdio/putchar-fbsd.c +++ /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 index 511cab4..0000000 --- a/stdio/puts-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/puts.c,v 1.11 2007/01/09 00:28:07 imp Exp $"); - -#include "namespace.h" -#include -#include -#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 index f7fa830..0000000 --- a/stdio/putw-fbsd.c +++ /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 index e854309..0000000 --- a/stdio/putwc-fbsd.c +++ /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 -__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 -#include -#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 index 84799bc..0000000 --- a/stdio/putwc.3 +++ /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 index bc3ef1f..0000000 --- a/stdio/putwchar-fbsd.c +++ /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 -__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 -#include -#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 index 8d42bbb..0000000 --- a/stdio/refill-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/refill.c,v 1.20 2008/04/17 22:17:54 jhb Exp $"); - -#include "namespace.h" -#include -#include -#include -#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 index 77af909..0000000 --- a/stdio/remove-fbsd.c +++ /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 index 5f10003..0000000 --- a/stdio/remove.3 +++ /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 index 3dc282d..0000000 --- a/stdio/rewind-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/rewind.c,v 1.12 2007/01/09 00:28:07 imp Exp $"); - -#include "namespace.h" -#include -#include -#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 index 6508de2..0000000 --- a/stdio/rget-fbsd.c +++ /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 index c2992ec..0000000 --- a/stdio/scanf-fbsd.c +++ /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 -__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 -#include -#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 index 4bf7240..0000000 --- a/stdio/scanf.3 +++ /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 index 329af07..0000000 --- a/stdio/setbuf-fbsd.c +++ /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 index 466d8b3..0000000 --- a/stdio/setbuf.3 +++ /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 index ee91e10..0000000 --- a/stdio/setbuffer-fbsd.c +++ /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 index dfc0b57..0000000 --- a/stdio/setvbuf-fbsd.c +++ /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 index 55f01cf..0000000 --- a/stdio/snprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/snprintf.c,v 1.22 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -#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 index f2cb3a9..0000000 --- a/stdio/sprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/sprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 16c313f..0000000 --- a/stdio/sscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/sscanf.c,v 1.13 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 5731d59..0000000 --- a/stdio/stdio-fbsd.c +++ /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 index 1cf1be6..0000000 --- a/stdio/stdio.3 +++ /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 - -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 - -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 index 698b6c8..0000000 --- a/stdio/swprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/swprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 4fc850a..0000000 --- a/stdio/swscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/swscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index adc2adf..0000000 --- a/stdio/tempnam-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/tempnam.c,v 1.11 2007/01/09 00:28:07 imp Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -__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 index 771e10e..0000000 --- a/stdio/tmpfile-fbsd.c +++ /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 index 6dad888..0000000 --- a/stdio/tmpnam-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/tmpnam.c,v 1.6 2007/01/09 00:28:07 imp Exp $"); - -#include - -#include -#include -#include -#include - -__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 index 5f377d9..0000000 --- a/stdio/tmpnam.3 +++ /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 index 3680701..0000000 --- a/stdio/ungetc-fbsd.c +++ /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 index 169a02b..0000000 --- a/stdio/ungetc.3 +++ /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 index 37e6402..0000000 --- a/stdio/ungetwc-fbsd.c +++ /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 -__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 -#include -#include -#include -#include -#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 index 726ec65..0000000 --- a/stdio/ungetwc.3 +++ /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 index d872a9e..0000000 --- a/stdio/vasprintf-fbsd.c +++ /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 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.19 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#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 index 5625bd6..0000000 --- a/stdio/vdprintf-fbsd.c +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__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 -#include -#include -#include -#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 index 3182836..0000000 --- a/stdio/vfprintf-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if 0 // xprintf pending API review -#include -#endif -#include - -#include -#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 index a3f9f3e..0000000 --- a/stdio/vfscanf-fbsd.c +++ /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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#include "collate.h" -#include "libc_private.h" -#include "local.h" - -#ifndef NO_FLOATING_POINT -#include -#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 index d085dcc..0000000 --- a/stdio/vfwprintf-fbsd.c +++ /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 -__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 - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#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 index bba07f2..0000000 --- a/stdio/vfwscanf-fbsd.c +++ /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 -__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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" - -#include "libc_private.h" -#include "local.h" - -#ifndef NO_FLOATING_POINT -#include -#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 index 894cd79..0000000 --- a/stdio/vprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vprintf.c,v 1.11 2007/01/09 00:28:08 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 397382e..0000000 --- a/stdio/vscanf-fbsd.c +++ /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 -__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 -#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 index 5f9a295..0000000 --- a/stdio/vsnprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vsnprintf.c,v 1.24 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index 9b85352..0000000 --- a/stdio/vsprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vsprintf.c,v 1.16 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index 7144259..0000000 --- a/stdio/vsscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.14 2008/04/17 22:17:54 jhb Exp $"); - -#include "xlocale_private.h" - -#include -#include -#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 index 4227e74..0000000 --- a/stdio/vswprintf-fbsd.c +++ /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 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -#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 -#include -#include -#include -#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 index d688164..0000000 --- a/stdio/vswscanf-fbsd.c +++ /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 -#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 -#include -#include -#include -#include -#include -#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 index 634f06d..0000000 --- a/stdio/vwprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vwprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 3b2fb28..0000000 --- a/stdio/vwscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/vwscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 9e9b59e..0000000 --- a/stdio/wbuf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/wbuf.c,v 1.12 2007/01/09 00:28:08 imp Exp $"); - -#include -#include -#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 index 42deed0..0000000 --- a/stdio/wprintf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/wprintf.c,v 1.1 2002/09/21 13:00:30 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index d1c3498..0000000 --- a/stdio/wprintf.3 +++ /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 index 99dc48d..0000000 --- a/stdio/wscanf-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdio/wscanf.c,v 1.1 2002/09/23 12:40:06 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include - -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 index 54fa5d6..0000000 --- a/stdio/wscanf.3 +++ /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 index 4f613d3..0000000 --- a/stdio/wsetup-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./wsetup.c \ No newline at end of file diff --git a/stdlib/FreeBSD/abort.3 b/stdlib/FreeBSD/abort.3 index c283b31..80ed972 100644 --- a/stdlib/FreeBSD/abort.3 +++ b/stdlib/FreeBSD/abort.3 @@ -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 index af99681..0000000 --- a/stdlib/FreeBSD/abort.3.patch +++ /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 diff --git a/stdlib/FreeBSD/abort.c b/stdlib/FreeBSD/abort.c index 50e34b0..0fcbb9e 100644 --- a/stdlib/FreeBSD/abort.c +++ b/stdlib/FreeBSD/abort.c @@ -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 +#include #include #include #include @@ -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); + + /* 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); + + /* 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); + + /* 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); + + /* 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: + * 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 index bb72417..0000000 --- a/stdlib/FreeBSD/abort.c.patch +++ /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 -+#include - #include - #include - #include -@@ -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); -+ -+ /* 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); -+ -+ /* 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); -+ -+ /* 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); -+ -+ /* 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: -+ * 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/abs.3 b/stdlib/FreeBSD/abs.3 index d53f7c1..9dc5299 100644 --- a/stdlib/FreeBSD/abs.3 +++ b/stdlib/FreeBSD/abs.3 @@ -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 diff --git a/stdlib/FreeBSD/abs.3.patch b/stdlib/FreeBSD/abs.3.patch deleted file mode 100644 index 6ea6642..0000000 --- a/stdlib/FreeBSD/abs.3.patch +++ /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 diff --git a/stdlib/FreeBSD/alloca.3 b/stdlib/FreeBSD/alloca.3 index 9866edf..492100a 100644 --- a/stdlib/FreeBSD/alloca.3 +++ b/stdlib/FreeBSD/alloca.3 @@ -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 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 index bf397fb..0000000 --- a/stdlib/FreeBSD/alloca.3.patch +++ /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 diff --git a/stdlib/FreeBSD/atexit.3 b/stdlib/FreeBSD/atexit.3 index bf40c80..b3d978b 100644 --- a/stdlib/FreeBSD/atexit.3 +++ b/stdlib/FreeBSD/atexit.3 @@ -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 diff --git a/stdlib/FreeBSD/atexit.3.patch b/stdlib/FreeBSD/atexit.3.patch deleted file mode 100644 index 5d23a79..0000000 --- a/stdlib/FreeBSD/atexit.3.patch +++ /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 diff --git a/stdlib/FreeBSD/atexit.c b/stdlib/FreeBSD/atexit.c index 05dad84..6acc776 100644 --- a/stdlib/FreeBSD/atexit.c +++ b/stdlib/FreeBSD/atexit.c @@ -41,14 +41,23 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp E #include #include #include +#if defined(__DYNAMIC__) || defined (__BLOCKS__) +#include +#endif /* defined(__DYNAMIC__) */ #include "atexit.h" #include "un-namespace.h" +#ifdef __BLOCKS__ +#include +#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 index a75ede0..0000000 --- a/stdlib/FreeBSD/atexit.c.patch +++ /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 - #include - #include -+#if defined(__DYNAMIC__) || defined (__BLOCKS__) -+#include -+#endif /* defined(__DYNAMIC__) */ - #include "atexit.h" - #include "un-namespace.h" - -+#ifdef __BLOCKS__ -+#include -+#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); diff --git a/stdlib/FreeBSD/atexit.h b/stdlib/FreeBSD/atexit.h index 94929b5..56220ef 100644 --- a/stdlib/FreeBSD/atexit.h +++ b/stdlib/FreeBSD/atexit.h @@ -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 index cea87c1..0000000 --- a/stdlib/FreeBSD/atexit.h.patch +++ /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); diff --git a/stdlib/FreeBSD/atof.3 b/stdlib/FreeBSD/atof.3 index e417e27..28f0870 100644 --- a/stdlib/FreeBSD/atof.3 +++ b/stdlib/FreeBSD/atof.3 @@ -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 index ae7bddc..0000000 --- a/stdlib/FreeBSD/atof.3.patch +++ /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 diff --git a/stdlib/FreeBSD/atof.c b/stdlib/FreeBSD/atof.c index 8ece097..fff3e7d 100644 --- a/stdlib/FreeBSD/atof.c +++ b/stdlib/FreeBSD/atof.c @@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atof.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); +#include "xlocale_private.h" + #include 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 index 35b0776..0000000 --- a/stdlib/FreeBSD/atof.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/atoi.3 b/stdlib/FreeBSD/atoi.3 index a73998e..3dc33e8 100644 --- a/stdlib/FreeBSD/atoi.3 +++ b/stdlib/FreeBSD/atoi.3 @@ -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 index a322d59..0000000 --- a/stdlib/FreeBSD/atoi.3.patch +++ /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 diff --git a/stdlib/FreeBSD/atoi.c b/stdlib/FreeBSD/atoi.c index 38ab632..ac6fcca 100644 --- a/stdlib/FreeBSD/atoi.c +++ b/stdlib/FreeBSD/atoi.c @@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); +#include "xlocale_private.h" + #include 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 index ed23851..0000000 --- a/stdlib/FreeBSD/atoi.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/atol.3 b/stdlib/FreeBSD/atol.3 index 68bf942..2c21151 100644 --- a/stdlib/FreeBSD/atol.3 +++ b/stdlib/FreeBSD/atol.3 @@ -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 index 6ad8177..0000000 --- a/stdlib/FreeBSD/atol.3.patch +++ /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 diff --git a/stdlib/FreeBSD/atol.c b/stdlib/FreeBSD/atol.c index 2209340..5e52d95 100644 --- a/stdlib/FreeBSD/atol.c +++ b/stdlib/FreeBSD/atol.c @@ -33,11 +33,22 @@ static char sccsid[] = "@(#)atol.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); +#include "xlocale_private.h" + #include 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 index 93958d9..0000000 --- a/stdlib/FreeBSD/atol.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/atoll.c b/stdlib/FreeBSD/atoll.c index c5bc881..c25a4da 100644 --- a/stdlib/FreeBSD/atoll.c +++ b/stdlib/FreeBSD/atoll.c @@ -30,11 +30,22 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); +#include "xlocale_private.h" + #include 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 index fb43ecf..0000000 --- a/stdlib/FreeBSD/atoll.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/bsearch.3 b/stdlib/FreeBSD/bsearch.3 index 5ae5867..857f800 100644 --- a/stdlib/FreeBSD/bsearch.3 +++ b/stdlib/FreeBSD/bsearch.3 @@ -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 diff --git a/stdlib/FreeBSD/bsearch.3.patch b/stdlib/FreeBSD/bsearch.3.patch deleted file mode 100644 index 4486b7d..0000000 --- a/stdlib/FreeBSD/bsearch.3.patch +++ /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 diff --git a/stdlib/FreeBSD/bsearch.c b/stdlib/FreeBSD/bsearch.c index b698869..6af4291 100644 --- a/stdlib/FreeBSD/bsearch.c +++ b/stdlib/FreeBSD/bsearch.c @@ -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 index 4d86020..0000000 --- a/stdlib/FreeBSD/bsearch.c.patch +++ /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__ */ diff --git a/stdlib/FreeBSD/div.3 b/stdlib/FreeBSD/div.3 index b29ca13..4a5bd35 100644 --- a/stdlib/FreeBSD/div.3 +++ b/stdlib/FreeBSD/div.3 @@ -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 , diff --git a/stdlib/FreeBSD/div.3.patch b/stdlib/FreeBSD/div.3.patch deleted file mode 100644 index 9d2d044..0000000 --- a/stdlib/FreeBSD/div.3.patch +++ /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 , diff --git a/stdlib/FreeBSD/exit.c b/stdlib/FreeBSD/exit.c index 8449600..aa23703 100644 --- a/stdlib/FreeBSD/exit.c +++ b/stdlib/FreeBSD/exit.c @@ -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 index 7afb640..0000000 --- a/stdlib/FreeBSD/exit.c.patch +++ /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); - } diff --git a/stdlib/FreeBSD/getenv.3 b/stdlib/FreeBSD/getenv.3 index fc19632..498a365 100644 --- a/stdlib/FreeBSD/getenv.3 +++ b/stdlib/FreeBSD/getenv.3 @@ -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 @@ 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 +.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 index 2e2be3b..0000000 --- a/stdlib/FreeBSD/getenv.3.patch +++ /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 -+.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.c b/stdlib/FreeBSD/getenv.c index b1e034a..47b60df 100644 --- a/stdlib/FreeBSD/getenv.c +++ b/stdlib/FreeBSD/getenv.c @@ -36,8 +36,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.8 2007/05/01 16:02:41 ache #include #include #include +#include -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 index 2155a0b..0000000 --- a/stdlib/FreeBSD/getenv.c.patch +++ /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 - #include - #include -+#include - --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())); - } diff --git a/stdlib/FreeBSD/getopt.c b/stdlib/FreeBSD/getopt.c index 375907a..c45494c 100644 --- a/stdlib/FreeBSD/getopt.c +++ b/stdlib/FreeBSD/getopt.c @@ -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 index b4b18e9..0000000 --- a/stdlib/FreeBSD/getopt.c.patch +++ /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; diff --git a/stdlib/FreeBSD/getsubopt.3 b/stdlib/FreeBSD/getsubopt.3 index 544e343..c1ddee2 100644 --- a/stdlib/FreeBSD/getsubopt.3 +++ b/stdlib/FreeBSD/getsubopt.3 @@ -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'' 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 index 9198467..0000000 --- a/stdlib/FreeBSD/getsubopt.3.patch +++ /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/heapsort_b-fbsd.c b/stdlib/FreeBSD/heapsort_b.c similarity index 100% rename from stdlib/heapsort_b-fbsd.c rename to stdlib/FreeBSD/heapsort_b.c diff --git a/stdlib/FreeBSD/heapsort_b.c.patch b/stdlib/FreeBSD/heapsort_b.c.patch deleted file mode 100644 index c1cab16..0000000 --- a/stdlib/FreeBSD/heapsort_b.c.patch +++ /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/heapsort_r-fbsd.c b/stdlib/FreeBSD/heapsort_r.c similarity index 100% rename from stdlib/heapsort_r-fbsd.c rename to stdlib/FreeBSD/heapsort_r.c diff --git a/stdlib/FreeBSD/heapsort_r.c.patch b/stdlib/FreeBSD/heapsort_r.c.patch deleted file mode 100644 index 04968f7..0000000 --- a/stdlib/FreeBSD/heapsort_r.c.patch +++ /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; diff --git a/stdlib/FreeBSD/imaxdiv.3 b/stdlib/FreeBSD/imaxdiv.3 index 2a6bad5..a9f5e12 100644 --- a/stdlib/FreeBSD/imaxdiv.3 +++ b/stdlib/FreeBSD/imaxdiv.3 @@ -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 @@ 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 index 8b7d615..0000000 --- a/stdlib/FreeBSD/imaxdiv.3.patch +++ /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 diff --git a/stdlib/FreeBSD/insque.3 b/stdlib/FreeBSD/insque.3 index 06f93bf..b1d47d6 100644 --- a/stdlib/FreeBSD/insque.3 +++ b/stdlib/FreeBSD/insque.3 @@ -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 index 8edc8e3..0000000 --- a/stdlib/FreeBSD/insque.3.patch +++ /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 diff --git a/stdlib/FreeBSD/labs.3 b/stdlib/FreeBSD/labs.3 index b38d8ad..b000955 100644 --- a/stdlib/FreeBSD/labs.3 +++ b/stdlib/FreeBSD/labs.3 @@ -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 , diff --git a/stdlib/FreeBSD/labs.3.patch b/stdlib/FreeBSD/labs.3.patch deleted file mode 100644 index baa4f45..0000000 --- a/stdlib/FreeBSD/labs.3.patch +++ /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 , diff --git a/stdlib/FreeBSD/ldiv.3 b/stdlib/FreeBSD/ldiv.3 index 492d508..904f0d5 100644 --- a/stdlib/FreeBSD/ldiv.3 +++ b/stdlib/FreeBSD/ldiv.3 @@ -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 diff --git a/stdlib/FreeBSD/ldiv.3.patch b/stdlib/FreeBSD/ldiv.3.patch deleted file mode 100644 index 107a217..0000000 --- a/stdlib/FreeBSD/ldiv.3.patch +++ /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 diff --git a/stdlib/FreeBSD/llabs.3 b/stdlib/FreeBSD/llabs.3 index a8238da..96b104f 100644 --- a/stdlib/FreeBSD/llabs.3 +++ b/stdlib/FreeBSD/llabs.3 @@ -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 , diff --git a/stdlib/FreeBSD/llabs.3.patch b/stdlib/FreeBSD/llabs.3.patch deleted file mode 100644 index 0ff3af8..0000000 --- a/stdlib/FreeBSD/llabs.3.patch +++ /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 , diff --git a/stdlib/FreeBSD/lldiv.3 b/stdlib/FreeBSD/lldiv.3 index 96ecf1a..98f4813 100644 --- a/stdlib/FreeBSD/lldiv.3 +++ b/stdlib/FreeBSD/lldiv.3 @@ -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 @@ 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 index b5320de..0000000 --- a/stdlib/FreeBSD/lldiv.3.patch +++ /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 diff --git a/stdlib/FreeBSD/lsearch.3 b/stdlib/FreeBSD/lsearch.3 index 3ad6f6c..5be997c 100644 --- a/stdlib/FreeBSD/lsearch.3 +++ b/stdlib/FreeBSD/lsearch.3 @@ -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 diff --git a/stdlib/FreeBSD/lsearch.3.patch b/stdlib/FreeBSD/lsearch.3.patch deleted file mode 100644 index ddf90a4..0000000 --- a/stdlib/FreeBSD/lsearch.3.patch +++ /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 diff --git a/stdlib/FreeBSD/memory.3 b/stdlib/FreeBSD/memory.3 index 3802a32..96cef24 100644 --- a/stdlib/FreeBSD/memory.3 +++ b/stdlib/FreeBSD/memory.3 @@ -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 +.Fd #include +.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 index 900b4cd..0000000 --- a/stdlib/FreeBSD/memory.3.patch +++ /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 -+.Fd #include -+.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/merge.c b/stdlib/FreeBSD/merge.c index 82acb0a..319f307 100644 --- a/stdlib/FreeBSD/merge.c +++ b/stdlib/FreeBSD/merge.c @@ -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 index 95d1c18..0000000 --- a/stdlib/FreeBSD/merge.c.patch +++ /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/merge_b-fbsd.c b/stdlib/FreeBSD/merge_b.c similarity index 100% rename from stdlib/merge_b-fbsd.c rename to stdlib/FreeBSD/merge_b.c diff --git a/stdlib/FreeBSD/merge_b.c.patch b/stdlib/FreeBSD/merge_b.c.patch deleted file mode 100644 index 7bf8e65..0000000 --- a/stdlib/FreeBSD/merge_b.c.patch +++ /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 - - 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/psort.3 b/stdlib/FreeBSD/psort.3 similarity index 100% rename from stdlib/psort.3 rename to stdlib/FreeBSD/psort.3 diff --git a/stdlib/psort-fbsd.c b/stdlib/FreeBSD/psort.c similarity index 100% rename from stdlib/psort-fbsd.c rename to stdlib/FreeBSD/psort.c diff --git a/stdlib/FreeBSD/psort_b.c b/stdlib/FreeBSD/psort_b.c new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/stdlib/FreeBSD/psort_b.c @@ -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 index 0000000..945c9b4 --- /dev/null +++ b/stdlib/FreeBSD/psort_r.c @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/stdlib/FreeBSD/putenv.c b/stdlib/FreeBSD/putenv.c index e74d346..a2c53be 100644 --- a/stdlib/FreeBSD/putenv.c +++ b/stdlib/FreeBSD/putenv.c @@ -35,22 +35,66 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/putenv.c,v 1.6 2007/05/01 16:02:41 ache #include #include +#include +#include +#include +#include + +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 index 47a412e..0000000 --- a/stdlib/FreeBSD/putenv.c.patch +++ /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 - #include -+#include -+#include -+#include -+#include -+#include -+ -+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 */ - } diff --git a/stdlib/FreeBSD/qsort.3 b/stdlib/FreeBSD/qsort.3 index 23a116c..f137a8d 100644 --- a/stdlib/FreeBSD/qsort.3 +++ b/stdlib/FreeBSD/qsort.3 @@ -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 @@ 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 index f511988..0000000 --- a/stdlib/FreeBSD/qsort.3.patch +++ /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 diff --git a/stdlib/FreeBSD/qsort.c b/stdlib/FreeBSD/qsort.c index 095ec8b..1d0e3c5 100644 --- a/stdlib/FreeBSD/qsort.c +++ b/stdlib/FreeBSD/qsort.c @@ -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 +#include #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 index c1fc970..0000000 --- a/stdlib/FreeBSD/qsort.c.patch +++ /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 -+#include - - #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 index 031e772..0000000 --- a/stdlib/FreeBSD/qsort_r.c.patch +++ /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" diff --git a/stdlib/FreeBSD/radixsort.c b/stdlib/FreeBSD/radixsort.c index 5e7c6dc..5208ce9 100644 --- a/stdlib/FreeBSD/radixsort.c +++ b/stdlib/FreeBSD/radixsort.c @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/radixsort.c,v 1.8 2007/01/09 00:28:10 im #include #include #include +#include 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 index 60f3cd6..0000000 --- a/stdlib/FreeBSD/radixsort.c.patch +++ /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 - #include - #include -+#include - - 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/rand.3 b/stdlib/FreeBSD/rand.3 index f470523..fec6ac6 100644 --- a/stdlib/FreeBSD/rand.3 +++ b/stdlib/FreeBSD/rand.3 @@ -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 , diff --git a/stdlib/FreeBSD/rand.3.patch b/stdlib/FreeBSD/rand.3.patch deleted file mode 100644 index f0944a2..0000000 --- a/stdlib/FreeBSD/rand.3.patch +++ /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 , diff --git a/stdlib/FreeBSD/random.3 b/stdlib/FreeBSD/random.3 index 4c3f061..84c8755 100644 --- a/stdlib/FreeBSD/random.3 +++ b/stdlib/FreeBSD/random.3 @@ -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 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 +.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 index 61c0621..0000000 --- a/stdlib/FreeBSD/random.3.patch +++ /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 -+.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.c b/stdlib/FreeBSD/random.c index 693550b..15db640 100644 --- a/stdlib/FreeBSD/random.c +++ b/stdlib/FreeBSD/random.c @@ -33,6 +33,14 @@ static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; #include __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 /* for srandomdev() */ #include /* 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 index d7feafa..0000000 --- a/stdlib/FreeBSD/random.c.patch +++ /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 - __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 /* for srandomdev() */ - #include /* 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/realpath.3 b/stdlib/FreeBSD/realpath.3 index dc6ba9a..3ffdf9c 100644 --- a/stdlib/FreeBSD/realpath.3 +++ b/stdlib/FreeBSD/realpath.3 @@ -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 +.Fd #include +.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 index f253985..0000000 --- a/stdlib/FreeBSD/realpath.3.patch +++ /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 -+.Fd #include -+.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.c b/stdlib/FreeBSD/realpath.c index 31e0977..234bce9 100644 --- a/stdlib/FreeBSD/realpath.c +++ b/stdlib/FreeBSD/realpath.c @@ -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 #include +#include #include #include #include #include +#include +#include #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 index 604474d..0000000 --- a/stdlib/FreeBSD/realpath.c.patch +++ /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 - #include -+#include - - #include - #include - #include - #include -+#include -+#include - #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. -+ */ - } - - /* diff --git a/stdlib/FreeBSD/setenv.c b/stdlib/FreeBSD/setenv.c index 6e0596e..7a12cea 100644 --- a/stdlib/FreeBSD/setenv.c +++ b/stdlib/FreeBSD/setenv.c @@ -36,81 +36,471 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/setenv.c,v 1.14 2007/05/01 16:02:41 ache #include #include #include +#include +#include +#include +#include -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 index 4d46b4f..0000000 --- a/stdlib/FreeBSD/setenv.c.patch +++ /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 - #include - #include -+#include -+#include -+#include -+#include -+#include - --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 */ - } diff --git a/stdlib/FreeBSD/strhash.c b/stdlib/FreeBSD/strhash.c index 022c45b..60cacbd 100644 --- a/stdlib/FreeBSD/strhash.c +++ b/stdlib/FreeBSD/strhash.c @@ -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 index fcd8c7c..0000000 --- a/stdlib/FreeBSD/strhash.c.patch +++ /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)){ diff --git a/stdlib/FreeBSD/strtod.3 b/stdlib/FreeBSD/strtod.3 index 42352b3..463553d 100644 --- a/stdlib/FreeBSD/strtod.3 +++ b/stdlib/FreeBSD/strtod.3 @@ -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 index 600a792..0000000 --- a/stdlib/FreeBSD/strtod.3.patch +++ /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 . diff --git a/stdlib/FreeBSD/strtoimax.c b/stdlib/FreeBSD/strtoimax.c index 09e073f..0c4c994 100644 --- a/stdlib/FreeBSD/strtoimax.c +++ b/stdlib/FreeBSD/strtoimax.c @@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtol.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 5725b73..0000000 --- a/stdlib/FreeBSD/strtoimax.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtol.3 b/stdlib/FreeBSD/strtol.3 index 42f7db3..6a6c99e 100644 --- a/stdlib/FreeBSD/strtol.3 +++ b/stdlib/FreeBSD/strtol.3 @@ -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 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 +.Fd #include +.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 index befb02b..0000000 --- a/stdlib/FreeBSD/strtol.3.patch +++ /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 -+.Fd #include -+.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.c b/stdlib/FreeBSD/strtol.c index 6bb1551..cac93b2 100644 --- a/stdlib/FreeBSD/strtol.c +++ b/stdlib/FreeBSD/strtol.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index d968ad7..0000000 --- a/stdlib/FreeBSD/strtol.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtoll.c b/stdlib/FreeBSD/strtoll.c index 80dac67..f7e11f3 100644 --- a/stdlib/FreeBSD/strtoll.c +++ b/stdlib/FreeBSD/strtoll.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 9510635..0000000 --- a/stdlib/FreeBSD/strtoll.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtoq.c b/stdlib/FreeBSD/strtoq.c index 0d101d5..9dd03e2 100644 --- a/stdlib/FreeBSD/strtoq.c +++ b/stdlib/FreeBSD/strtoq.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index b5a517d..0000000 --- a/stdlib/FreeBSD/strtoq.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - #include -@@ -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/strtoul.3 b/stdlib/FreeBSD/strtoul.3 index adc6643..91c759e 100644 --- a/stdlib/FreeBSD/strtoul.3 +++ b/stdlib/FreeBSD/strtoul.3 @@ -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 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 +.Fd #include +.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 index e9730cd..0000000 --- a/stdlib/FreeBSD/strtoul.3.patch +++ /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 -+.Fd #include -+.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.c b/stdlib/FreeBSD/strtoul.c index 76cd7b0..c7b5967 100644 --- a/stdlib/FreeBSD/strtoul.c +++ b/stdlib/FreeBSD/strtoul.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index 9c56431..0000000 --- a/stdlib/FreeBSD/strtoul.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtoull.c b/stdlib/FreeBSD/strtoull.c index 38d6194..8f2fd94 100644 --- a/stdlib/FreeBSD/strtoull.c +++ b/stdlib/FreeBSD/strtoull.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index fac7b63..0000000 --- a/stdlib/FreeBSD/strtoull.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtoumax.c b/stdlib/FreeBSD/strtoumax.c index f592063..22400a5 100644 --- a/stdlib/FreeBSD/strtoumax.c +++ b/stdlib/FreeBSD/strtoumax.c @@ -33,6 +33,8 @@ static char sccsid[] = "from @(#)strtoul.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include #include @@ -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 index fbbc5e0..0000000 --- a/stdlib/FreeBSD/strtoumax.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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()); -+} diff --git a/stdlib/FreeBSD/strtouq.c b/stdlib/FreeBSD/strtouq.c index 614c5b8..29f0f13 100644 --- a/stdlib/FreeBSD/strtouq.c +++ b/stdlib/FreeBSD/strtouq.c @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index cfeabed..0000000 --- a/stdlib/FreeBSD/strtouq.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - #include -@@ -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/system.3 b/stdlib/FreeBSD/system.3 index ba5fb6e..72bc6cb 100644 --- a/stdlib/FreeBSD/system.3 +++ b/stdlib/FreeBSD/system.3 @@ -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, diff --git a/stdlib/FreeBSD/system.3.patch b/stdlib/FreeBSD/system.3.patch deleted file mode 100644 index b202c83..0000000 --- a/stdlib/FreeBSD/system.3.patch +++ /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, diff --git a/stdlib/FreeBSD/system.c b/stdlib/FreeBSD/system.c index 8cdc1dd..c2a56c7 100644 --- a/stdlib/FreeBSD/system.c +++ b/stdlib/FreeBSD/system.c @@ -40,23 +40,61 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp #include #include #include +#include #include #include #include "un-namespace.h" #include "libc_private.h" +#include +#define environ (*_NSGetEnviron()) + +#if __DARWIN_UNIX03 +#include + +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 index 6691e7a..0000000 --- a/stdlib/FreeBSD/system.c.patch +++ /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 - #include - #include -+#include - #include - #include - #include "un-namespace.h" - #include "libc_private.h" - -+#include -+#define environ (*_NSGetEnviron()) -+ -+#if __DARWIN_UNIX03 -+#include -+ -+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/tsearch.3 b/stdlib/FreeBSD/tsearch.3 index d7121d4..9d7a863 100644 --- a/stdlib/FreeBSD/tsearch.3 +++ b/stdlib/FreeBSD/tsearch.3 @@ -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/FreeBSD/tsearch.3.patch b/stdlib/FreeBSD/tsearch.3.patch deleted file mode 100644 index 7e8355c..0000000 --- a/stdlib/FreeBSD/tsearch.3.patch +++ /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 index c33b883..0000000 --- a/stdlib/Makefile.inc +++ /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 diff --git a/stdlib/NetBSD/strfmon.3 b/stdlib/NetBSD/strfmon.3 index 7d7fe40..6b6976f 100644 --- a/stdlib/NetBSD/strfmon.3 +++ b/stdlib/NetBSD/strfmon.3 @@ -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 + #include + #include + + 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 index 1a72c21..0000000 --- a/stdlib/NetBSD/strfmon.3.patch +++ /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 -+ #include -+ #include -+ -+ 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.c b/stdlib/NetBSD/strfmon.c index d53ed7f..2afa835 100644 --- a/stdlib/NetBSD/strfmon.c +++ b/stdlib/NetBSD/strfmon.c @@ -41,6 +41,8 @@ __RCSID("$NetBSD: strfmon.c,v 1.7 2009/01/30 23:46:03 lukem Exp $"); #include #endif +#include "xlocale_private.h" + #include #include #include @@ -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 index 7e73ea7..0000000 --- a/stdlib/NetBSD/strfmon.c.patch +++ /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 - #endif - -+#include "xlocale_private.h" -+ - #include - #include - #include -@@ -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; -+} diff --git a/stdlib/OpenBSD/ecvt.3 b/stdlib/OpenBSD/ecvt.3 index 0717a2c..d8d663e 100644 --- a/stdlib/OpenBSD/ecvt.3 +++ b/stdlib/OpenBSD/ecvt.3 @@ -31,9 +31,9 @@ string .Sh SYNOPSIS .Fd #include .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 index 63e8b3b..0000000 --- a/stdlib/OpenBSD/ecvt.3.patch +++ /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 - .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.c b/stdlib/OpenBSD/ecvt.c index 03ff918..869674e 100644 --- a/stdlib/OpenBSD/ecvt.c +++ b/stdlib/OpenBSD/ecvt.c @@ -20,6 +20,7 @@ * Materiel Command, USAF, under agreement number F39502-99-1-0512. */ +#include #include #include #include @@ -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 index 96586f4..0000000 --- a/stdlib/OpenBSD/ecvt.c.patch +++ /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 - #include - #include - #include -@@ -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)); - } diff --git a/stdlib/OpenBSD/gcvt.c b/stdlib/OpenBSD/gcvt.c index e5488d9..703f783 100644 --- a/stdlib/OpenBSD/gcvt.c +++ b/stdlib/OpenBSD/gcvt.c @@ -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 index 63377e9..0000000 --- a/stdlib/OpenBSD/gcvt.c.patch +++ /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 index b2b392f..0000000 --- a/stdlib/_Exit_-fbsd.c +++ /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 index 0fcbb9e..0000000 --- a/stdlib/abort-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/abort.c,v 1.11 2007/01/09 00:28:09 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#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); - - /* 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); - - /* 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); - - /* 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); - - /* 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: - * 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 index 80ed972..0000000 --- a/stdlib/abort.3 +++ /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 index 9ff17c5..0000000 --- a/stdlib/abs-fbsd.c +++ /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 index 9dc5299..0000000 --- a/stdlib/abs.3 +++ /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 index 492100a..0000000 --- a/stdlib/alloca.3 +++ /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 index 6acc776..0000000 --- a/stdlib/atexit-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/atexit.c,v 1.8 2007/01/09 00:28:09 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#if defined(__DYNAMIC__) || defined (__BLOCKS__) -#include -#endif /* defined(__DYNAMIC__) */ -#include "atexit.h" -#include "un-namespace.h" - -#ifdef __BLOCKS__ -#include -#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 index b3d978b..0000000 --- a/stdlib/atexit.3 +++ /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/atof-fbsd.c b/stdlib/atof-fbsd.c deleted file mode 100644 index fff3e7d..0000000 --- a/stdlib/atof-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/atof.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 28f0870..0000000 --- a/stdlib/atof.3 +++ /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 index ac6fcca..0000000 --- a/stdlib/atoi-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/atoi.c,v 1.6 2007/01/09 00:28:09 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 3dc33e8..0000000 --- a/stdlib/atoi.3 +++ /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 index 5e52d95..0000000 --- a/stdlib/atol-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/atol.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 2c21151..0000000 --- a/stdlib/atol.3 +++ /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 index c25a4da..0000000 --- a/stdlib/atoll-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/atoll.c,v 1.5 2007/01/09 00:28:09 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 6af4291..0000000 --- a/stdlib/bsearch-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/bsearch.c,v 1.4 2007/01/09 00:28:09 imp Exp $"); - -#include -#include - -/* - * 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 index 857f800..0000000 --- a/stdlib/bsearch.3 +++ /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 index 9fce9b8..0000000 --- a/stdlib/div-fbsd.c +++ /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 index 4a5bd35..0000000 --- a/stdlib/div.3 +++ /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 index 869674e..0000000 --- a/stdlib/ecvt-obsd.c +++ /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 - * - * 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 -#include -#include -#include - -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 index d8d663e..0000000 --- a/stdlib/ecvt.3 +++ /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 -.\" -.\" 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 -.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 index aa23703..0000000 --- a/stdlib/exit-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/exit.c,v 1.9 2007/01/09 00:28:09 imp Exp $"); - -#include "namespace.h" -#include -#include -#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 index 9110a44..0000000 --- a/stdlib/exit.3 +++ /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 index 703f783..0000000 --- a/stdlib/gcvt-obsd.c +++ /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 - * - * 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 -#include -#include -#include - -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 index 47b60df..0000000 --- a/stdlib/getenv-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.8 2007/05/01 16:02:41 ache Exp $"); - -#include -#include -#include -#include - -__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 index 498a365..0000000 --- a/stdlib/getenv.3 +++ /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 -.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 index c45494c..0000000 --- a/stdlib/getopt-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/getopt.c,v 1.8 2007/01/09 00:28:10 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#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 index 67219ac..0000000 --- a/stdlib/getopt.3 +++ /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 index efa4ec8..0000000 --- a/stdlib/getopt_long-fbsd.c +++ /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 index 4cab876..0000000 --- a/stdlib/getopt_long.3 +++ /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 index 96dc064..0000000 --- a/stdlib/getsubopt-fbsd.c +++ /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 index c1ddee2..0000000 --- a/stdlib/getsubopt.3 +++ /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 index b06b592..0000000 --- a/stdlib/hcreate-fbsd.c +++ /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 index 94586da..0000000 --- a/stdlib/hcreate.3 +++ /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 index a549564..0000000 --- a/stdlib/heapsort-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./heapsort.c \ No newline at end of file diff --git a/stdlib/imaxabs-fbsd.c b/stdlib/imaxabs-fbsd.c deleted file mode 120000 index 2ec179f..0000000 --- a/stdlib/imaxabs-fbsd.c +++ /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 index da7c29d..0000000 --- a/stdlib/imaxabs.3 +++ /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 index e8331e0..0000000 --- a/stdlib/imaxdiv-fbsd.c +++ /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 index a9f5e12..0000000 --- a/stdlib/imaxdiv.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 2001 Mike Barcroft -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index 86c8bff..0000000 --- a/stdlib/insque-fbsd.c +++ /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 index b1d47d6..0000000 --- a/stdlib/insque.3 +++ /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 index 8c4a475..0000000 --- a/stdlib/labs-fbsd.c +++ /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 index b000955..0000000 --- a/stdlib/labs.3 +++ /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 index 0b50c5d..0000000 --- a/stdlib/ldiv-fbsd.c +++ /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 index 904f0d5..0000000 --- a/stdlib/ldiv.3 +++ /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 index 1eabe54..0000000 --- a/stdlib/llabs-fbsd.c +++ /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 index 96b104f..0000000 --- a/stdlib/llabs.3 +++ /dev/null @@ -1,62 +0,0 @@ -.\" Copyright (c) 2001 Mike Barcroft -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index 266ebc0..0000000 --- a/stdlib/lldiv-fbsd.c +++ /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 index 98f4813..0000000 --- a/stdlib/lldiv.3 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 2001 Mike Barcroft -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index 739569c..0000000 --- a/stdlib/lsearch-fbsd.c +++ /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 index 5be997c..0000000 --- a/stdlib/lsearch.3 +++ /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 index 96cef24..0000000 --- a/stdlib/memory.3 +++ /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 -.Fd #include -.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 index 319f307..0000000 --- a/stdlib/merge-fbsd.c +++ /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 -__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 - -#include -#include -#include - -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/psort.3.patch b/stdlib/psort.3.patch deleted file mode 100644 index 77aea36..0000000 --- a/stdlib/psort.3.patch +++ /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 index b718226..0000000 --- a/stdlib/psort.c.patch +++ /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 -+#include -+#include -+#include - #include -+#include -+#include -+#include -+#define __APPLE_API_PRIVATE -+#include - --#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 index a95ce60..0000000 --- a/stdlib/psort_b-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#define __APPLE_API_PRIVATE -#include - -#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 index a95ce60..0000000 --- a/stdlib/psort_r-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include -#define __APPLE_API_PRIVATE -#include - -#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 index 55ce0c1..0000000 --- a/stdlib/putenv-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/putenv.c,v 1.6 2007/05/01 16:02:41 ache Exp $"); - -#include -#include -#include -#include -#include -#include -#include - -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 index 1d0e3c5..0000000 --- a/stdlib/qsort-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/qsort.c,v 1.15 2008/01/14 09:21:34 das Exp $"); - -#include -#include - -#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 index f137a8d..0000000 --- a/stdlib/qsort.3 +++ /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 . diff --git a/stdlib/qsort_b-fbsd.c b/stdlib/qsort_b-fbsd.c index 81e27a9..17c0c50 100644 --- a/stdlib/qsort_b-fbsd.c +++ b/stdlib/qsort_b-fbsd.c @@ -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 index 684d15c..0000000 --- a/stdlib/qsort_r-fbsd.c +++ /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 index 5208ce9..0000000 --- a/stdlib/radixsort-fbsd.c +++ /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 -__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 -#include -#include -#include -#include - -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 index d5e498c..0000000 --- a/stdlib/radixsort.3 +++ /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 index a77f59d..0000000 --- a/stdlib/rand-fbsd.c +++ /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 index fec6ac6..0000000 --- a/stdlib/rand.3 +++ /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 index 15db640..0000000 --- a/stdlib/random-fbsd.c +++ /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 -__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 /* for srandomdev() */ -#include /* for srandomdev() */ -#include -#include -#include -#include /* 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 index 84c8755..0000000 --- a/stdlib/random.3 +++ /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 -.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 index 001360c..0000000 --- a/stdlib/reallocf-fbsd.c +++ /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 index 234bce9..0000000 --- a/stdlib/realpath-fbsd.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2003 Constantin S. Svintsoff - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/realpath.c,v 1.20 2003/05/28 08:23:01 fjoe Exp $"); - -#include "namespace.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#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 index 3ffdf9c..0000000 --- a/stdlib/realpath.3 +++ /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 -.Fd #include -.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 index f8680b9..0000000 --- a/stdlib/remque-fbsd.c +++ /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 index 8965a6a..0000000 --- a/stdlib/setenv-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/setenv.c,v 1.14 2007/05/01 16:02:41 ache Exp $"); - -#include -#include -#include -#include -#include -#include -#include -#include - -#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 index 2afa835..0000000 --- a/stdlib/strfmon-nbsd.c +++ /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 - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -#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 -#endif - -#include "xlocale_private.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* 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 index 6b6976f..0000000 --- a/stdlib/strfmon.3 +++ /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 -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 - #include - #include - - 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 index 60cacbd..0000000 --- a/stdlib/strhash-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strhash.c,v 1.10 2002/03/22 21:53:10 obrien Exp $"); - -#include -#include -#include -#include -#include - -#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 index 463553d..0000000 --- a/stdlib/strtod.3 +++ /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 index 0c4c994..0000000 --- a/stdlib/strtoimax-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -/* - * 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 index cac93b2..0000000 --- a/stdlib/strtol-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtol.c,v 1.20 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - - -/* - * 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 index 6a6c99e..0000000 --- a/stdlib/strtol.3 +++ /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 -.Fd #include -.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 index f7e11f3..0000000 --- a/stdlib/strtoll-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.22 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -/* - * 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 index 9dd03e2..0000000 --- a/stdlib/strtoq-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include - -#include - -/* - * 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 index c7b5967..0000000 --- a/stdlib/strtoul-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoul.c,v 1.19 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -/* - * 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 index 91c759e..0000000 --- a/stdlib/strtoul.3 +++ /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 -.Fd #include -.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 index 8f2fd94..0000000 --- a/stdlib/strtoull-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.21 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -/* - * 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 index 22400a5..0000000 --- a/stdlib/strtoumax-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.11 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include - -/* - * 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 index 29f0f13..0000000 --- a/stdlib/strtouq-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/strtouq.c,v 1.12 2007/01/09 00:28:10 imp Exp $"); - -#include "xlocale_private.h" - -#include - -#include - -/* - * 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 index c2a56c7..0000000 --- a/stdlib/system-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp Exp $"); - -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" -#include "libc_private.h" - -#include -#define environ (*_NSGetEnviron()) - -#if __DARWIN_UNIX03 -#include - -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 index 72bc6cb..0000000 --- a/stdlib/system.3 +++ /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 index 780001f..0000000 --- a/stdlib/tdelete-fbsd.c +++ /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 index a6149c5..0000000 --- a/stdlib/tfind-fbsd.c +++ /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 index 9a316ad..0000000 --- a/stdlib/tsearch-fbsd.c +++ /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 index 9d7a863..0000000 --- a/stdlib/tsearch.3 +++ /dev/null @@ -1,181 +0,0 @@ -.\" $NetBSD$ -.\" Copyright (c) 1997 Todd C. Miller -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must 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 index eef8457..0000000 --- a/stdlib/twalk-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./twalk.c \ No newline at end of file diff --git a/stdtime/FreeBSD/asctime.c b/stdtime/FreeBSD/asctime.c index 0a291df..89804ab 100644 --- a/stdtime/FreeBSD/asctime.c +++ b/stdtime/FreeBSD/asctime.c @@ -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 index 07e8113..0000000 --- a/stdtime/FreeBSD/asctime.c.patch +++ /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" diff --git a/stdtime/FreeBSD/ctime.3 b/stdtime/FreeBSD/ctime.3 index 5e7f3b7..7bcc80b 100644 --- a/stdtime/FreeBSD/ctime.3 +++ b/stdtime/FreeBSD/ctime.3 @@ -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 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 index b91ccb4..0000000 --- a/stdtime/FreeBSD/ctime.3.patch +++ /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 , diff --git a/stdtime/FreeBSD/ftime.3 b/stdtime/FreeBSD/ftime.3 index 7cee2be..4676bd8 100644 --- a/stdtime/FreeBSD/ftime.3 +++ b/stdtime/FreeBSD/ftime.3 @@ -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 @@ 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 +.Fd #include +.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 index 0f04f6c..0000000 --- a/stdtime/FreeBSD/ftime.3.patch +++ /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 -+.Fd #include -+.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/localtime.c b/stdtime/FreeBSD/localtime.c index 97b022c..7e3cd2a 100644 --- a/stdtime/FreeBSD/localtime.c +++ b/stdtime/FreeBSD/localtime.c @@ -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 #include +#include #include #include +#include +#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 +#include +#include +#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. + *----------------------------------------------------------------*/ + 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 index 67e338f..0000000 --- a/stdtime/FreeBSD/localtime.c.patch +++ /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 - #include -+#include - #include - #include -+#include -+#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 -+#include -+#include -+#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. -+ *----------------------------------------------------------------*/ -+ 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/strftime.3 b/stdtime/FreeBSD/strftime.3 index 1a8c9e7..5454a07 100644 --- a/stdtime/FreeBSD/strftime.3 +++ b/stdtime/FreeBSD/strftime.3 @@ -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 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 index 837ad75..0000000 --- a/stdtime/FreeBSD/strftime.3.patch +++ /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. diff --git a/stdtime/FreeBSD/strftime.c b/stdtime/FreeBSD/strftime.c index 197f1e9..0f0e524 100644 --- a/stdtime/FreeBSD/strftime.c +++ b/stdtime/FreeBSD/strftime.c @@ -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 #include #include #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 index cef5022..0000000 --- a/stdtime/FreeBSD/strftime.c.patch +++ /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 - #include - #include - #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 */ diff --git a/stdtime/FreeBSD/strptime.3 b/stdtime/FreeBSD/strptime.3 index 00e6b57..a9c25f9 100644 --- a/stdtime/FreeBSD/strptime.3 +++ b/stdtime/FreeBSD/strptime.3 @@ -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 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 index 026d9d0..0000000 --- a/stdtime/FreeBSD/strptime.3.patch +++ /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 diff --git a/stdtime/FreeBSD/strptime.c b/stdtime/FreeBSD/strptime.c index f1503f8..963410b 100644 --- a/stdtime/FreeBSD/strptime.c +++ b/stdtime/FreeBSD/strptime.c @@ -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 #include #include +#include #include #include #include +#include +#include #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 index 5bce7e0..0000000 --- a/stdtime/FreeBSD/strptime.c.patch +++ /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 - #include - #include -+#include - #include - #include - #include -+#include -+#include - #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); diff --git a/stdtime/FreeBSD/timelocal.c b/stdtime/FreeBSD/timelocal.c index 2aba03c..e3673be 100644 --- a/stdtime/FreeBSD/timelocal.c +++ b/stdtime/FreeBSD/timelocal.c @@ -28,15 +28,14 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $"); +#include "xlocale_private.h" + #include +#include #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 index fa75095..0000000 --- a/stdtime/FreeBSD/timelocal.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $"); - -+#include "xlocale_private.h" -+ - #include -+#include - - #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); - } diff --git a/stdtime/FreeBSD/timelocal.h b/stdtime/FreeBSD/timelocal.h index 0b0a59a..02806e8 100644 --- a/stdtime/FreeBSD/timelocal.h +++ b/stdtime/FreeBSD/timelocal.h @@ -29,6 +29,8 @@ #ifndef _TIMELOCAL_H_ #define _TIMELOCAL_H_ +#include + /* * 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 index 7aa22dd..0000000 --- a/stdtime/FreeBSD/timelocal.h.patch +++ /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 -+ - /* - * 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_ */ diff --git a/stdtime/FreeBSD/tzfile.5 b/stdtime/FreeBSD/tzfile.5 index 04ecce8..6dcbc27 100644 --- a/stdtime/FreeBSD/tzfile.5 +++ b/stdtime/FreeBSD/tzfile.5 @@ -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 index 7545cfc..0000000 --- a/stdtime/FreeBSD/tzfile.5.patch +++ /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 diff --git a/stdtime/FreeBSD/tzfile.h b/stdtime/FreeBSD/tzfile.h index 378d7ae..efa8416 100644 --- a/stdtime/FreeBSD/tzfile.h +++ b/stdtime/FreeBSD/tzfile.h @@ -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 index 4b7a18c..0000000 --- a/stdtime/FreeBSD/tzfile.h.patch +++ /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 index be72644..0000000 --- a/stdtime/Makefile.inc +++ /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 index 89804ab..0000000 --- a/stdtime/asctime-fbsd.c +++ /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 -#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 index 7bcc80b..0000000 --- a/stdtime/ctime.3 +++ /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 index 64af329..0000000 --- a/stdtime/difftime-fbsd.c +++ /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 index cdda967..0000000 --- a/stdtime/ftime-fbsd.c +++ /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 index 4676bd8..0000000 --- a/stdtime/ftime.3 +++ /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 -.Fd #include -.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 index 7e3cd2a..0000000 --- a/stdtime/localtime-fbsd.c +++ /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 -#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 -#include -#include -#include -#include -#include -#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 -#include -#include -#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. - *----------------------------------------------------------------*/ - 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 index af6f8e0..0000000 --- a/stdtime/private.h +++ /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 index 0f0e524..0000000 --- a/stdtime/strftime-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/stdtime/strftime.c,v 1.44 2009/06/09 09:02:58 delphij Exp $"); - -#include "tzfile.h" -#include -#include -#include -#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 index 5454a07..0000000 --- a/stdtime/strftime.3 +++ /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 index 963410b..0000000 --- a/stdtime/strptime-fbsd.c +++ /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 - * To: James FitzGibbon - * 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 -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#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 index a9c25f9..0000000 --- a/stdtime/strptime.3 +++ /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 index 88a474d..0000000 --- a/stdtime/time2posix.3 +++ /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 index 80a48d1..0000000 --- a/stdtime/time32-fbsd.c +++ /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 index e3673be..0000000 --- a/stdtime/timelocal-fbsd.c +++ /dev/null @@ -1,154 +0,0 @@ -/*- - * Copyright (c) 2001 Alexey Zelkin - * 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 -__FBSDID("$FreeBSD: src/lib/libc/stdtime/timelocal.c,v 1.25 2003/06/13 00:14:07 jkh Exp $"); - -#include "xlocale_private.h" - -#include -#include - -#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 index 02806e8..0000000 --- a/stdtime/timelocal.h +++ /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 - -/* - * 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 index 6dcbc27..0000000 --- a/stdtime/tzfile.5 +++ /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 index efa8416..0000000 --- a/stdtime/tzfile.h +++ /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 . -*/ -#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 */ diff --git a/string/FreeBSD/bcmp.3 b/string/FreeBSD/bcmp.3 index cf68665..67f456b 100644 --- a/string/FreeBSD/bcmp.3 +++ b/string/FreeBSD/bcmp.3 @@ -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 diff --git a/string/FreeBSD/bcmp.3.patch b/string/FreeBSD/bcmp.3.patch deleted file mode 100644 index ca7df14..0000000 --- a/string/FreeBSD/bcmp.3.patch +++ /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 diff --git a/string/FreeBSD/bcopy.3 b/string/FreeBSD/bcopy.3 index b7f511b..e0371a4 100644 --- a/string/FreeBSD/bcopy.3 +++ b/string/FreeBSD/bcopy.3 @@ -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.3.patch b/string/FreeBSD/bcopy.3.patch deleted file mode 100644 index c6bb7b8..0000000 --- a/string/FreeBSD/bcopy.3.patch +++ /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/stdlib/atexit.h b/string/FreeBSD/bcopy.c similarity index 87% rename from stdlib/atexit.h rename to string/FreeBSD/bcopy.c index 56220ef..f1cb0b5 100644 --- a/stdlib/atexit.h +++ b/string/FreeBSD/bcopy.c @@ -2,6 +2,9 @@ * 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: @@ -25,12 +28,5 @@ * LIABILITY, OR TORT (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/string/FreeBSD/bstring.3 b/string/FreeBSD/bstring.3 index aa3f361..4b34387 100644 --- a/string/FreeBSD/bstring.3 +++ b/string/FreeBSD/bstring.3 @@ -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 +.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 index e2604c9..0000000 --- a/string/FreeBSD/bstring.3.patch +++ /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 -+.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 , diff --git a/string/FreeBSD/bzero.3 b/string/FreeBSD/bzero.3 index 52d2684..642b2f1 100644 --- a/string/FreeBSD/bzero.3 +++ b/string/FreeBSD/bzero.3 @@ -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.3.patch b/string/FreeBSD/bzero.3.patch deleted file mode 100644 index 08ec1c7..0000000 --- a/string/FreeBSD/bzero.3.patch +++ /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/arm/string/strlcpy.s b/string/FreeBSD/bzero.c similarity index 100% rename from arm/string/strlcpy.s rename to string/FreeBSD/bzero.c diff --git a/string/FreeBSD/bzero.c.patch b/string/FreeBSD/bzero.c.patch deleted file mode 100644 index 1f2956a..0000000 --- a/string/FreeBSD/bzero.c.patch +++ /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" diff --git a/string/FreeBSD/ffs.3 b/string/FreeBSD/ffs.3 index 141b1be..d019b6d 100644 --- a/string/FreeBSD/ffs.3 +++ b/string/FreeBSD/ffs.3 @@ -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 . diff --git a/string/FreeBSD/ffs.3.patch b/string/FreeBSD/ffs.3.patch deleted file mode 100644 index e5cd57d..0000000 --- a/string/FreeBSD/ffs.3.patch +++ /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 . diff --git a/string/FreeBSD/index.3 b/string/FreeBSD/index.3 index 387b1eb..ecbbb63 100644 --- a/string/FreeBSD/index.3 +++ b/string/FreeBSD/index.3 @@ -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 index e015562..0000000 --- a/string/FreeBSD/index.3.patch +++ /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 diff --git a/string/FreeBSD/memccpy.3 b/string/FreeBSD/memccpy.3 index 416d0f8..02cfa37 100644 --- a/string/FreeBSD/memccpy.3 +++ b/string/FreeBSD/memccpy.3 @@ -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 , diff --git a/string/FreeBSD/memccpy.3.patch b/string/FreeBSD/memccpy.3.patch deleted file mode 100644 index cdbdd6e..0000000 --- a/string/FreeBSD/memccpy.3.patch +++ /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 , diff --git a/string/FreeBSD/memchr.3 b/string/FreeBSD/memchr.3 index 5581ccc..430441b 100644 --- a/string/FreeBSD/memchr.3 +++ b/string/FreeBSD/memchr.3 @@ -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 . diff --git a/string/FreeBSD/memchr.3.patch b/string/FreeBSD/memchr.3.patch deleted file mode 100644 index b0e9102..0000000 --- a/string/FreeBSD/memchr.3.patch +++ /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 . diff --git a/string/FreeBSD/memcmp.3 b/string/FreeBSD/memcmp.3 index 98d2b6a..f48f5d4 100644 --- a/string/FreeBSD/memcmp.3 +++ b/string/FreeBSD/memcmp.3 @@ -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 diff --git a/string/FreeBSD/memcmp.3.patch b/string/FreeBSD/memcmp.3.patch deleted file mode 100644 index 277a31d..0000000 --- a/string/FreeBSD/memcmp.3.patch +++ /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 diff --git a/string/FreeBSD/memcpy.3 b/string/FreeBSD/memcpy.3 index b34bc17..77bd719 100644 --- a/string/FreeBSD/memcpy.3 +++ b/string/FreeBSD/memcpy.3 @@ -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.3.patch b/string/FreeBSD/memcpy.3.patch deleted file mode 100644 index 631b4d7..0000000 --- a/string/FreeBSD/memcpy.3.patch +++ /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 index 0000000..ed03856 --- /dev/null +++ b/string/FreeBSD/memcpy.c @@ -0,0 +1,5 @@ +#include +__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 index 4e60f56..0000000 --- a/string/FreeBSD/memcpy.c.patch +++ /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" diff --git a/string/FreeBSD/memmove.3 b/string/FreeBSD/memmove.3 index 6cac604..64871c8 100644 --- a/string/FreeBSD/memmove.3 +++ b/string/FreeBSD/memmove.3 @@ -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.3.patch b/string/FreeBSD/memmove.3.patch deleted file mode 100644 index a303997..0000000 --- a/string/FreeBSD/memmove.3.patch +++ /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 index 0000000..05cf75a --- /dev/null +++ b/string/FreeBSD/memmove.c @@ -0,0 +1,5 @@ +#include +__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 index 1478a89..0000000 --- a/string/FreeBSD/memmove.c.patch +++ /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" diff --git a/string/FreeBSD/memset.3 b/string/FreeBSD/memset.3 index 73ffcec..701d739 100644 --- a/string/FreeBSD/memset.3 +++ b/string/FreeBSD/memset.3 @@ -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 index 2257b5b..0000000 --- a/string/FreeBSD/memset.3.patch +++ /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 diff --git a/string/FreeBSD/rindex.3 b/string/FreeBSD/rindex.3 index 2a2d1aa..f1a80e1 100644 --- a/string/FreeBSD/rindex.3 +++ b/string/FreeBSD/rindex.3 @@ -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 index 03b5fe5..0000000 --- a/string/FreeBSD/rindex.3.patch +++ /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 index ffbc0a2..0000000 --- a/string/FreeBSD/stpcpy.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/stpcpy.c,v 1.2 2009/02/28 06:05:37 das Exp $"); - -#include - -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 index 52f6149..0000000 --- a/string/FreeBSD/stpncpy.c +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/string/stpncpy.c,v 1.1 2009/02/28 06:00:58 das Exp $"); - -#include - -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); -} diff --git a/string/FreeBSD/strcasecmp.3 b/string/FreeBSD/strcasecmp.3 index 004b081..0d686a6 100644 --- a/string/FreeBSD/strcasecmp.3 +++ b/string/FreeBSD/strcasecmp.3 @@ -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 diff --git a/string/FreeBSD/strcasecmp.3.patch b/string/FreeBSD/strcasecmp.3.patch deleted file mode 100644 index c34f056..0000000 --- a/string/FreeBSD/strcasecmp.3.patch +++ /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 diff --git a/string/FreeBSD/strcasecmp.c b/string/FreeBSD/strcasecmp.c index 2e063bb..8299c16 100644 --- a/string/FreeBSD/strcasecmp.c +++ b/string/FreeBSD/strcasecmp.c @@ -33,38 +33,59 @@ static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; #include __FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $"); +#include "xlocale_private.h" + #include #include 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 index 22938eb..0000000 --- a/string/FreeBSD/strcasecmp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - - 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/strcasestr.c b/string/FreeBSD/strcasestr.c index 54c345b..e8f576f 100644 --- a/string/FreeBSD/strcasestr.c +++ b/string/FreeBSD/strcasestr.c @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $"); +#include "xlocale_private.h" + #include #include @@ -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 index 19818d7..0000000 --- a/string/FreeBSD/strcasestr.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - -@@ -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()); -+} diff --git a/string/FreeBSD/strcat.3 b/string/FreeBSD/strcat.3 index 00d0788..9eb86ec 100644 --- a/string/FreeBSD/strcat.3 +++ b/string/FreeBSD/strcat.3 @@ -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.3.patch b/string/FreeBSD/strcat.3.patch deleted file mode 100644 index 2351d2e..0000000 --- a/string/FreeBSD/strcat.3.patch +++ /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 index 8ebcf1b..0000000 --- a/string/FreeBSD/strcat.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strcat.c,v 1.8 2007/01/09 00:28:12 imp Exp $"); - -#include - -char * -strcat(char * __restrict s, const char * __restrict append) -{ - char *save = s; - - for (; *s; ++s); - while ((*s++ = *append++)); - return(save); -} diff --git a/string/FreeBSD/strchr.3 b/string/FreeBSD/strchr.3 index 278db74..512bc6f 100644 --- a/string/FreeBSD/strchr.3 +++ b/string/FreeBSD/strchr.3 @@ -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.3.patch b/string/FreeBSD/strchr.3.patch deleted file mode 100644 index d5ff416..0000000 --- a/string/FreeBSD/strchr.3.patch +++ /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 index ed9a447..0000000 --- a/string/FreeBSD/strchr.c.patch +++ /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" diff --git a/string/FreeBSD/strcmp.3 b/string/FreeBSD/strcmp.3 index 43acd33..e04b4dd 100644 --- a/string/FreeBSD/strcmp.3 +++ b/string/FreeBSD/strcmp.3 @@ -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.3.patch b/string/FreeBSD/strcmp.3.patch deleted file mode 100644 index 1e3d6b4..0000000 --- a/string/FreeBSD/strcmp.3.patch +++ /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/db/recno/recno.h b/string/FreeBSD/strcmp.c similarity index 85% rename from db/recno/recno.h rename to string/FreeBSD/strcmp.c index 26eb9f3..f1cb0b5 100644 --- a/db/recno/recno.h +++ b/string/FreeBSD/strcmp.c @@ -1,7 +1,10 @@ /*- - * Copyright (c) 1991, 1993 + * 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: @@ -25,12 +28,5 @@ * LIABILITY, OR TORT (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/string/FreeBSD/strcoll.3 b/string/FreeBSD/strcoll.3 index 8c18f77..fcbbbe1 100644 --- a/string/FreeBSD/strcoll.3 +++ b/string/FreeBSD/strcoll.3 @@ -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 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 index fc46410..0000000 --- a/string/FreeBSD/strcoll.3.patch +++ /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 diff --git a/string/FreeBSD/strcoll.c b/string/FreeBSD/strcoll.c index 65448df..3128289 100644 --- a/string/FreeBSD/strcoll.c +++ b/string/FreeBSD/strcoll.c @@ -28,58 +28,41 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $"); +#include "xlocale_private.h" + #include #include +#include +#include #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 index 58fc3c0..0000000 --- a/string/FreeBSD/strcoll.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include -+#include -+#include - #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/strcpy.3 b/string/FreeBSD/strcpy.3 index 4b719be..e1fbdc1 100644 --- a/string/FreeBSD/strcpy.3 +++ b/string/FreeBSD/strcpy.3 @@ -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.3.patch b/string/FreeBSD/strcpy.3.patch deleted file mode 100644 index d29e550..0000000 --- a/string/FreeBSD/strcpy.3.patch +++ /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 index 7489997..0000000 --- a/string/FreeBSD/strcpy.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strcpy.c,v 1.8 2007/01/09 00:28:12 imp Exp $"); - -#include - -char * -strcpy(char * __restrict to, const char * __restrict from) -{ - char *save = to; - - for (; (*to = *from); ++from, ++to); - return(save); -} diff --git a/string/FreeBSD/strcspn.3 b/string/FreeBSD/strcspn.3 index dc57aa1..938f80b 100644 --- a/string/FreeBSD/strcspn.3 +++ b/string/FreeBSD/strcspn.3 @@ -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 diff --git a/string/FreeBSD/strcspn.3.patch b/string/FreeBSD/strcspn.3.patch deleted file mode 100644 index 22519f0..0000000 --- a/string/FreeBSD/strcspn.3.patch +++ /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 diff --git a/string/FreeBSD/strdup.3 b/string/FreeBSD/strdup.3 index b9bf40c..688d317 100644 --- a/string/FreeBSD/strdup.3 +++ b/string/FreeBSD/strdup.3 @@ -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 diff --git a/string/FreeBSD/strdup.3.patch b/string/FreeBSD/strdup.3.patch deleted file mode 100644 index 5ef2029..0000000 --- a/string/FreeBSD/strdup.3.patch +++ /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 diff --git a/string/FreeBSD/strerror.3 b/string/FreeBSD/strerror.3 index b8223d2..f6f7510 100644 --- a/string/FreeBSD/strerror.3 +++ b/string/FreeBSD/strerror.3 @@ -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 @@ 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 index 3f34cd9..0000000 --- a/string/FreeBSD/strerror.3.patch +++ /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 . diff --git a/string/FreeBSD/strerror.c b/string/FreeBSD/strerror.c index 7da9796..63e8101 100644 --- a/string/FreeBSD/strerror.c +++ b/string/FreeBSD/strerror.c @@ -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 index 0b88960..0000000 --- a/string/FreeBSD/strerror.c.patch +++ /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); - } diff --git a/string/FreeBSD/string.3 b/string/FreeBSD/string.3 index 05f92f2..7f8f9ad 100644 --- a/string/FreeBSD/string.3 +++ b/string/FreeBSD/string.3 @@ -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" +.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 index ca6f33d..0000000 --- a/string/FreeBSD/string.3.patch +++ /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 index deec7d7..0000000 --- a/string/FreeBSD/strlcat.c +++ /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 - * - * 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 -__FBSDID("$FreeBSD: src/lib/libc/string/strlcat.c,v 1.12 2009/02/28 05:15:02 das Exp $"); - -#include -#include - -/* - * 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 */ -} diff --git a/string/FreeBSD/strlcpy.3 b/string/FreeBSD/strlcpy.3 index 1afd8d8..3cf8bc2 100644 --- a/string/FreeBSD/strlcpy.3 +++ b/string/FreeBSD/strlcpy.3 @@ -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 index e008fc6..0000000 --- a/string/FreeBSD/strlcpy.3.patch +++ /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 index 082ea3f..0000000 --- a/string/FreeBSD/strlcpy.c +++ /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 - * - * 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 -__FBSDID("$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.11 2009/02/28 05:15:02 das Exp $"); - -#include -#include - -/* - * 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 */ -} diff --git a/string/FreeBSD/strlen.c b/string/FreeBSD/strlen.c index 81269a2..66c9c6c 100644 --- a/string/FreeBSD/strlen.c +++ b/string/FreeBSD/strlen.c @@ -27,7 +27,7 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/strlen.c,v 1.7 2009/01/26 07:31:28 delphij Exp $"); -#include +#include #include #include diff --git a/string/FreeBSD/strmode.3 b/string/FreeBSD/strmode.3 index 4537bc9..704224e 100644 --- a/string/FreeBSD/strmode.3 +++ b/string/FreeBSD/strmode.3 @@ -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/strmode.3.patch b/string/FreeBSD/strmode.3.patch deleted file mode 100644 index 889c378..0000000 --- a/string/FreeBSD/strmode.3.patch +++ /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 index a9b5d7c..0000000 --- a/string/FreeBSD/strncat.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strncat.c,v 1.7 2007/01/09 00:28:12 imp Exp $"); - -#include - -/* - * 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 index c2e11f9..0000000 --- a/string/FreeBSD/strncpy.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strncpy.c,v 1.8 2009/02/03 17:58:20 danger Exp $"); - -#include - -/* - * 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); -} diff --git a/string/FreeBSD/strpbrk.3 b/string/FreeBSD/strpbrk.3 index 105febe..30db8c2 100644 --- a/string/FreeBSD/strpbrk.3 +++ b/string/FreeBSD/strpbrk.3 @@ -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/strpbrk.3.patch b/string/FreeBSD/strpbrk.3.patch deleted file mode 100644 index cd2c7b6..0000000 --- a/string/FreeBSD/strpbrk.3.patch +++ /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 index 785cbbf..0000000 --- a/string/FreeBSD/strrchr.3 +++ /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 index 2e8fe81..0000000 --- a/string/FreeBSD/strrchr.3.patch +++ /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 index d31740f..0000000 --- a/string/FreeBSD/strrchr.c.patch +++ /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" diff --git a/string/FreeBSD/strsignal.c b/string/FreeBSD/strsignal.c index b5453a1..7806d63 100644 --- a/string/FreeBSD/strsignal.c +++ b/string/FreeBSD/strsignal.c @@ -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 index 4df57ad..0000000 --- a/string/FreeBSD/strsignal.c.patch +++ /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; diff --git a/string/FreeBSD/strspn.3 b/string/FreeBSD/strspn.3 index a976bf9..fcd199c 100644 --- a/string/FreeBSD/strspn.3 +++ b/string/FreeBSD/strspn.3 @@ -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 diff --git a/string/FreeBSD/strspn.3.patch b/string/FreeBSD/strspn.3.patch deleted file mode 100644 index a161f12..0000000 --- a/string/FreeBSD/strspn.3.patch +++ /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 diff --git a/string/FreeBSD/strstr.3 b/string/FreeBSD/strstr.3 index 80b383e..70fbda4 100644 --- a/string/FreeBSD/strstr.3 +++ b/string/FreeBSD/strstr.3 @@ -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, 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 index ff2b12f..0000000 --- a/string/FreeBSD/strstr.3.patch +++ /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 diff --git a/string/FreeBSD/strtok.3 b/string/FreeBSD/strtok.3 index fff792e..25b9179 100644 --- a/string/FreeBSD/strtok.3 +++ b/string/FreeBSD/strtok.3 @@ -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 diff --git a/string/FreeBSD/strtok.3.patch b/string/FreeBSD/strtok.3.patch deleted file mode 100644 index cf057c6..0000000 --- a/string/FreeBSD/strtok.3.patch +++ /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 diff --git a/string/FreeBSD/strxfrm.3 b/string/FreeBSD/strxfrm.3 index c32ea5c..d6ded5b 100644 --- a/string/FreeBSD/strxfrm.3 +++ b/string/FreeBSD/strxfrm.3 @@ -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 diff --git a/string/FreeBSD/strxfrm.3.patch b/string/FreeBSD/strxfrm.3.patch deleted file mode 100644 index 5dce9b9..0000000 --- a/string/FreeBSD/strxfrm.3.patch +++ /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 diff --git a/string/FreeBSD/strxfrm.c b/string/FreeBSD/strxfrm.c index 9ef2e87..b1a70dd 100644 --- a/string/FreeBSD/strxfrm.c +++ b/string/FreeBSD/strxfrm.c @@ -28,46 +28,118 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $"); +#include "xlocale_private.h" + #include #include +#include +#include #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 index 5178604..0000000 --- a/string/FreeBSD/strxfrm.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include -+#include -+#include - #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/swab.3 b/string/FreeBSD/swab.3 index d42143d..82468db 100644 --- a/string/FreeBSD/swab.3 +++ b/string/FreeBSD/swab.3 @@ -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 diff --git a/string/FreeBSD/swab.3.patch b/string/FreeBSD/swab.3.patch deleted file mode 100644 index f85ec9c..0000000 --- a/string/FreeBSD/swab.3.patch +++ /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 diff --git a/string/FreeBSD/swab.c b/string/FreeBSD/swab.c index fae6e56..1d55327 100644 --- a/string/FreeBSD/swab.c +++ b/string/FreeBSD/swab.c @@ -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 index 5565deb..0000000 --- a/string/FreeBSD/swab.c.patch +++ /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; diff --git a/string/FreeBSD/wcscasecmp.c b/string/FreeBSD/wcscasecmp.c index 8618c50..f158b14 100644 --- a/string/FreeBSD/wcscasecmp.c +++ b/string/FreeBSD/wcscasecmp.c @@ -27,19 +27,27 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); +#include "xlocale_private.h" + #include #include 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 index aa62f56..0000000 --- a/string/FreeBSD/wcscasecmp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - - 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/wcscoll.3 b/string/FreeBSD/wcscoll.3 index 819ae87..df534cb 100644 --- a/string/FreeBSD/wcscoll.3 +++ b/string/FreeBSD/wcscoll.3 @@ -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 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 index 50a59cc..0000000 --- a/string/FreeBSD/wcscoll.3.patch +++ /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 diff --git a/string/FreeBSD/wcscoll.c b/string/FreeBSD/wcscoll.c index 5095158..ce09e41 100644 --- a/string/FreeBSD/wcscoll.c +++ b/string/FreeBSD/wcscoll.c @@ -27,72 +27,222 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); +#include "xlocale_private.h" + #include #include #include #include #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 index 5f0d2e9..0000000 --- a/string/FreeBSD/wcscoll.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - #include - #include - #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/wcsncasecmp.c b/string/FreeBSD/wcsncasecmp.c index 436a324..167fac1 100644 --- a/string/FreeBSD/wcsncasecmp.c +++ b/string/FreeBSD/wcsncasecmp.c @@ -27,19 +27,21 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); +#include "xlocale_private.h" + #include #include 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 index d1d04e6..0000000 --- a/string/FreeBSD/wcsncasecmp.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); - -+#include "xlocale_private.h" -+ - #include - #include - - 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()); -+} -+ diff --git a/string/FreeBSD/wcstok.3 b/string/FreeBSD/wcstok.3 index 4ddfb04..2b8de3f 100644 --- a/string/FreeBSD/wcstok.3 +++ b/string/FreeBSD/wcstok.3 @@ -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 @@ 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 index 233597e..0000000 --- a/string/FreeBSD/wcstok.3.patch +++ /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. diff --git a/string/FreeBSD/wcswidth.3 b/string/FreeBSD/wcswidth.3 index 973bfe0..07eb058 100644 --- a/string/FreeBSD/wcswidth.3 +++ b/string/FreeBSD/wcswidth.3 @@ -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 @@ 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 index e679795..0000000 --- a/string/FreeBSD/wcswidth.3.patch +++ /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 diff --git a/string/FreeBSD/wcswidth.c b/string/FreeBSD/wcswidth.c index 5a38012..447c8e5 100644 --- a/string/FreeBSD/wcswidth.c +++ b/string/FreeBSD/wcswidth.c @@ -38,20 +38,30 @@ #include __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $"); +#include "xlocale_private.h" + #include 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 index e674206..0000000 --- a/string/FreeBSD/wcswidth.c.patch +++ /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 - __FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $"); - -+#include "xlocale_private.h" -+ - #include - - 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/wcsxfrm.3 b/string/FreeBSD/wcsxfrm.3 index 16087fd..038c7c7 100644 --- a/string/FreeBSD/wcsxfrm.3 +++ b/string/FreeBSD/wcsxfrm.3 @@ -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. diff --git a/string/FreeBSD/wcsxfrm.3.patch b/string/FreeBSD/wcsxfrm.3.patch deleted file mode 100644 index f6bc4a1..0000000 --- a/string/FreeBSD/wcsxfrm.3.patch +++ /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. diff --git a/string/FreeBSD/wcsxfrm.c b/string/FreeBSD/wcsxfrm.c index 7aea3d1..eae9360 100644 --- a/string/FreeBSD/wcsxfrm.c +++ b/string/FreeBSD/wcsxfrm.c @@ -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 #include #include +#include #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 index a1a9e0c..0000000 --- a/string/FreeBSD/wcsxfrm.c.patch +++ /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 - #include - #include -+#include - #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()); - } diff --git a/string/FreeBSD/wmemchr.3 b/string/FreeBSD/wmemchr.3 index 41b0ac0..2e1d3ec 100644 --- a/string/FreeBSD/wmemchr.3 +++ b/string/FreeBSD/wmemchr.3 @@ -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/FreeBSD/wmemchr.3.patch b/string/FreeBSD/wmemchr.3.patch deleted file mode 100644 index b2ba5da..0000000 --- a/string/FreeBSD/wmemchr.3.patch +++ /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 index 41191f6..0000000 --- a/string/Makefile.inc +++ /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 index 354ed88..0000000 --- a/string/bcmp-fbsd.c +++ /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 index 67f456b..0000000 --- a/string/bcmp.3 +++ /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 index e0371a4..0000000 --- a/string/bcopy.3 +++ /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 index 4b34387..0000000 --- a/string/bstring.3 +++ /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 -.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 index 642b2f1..0000000 --- a/string/bzero.3 +++ /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 index d019b6d..0000000 --- a/string/ffs.3 +++ /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 index d789f40..0000000 --- a/string/index-fbsd.c +++ /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 index ecbbb63..0000000 --- a/string/index.3 +++ /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 index 44404f4..0000000 --- a/string/memccpy-fbsd.c +++ /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 index 02cfa37..0000000 --- a/string/memccpy.3 +++ /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 index c6fcee6..0000000 --- a/string/memchr-fbsd.c +++ /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 index 430441b..0000000 --- a/string/memchr.3 +++ /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 index d50831d..0000000 --- a/string/memcmp-fbsd.c +++ /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 index f48f5d4..0000000 --- a/string/memcmp.3 +++ /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 index 77bd719..0000000 --- a/string/memcpy.3 +++ /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 index 845d9f1..0000000 --- a/string/memmem-fbsd.c +++ /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 index 9b3234e..0000000 --- a/string/memmem.3 +++ /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 index 64871c8..0000000 --- a/string/memmove.3 +++ /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 index 0ea82de..0000000 --- a/string/memset-fbsd.c +++ /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 index 701d739..0000000 --- a/string/memset.3 +++ /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 index 0000000..ebeb780 --- /dev/null +++ b/string/memset_pattern.c @@ -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 + +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 index 648088c..0000000 --- a/string/rindex-fbsd.c +++ /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 index f1a80e1..0000000 --- a/string/rindex.3 +++ /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 index 64749ca..0000000 --- a/string/stpcpy-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./stpcpy.c \ No newline at end of file diff --git a/internat/NXIsAscii.c b/string/stpcpy.c similarity index 66% rename from internat/NXIsAscii.c rename to string/stpcpy.c index fc6f4bf..4e909ac 100644 --- a/internat/NXIsAscii.c +++ b/string/stpcpy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,17 +20,16 @@ * * @APPLE_LICENSE_HEADER_END@ */ -/* - * Copyright 1990, NeXT, Inc. - */ -#include "NXCType.h" -#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF +#include -int -NXIsAscii(c) - unsigned int c; -{ - FIXSIGNEDCHAR(c); - return (c <= 0177); +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 index 9e47db9..0000000 --- a/string/stpncpy-fbsd.c +++ /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 index 0000000..44c35bd --- /dev/null +++ b/string/stpncpy.c @@ -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 + +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 index 8299c16..0000000 --- a/string/strcasecmp-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strcasecmp.c,v 1.8 2009/02/03 17:58:20 danger Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index 0d686a6..0000000 --- a/string/strcasecmp.3 +++ /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 index e8f576f..0000000 --- a/string/strcasestr-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $"); - -#include "xlocale_private.h" - -#include -#include - -/* - * 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 index 6dc4b61..0000000 --- a/string/strcat-fbsd.c +++ /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 index 9eb86ec..0000000 --- a/string/strcat.3 +++ /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 index 0000000..4933817 --- /dev/null +++ b/string/strcat.c @@ -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 + +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 index 26433c0..0000000 --- a/string/strchr-fbsd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -__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 index 512bc6f..0000000 --- a/string/strchr.3 +++ /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 index e04b4dd..0000000 --- a/string/strcmp.3 +++ /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 index 3128289..0000000 --- a/string/strcoll-fbsd.c +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants - * 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 -__FBSDID("$FreeBSD: src/lib/libc/string/strcoll.c,v 1.14 2009/02/03 17:58:20 danger Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index fcbbbe1..0000000 --- a/string/strcoll.3 +++ /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 index 39cf6f7..0000000 --- a/string/strcpy-fbsd.c +++ /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 index e1fbdc1..0000000 --- a/string/strcpy.3 +++ /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/internat/NXIsAlpha.c b/string/strcpy.c similarity index 69% rename from internat/NXIsAlpha.c rename to string/strcpy.c index 509673d..dda3813 100644 --- a/internat/NXIsAlpha.c +++ b/string/strcpy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,19 +20,15 @@ * * @APPLE_LICENSE_HEADER_END@ */ -/* - * Copyright 1990, NeXT, Inc. - */ - -#include "NXCType.h" -#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF +#include -int NXIsAlpha(c) - unsigned int c; -{ - FIXSIGNEDCHAR(c); - if (c < 256) - return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_U|_CTYPE_L))); - return 0; +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 index c86ab8c..0000000 --- a/string/strcspn-fbsd.c +++ /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 index 938f80b..0000000 --- a/string/strcspn.3 +++ /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 index e2aeecc..0000000 --- a/string/strdup-fbsd.c +++ /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 index 688d317..0000000 --- a/string/strdup.3 +++ /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 index 63e8101..0000000 --- a/string/strerror-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/strerror.c,v 1.16 2007/01/09 00:28:12 imp Exp $"); - -#if defined(NLS) -#include -#endif - -#include -#include -#include -#include - -#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 index f6f7510..0000000 --- a/string/strerror.3 +++ /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 index 7f8f9ad..0000000 --- a/string/string.3 +++ /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 index 8828d3f..0000000 --- a/string/strlcat-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./strlcat.c \ No newline at end of file diff --git a/internat/NXIsCntrl.c b/string/strlcat.c similarity index 64% rename from internat/NXIsCntrl.c rename to string/strlcat.c index 53263d0..ac44163 100644 --- a/internat/NXIsCntrl.c +++ b/string/strlcat.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,18 +20,19 @@ * * @APPLE_LICENSE_HEADER_END@ */ -/* - * Copyright 1990, NeXT, Inc. - */ -#include "NXCType.h" -#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF +#include -int NXIsCntrl(c) - unsigned int c; -{ - FIXSIGNEDCHAR(c); - if (c < 256) - return ((unsigned int)((_NX_CTypeTable_ + 1)[c] & (_CTYPE_C))); - return 0; +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 index f63c48d..0000000 --- a/string/strlcpy-fbsd.c +++ /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 index 3cf8bc2..0000000 --- a/string/strlcpy.3 +++ /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 -.\" -.\" 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/internat/NXIsAlNum.c b/string/strlcpy.c similarity index 70% rename from internat/NXIsAlNum.c rename to string/strlcpy.c index 35670e0..763d309 100644 --- a/internat/NXIsAlNum.c +++ b/string/strlcpy.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * Copyright (c) 2011 Apple, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * @@ -20,18 +20,17 @@ * * @APPLE_LICENSE_HEADER_END@ */ -/* - * Copyright 1990, NeXT, Inc. - */ -#include "NXCType.h" -#define FIXSIGNEDCHAR(i) if ((i & 0xFFFFFF80) == 0xFFFFFF80) i &= 0x000000FF +#include -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; +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 index 2261013..0000000 --- a/string/strlen-fbsd.c +++ /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 index de61b5f..0000000 --- a/string/strlen.3 +++ /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 index baa76fd..0000000 --- a/string/strmode-fbsd.c +++ /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 index 704224e..0000000 --- a/string/strmode.3 +++ /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 index b375d5e..0000000 --- a/string/strncat-fbsd.c +++ /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 index 0000000..ed88ee6 --- /dev/null +++ b/string/strncat.c @@ -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 + +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 index 7816922..0000000 --- a/string/strncmp-fbsd.c +++ /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 index 1b81656..0000000 --- a/string/strncpy-fbsd.c +++ /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 index 0000000..5db7554 --- /dev/null +++ b/string/strncpy.c @@ -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 + +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 index 2d7b8d4..0000000 --- a/string/strndup-fbsd.c +++ /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 index e1a5577..0000000 --- a/string/strnlen-fbsd.c +++ /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 index 98aea3e..0000000 --- a/string/strnstr-fbsd.c +++ /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 index d21223d..0000000 --- a/string/strpbrk-fbsd.c +++ /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 index 30db8c2..0000000 --- a/string/strpbrk.3 +++ /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 index bdf8f06..0000000 --- a/string/strrchr-fbsd.c +++ /dev/null @@ -1,5 +0,0 @@ -#include -__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 index ef14451..0000000 --- a/string/strrchr.3 +++ /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 index acbe4c2..0000000 --- a/string/strsep-fbsd.c +++ /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 index 5d61434..0000000 --- a/string/strsep.3 +++ /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 index 7806d63..0000000 --- a/string/strsignal-fbsd.c +++ /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 -__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 -#endif -#include -#include -#include -#include -#include -#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 index 2b2b2b8..0000000 --- a/string/strspn-fbsd.c +++ /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 index fcd199c..0000000 --- a/string/strspn.3 +++ /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 index ec3a758..0000000 --- a/string/strstr-fbsd.c +++ /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 index 70fbda4..0000000 --- a/string/strstr.3 +++ /dev/null @@ -1,174 +0,0 @@ -.\" Copyright (c) 2001 Mike Barcroft -.\" 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 index 48d8517..0000000 --- a/string/strtok-fbsd.c +++ /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 index 25b9179..0000000 --- a/string/strtok.3 +++ /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 -.\" -.\" 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 index b1a70dd..0000000 --- a/string/strxfrm-fbsd.c +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants - * 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 -__FBSDID("$FreeBSD: src/lib/libc/string/strxfrm.c,v 1.17 2008/10/19 09:10:44 delphij Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index d6ded5b..0000000 --- a/string/strxfrm.3 +++ /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 index 1d55327..0000000 --- a/string/swab-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/swab.c,v 1.7 2007/01/09 00:28:12 imp Exp $"); - -#include - -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 index 82468db..0000000 --- a/string/swab.3 +++ /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 index e189c60..0000000 --- a/string/wcpcpy-fbsd.c +++ /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 index 7ca173a..0000000 --- a/string/wcpncpy-fbsd.c +++ /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 index f158b14..0000000 --- a/string/wcscasecmp-fbsd.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/string/wcscasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index 530f0a9..0000000 --- a/string/wcscat-fbsd.c +++ /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 index 4d19f9f..0000000 --- a/string/wcschr-fbsd.c +++ /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 index 825a844..0000000 --- a/string/wcscmp-fbsd.c +++ /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 index ce09e41..0000000 --- a/string/wcscoll-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/wcscoll.c,v 1.3 2004/04/07 09:47:56 tjr Exp $"); - -#include "xlocale_private.h" - -#include -#include -#include -#include -#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 index df534cb..0000000 --- a/string/wcscoll.3 +++ /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 index c966e09..0000000 --- a/string/wcscpy-fbsd.c +++ /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 index 2ba3b34..0000000 --- a/string/wcscspn-fbsd.c +++ /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 index 9cb882c..0000000 --- a/string/wcsdup-fbsd.c +++ /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 index 171476e..0000000 --- a/string/wcslcat-fbsd.c +++ /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 index 680dfea..0000000 --- a/string/wcslcpy-fbsd.c +++ /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 index 168686a..0000000 --- a/string/wcslen-fbsd.c +++ /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 index 167fac1..0000000 --- a/string/wcsncasecmp-fbsd.c +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must 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 -__FBSDID("$FreeBSD: src/lib/libc/string/wcsncasecmp.c,v 1.1 2009/02/28 06:00:58 das Exp $"); - -#include "xlocale_private.h" - -#include -#include - -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 index 581b079..0000000 --- a/string/wcsncat-fbsd.c +++ /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 index aa426db..0000000 --- a/string/wcsncmp-fbsd.c +++ /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 index 94dc751..0000000 --- a/string/wcsncpy-fbsd.c +++ /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 index a87c777..0000000 --- a/string/wcsnlen-fbsd.c +++ /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 index 2e91288..0000000 --- a/string/wcspbrk-fbsd.c +++ /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 index 1514a72..0000000 --- a/string/wcsrchr-fbsd.c +++ /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 index d161daa..0000000 --- a/string/wcsspn-fbsd.c +++ /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 index bd7adb3..0000000 --- a/string/wcsstr-fbsd.c +++ /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 index 256c17d..0000000 --- a/string/wcstok-fbsd.c +++ /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 index 2b8de3f..0000000 --- a/string/wcstok.3 +++ /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 -.\" -.\" 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 index 447c8e5..0000000 --- a/string/wcswidth-fbsd.c +++ /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 -__FBSDID("$FreeBSD: src/lib/libc/string/wcswidth.c,v 1.7 2007/01/09 00:28:12 imp Exp $"); - -#include "xlocale_private.h" - -#include - -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 index 07eb058..0000000 --- a/string/wcswidth.3 +++ /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 index eae9360..0000000 --- a/string/wcsxfrm-fbsd.c +++ /dev/null @@ -1,109 +0,0 @@ -/*- - * Copyright (c) 1995 Alex Tatmanjants - * 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 -#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 -#include -#include -#include -#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 index 038c7c7..0000000 --- a/string/wcsxfrm.3 +++ /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 index 0ad0f50..0000000 --- a/string/wmemchr-fbsd.c +++ /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 index 2e1d3ec..0000000 --- a/string/wmemchr.3 +++ /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 index e0c5393..0000000 --- a/string/wmemcmp-fbsd.c +++ /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 index 0518204..0000000 --- a/string/wmemcpy-fbsd.c +++ /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 index 39fcfbe..0000000 --- a/string/wmemmove-fbsd.c +++ /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 index 60f8a54..0000000 --- a/string/wmemset-fbsd.c +++ /dev/null @@ -1 +0,0 @@ -./wmemset.c \ No newline at end of file diff --git a/sys/Makefile.inc b/sys/Makefile.inc deleted file mode 100644 index 5036958..0000000 --- a/sys/Makefile.inc +++ /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 diff --git a/sys/OSMemoryNotification.c b/sys/OSMemoryNotification.c index b0f1ae4..897b9ac 100644 --- a/sys/OSMemoryNotification.c +++ b/sys/OSMemoryNotification.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include 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; } diff --git a/sys/OSThermalNotification.c b/sys/OSThermalNotification.c index 618bf58..772490f 100644 --- a/sys/OSThermalNotification.c +++ b/sys/OSThermalNotification.c @@ -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; } diff --git a/sys/OpenBSD/stack_protector.c b/sys/OpenBSD/stack_protector.c index 7b96532..74976f6 100644 --- a/sys/OpenBSD/stack_protector.c +++ b/sys/OpenBSD/stack_protector.c @@ -28,65 +28,112 @@ */ #include -#include #include #include -#include +#include +#include #include +#include +#include +#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 index 403b664..0000000 --- a/sys/OpenBSD/stack_protector.c.patch +++ /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 --#include - #include - #include --#include -+#include -+#include - #include -+#include -+#include -+#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(); - } diff --git a/sys/__libc_init.c b/sys/__libc_init.c index 963fe1e..72f0718 100644 --- a/sys/__libc_init.c +++ b/sys/__libc_init.c @@ -27,6 +27,7 @@ #include #include #include +#include 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 @@ -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); diff --git a/sys/getiopolicy_np.3 b/sys/getiopolicy_np.3 index 0e77798..fd801a8 100644 --- a/sys/getiopolicy_np.3 +++ b/sys/getiopolicy_np.3 @@ -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 diff --git a/sys/getiopolicy_np.c b/sys/getiopolicy_np.c index 8475a6e..146fdac 100644 --- a/sys/getiopolicy_np.c +++ b/sys/getiopolicy_np.c @@ -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)); } diff --git a/sys/posix_spawn.c b/sys/posix_spawn.c index d92ac84..ef1bfa9 100644 --- a/sys/posix_spawn.c +++ b/sys/posix_spawn.c @@ -39,6 +39,9 @@ #include #include +#if TARGET_OS_EMBEDDED +#include +#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 index 74976f6..0000000 --- a/sys/stack_protector-obsd.c +++ /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 -#include -#include -#include -#include -#include -#include -#include -#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 index ad93bed..0000000 --- a/threads/Makefile.inc +++ /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 diff --git a/threads/cprocs.c b/threads/cprocs.c index 71be8b9..ffcad58 100644 --- a/threads/cprocs.c +++ b/threads/cprocs.c @@ -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; } diff --git a/threads/cthreads.h b/threads/cthreads.h index e5207b8..c4fa284 100644 --- a/threads/cthreads.h +++ b/threads/cthreads.h @@ -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 index 69f132e..0000000 --- a/util/Makefile.inc +++ /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 index 0000000..b5be64b --- /dev/null +++ b/util/mkpath_np.3 @@ -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 +.\" +.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 index 0000000..453219a --- /dev/null +++ b/util/mkpath_np.c @@ -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 +#include +#include +#include +#include + +/* 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: + */ + +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: /* */ + 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: + */ + 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 index ede65ae..0000000 --- a/uuid/Makefile.inc +++ /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 index 77ad4f8..0000000 --- a/uuid/clear-uuid.c +++ /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 index 51b9486..0000000 --- a/uuid/compare-uuid.c +++ /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 index 4372f3f..0000000 --- a/uuid/copy-uuid.c +++ /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 index 651ce93..0000000 --- a/uuid/gen_uuid-uuid.c +++ /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 -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_IOCTL_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_SYS_SOCKIO_H -#include -#endif -#ifdef HAVE_NET_IF_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NET_IF_DL_H -#include -#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 index ba062b0..0000000 --- a/uuid/isnull-uuid.c +++ /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 index 772b4f2..0000000 --- a/uuid/pack-uuid.c +++ /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 index 5f2e8d6..0000000 --- a/uuid/parse-uuid.c +++ /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 index dd9411c..0000000 --- a/uuid/unpack-uuid.c +++ /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 index dd7814a..0000000 --- a/uuid/unparse-uuid.c +++ /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 - -#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 index 79e5b28..0000000 --- a/uuid/uuid.3 +++ /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 -.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 index 236dc3a..0000000 --- a/uuid/uuid.3-uuid.in +++ /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 index a75e45a..0000000 --- a/uuid/uuidP.h +++ /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 -#else -#include -#endif -#include -#include -#include - -#include - -/* - * 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 index a90694e..0000000 --- a/uuid/uuid_clear.3 +++ /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 -.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 index 32ce86e..0000000 --- a/uuid/uuid_clear.3-uuid.in +++ /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 index 7dac2d1..0000000 --- a/uuid/uuid_compare.3 +++ /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 -.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 index cae5088..0000000 --- a/uuid/uuid_compare.3-uuid.in +++ /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 index e0a3fbd..0000000 --- a/uuid/uuid_copy.3 +++ /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 -.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 index bf39bbc..0000000 --- a/uuid/uuid_copy.3-uuid.in +++ /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 index c33fa5d..0000000 --- a/uuid/uuid_generate.3 +++ /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 -.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 index 0c031b8..0000000 --- a/uuid/uuid_generate.3-uuid.in +++ /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 index cfd2169..0000000 --- a/uuid/uuid_is_null.3 +++ /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 -.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 index 2694458..0000000 --- a/uuid/uuid_is_null.3-uuid.in +++ /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 index 253a261..0000000 --- a/uuid/uuid_parse.3 +++ /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 -.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 index 24e0f63..0000000 --- a/uuid/uuid_parse.3-uuid.in +++ /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 index a4964db..0000000 --- a/uuid/uuid_unparse.3 +++ /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 -.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 index 70734fd..0000000 --- a/uuid/uuid_unparse.3-uuid.in +++ /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 -.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/uuidsrc/gen_uuid.c b/uuid/uuidsrc/gen_uuid.c index 30d6202..cad4eb7 100644 --- a/uuid/uuidsrc/gen_uuid.c +++ b/uuid/uuidsrc/gen_uuid.c @@ -72,64 +72,7 @@ #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 index ee2b833..0000000 --- a/uuid/uuidsrc/gen_uuid.c.patch +++ /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); - } diff --git a/uuid/uuidsrc/unparse.c b/uuid/uuidsrc/unparse.c index c0e08ef..dd7814a 100644 --- a/uuid/uuidsrc/unparse.c +++ b/uuid/uuidsrc/unparse.c @@ -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) diff --git a/uuid/uuidsrc/unparse.c.patch b/uuid/uuidsrc/unparse.c.patch deleted file mode 100644 index 97a71eb..0000000 --- a/uuid/uuidsrc/unparse.c.patch +++ /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) diff --git a/uuid/uuidsrc/uuidP.h b/uuid/uuidsrc/uuidP.h index 21de696..a75e45a 100644 --- a/uuid/uuidsrc/uuidP.h +++ b/uuid/uuidsrc/uuidP.h @@ -41,7 +41,7 @@ #include #include -#include "uuid.h" +#include /* * 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 index ccf8c3c..0000000 --- a/uuid/uuidsrc/uuidP.h.patch +++ /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 - #include - --#include "uuid.h" -+#include - - /* - * Offset between 15-Oct-1582 and 1-Jan-70 diff --git a/uuid/uuidsrc/uuid_unparse.3.in b/uuid/uuidsrc/uuid_unparse.3.in index 8616da9..70734fd 100644 --- a/uuid/uuidsrc/uuid_unparse.3.in +++ b/uuid/uuidsrc/uuid_unparse.3.in @@ -36,17 +36,26 @@ uuid_unparse \- convert an UUID from binary representation to a string .nf .B #include .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 index 170f27b..0000000 --- a/uuid/uuidsrc/uuid_unparse.3.in.patch +++ /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 - .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 index ef0825d..0000000 --- a/x86_64/gen/Makefile.inc +++ /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 diff --git a/x86_64/gen/_setcontext.S b/x86_64/gen/_setcontext.S index 864cdd6..c3994b8 100644 --- a/x86_64/gen/_setcontext.S +++ b/x86_64/gen/_setcontext.S @@ -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/ppc/gen/setjmperr.c b/x86_64/gen/setjmperr.c similarity index 58% rename from ppc/gen/setjmperr.c rename to x86_64/gen/setjmperr.c index 24403f2..bf06595 100644 --- a/ppc/gen/setjmperr.c +++ b/x86_64/gen/setjmperr.c @@ -22,18 +22,26 @@ */ /* * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. + * 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. */ -#include -#include - #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)setjmperr.c 5.2 (Berkeley) 3/9/86"; -#endif LIBC_SCCS and not lint +static char sccsid[] = "@(#)setjmperr.c 5.4 (Berkeley) 6/27/88"; +#endif /* LIBC_SCCS and not lint */ -#define ERRMSG "longjmp botch\n" +#include /* * This routine is called from longjmp() when an error occurs. @@ -41,8 +49,10 @@ static char sccsid[] = "@(#)setjmperr.c 5.2 (Berkeley) 3/9/86"; * write their own versions. * If this routine returns, the program is aborted. */ + void -longjmperror(void) +longjmperror() { - write(2, ERRMSG, sizeof(ERRMSG)); +#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 index 49f1faa..0000000 --- a/x86_64/pthreads/Makefile.inc +++ /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 index 15f37ff..0000000 --- a/x86_64/pthreads/get_cpu_capabilities.s +++ /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 -#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 diff --git a/x86_64/pthreads/pthread_mutex_lock.s b/x86_64/pthreads/pthread_mutex_lock.s index b1ca841..b45887b 100644 --- a/x86_64/pthreads/pthread_mutex_lock.s +++ b/x86_64/pthreads/pthread_mutex_lock.s @@ -22,6 +22,7 @@ */ #include +#include #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 index 107fe30..0000000 --- a/x86_64/stdlib/gdtoa.mk +++ /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 index a3c985a..0000000 --- a/x86_64/string/Makefile.inc +++ /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 diff --git a/x86_64/string/bcopy.c b/x86_64/string/bcopy.c index 96fe199..3187dec 100644 --- a/x86_64/string/bcopy.c +++ b/x86_64/string/bcopy.c @@ -22,7 +22,7 @@ */ #include -#include +#include "platfunc.h" PLATFUNC_DESCRIPTOR_PROTOTYPE(bcopy, sse42) PLATFUNC_DESCRIPTOR_PROTOTYPE(bcopy, sse3x) diff --git a/x86_64/string/bcopy_sse3x.s b/x86_64/string/bcopy_sse3x.s index 8556a10..0881b14 100644 --- a/x86_64/string/bcopy_sse3x.s +++ b/x86_64/string/bcopy_sse3x.s @@ -27,7 +27,7 @@ */ #include -#include +#include "platfunc.h" /* * The bcopy/memcpy loops, tuned for 64-bit Pentium-M class processors with diff --git a/x86_64/string/bcopy_sse42.s b/x86_64/string/bcopy_sse42.s index cfb1a28..236e454 100644 --- a/x86_64/string/bcopy_sse42.s +++ b/x86_64/string/bcopy_sse42.s @@ -27,7 +27,7 @@ */ #include -#include +#include "platfunc.h" /* * The bcopy/memcpy loops, tuned for Nehalem. This is the 64-bit version. diff --git a/x86_64/string/bzero.c b/x86_64/string/bzero.c index 99e7cae..d5feed5 100644 --- a/x86_64/string/bzero.c +++ b/x86_64/string/bzero.c @@ -22,7 +22,7 @@ */ #include -#include +#include "platfunc.h" PLATFUNC_DESCRIPTOR_PROTOTYPE(bzero, sse42) PLATFUNC_DESCRIPTOR_PROTOTYPE(bzero, sse2) diff --git a/x86_64/string/bzero_sse2.s b/x86_64/string/bzero_sse2.s index 6b6effd..3d7d596 100644 --- a/x86_64/string/bzero_sse2.s +++ b/x86_64/string/bzero_sse2.s @@ -27,7 +27,7 @@ */ #include -#include +#include "platfunc.h" /* * Bzero, tuned for Pentium-M class processors with SSE2 diff --git a/x86_64/string/bzero_sse42.s b/x86_64/string/bzero_sse42.s index 5b0358f..415d8d4 100644 --- a/x86_64/string/bzero_sse42.s +++ b/x86_64/string/bzero_sse42.s @@ -27,7 +27,7 @@ */ #include -#include +#include "platfunc.h" /* * Bzero, tuned for processors with SSE4.2 and 64-byte cache lines, ie Nehalem. diff --git a/x86_64/string/memcpy.c b/x86_64/string/memcpy.c index 347d185..7a98a4c 100644 --- a/x86_64/string/memcpy.c +++ b/x86_64/string/memcpy.c @@ -22,7 +22,7 @@ */ #include -#include +#include "platfunc.h" PLATFUNC_DESCRIPTOR_PROTOTYPE(memcpy, sse42) PLATFUNC_DESCRIPTOR_PROTOTYPE(memcpy, sse3x) diff --git a/x86_64/string/memmove.c b/x86_64/string/memmove.c index 6fe7d07..6476423 100644 --- a/x86_64/string/memmove.c +++ b/x86_64/string/memmove.c @@ -22,7 +22,7 @@ */ #include -#include +#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 index 0719fa2..0000000 --- a/x86_64/sys/Makefile.inc +++ /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 diff --git a/x86_64/sys/OSAtomic.s b/x86_64/sys/OSAtomic.s index 2f18fb9..ed32624 100644 --- a/x86_64/sys/OSAtomic.s +++ b/x86_64/sys/OSAtomic.s @@ -23,7 +23,8 @@ */ #include -#include +#include "platfunc.h" +#include #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 diff --git a/x86_64/sys/_sigtramp.s b/x86_64/sys/_sigtramp.s index 5c80116..a528650 100644 --- a/x86_64/sys/_sigtramp.s +++ b/x86_64/sys/_sigtramp.s @@ -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) diff --git a/x86_64/sys/atomic.c b/x86_64/sys/atomic.c index 8a2ee19..ca447f5 100644 --- a/x86_64/sys/atomic.c +++ b/x86_64/sys/atomic.c @@ -22,7 +22,7 @@ */ #include -#include +#include "platfunc.h" #define RESOLVER_UP_MP(symbol) \ PLATFUNC_DESCRIPTOR(symbol, up, kUP, 0); \ diff --git a/x86_64/sys/i386_gettimeofday_asm.s b/x86_64/sys/i386_gettimeofday_asm.s index 42898ff..28a3bd2 100644 --- a/x86_64/sys/i386_gettimeofday_asm.s +++ b/x86_64/sys/i386_gettimeofday_asm.s @@ -28,7 +28,7 @@ #include #include -#include +#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 diff --git a/x86_64/sys/spinlocks.c b/x86_64/sys/spinlocks.c index 8bc85a8..9512679 100644 --- a/x86_64/sys/spinlocks.c +++ b/x86_64/sys/spinlocks.c @@ -22,7 +22,7 @@ */ #include -#include +#include "platfunc.h" #define RESOLVER_UP_MP(symbol) \ PLATFUNC_DESCRIPTOR_PROTOTYPE(symbol, up); \ diff --git a/x86_64/sys/spinlocks_asm.s b/x86_64/sys/spinlocks_asm.s index 7bc0fbd..746eb64 100644 --- a/x86_64/sys/spinlocks_asm.s +++ b/x86_64/sys/spinlocks_asm.s @@ -28,8 +28,8 @@ #include #include -#include #include +#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 index 0000000..097d6b7 --- /dev/null +++ b/xcodescripts/build_linklists.sh @@ -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 index 0000000..39c4f38 --- /dev/null +++ b/xcodescripts/clean_simulator.sh @@ -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 index 0000000..d4ed302 --- /dev/null +++ b/xcodescripts/force_libc_to_build.sh @@ -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 index 0000000..ce710f4 --- /dev/null +++ b/xcodescripts/generate_features.pl @@ -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 () { + 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 index 0000000..47028ea --- /dev/null +++ b/xcodescripts/headers.sh @@ -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 index 0000000..ac40d92 --- /dev/null +++ b/xcodescripts/libc.xcconfig @@ -0,0 +1,107 @@ +#include "/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) + +// - 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 index 0000000..fa84889 --- /dev/null +++ b/xcodescripts/manpages.sh @@ -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}$"< 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 index 0000000..a017656 --- /dev/null +++ b/xcodescripts/mig_headers.sh @@ -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/patchHeaders b/xcodescripts/patch_headers_variants.pl old mode 100755 new mode 100644 similarity index 66% rename from patchHeaders rename to xcodescripts/patch_headers_variants.pl index 603693d..b404cbc --- a/patchHeaders +++ b/xcodescripts/patch_headers_variants.pl @@ -46,46 +46,55 @@ 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 = (); + 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 = ($_); + @save = ($_); } } else { push(@save, $_); } - } - $f->print(@save); +} +$f->print(@save); } sub usage { @@ -94,13 +103,13 @@ sub usage { 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); + #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); + #print "FIL: $File::Find::name\n"; + my $file = File::Spec->join($dest, $File::Find::name); + process($File::Find::name, $file); } } diff --git a/xcodescripts/sanitise_headers.sh b/xcodescripts/sanitise_headers.sh new file mode 100644 index 0000000..41f4669 --- /dev/null +++ b/xcodescripts/sanitise_headers.sh @@ -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/strip-header.ed b/xcodescripts/strip-header.ed similarity index 100% rename from strip-header.ed rename to xcodescripts/strip-header.ed diff --git a/xcodescripts/variants.xcconfig b/xcodescripts/variants.xcconfig new file mode 100644 index 0000000..fd3480f --- /dev/null +++ b/xcodescripts/variants.xcconfig @@ -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 + -- 2.45.2