summaryrefslogtreecommitdiff
path: root/src/lib/libast/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libast/comp')
-rw-r--r--src/lib/libast/comp/atexit.c115
-rw-r--r--src/lib/libast/comp/basename.c55
-rw-r--r--src/lib/libast/comp/catopen.c182
-rw-r--r--src/lib/libast/comp/closelog.c51
-rw-r--r--src/lib/libast/comp/conf.sh1635
-rw-r--r--src/lib/libast/comp/conf.tab601
-rw-r--r--src/lib/libast/comp/creat64.c38
-rw-r--r--src/lib/libast/comp/dirname.c61
-rw-r--r--src/lib/libast/comp/dup2.c46
-rw-r--r--src/lib/libast/comp/eaccess.c139
-rw-r--r--src/lib/libast/comp/errno.c40
-rw-r--r--src/lib/libast/comp/execlp.c50
-rw-r--r--src/lib/libast/comp/execve.c70
-rw-r--r--src/lib/libast/comp/execvp.c50
-rw-r--r--src/lib/libast/comp/execvpe.c78
-rw-r--r--src/lib/libast/comp/fakelink.h34
-rw-r--r--src/lib/libast/comp/fcntl.c98
-rw-r--r--src/lib/libast/comp/fmtmsg.h141
-rw-r--r--src/lib/libast/comp/fmtmsglib.c335
-rw-r--r--src/lib/libast/comp/fnmatch.c79
-rw-r--r--src/lib/libast/comp/fnmatch.h61
-rw-r--r--src/lib/libast/comp/frexp.c153
-rw-r--r--src/lib/libast/comp/frexpl.c161
-rw-r--r--src/lib/libast/comp/fsync.c46
-rw-r--r--src/lib/libast/comp/ftw.c50
-rw-r--r--src/lib/libast/comp/ftw.h60
-rw-r--r--src/lib/libast/comp/getdate.c83
-rw-r--r--src/lib/libast/comp/getgroups.c78
-rw-r--r--src/lib/libast/comp/getlogin.c42
-rw-r--r--src/lib/libast/comp/getopt.c78
-rw-r--r--src/lib/libast/comp/getopt.h51
-rw-r--r--src/lib/libast/comp/getoptl.c151
-rw-r--r--src/lib/libast/comp/getpgrp.c47
-rw-r--r--src/lib/libast/comp/getsubopt.c84
-rw-r--r--src/lib/libast/comp/getwd.c37
-rw-r--r--src/lib/libast/comp/gross.c99
-rw-r--r--src/lib/libast/comp/gross_sgi.h188
-rw-r--r--src/lib/libast/comp/hsearch.c138
-rw-r--r--src/lib/libast/comp/iconv.c1599
-rw-r--r--src/lib/libast/comp/killpg.c40
-rw-r--r--src/lib/libast/comp/libgen.h52
-rw-r--r--src/lib/libast/comp/link.c47
-rw-r--r--src/lib/libast/comp/localeconv.c100
-rw-r--r--src/lib/libast/comp/lstat.c39
-rw-r--r--src/lib/libast/comp/memccpy.c51
-rw-r--r--src/lib/libast/comp/memchr.c49
-rw-r--r--src/lib/libast/comp/memcmp.c45
-rw-r--r--src/lib/libast/comp/memcpy.c60
-rw-r--r--src/lib/libast/comp/memmove.c53
-rw-r--r--src/lib/libast/comp/memset.c42
-rw-r--r--src/lib/libast/comp/mkdir.c62
-rw-r--r--src/lib/libast/comp/mkfifo.c50
-rw-r--r--src/lib/libast/comp/mknod.c50
-rw-r--r--src/lib/libast/comp/mktemp.c85
-rw-r--r--src/lib/libast/comp/mktime.c77
-rw-r--r--src/lib/libast/comp/mount.c49
-rw-r--r--src/lib/libast/comp/nftw.c61
-rw-r--r--src/lib/libast/comp/omitted.c1152
-rw-r--r--src/lib/libast/comp/open.c119
-rw-r--r--src/lib/libast/comp/openlog.c58
-rw-r--r--src/lib/libast/comp/putenv.c53
-rw-r--r--src/lib/libast/comp/re_comp.c81
-rw-r--r--src/lib/libast/comp/re_comp.h41
-rw-r--r--src/lib/libast/comp/readlink.c61
-rw-r--r--src/lib/libast/comp/realpath.c48
-rw-r--r--src/lib/libast/comp/regcmp.c224
-rw-r--r--src/lib/libast/comp/regexp.c123
-rw-r--r--src/lib/libast/comp/regexp.h129
-rw-r--r--src/lib/libast/comp/remove.c49
-rw-r--r--src/lib/libast/comp/rename.c98
-rw-r--r--src/lib/libast/comp/resolvepath.c72
-rw-r--r--src/lib/libast/comp/rmdir.c66
-rw-r--r--src/lib/libast/comp/setenv.c58
-rw-r--r--src/lib/libast/comp/setlocale.c2865
-rw-r--r--src/lib/libast/comp/setlogmask.c48
-rw-r--r--src/lib/libast/comp/setpgid.c80
-rw-r--r--src/lib/libast/comp/setsid.c90
-rw-r--r--src/lib/libast/comp/sigflag.c52
-rw-r--r--src/lib/libast/comp/sigunblock.c63
-rw-r--r--src/lib/libast/comp/spawnveg.c296
-rw-r--r--src/lib/libast/comp/statvfs.c163
-rw-r--r--src/lib/libast/comp/strcasecmp.c58
-rw-r--r--src/lib/libast/comp/strchr.c57
-rw-r--r--src/lib/libast/comp/strftime.c104
-rw-r--r--src/lib/libast/comp/strncasecmp.c62
-rw-r--r--src/lib/libast/comp/strptime.c82
-rw-r--r--src/lib/libast/comp/strrchr.c60
-rw-r--r--src/lib/libast/comp/strstr.c76
-rw-r--r--src/lib/libast/comp/strtod.c31
-rw-r--r--src/lib/libast/comp/strtol.c34
-rw-r--r--src/lib/libast/comp/strtold.c50
-rw-r--r--src/lib/libast/comp/strtoll.c44
-rw-r--r--src/lib/libast/comp/strtoul.c35
-rw-r--r--src/lib/libast/comp/strtoull.c45
-rw-r--r--src/lib/libast/comp/swab.c60
-rw-r--r--src/lib/libast/comp/symlink.c59
-rw-r--r--src/lib/libast/comp/syslog.c367
-rw-r--r--src/lib/libast/comp/syslog.h132
-rw-r--r--src/lib/libast/comp/sysloglib.h54
-rw-r--r--src/lib/libast/comp/system.c55
-rw-r--r--src/lib/libast/comp/tempnam.c58
-rw-r--r--src/lib/libast/comp/tmpnam.c51
-rw-r--r--src/lib/libast/comp/transition.c86
-rw-r--r--src/lib/libast/comp/tsearch.c240
-rw-r--r--src/lib/libast/comp/unlink.c38
-rw-r--r--src/lib/libast/comp/unsetenv.c50
-rw-r--r--src/lib/libast/comp/vfork.c55
-rw-r--r--src/lib/libast/comp/waitpid.c199
-rw-r--r--src/lib/libast/comp/wc.c139
-rw-r--r--src/lib/libast/comp/wordexp.c217
-rw-r--r--src/lib/libast/comp/wordexp.h63
111 files changed, 16866 insertions, 0 deletions
diff --git a/src/lib/libast/comp/atexit.c b/src/lib/libast/comp/atexit.c
new file mode 100644
index 0000000..d0df2d5
--- /dev/null
+++ b/src/lib/libast/comp/atexit.c
@@ -0,0 +1,115 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * ANSI C atexit()
+ * arrange for func to be called LIFO on exit()
+ */
+
+#include <ast.h>
+
+#if _lib_atexit
+
+NoN(atexit)
+
+#else
+
+#if _lib_onexit || _lib_on_exit
+
+#if !_lib_onexit
+#define onexit on_exit
+#endif
+
+extern int onexit(void(*)(void));
+
+int
+atexit(void (*func)(void))
+{
+ return(onexit(func));
+}
+
+#else
+
+struct list
+{
+ struct list* next;
+ void (*func)(void);
+};
+
+static struct list* funclist;
+
+extern void _exit(int);
+
+int
+atexit(void (*func)(void))
+{
+ register struct list* p;
+
+ if (!(p = newof(0, struct list, 1, 0))) return(-1);
+ p->func = func;
+ p->next = funclist;
+ funclist = p;
+ return(0);
+}
+
+void
+_ast_atexit(void)
+{
+ register struct list* p;
+
+ while (p = funclist)
+ {
+ funclist = p->next;
+ (*p->func)();
+ }
+}
+
+#if _std_cleanup
+
+#if _lib__cleanup
+extern void _cleanup(void);
+#endif
+
+void
+exit(int code)
+{
+ _ast_atexit();
+#if _lib__cleanup
+ _cleanup();
+#endif
+ _exit(code);
+}
+
+#else
+
+void
+_cleanup(void)
+{
+ _ast_atexit();
+}
+
+#endif
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/basename.c b/src/lib/libast/comp/basename.c
new file mode 100644
index 0000000..912f8d6
--- /dev/null
+++ b/src/lib/libast/comp/basename.c
@@ -0,0 +1,55 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * basename(3) implementation
+ */
+
+#include <ast_std.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char *basename(register char *pathname)
+{
+ register char *first, *last;
+ for(first=last=pathname; *last; last++);
+ /* back over trailing '/' */
+ if(last>first)
+ while(*--last=='/' && last > first);
+ if(last==first && *last=='/')
+ {
+ /* all '/' or "" */
+ if(*first=='/')
+ if(*++last=='/') /* keep leading // */
+ last++;
+ }
+ else
+ {
+ for(first=last++;first>pathname && *first!='/';first--);
+ if(*first=='/')
+ first++;
+ }
+ *last = 0;
+ return(first);
+}
diff --git a/src/lib/libast/comp/catopen.c b/src/lib/libast/comp/catopen.c
new file mode 100644
index 0000000..7bace39
--- /dev/null
+++ b/src/lib/libast/comp/catopen.c
@@ -0,0 +1,182 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * catopen intercept
+ * the ast catalogs are checked first
+ * the ast mc* and native cat* routines do all the work
+ * catalogs found by mcfind() are converted from utf to ucs
+ *
+ * nl_catd is cast to void*
+ * this is either an Mc_t* (Mc_t.set != 0)
+ * or a Cc_t* where Cc_t.cat is the native nl_catd
+ */
+
+#include <ast.h>
+#include <mc.h>
+#include <nl_types.h>
+#include <iconv.h>
+
+#ifndef DEBUG_trace
+#define DEBUG_trace 0
+#endif
+#if DEBUG_trace
+#undef setlocale
+#endif
+
+#if _lib_catopen
+
+#undef nl_catd
+#undef catopen
+#undef catgets
+#undef catclose
+
+typedef struct
+{
+ Mcset_t* set;
+ nl_catd cat;
+ iconv_t cvt;
+ Sfio_t* tmp;
+} Cc_t;
+
+#else
+
+#define _ast_nl_catd nl_catd
+#define _ast_catopen catopen
+#define _ast_catgets catgets
+#define _ast_catclose catclose
+
+#endif
+
+_ast_nl_catd
+_ast_catopen(const char* name, int flag)
+{
+ Mc_t* mc;
+ char* s;
+ Sfio_t* ip;
+ char path[PATH_MAX];
+
+ /*
+ * first try the ast catalogs
+ */
+
+#if DEBUG_trace
+sfprintf(sfstderr, "AHA#%d:%s %s LC_MESSAGES=%s:%s\n", __LINE__, __FILE__, name, _ast_setlocale(LC_MESSAGES, 0), setlocale(LC_MESSAGES, 0));
+#endif
+ if ((s = mcfind(NiL, name, LC_MESSAGES, flag, path, sizeof(path))) && (ip = sfopen(NiL, s, "r")))
+ {
+#if DEBUG_trace
+sfprintf(sfstderr, "AHA#%d:%s %s\n", __LINE__, __FILE__, s);
+#endif
+ mc = mcopen(ip);
+ sfclose(ip);
+ if (mc)
+ return (_ast_nl_catd)mc;
+ }
+#if _lib_catopen
+ if (strcmp(setlocale(LC_MESSAGES, NiL), "debug"))
+ {
+ Cc_t* cc;
+ nl_catd d;
+
+ /*
+ * now the native catalogs
+ */
+
+ if (s && (d = catopen(s, flag)) != (nl_catd)(-1) || !(s = 0) && (d = catopen(name, flag)) != (nl_catd)(-1))
+ {
+ if (!(cc = newof(0, Cc_t, 1, 0)))
+ {
+ catclose(d);
+ return (_ast_nl_catd)(-1);
+ }
+ cc->cat = d;
+ if ((s || *name == '/') && (ast.locale.set & (1<<AST_LC_MESSAGES)))
+ {
+ if ((cc->cvt = iconv_open("", "utf")) == (iconv_t)(-1) || !(cc->tmp = sfstropen()))
+ {
+ catclose(d);
+ free(cc);
+ return (_ast_nl_catd)(-1);
+ }
+ }
+ else
+ cc->cvt = (iconv_t)(-1);
+#if DEBUG_trace
+sfprintf(sfstderr, "AHA#%d:%s %s %s native %p\n", __LINE__, __FILE__, s, name, cc->cat);
+#endif
+ return (_ast_nl_catd)cc;
+ }
+ }
+#endif
+
+ /*
+ * loser
+ */
+
+ return (_ast_nl_catd)(-1);
+}
+
+char*
+_ast_catgets(_ast_nl_catd cat, int set, int num, const char* msg)
+{
+ if (cat == (_ast_nl_catd)(-1))
+ return (char*)msg;
+#if _lib_catopen
+ if (!((Cc_t*)cat)->set)
+ {
+ char* s;
+ size_t n;
+
+ msg = (char*)catgets(((Cc_t*)cat)->cat, set, num, msg);
+ if (((Cc_t*)cat)->cvt != (iconv_t)(-1))
+ {
+ s = (char*)msg;
+ n = strlen(s);
+ iconv_write(((Cc_t*)cat)->cvt, ((Cc_t*)cat)->tmp, &s, &n, NiL);
+ if (s = sfstruse(((Cc_t*)cat)->tmp))
+ return s;
+ }
+ return (char*)msg;
+ }
+#endif
+ return mcget((Mc_t*)cat, set, num, msg);
+}
+
+int
+_ast_catclose(_ast_nl_catd cat)
+{
+ if (cat == (_ast_nl_catd)(-1))
+ return -1;
+#if _lib_catopen
+ if (!((Cc_t*)cat)->set)
+ {
+ if (((Cc_t*)cat)->cvt != (iconv_t)(-1))
+ iconv_close(((Cc_t*)cat)->cvt);
+ if (((Cc_t*)cat)->tmp)
+ sfclose(((Cc_t*)cat)->tmp);
+ return catclose(((Cc_t*)cat)->cat);
+ }
+#endif
+ return mcclose((Mc_t*)cat);
+}
diff --git a/src/lib/libast/comp/closelog.c b/src/lib/libast/comp/closelog.c
new file mode 100644
index 0000000..b8c848a
--- /dev/null
+++ b/src/lib/libast/comp/closelog.c
@@ -0,0 +1,51 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * closelog implementation
+ */
+
+#include <ast.h>
+
+#if _lib_syslog
+
+NoN(closelog)
+
+#else
+
+#include "sysloglib.h"
+
+void
+closelog(void)
+{
+ if (log.fd >= 0)
+ {
+ close(log.fd);
+ log.fd = -1;
+ }
+ log.facility = 0;
+ log.flags = 0;
+ log.mask = ~0;
+ log.attempt = 0;
+}
+
+#endif
diff --git a/src/lib/libast/comp/conf.sh b/src/lib/libast/comp/conf.sh
new file mode 100644
index 0000000..aaf3f3a
--- /dev/null
+++ b/src/lib/libast/comp/conf.sh
@@ -0,0 +1,1635 @@
+########################################################################
+# #
+# This software is part of the ast package #
+# Copyright (c) 1985-2011 AT&T Intellectual Property #
+# and is licensed under the #
+# Eclipse Public License, Version 1.0 #
+# by AT&T Intellectual Property #
+# #
+# A copy of the License is available at #
+# http://www.eclipse.org/org/documents/epl-v10.html #
+# (with md5 checksum b35adb5213ca9657e911e9befb180842) #
+# #
+# Information and Software Systems Research #
+# AT&T Research #
+# Florham Park NJ #
+# #
+# Glenn Fowler <gsf@research.att.com> #
+# David Korn <dgk@research.att.com> #
+# Phong Vo <kpv@research.att.com> #
+# #
+########################################################################
+: generate getconf and limits info
+#
+# @(#)conf.sh (AT&T Research) 2011-08-26
+#
+# this script generates these files from the table file in the first arg
+# the remaining args are the C compiler name and flags
+#
+# conflim.h supplemental limits.h definitions
+# conftab.h readonly string table definitions
+# conftab.c readonly string table data
+#
+# you may think it should be simpler
+# but you shall be confused anyway
+#
+
+case $-:$BASH_VERSION in
+*x*:[0123456789]*) : bash set -x is broken :; set +ex ;;
+esac
+
+LC_ALL=C
+export LC_ALL
+
+command=conf
+
+shell=`eval 'x=123&&integer n=\${#x}\${x#1?}&&((n==330/(10)))&&echo ksh' 2>/dev/null`
+
+append=0
+debug=
+extra=0
+keep_call='*'
+keep_name='*'
+trace=
+verbose=0
+while :
+do case $1 in
+ -a) append=1 ;;
+ -c*) keep_call=${1#-?} ;;
+ -d*) debug=$1 ;;
+ -l) extra=1 ;;
+ -n*) keep_name=${1#-?} ;;
+ -t) trace=1 ;;
+ -v) verbose=1 ;;
+ -*) echo "Usage: $command [-a] [-ccall-pattern] [-dN] [-l] [-nname_pattern] [-t] [-v] conf.tab" >&2; exit 2 ;;
+ *) break ;;
+ esac
+ shift
+done
+head='#include "FEATURE/standards"
+#include "FEATURE/common"'
+tail='#include "FEATURE/param"'
+generated="/* : : generated by $command from $1 : : */"
+hdr=
+ifs=${IFS-'
+ '}
+nl='
+'
+sp=' '
+ob='{'
+cb='}'
+sym=[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*
+tmp=conf.tmp
+case $verbose:$debug$trace in
+1:?*) echo "$command: debug=$debug trace=$trace keep_call=$keep_call keep_name=$keep_name" >&2 ;;
+esac
+case $trace in
+1) PS4='+$LINENO+ '; set -x ;;
+esac
+
+case $# in
+0) case $extra in
+ 0) echo "$command: table argument expected" >&2
+ exit 1
+ ;;
+ esac
+ tab=/dev/null
+ ;;
+*) tab=$1
+ shift
+ if test ! -f $tab
+ then echo "$command: $tab: cannot read" >&2
+ exit 1
+ fi
+ ;;
+esac
+case $# in
+0) cc=cc ;;
+*) cc=$* ;;
+esac
+
+rm -f $tmp.*
+case $debug in
+'') trap "code=\$?; rm -f $tmp.*; exit \$code" 0 1 2 ;;
+esac
+
+# determine the intmax_t printf format
+
+cat > $tmp.c <<!
+${head}
+int
+main()
+{
+#if _ast_intmax_long
+ return 1;
+#else
+ return 0;
+#endif
+}
+!
+if $cc -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe
+then LL_format='ll'
+else LL_format='l'
+fi
+
+# determine the intmax_t constant suffix
+
+cat > $tmp.c <<!
+${head}
+int
+main()
+{
+#if _ast_intmax_long
+ return 1;
+#else
+ _ast_intmax_t s = 0x7fffffffffffffffLL;
+ unsigned _ast_intmax_t u = 0xffffffffffffffffLL;
+
+ return 0;
+#endif
+}
+!
+if $cc -o $tmp.exe $tmp.c >/dev/null 2>&1
+then if ./$tmp.exe
+ then LL_suffix='LL'
+ else LL_suffix='L'
+ fi
+else LL_suffix=''
+fi
+
+cat > $tmp.c <<!
+${head}
+int
+main()
+{
+ unsigned int u = 1U;
+ unsigned int ul = 1UL;
+
+ return 0;
+}
+!
+if $cc -o $tmp.exe $tmp.c >/dev/null 2>&1
+then U_suffix='U'
+else U_suffix=''
+fi
+
+# set up the names and keys
+
+keys=
+standards=
+
+case $append$extra in
+00) case $verbose in
+ 1) echo "$command: read $tab" >&2 ;;
+ esac
+ exec < $tab
+ while :
+ do IFS=""
+ read line
+ eof=$?
+ IFS=$ifs
+ case $eof in
+ 0) ;;
+ *) break ;;
+ esac
+ case $line in
+ ""|\#*) ;;
+ *) set x $line
+ shift; name=$1
+ shift; standard=$1
+ shift; call=$1
+ shift; section=$1
+ shift; flags=$1
+ alternates=
+ define=
+ values=
+ script=
+ headers=
+ while :
+ do shift
+ case $# in
+ 0) break ;;
+ esac
+ case $1 in
+ ":") shift
+ eval script='$'script_$1
+ break
+ ;;
+ *"{") case $1 in
+ "sh{") script="# $name" ;;
+ *) script= ;;
+ esac
+ shift
+ args="$*"
+ IFS=""
+ while read line
+ do case $line in
+ "}") break ;;
+ esac
+ script=$script$nl$line
+ done
+ IFS=$ifs
+ break
+ ;;
+ *.h) case $shell in
+ ksh) f=${1%.h} ;;
+ *) f=`echo $1 | sed 's,\.h$,,'` ;;
+ esac
+ case " $hdr " in
+ *" $f "*)
+ headers=$headers$nl#include$sp'<'$1'>'
+ ;;
+ *" -$f- "*)
+ ;;
+ *) if iffe -n - hdr $f | grep _hdr_$f >/dev/null
+ then hdr="$hdr $f"
+ headers=$headers$nl#include$sp'<'$1'>'
+ else hdr="$hdr -$f-"
+ fi
+ ;;
+ esac
+ ;;
+ *) values=$values$sp$1
+ case $1 in
+ $sym) echo "$1" >> $tmp.v ;;
+ esac
+ ;;
+ esac
+ done
+ case " $standards " in
+ *" $standard "*)
+ ;;
+ *) standards="$standards $standard"
+ ;;
+ esac
+ case $name:$flags in
+ *:*S*) ;;
+ VERSION)flags="${flags}S" ;;
+ esac
+ case $name in
+ *VERSION*)key=${standard}${section} ;;
+ *) key= ;;
+ esac
+ case $key in
+ ''|*_) key=${key}${name} ;;
+ *) key=${key}_${name} ;;
+ esac
+ eval sys='$'CONF_call_${key}
+ case $sys in
+ ?*) call=$sys ;;
+ esac
+ case $call in
+ SI) sys=CS ;;
+ *) sys=$call ;;
+ esac
+ key=${sys}_${key}
+ keys="$keys$nl$key"
+ eval CONF_name_${key}='$'name
+ eval CONF_standard_${key}='$'standard
+ eval CONF_call_${key}='$'call
+ eval CONF_section_${key}='$'section
+ eval CONF_flags_${key}='$'flags
+ eval CONF_define_${key}='$'define
+ eval CONF_values_${key}='$'values
+ eval CONF_script_${key}='$'script
+ eval CONF_args_${key}='$'args
+ eval CONF_headers_${key}='$'headers
+ eval CONF_keys_${name}=\"'$'CONF_keys_${name} '$'key\"
+ ;;
+ esac
+ done
+ ;;
+esac
+case $debug in
+-d1) for key in $keys
+ do eval name=\"'$'CONF_name_$key\"
+ case $name in
+ ?*) eval standard=\"'$'CONF_standard_$key\"
+ eval call=\"'$'CONF_call_$key\"
+ eval section=\"'$'CONF_section_$key\"
+ eval flags=\"'$'CONF_flags_$key\"
+ eval define=\"'$'CONF_define_$key\"
+ eval values=\"'$'CONF_values_$key\"
+ eval script=\"'$'CONF_script_$key\"
+ eval args=\"'$'CONF_args_$key\"
+ eval headers=\"'$'CONF_headers_$key\"
+ printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
+ ;;
+ esac
+ done
+ exit
+ ;;
+esac
+
+systeminfo='
+#if !defined(SYS_NMLEN)
+#define SYS_NMLEN 9
+#endif
+#include <sys/systeminfo.h>'
+echo "$systeminfo" > $tmp.c
+$cc -E $tmp.c >/dev/null 2>&1 || systeminfo=
+
+# check for native getconf(1)
+
+CONF_getconf=
+CONF_getconf_a=
+for d in /usr/bin /bin /usr/sbin /sbin
+do if test -x $d/getconf
+ then case `$d/getconf --?-version 2>&1` in
+ *"AT&T"*"Research"*)
+ : presumably an implementation also configured from conf.tab
+ ;;
+ *) CONF_getconf=$d/getconf
+ if $CONF_getconf -a >/dev/null 2>&1
+ then CONF_getconf_a=-a
+ fi
+ ;;
+ esac
+ break
+ fi
+done
+export CONF_getconf CONF_getconf_a
+
+case $verbose in
+1) echo "$command: check ${CONF_getconf:+$CONF_getconf(1),}confstr(2),pathconf(2),sysconf(2),sysinfo(2) configuration names" >&2 ;;
+esac
+{
+ echo "#include <unistd.h>$systeminfo
+int i = 0;" > $tmp.c
+ $cc -E $tmp.c
+} |
+sed \
+ -e '/^#[^0123456789]*1[ ]*".*".*/!d' \
+ -e 's/^#[^0123456789]*1[ ]*"\(.*\)".*/\1/' |
+sort -u > $tmp.f
+{
+sed \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]/ /g' \
+ -e 's/[ ][ ]*/\n/g' \
+ `cat $tmp.f` 2>/dev/null |
+ egrep '^(SI|_(CS|PC|SC|SI))_.'
+ case $CONF_getconf_a in
+ ?*) $CONF_getconf $CONF_getconf_a | sed 's,[=: ].*,,'
+ ;;
+ *) case $CONF_getconf in
+ ?*) for v in `strings $CONF_getconf | grep '^[ABCDEFGHIJKLMNOPQRSTUVWXYZ_][ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789]*$'`
+ do if $CONF_getconf $v >/dev/null
+ then echo $v
+ fi
+ done
+ ;;
+ esac
+ ;;
+ esac 2>/dev/null
+} |
+egrep -v '^_[ABCDEFGHIJKLMNOPQRSTUVWXYZ]+_(COUNT|LAST|N|STR)$' |
+sort -u > $tmp.g
+{
+ grep '^_' $tmp.g
+ grep '^[^_]' $tmp.g
+} > $tmp.t
+mv $tmp.t $tmp.g
+case $debug in
+-d2) exit ;;
+esac
+
+HOST=`package | sed -e 's,[0123456789.].*,,' | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
+case $HOST in
+'') HOST=SYSTEM ;;
+esac
+
+exec < $tmp.g
+
+while read line
+do flags=F
+ section=
+ underscore=
+ define=$line
+ IFS=_
+ set $line
+ IFS=$ifs
+ case $1 in
+ '') case $# in
+ 0) continue ;;
+ esac
+ shift
+ ;;
+ esac
+ case $1 in
+ CS|PC|SC|SI)
+ call=$1
+ shift
+ standard=$1
+ ;;
+ *) flags=${flags}R
+ standard=$1
+ while :
+ do case $# in
+ 0) continue 2 ;;
+ esac
+ shift
+ case $1 in
+ CS|PC|SC|SI)
+ call=$1
+ shift
+ break
+ ;;
+ O|o|OLD|old)
+ continue 2
+ ;;
+ esac
+ standard=${standard}_$1
+ done
+ ;;
+ esac
+ case $1 in
+ SET) continue ;;
+ esac
+ case $standard in
+ _*) standard=`echo $standard | sed 's,^_*,,'` ;;
+ esac
+ case " $standards " in
+ *" $standard "*)
+ ;;
+ *) case $standard in
+ [0123456789]*)
+ section=$standard
+ standard=POSIX
+ ;;
+ *[0123456789])
+ eval `echo $standard | sed 's,\(.*\)\([0123456789]*\),standard=\1 section=\2,'`
+ ;;
+ esac
+ ;;
+ esac
+ case $flags in
+ *R*) case $call in
+ SI) ;;
+ *) underscore=U ;;
+ esac
+ ;;
+ *) case " $standards " in
+ " C ") shift
+ ;;
+ *" $standard "*)
+ case $call in
+ SI) ;;
+ *) flags=${flags}P
+ underscore=U
+ ;;
+ esac
+ shift
+ ;;
+ *) standard=
+ ;;
+ esac
+ ;;
+ esac
+ case $standard in
+ '') standard=$HOST
+ case $call in
+ SI) ;;
+ *) underscore=U ;;
+ esac
+ case $call in
+ CS|PC|SC)
+ case $define in
+ _${call}_*)
+ standard=POSIX
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ part=$section
+ case $section in
+ '') section=1
+ case $standard in
+ POSIX|XOPEN) part=$section ;;
+ esac
+ ;;
+ esac
+ name=
+ while :
+ do case $# in
+ 0) break ;;
+ esac
+ case $name in
+ '') name=$1 ;;
+ *) name=${name}_$1 ;;
+ esac
+ shift
+ done
+ case $name in
+ '') ;;
+ CONFORMANCE|FS_3D|HOSTTYPE|LIBPATH|LIBPREFIX|LIBSUFFIX|PATH_ATTRIBUTES|PATH_RESOLVE|UNIVERSE)
+ ;;
+ *) values=
+ script=
+ args=
+ headers=
+ case $name in
+ V[123456789]_*|V[123456789][0123456789]_*) underscore=VW ;;
+ esac
+ case $call in
+ CS|SI) key=CS ;;
+ *) key=$call ;;
+ esac
+ case $name in
+ *VERSION*)key=${key}_${standard}${part} ;;
+ esac
+ key=${key}_${name}
+ eval x='$'CONF_keys_$name
+ case $x in
+ '') eval x='$'CONF_name_$key
+ case $x in
+ '') case $call in
+ SI) flags=O$flags ;;
+ esac
+ case $underscore in
+ ?*) flags=${flags}${underscore} ;;
+ esac
+ old=QQ
+ case $name in
+ *VERSION*)old=${old}_${standard}${part} ;;
+ esac
+ old=${old}_${name}
+ eval x='$'CONF_name_$old
+ case $x in
+ ?*) eval CONF_name_$old=
+ eval flags='$'flags'$'CONF_flags_$old
+ eval values='$'CONF_values_$old
+ eval script='$'CONF_script_$old
+ eval args='$'CONF_args_$old
+ eval headers='$'CONF_headers_$old
+ ;;
+ esac
+ keys="$keys$nl$key"
+ eval CONF_name_${key}='$'name
+ eval CONF_standard_${key}='$'standard
+ eval CONF_call_${key}='$'call
+ eval CONF_section_${key}='$'section
+ eval CONF_flags_${key}=d'$'flags
+ eval CONF_define_${key}='$'define
+ eval CONF_values_${key}='$'values
+ eval CONF_script_${key}='$'script
+ eval CONF_args_${key}='$'args
+ eval CONF_headers_${key}='$'headers
+ ;;
+ *) eval x='$'CONF_define_$key
+ case $x in
+ ?*) case $call in
+ CS) eval x='$'CONF_call_$key
+ case $x in
+ SI) ;;
+ *) define= ;;
+ esac
+ ;;
+ *) define=
+ ;;
+ esac
+ ;;
+ esac
+ case $define in
+ ?*) eval CONF_define_${key}='$'define
+ eval CONF_call_${key}='$'call
+ eval x='$'CONF_call_${key}
+ case $x in
+ QQ) ;;
+ *) case $flags in
+ *R*) flags=R ;;
+ *) flags= ;;
+ esac
+ ;;
+ esac
+ case $call in
+ SI) flags=O$flags ;;
+ esac
+ eval CONF_flags_${key}=d'$'flags'$'CONF_flags_${key}
+ ;;
+ esac
+ old=QQ
+ case $name in
+ *VERSION*)old=${old}_${standard}${part} ;;
+ esac
+ old=${old}_${name}
+ eval CONF_name_$old=
+ esac
+ ;;
+ *) for key in $x
+ do eval x='$'CONF_call_${key}
+ case $x in
+ XX) eval CONF_call_${key}=QQ
+ eval CONF_flags_${key}=S'$'CONF_flags_${key}
+ ;;
+ esac
+ done
+ esac
+ ;;
+ esac
+done
+
+# sort keys by name
+
+keys=`for key in $keys
+do eval echo '$'CONF_name_$key '$'key
+done | sort -u | sed 's,.* ,,'`
+case $debug in
+-d3) for key in $keys
+ do eval name=\"'$'CONF_name_$key\"
+ case $name in
+ ?*) eval standard=\"'$'CONF_standard_$key\"
+ eval call=\"'$'CONF_call_$key\"
+ eval section=\"'$'CONF_section_$key\"
+ eval flags=\"'$'CONF_flags_$key\"
+ eval define=\"'$'CONF_define_$key\"
+ eval values=\"'$'CONF_values_$key\"
+ eval script=\"'$'CONF_script_$key\"
+ eval headers=\"'$'CONF_headers_$key\"
+ printf "%29s %35s %8s %2s %1d %5s %s$nl" "$name" "$key" "$standard" "$call" "$section" "$flags" "$define${values:+$sp=$values}${headers:+$sp$headers$nl}${script:+$sp$ob$script$nl$cb}"
+ ;;
+ esac
+ done
+ exit
+ ;;
+esac
+
+# mark the dups CONF_PREFIXED
+
+prev_key=
+prev_name=
+for key in $keys
+do eval name=\"'$'CONF_name_$key\"
+ case $name in
+ '') continue
+ ;;
+ $prev_name)
+ eval p='$'CONF_flags_${prev_key}
+ eval c='$'CONF_flags_${key}
+ case $p:$c in
+ *L*:*L*);;
+ *L*:*) c=L${c} ;;
+ *:*L*) p=L${p} ;;
+ *) p=P$p c=P$c ;;
+ esac
+ eval CONF_flags_${prev_key}=$p
+ eval CONF_flags_${key}=$c
+ ;;
+ esac
+ prev_name=$name
+ prev_key=$key
+done
+
+# collect all the macros/enums
+
+for key in $keys
+do eval name=\"'$'CONF_name_$key\"
+ case $name in
+ '') continue ;;
+ $keep_name) ;;
+ *) continue ;;
+ esac
+ eval call=\"'$'CONF_call_$key\"
+ case $call in
+ $keep_call) ;;
+ *) continue ;;
+ esac
+ eval standard=\"'$'CONF_standard_$key\"
+ eval section=\"'$'CONF_section_$key\"
+ eval flags=\"'$'CONF_flags_$key\"
+ eval define=\"'$'CONF_define_$key\"
+ eval values=\"'$'CONF_values_$key\"
+ eval script=\"'$'CONF_script_$key\"
+ eval args=\"'$'CONF_args_$key\"
+ eval headers=\"'$'CONF_headers_$key\"
+ conf_name=$name
+ case $call in
+ QQ) call=XX
+ for c in SC PC CS
+ do case $flags in
+ *S*) case $section in
+ 1) eval x='$'CONF_call_${c}_${standard}_${name} ;;
+ *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
+ esac
+ ;;
+ *) eval x='$'CONF_call_${c}_${name}
+ ;;
+ esac
+ case $x in
+ ?*) call=$x
+ break
+ ;;
+ esac
+ done
+ case $call in
+ XX) for c in SC PC CS
+ do echo "_${c}_${name}"
+ case $flags in
+ *S*) case $section in
+ 1) echo "_${c}_${standard}_${name}" ;;
+ *) echo "_${c}_${standard}${section}_${name}" ;;
+ esac
+ ;;
+ esac
+ done
+ ;;
+ esac
+ ;;
+ esac
+ case $call in
+ CS|PC|SC|SI|XX)
+ ;;
+ *) echo "$command: $name: $call: invalid call" >&2
+ exit 1
+ ;;
+ esac
+ case $flags in
+ *[ABEGHIJQTYZabcefghijklmnopqrstuvwxyz_123456789]*)
+ echo "$command: $name: $flags: invalid flag(s)" >&2
+ exit 1
+ ;;
+ esac
+ case $section in
+ [01]) ;;
+ *) case $flags in
+ *N*) ;;
+ *) name=${section}_${name} ;;
+ esac
+ standard=${standard}${section}
+ ;;
+ esac
+ case $call in
+ XX) ;;
+ *) case $flags in
+ *d*) conf_op=${define} ;;
+ *O*) conf_op=${call}_${name} ;;
+ *R*) conf_op=_${standard}_${call}_${name} ;;
+ *S*) conf_op=_${call}_${standard}_${name} ;;
+ *) conf_op=_${call}_${name} ;;
+ esac
+ echo "${conf_op}"
+ ;;
+ esac
+ case $standard:$flags in
+ C:*) ;;
+ *:*L*) echo "${conf_name}"
+ echo "_${standard}_${conf_name}"
+ ;;
+ *:*M*) case $section in
+ 1) echo "_${standard}_${conf_name}" ;;
+ *) echo "_${standard}${section}_${conf_name}" ;;
+ esac
+ ;;
+ esac
+done > $tmp.q
+sort -u < $tmp.q > $tmp.t
+mv $tmp.t $tmp.q
+sort -u < $tmp.v > $tmp.t
+mv $tmp.t $tmp.v
+case $debug in
+-d4) exit ;;
+esac
+
+# test all the macros in a few batches (some compilers have an error limit)
+
+defined() # list-file
+{
+ : > $tmp.p
+ while :
+ do {
+ cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+unsigned int conf[] = {
+!
+ sed 's/$/,/' $1
+ echo "};"
+ } > $tmp.c
+ [ -f $tmp.1.c ] || cp $tmp.c $tmp.1.c
+ if $cc -c $tmp.c > $tmp.e 2>&1
+ then break
+ fi
+ [ -f $tmp.1.e ] || cp $tmp.e $tmp.1.e
+ snl='\
+'
+ sed "s/[^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][^_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*/${snl}/g" $tmp.e |
+ grep '^[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz][_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]*$' |
+ sort -u > $tmp.n
+ cmp -s $tmp.n $tmp.p && break
+ fgrep -x -v -f $tmp.n $1 > $tmp.y
+ mv $tmp.y $1
+ mv $tmp.n $tmp.p
+ done
+ {
+ cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+!
+ sed 's/.*/conf "&" = &/' $1
+ } > $tmp.c
+ $cc -E $tmp.c 2>/dev/null |
+ sed -e '/conf[ ]*".*"[ ]*=[ ]*/!d' -e '/[_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789][ ]*(/!d' -e 's/.*"\(.*\)".*/\1/' > $tmp.n
+ if test -s $tmp.n
+ then fgrep -x -v -f $tmp.n $1 > $tmp.y
+ mv $tmp.y $1
+ fi
+}
+
+case $verbose in
+1) echo "$command: check macros/enums as static initializers" >&2 ;;
+esac
+defined $tmp.q
+defined $tmp.v
+case $debug in
+-d5) exit ;;
+esac
+
+# mark the constant macros/enums
+
+exec < $tmp.q
+while read line
+do eval CONF_const_${line}=1
+done
+exec < $tmp.v
+while read line
+do eval CONF_const_${line}=1
+done
+
+# mark the string literal values
+
+{
+ cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#undef conf
+!
+ sed 's/.*/conf "&" = &/' $tmp.q
+} > $tmp.c
+$cc -E $tmp.c 2>/dev/null |
+sed -e '/conf[ ]*".*"[ ]*=[ ]*"/!d' -e 's/.*"\([^"]*\)".*/\1/' > $tmp.e
+exec < $tmp.e
+while read line
+do eval CONF_string_${line}=1
+done
+
+# walk through the table
+
+case $shell in
+ksh) integer len name_max ;;
+esac
+name_max=1
+export tmp name standard call cc
+
+exec > $tmp.t
+for key in $keys
+do eval name=\"'$'CONF_name_$key\"
+ case $name in
+ '') continue ;;
+ $keep_name) ;;
+ *) continue ;;
+ esac
+ eval call=\"'$'CONF_call_$key\"
+ case $call in
+ $keep_call) ;;
+ *) continue ;;
+ esac
+ eval standard=\"'$'CONF_standard_$key\"
+ eval section=\"'$'CONF_section_$key\"
+ eval flags=\"'$'CONF_flags_$key\"
+ eval define=\"'$'CONF_define_$key\"
+ eval values=\"'$'CONF_values_$key\"
+ eval script=\"'$'CONF_script_$key\"
+ eval args=\"'$'CONF_args_$key\"
+ eval headers=\"'$'CONF_headers_$key\"
+ conf_name=$name
+ case $call in
+ QQ) call=XX
+ for c in SC PC CS
+ do case $flags in
+ *S*) case $section in
+ 1) eval x='$'CONF_call_${c}_${standard}_${name} ;;
+ *) eval x='$'CONF_call_${c}_${standard}${section}_${name} ;;
+ esac
+ ;;
+ *) eval x='$'CONF_call_${c}_${name}
+ ;;
+ esac
+ case $x in
+ ?*) call=$x
+ break
+ ;;
+ esac
+ done
+ case $call in
+ XX) for c in SC PC CS
+ do case $flags in
+ *S*) case $section in
+ 1) eval x='$'CONF_const__${c}_${standard}_${name} ;;
+ *) eval x='$'CONF_const__${c}_${standard}${section}_${name} ;;
+ esac
+ ;;
+ *) eval x='$'CONF_const__${c}_${name}
+ ;;
+ esac
+ case $x in
+ 1) call=$c
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+ case $call in
+ XX) case $standard in
+ C) standard=POSIX ;;
+ esac
+ case $flags in
+ *L*) flags=lFU ;;
+ *) flags=FU ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ case " $standards " in
+ *" $standard "*)
+ ;;
+ *) standards="$standards $standard"
+ ;;
+ esac
+ conf_standard=CONF_${standard}
+ case $call in
+ CS) conf_call=CONF_confstr
+ ;;
+ PC) conf_call=CONF_pathconf
+ ;;
+ SC) conf_call=CONF_sysconf
+ ;;
+ SI) conf_call=CONF_sysinfo
+ ;;
+ XX) conf_call=CONF_nop
+ ;;
+ esac
+ conf_op=-1
+ for s in _${call}_${standard}${section}_${name} _${call}_${standard}_${name} _${call}_${section}_${name} _${call}_${name} ${call}_${name}
+ do eval x='$'CONF_const_${s}
+ case $x in
+ 1) conf_op=${s}
+ break
+ ;;
+ esac
+ done
+ conf_section=$section
+ conf_flags=0
+ case $flags in
+ *C*) conf_flags="${conf_flags}|CONF_DEFER_CALL" ;;
+ esac
+ case $flags in
+ *D*) conf_flags="${conf_flags}|CONF_DEFER_MM" ;;
+ esac
+ case $flags in
+ *F*) conf_flags="${conf_flags}|CONF_FEATURE" ;;
+ esac
+ case $flags in
+ *L*) conf_flags="${conf_flags}|CONF_LIMIT" ;;
+ esac
+ case $flags in
+ *M*) conf_flags="${conf_flags}|CONF_MINMAX" ;;
+ esac
+ case $flags in
+ *N*) conf_flags="${conf_flags}|CONF_NOSECTION" ;;
+ esac
+ case $flags in
+ *P*) conf_flags="${conf_flags}|CONF_PREFIXED" ;;
+ esac
+ case $flags in
+ *S*) conf_flags="${conf_flags}|CONF_STANDARD" ;;
+ esac
+ case $flags in
+ *U*) conf_flags="${conf_flags}|CONF_UNDERSCORE" ;;
+ esac
+ case $flags in
+ *V*) conf_flags="${conf_flags}|CONF_NOUNDERSCORE" ;;
+ esac
+ case $flags in
+ *W*) conf_flags="${conf_flags}|CONF_PREFIX_ONLY" ;;
+ esac
+ case $debug in
+ ?*) case $standard in
+ ????) sep=" " ;;
+ ???) sep=" " ;;
+ ??) sep=" " ;;
+ ?) sep=" " ;;
+ *) sep="" ;;
+ esac
+ echo "$command: test: $sep$standard $call $name" >&2
+ ;;
+ esac
+ case $call in
+ CS|SI) conf_flags="${conf_flags}|CONF_STRING"
+ string=1
+ ;;
+ *) eval string='$'CONF_string_${key}
+ ;;
+ esac
+ conf_limit=0
+ case $flags in
+ *[Ll]*) d=
+ case ${conf_name} in
+ LONG_MAX|SSIZE_MAX)
+ x=
+ ;;
+ *) eval x='$'CONF_const_${conf_name}
+ ;;
+ esac
+ case $x in
+ '') for s in ${values}
+ do case $s in
+ $sym) eval x='$'CONF_const_${s}
+ case $x in
+ 1) eval a='$'CONF_const_${standard}_${s}
+ case $a in
+ $x) x= ;;
+ *) x=$s ;;
+ esac
+ break
+ ;;
+ esac
+ ;;
+ [0123456789]*|[-+][0123456789]*)
+ d=$s
+ break
+ ;;
+ esac
+ done
+ case ${x:+1}:$flags:$conf_op in
+ :*:-1|:*X*:*)
+ case $verbose in
+ 1) echo "$command: probe for ${conf_name} <limits.h> value" >&2 ;;
+ esac
+ x=
+ case $CONF_getconf in
+ ?*) if $CONF_getconf $conf_name > $tmp.x 2>/dev/null
+ then x=`cat $tmp.x`
+ case $x in
+ undefined) x= ;;
+ esac
+ fi
+ ;;
+ esac
+ case ${x:+1} in
+ '') case $script in
+ '#'*) echo "$script" > $tmp.sh
+ chmod +x $tmp.sh
+ x=`./$tmp.sh 2>/dev/null`
+ ;;
+ '') case $conf_name in
+ SIZE_*|U*|*_MAX)
+ f="%${LL_format}u"
+ t="unsigned _ast_intmax_t"
+ ;;
+ *) f="%${LL_format}d"
+ t="_ast_intmax_t"
+ ;;
+ esac
+ cat > $tmp.c <<!
+${head}
+#include <stdio.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+int
+main()
+{
+ printf("$f\n", ($t)$conf_name);
+ return 0;
+}
+!
+ ;;
+ *) cat > $tmp.c <<!
+${head}
+#include <stdio.h>
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+${script}
+!
+ ;;
+ esac
+ case $args in
+ '') set "" ;;
+ *) eval set '""' '"'$args'"'; shift ;;
+ esac
+ for a
+ do case $script in
+ '#'*) ./$tmp.sh $a > $tmp.x 2>/dev/null
+ x=$?
+ ;;
+ *) $cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
+ x=$?
+ ;;
+ esac
+ case $x in
+ 0) x=`cat $tmp.x`
+ case $x in
+ "-") x=$a ;;
+ esac
+ break
+ ;;
+ *) x=
+ ;;
+ esac
+ done
+ ;;
+ esac
+ case $x in
+ '') x=$d ;;
+ esac
+ ;;
+ esac
+ case ${x:+1}:$flags:$conf_op in
+ 1:*:-1|1:*X*:*)
+ conf_limit=$x
+ case $flags in
+ *L*) ;;
+ *) conf_flags="${conf_flags}|CONF_LIMIT" ;;
+ esac
+ conf_flags="${conf_flags}|CONF_LIMIT_DEF"
+ case $string:$x in
+ 1:*) cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#define ${conf_name} \"${x}\"\n");
+printf("#endif\n");
+!
+ ;;
+ *:U*) cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#ifndef ${x}\n");
+printf("#define ${x} %lu\n", ${x});
+printf("#endif\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+ ;;
+ *:$sym) cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#ifndef ${x}\n");
+printf("#define ${x} %ld\n", ${x});
+printf("#endif\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+ ;;
+ *) cat >> $tmp.l <<!
+printf("#ifndef ${conf_name}\n");
+printf("#define ${conf_name} ${x}\n");
+printf("#endif\n");
+!
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ case $section in
+ [01]) ;;
+ *) case $flags in
+ *N*) ;;
+ *) name=${section}_${name} ;;
+ esac
+ standard=${standard}${section}
+ ;;
+ esac
+ conf_minmax=0
+ case $call:$standard:$flags in
+ *:C:*M*)for s in _${standard}_${conf_name} ${values}
+ do case $s in
+ $sym) ;;
+ *) conf_minmax=$s
+ conf_flags="${conf_flags}|CONF_MINMAX_DEF"
+ break
+ ;;
+ esac
+ done
+ ;;
+ *:C:*) ;;
+ [CPSX][CSX]:*:*[FM]*)
+ x=
+ for s in _${standard}_${conf_name} ${values}
+ do case $s in
+ $sym) eval x='$'CONF_const_${s} ;;
+ *) x=1 ;;
+ esac
+ case $x in
+ 1) conf_minmax=$s
+ case $flags in
+ *M*) conf_flags="${conf_flags}|CONF_MINMAX_DEF" ;;
+ esac
+ case $conf_minmax in
+ [-+0123456789]*) x= ;;
+ esac
+ break
+ ;;
+ esac
+ done
+ case ${x:+1}:${script:+1} in
+ :1) case $verbose in
+ 1) echo "$command: probe for _${standard}_${conf_name} minmax value" >&2 ;;
+ esac
+ case $CONF_getconf in
+ ?*) if $CONF_getconf _${standard}_${conf_name} > $tmp.x 2>/dev/null
+ then x=`cat $tmp.x`
+ case $x in
+ undefined) x= ;;
+ esac
+ fi
+ ;;
+ esac
+ case $x in
+ '') case $script in
+ '#'*) echo "$script" > $tmp.sh
+ chmod +x $tmp.sh
+ x=`./$tmp.sh 2>/dev/null`
+ ;;
+ *) cat > $tmp.c <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+${script}
+!
+ ;;
+ esac
+ case $args in
+ '') set "" ;;
+ *) eval set '""' "$args"; shift ;;
+ esac
+ for a
+ do case $script in
+ '#'*) ./$tmp.sh $a > $tmp.x 2>/dev/null
+ x=$?
+ ;;
+ *) $cc $a -o $tmp.exe $tmp.c >/dev/null 2>&1 && ./$tmp.exe > $tmp.x 2>/dev/null
+ x=$?
+ ;;
+ esac
+ case $x in
+ 0) x=`cat $tmp.x`
+ case $x in
+ "-") x=$a ;;
+ esac
+ break
+ ;;
+ *) x=
+ ;;
+ esac
+ done
+ ;;
+ esac
+ case $x in
+ ?*) conf_minmax=$x
+ case $flags in
+ *M*) case "|$conf_flags|" in
+ *'|CONF_MINMAX_DEF|'*)
+ ;;
+ *) conf_flags="${conf_flags}|CONF_MINMAX_DEF"
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ esac
+ case $string in
+ 1) conf_limit="{ 0, $conf_limit }" conf_minmax="{ 0, $conf_minmax }"
+ ;;
+ *) case $conf_limit in
+ 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
+ ;;
+ *[!0123456789abcdefABCDEF]*)
+ conf_limit=0
+ ;;
+ *[!0123456789]*)
+ conf_limit=0x$conf_limit
+ ;;
+ esac
+ case $conf_minmax in
+ 0[xX]*|-*|+*|[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_]*)
+ ;;
+ *[!0123456789abcdefABCDEF]*)
+ conf_minmax=0
+ ;;
+ *[!0123456789]*)
+ conf_minmax=0x$conf_minmax
+ ;;
+ esac
+ case $conf_limit in
+ ?*[-+]*|*['()']*)
+ ;;
+ *[lLuU])
+ case $LL_suffix in
+ ??) case $conf_limit in
+ *[!lL][lL]|*[!lL][lL][uU])
+ conf_limit=${conf_limit}L
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ -*[2468])
+ case $shell in
+ ksh) p=${conf_limit%?}
+ s=${conf_limit#$p}
+ ((s=s-1))
+ ;;
+ *) eval `echo '' $conf_limit | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
+ s=`expr $s - 1`
+ ;;
+ esac
+ conf_limit=${p}${s}${LL_suffix}-1${LL_suffix}
+ ;;
+ 0[xX]*[abcdefABCDEF])
+ conf_limit=${conf_limit}${LL_suffix}
+ ;;
+ -*[0123456789])
+ conf_limit=${conf_limit}${LL_suffix}
+ ;;
+ *[0123456789])
+ conf_limit=${conf_limit}${U_suffix}${LL_suffix}
+ ;;
+ esac
+ case $conf_minmax in
+ ?*[-+]*|*['()']*)
+ ;;
+ *[lLuU])
+ case $LL_suffix in
+ ??) case $conf_minmax in
+ *[!lL][lL]|*[!lL][lL][uU])
+ conf_minmax=${conf_minmax}L
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ -*[2468])
+ case $shell in
+ ksh) p=${conf_minmax%?}
+ s=${conf_minmax#$p}
+ ((s=s-1))
+ ;;
+ *) eval `echo '' $conf_minmax | sed 's/ *\(.*\)\(.\) */p=\1 s=\2/'`
+ s=`expr $s - 1`
+ ;;
+ esac
+ conf_minmax=${p}${s}${LL_suffix}-1${LL_suffix}
+ ;;
+ 0[xX]*[abcdefABCDEF])
+ conf_minmax=${conf_minmax}${LL_suffix}
+ ;;
+ -*[0123456789])
+ conf_minmax=${conf_minmax}${LL_suffix}
+ ;;
+ *[0123456789])
+ conf_minmax=${conf_minmax}${U_suffix}${LL_suffix}
+ ;;
+ esac
+ conf_limit="{ $conf_limit, 0 }" conf_minmax="{ $conf_minmax, 0 }"
+ ;;
+ esac
+ case $conf_flags in
+ '0|'*) case $shell in
+ ksh) conf_flags=${conf_flags#0?} ;;
+ *) conf_flags=`echo "$conf_flags" | sed 's/^0.//'` ;;
+ esac
+ ;;
+ esac
+ echo "{ \"$conf_name\", $conf_limit, $conf_minmax, $conf_flags, $conf_standard, $conf_section, $conf_call, $conf_op },"
+ case $shell in
+ ksh) len=${#conf_name}
+ if ((len>=name_max))
+ then ((name_max=len+1))
+ fi
+ ;;
+ *) len=`echo ${conf_name} | wc -c`
+ if expr \( $len - 1 \) \>= ${name_max} >/dev/null
+ then name_max=$len
+ fi
+ ;;
+ esac
+done
+exec > /dev/null
+case $debug in
+-d6) exit ;;
+esac
+
+# conf string table
+
+base=conftab
+case $verbose in
+1) echo "$command: generate ${base}.h string table header" >&2 ;;
+esac
+case $shell in
+ksh) ((name_max=name_max+3)); ((name_max=name_max/4*4)) ;; # bsd /bin/sh !
+*) name_max=`expr \( $name_max + 3 \) / 4 \* 4` ;;
+esac
+{
+cat <<!
+#ifndef _CONFTAB_H
+#define _CONFTAB_H
+$systeminfo
+
+${generated}
+
+#if !defined(const) && !defined(__STDC__) && !defined(__cplusplus) && !defined(c_plusplus)
+#define const
+#endif
+
+#define conf _ast_conf_data
+#define conf_elements _ast_conf_ndata
+
+#define prefix _ast_conf_prefix
+#define prefix_elements _ast_conf_nprefix
+
+#define CONF_nop 0
+#define CONF_confstr 1
+#define CONF_pathconf 2
+#define CONF_sysconf 3
+#define CONF_sysinfo 4
+
+!
+index=0
+for standard in $standards
+do echo "#define CONF_${standard} ${index}"
+ case $shell in
+ ksh) ((index=index+1)) ;;
+ *) index=`expr ${index} + 1` ;;
+ esac
+done
+echo "#define CONF_call ${index}"
+case $CONF_getconf in
+?*) echo
+ echo "#define _pth_getconf \"$CONF_getconf\""
+ case $CONF_getconf_a in
+ ?*) echo "#define _pth_getconf_a \"$CONF_getconf_a\"" ;;
+ esac
+ ;;
+esac
+cat <<!
+
+#define CONF_DEFER_CALL 0x0001
+#define CONF_DEFER_MM 0x0002
+#define CONF_FEATURE 0x0004
+#define CONF_LIMIT 0x0008
+#define CONF_LIMIT_DEF 0x0010
+#define CONF_MINMAX 0x0020
+#define CONF_MINMAX_DEF 0x0040
+#define CONF_NOSECTION 0x0080
+#define CONF_NOUNDERSCORE 0x0100
+#define CONF_PREFIX_ONLY 0x0200
+#define CONF_PREFIXED 0x0400
+#define CONF_STANDARD 0x0800
+#define CONF_STRING 0x1000
+#define CONF_UNDERSCORE 0x2000
+#define CONF_USER 0x4000
+
+struct Conf_s; typedef struct Conf_s Conf_t;
+
+typedef struct Value_s
+{
+ intmax_t number;
+ const char* string;
+} Value_t;
+
+struct Conf_s
+{
+ const char name[${name_max}];
+ Value_t limit;
+ Value_t minmax;
+ unsigned int flags;
+ short standard;
+ short section;
+ short call;
+ short op;
+};
+
+typedef struct Prefix_s
+{
+ const char name[16];
+ short length;
+ short standard;
+ short call;
+} Prefix_t;
+
+extern const Conf_t conf[];
+extern const int conf_elements;
+
+extern const Prefix_t prefix[];
+extern const int prefix_elements;
+
+#endif
+!
+} > $tmp.2
+case $debug in
+-d7) echo $command: $tmp.2 ${base}.h ;;
+*) cmp -s $tmp.2 ${base}.h 2>/dev/null || mv $tmp.2 ${base}.h ;;
+esac
+
+case $verbose in
+1) echo "$command: generate ${base}.c string table" >&2 ;;
+esac
+{
+cat <<!
+${head}
+#include <sys/types.h>
+#include <limits.h>
+#include <unistd.h>$systeminfo$headers
+${tail}
+#include "${base}.h"
+
+${generated}
+
+/*
+ * prefix strings -- the first few are indexed by Conf_t.standard
+ */
+
+const Prefix_t prefix[] =
+{
+!
+for standard in $standards
+do case $shell in
+ ksh) len=${#standard} ;;
+ *) len=`echo ${standard} | wc -c`; len=`expr $len - 1` ;;
+ esac
+ echo " \"${standard}\", ${len}, CONF_${standard}, -1,"
+done
+cat <<!
+ "XX", 2, CONF_POSIX, CONF_nop,
+ "CS", 2, CONF_POSIX, CONF_confstr,
+ "PC", 2, CONF_POSIX, CONF_pathconf,
+ "SC", 2, CONF_POSIX, CONF_sysconf,
+ "SI", 2, CONF_SVID, CONF_sysinfo,
+};
+
+const int prefix_elements = (int)sizeof(prefix) / (int)sizeof(prefix[0]);
+
+/*
+ * conf strings sorted in ascending order
+ */
+
+const Conf_t conf[] =
+{
+!
+cat $tmp.t
+cat <<!
+};
+
+const int conf_elements = (int)sizeof(conf) / (int)sizeof(conf[0]);
+!
+} > $tmp.4
+case $debug in
+-d7) echo $command: $tmp.4 ${base}.c ;;
+*) cmp -s $tmp.4 ${base}.c 2>/dev/null || mv $tmp.4 ${base}.c ;;
+esac
+
+# limits.h generation code
+
+base=conflim
+case $verbose in
+1) echo "$command: generate ${base}.h supplemental <limits.h> values" >&2 ;;
+esac
+{
+cat <<!
+${generated}
+
+/*
+ * supplemental <limits.h> values
+ */
+
+!
+test -f $tmp.l && cat $tmp.l
+} > $tmp.5
+case $debug in
+-d7) echo $command: $tmp.5 ${base}.h ;;
+*) cmp -s $tmp.5 ${base}.h 2>/dev/null || mv $tmp.5 ${base}.h ;;
+esac
+exit 0
diff --git a/src/lib/libast/comp/conf.tab b/src/lib/libast/comp/conf.tab
new file mode 100644
index 0000000..2dc05e0
--- /dev/null
+++ b/src/lib/libast/comp/conf.tab
@@ -0,0 +1,601 @@
+#
+# posix { getconf limits } macro table
+#
+# @(#)conf.tab (AT&T Research) 2010-06-28
+#
+# name standard section call flags [ header ... ] [ value ... ]
+#
+# name: sans prefix
+# standard: AST, C, POSIX, SVID, XOPEN, <vendor> { SCO, SGI, SUN, ... }
+# section: section number in standard
+# call: CS=confstr PC=pathconf SC=sysconf SI=sysinfo QQ=query XX=none
+# flags: 0 no flags
+# C defer call to native getconf(1)
+# D defer minmax to native getconf(1)
+# F unistd.h feature
+# L limits.h constant
+# M has _<standard><section>_<name> minmax value
+# N _<call>_<name>
+# O use original name and definition
+# R _<standard>_<call>_<section>_<name>
+# S _<call>_<standard><section>_<name>
+# U <standard><section>_<name> prefixed by underscore
+# V _ prefix not allowed
+# W standard required
+# X define even if native is dynamic (ast special)
+#
+# default names if <section> <= 1
+#
+# _<call>_<name>
+# <standard>_<name>
+#
+# default names if <section> > 1
+#
+# _<call>_<section>_<name>
+# <standard><section>_<name>
+#
+# the [NSU] flags modify the default names
+#
+
+ABI_AIO_XFER_MAX C QQ 1 L
+ABI_ASYNCHRONOUS_IO C QQ 1 L
+ABI_ASYNC_IO C QQ 1 L
+ADVISORY_INFO POSIX SC 1 FUW
+AIO_LISTIO_MAX POSIX SC 1 LMU 2
+AIO_MAX POSIX SC 1 LMU 1
+AIO_PRIO_DELTA_MAX POSIX SC 1 LMU
+ALLOC_SIZE_MIN POSIX PC 1 LUVW
+ARCHITECTURE SVID SI 1 O
+ARG_MAX POSIX SC 1 CDLMUX NCARGS 4096
+ASYNCHRONOUS_IO POSIX SC 1 CDFUW
+ASYNC_IO POSIX PC 1 FUW
+ATEXIT_MAX XOPEN SC 1 LMU 32
+AUDIT C QQ 1 L
+AVAIL_PROCESSORS C QQ 1 L
+AVPHYS_PAGES SUN SC 1 0
+BARRIERS POSIX SC 1 FUW
+BC_BASE_MAX POSIX SC 2 LMN 99
+BC_DIM_MAX POSIX SC 2 LMN 2048
+BC_SCALE_MAX POSIX SC 2 LMN 99
+BC_STRING_MAX POSIX SC 2 LMN 1000
+BUSTYPES SVID SI 1 O
+CHARCLASS_NAME_MAX XOPEN XX 1 L 14
+CHAR_BIT C XX 1 L 8
+CHAR_MAX C XX 1 L
+CHAR_MIN C XX 1 L
+CHAR_TERM POSIX SC 2 FUW
+CHILD_MAX POSIX SC 1 CDLMUX 6 cc{
+ #if _lib_fork
+ #define child() fork()
+ #else
+ #ifdef _map_spawnve
+ #define spawnve _map_spawnve
+ #endif
+ extern int spawnve(const char*, char* const[], char* const[]);
+ static char* cmd[] = { "/bin/echo", 0 };
+ #define child() spawnve(cmd[0],cmd,(char**)0)
+ #endif
+ int main()
+ {
+ int i;
+ int n;
+ for (i = 3; i < 512 && (n = child()) >= 0; i++)
+ if (!n) _exit(0);
+ while (wait((int*)0) > 0);
+ for (n = 8; n < i; n <<= 1);
+ printf("%d", n);
+ return 0;
+ }
+}
+CHOWN_RESTRICTED POSIX PC 1 FUW
+CKPT POSIX SC 1 FU
+CLK_TCK POSIX SC 1 L HZ 60
+CLOCKRES_MIN POSIX SC 1 MUW 1
+CLOCKS_PER_SEC C QQ 1 L
+CLOCK_SELECTION POSIX SC 1 FUVW
+COLL_WEIGHTS_MAX POSIX SC 2 DLMN 2
+CPUTIME POSIX SC 1 FUW
+CPU_KEYBITS1 C QQ 1 L
+CPU_VERSION C QQ 1 L
+CRYPT XOPEN SC 1 FSUW
+C_BIND POSIX SC 2 CFU
+C_DEV POSIX SC 2 CFU
+C_VERSION POSIX SC 2 CDFU
+DATAKEYS_MAX C QQ 1 0
+DELAYTIMER_MAX POSIX SC 1 LMU 32
+ENH_I18N XOPEN SC 1 FSUW
+EQUIV_CLASS_MAX C QQ 1 L
+EXEC_INTERPRETER_LENGTH C QQ 1 L
+EXPR_NEST_MAX POSIX SC 2 LMN 32
+FCHR_MAX SVID SC 1 LMU LONG_MAX 2147483647
+FILESIZEBITS POSIX PC 1 LMU (8*sizeof(off_t)) 32
+FILE_LOCKING POSIX SC 1 FU
+FORT_DEV POSIX SC 2 CFUW
+FORT_RUN POSIX SC 2 CFUW
+FSYNC POSIX SC 1 CDFUW _lib_fsync
+GETGR_R_SIZE_MAX C QQ 1 L
+GETPW_R_SIZE_MAX C QQ 1 L
+HOSTID C QQ 1 L
+HOSTNAME SVID SI 1 O
+HOST_NAME_MAX POSIX SC 1 LMU 255
+HW_PROVIDER SVID SI 1 O
+HW_SERIAL C QQ 1 L
+ILP32_OFF32 XBS5 SC 1 FU
+ILP32_OFF32_CFLAGS XBS5 CS 1 FU
+ILP32_OFF32_LDFLAGS XBS5 CS 1 FU
+ILP32_OFF32_LIBS XBS5 CS 1 FU
+ILP32_OFF32_LINTFLAGS XBS5 CS 1 FU
+ILP32_OFFBIG XBS5 SC 1 FU
+ILP32_OFFBIG_CFLAGS XBS5 CS 1 FU
+ILP32_OFFBIG_LDFLAGS XBS5 CS 1 FU
+ILP32_OFFBIG_LIBS XBS5 CS 1 FU
+ILP32_OFFBIG_LINTFLAGS XBS5 CS 1 FU
+INITTAB_NAME SVID SI 1 O
+INT_MAX C XX 1 L 32767
+INT_MIN C XX 1 L -32767
+IOV_MAX XOPEN SC 1 LMU 16
+IO_TYPE C QQ 1 L
+IPV6 POSIX SC 1 FUW
+IP_SECOPTS C QQ 1 L
+JOB_CONTROL POSIX SC 1 FUW cc{
+ #include "FEATURE/wait"
+ #if _ok_wif
+ int main()
+ {
+ printf("1");
+ return 0;
+ }
+ #endif
+}
+KERNEL_CLIST SCO SC 1 0
+KERNEL_CLIST_MAX SCO SC 1 0
+KERNEL_DISK SCO SC 1 0
+KERNEL_DISK_MAX SCO SC 1 0
+KERNEL_DMABUF SCO SC 1 0
+KERNEL_DMABUF_MAX SCO SC 1 0
+KERNEL_FILE SCO SC 1 0
+KERNEL_FILE_MAX SCO SC 1 0
+KERNEL_FLCKREC SCO SC 1 0
+KERNEL_FLCKREC_MAX SCO SC 1 0
+KERNEL_INODE SCO SC 1 0
+KERNEL_INODE_MAX SCO SC 1 0
+KERNEL_MOUNT SCO SC 1 0
+KERNEL_MOUNT_MAX SCO SC 1 0
+KERNEL_PINODE SCO SC 1 0
+KERNEL_PINODE_MAX SCO SC 1 0
+KERNEL_PROC SCO SC 1 0
+KERNEL_PROC_MAX SCO SC 1 0
+KERNEL_REGION SCO SC 1 0
+KERNEL_REGION_MAX SCO SC 1 0
+KERNEL_S5INODE SCO SC 1 0
+KERNEL_S5INODE_MAX SCO SC 1 0
+KERNEL_STAMP SVID SI 1 O
+KERN_POINTERS C QQ 1 L
+KERN_SIM C QQ 1 L
+LEGACY XOPEN SC 1 FU
+LFS_CFLAGS POSIX CS 1 MU cc{ -D_LARGEFILE_SOURCE "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" -D_LARGEFILE64_SOURCE -64
+ #include <sys/types.h>
+ int
+ main()
+ {
+ if (sizeof(off_t) >= sizeof(off_64_t))
+ {
+ printf("-");
+ return 0;
+ }
+ return 1;
+ }
+}
+LFS64_CFLAGS POSIX CS 1 MU : LFS_CFLAGS
+LFS64_LDFLAGS POSIX CS 1 MU : LFS_CFLAGS
+LFS64_LIBS POSIX CS 1 MU
+LFS64_LINTFLAGS POSIX CS 1 MU : LFS_CFLAGS
+LFS_LDFLAGS POSIX CS 1 MU : LFS_CFLAGS
+LFS_LIBS POSIX CS 1 MU
+LFS_LINTFLAGS POSIX CS 1 MU : LFS_CFLAGS
+LINE_MAX POSIX SC 2 LMN 2048
+LINK_MAX POSIX PC 1 LMU MAXLINK SHRT_MAX 8
+LLONG_MAX C XX 1 L
+LLONG_MIN C XX 1 L
+LOCALEDEF POSIX SC 1 FUW
+LOCALEDEF POSIX SC 2 CFUW
+LOGIN_NAME_MAX POSIX SC 1 LMU
+LOGNAME_MAX SVID SC 1 MU 8
+LONG_BIT XOPEN XX 1 L (8*sizeof(long)) 32
+LONG_MAX C XX 1 L 2147483647
+LONG_MIN C XX 1 L -2147483647
+LP64_OFF64 XBS5 SC 1 FU
+LP64_OFF64_CFLAGS XBS5 CS 1 FU
+LP64_OFF64_LDFLAGS XBS5 CS 1 FU
+LP64_OFF64_LIBS XBS5 CS 1 FU
+LP64_OFF64_LINTFLAGS XBS5 CS 1 FU
+LPBIG_OFFBIG XBS5 SC 1 FU
+LPBIG_OFFBIG_CFLAGS XBS5 CS 1 FU
+LPBIG_OFFBIG_LDFLAGS XBS5 CS 1 FU
+LPBIG_OFFBIG_LIBS XBS5 CS 1 FU
+LPBIG_OFFBIG_LINTFLAGS XBS5 CS 1 FU
+MACHINE SVID SI 1 O
+MAPPED_FILES POSIX SC 1 CDFUW _lib_mmap
+MAX_CANON POSIX PC 1 LMU CANBSIZ 255
+MAX_INPUT POSIX PC 1 LMU MAX_CANON 255
+MB_LEN_MAX C XX 1 L 1
+MCAS_OFFSET C QQ 1 L
+MEMLOCK POSIX SC 1 CDFUW
+MEMLOCK_RANGE POSIX SC 1 CDFUW
+MEMORY_PROTECTION POSIX SC 1 CDFUW
+MESSAGE_PASSING POSIX SC 1 CDFUW
+MMAP_FIXED_ALIGNMENT C QQ 1 L _AST_PAGESIZE
+MONOTONIC_CLOCK POSIX SC 1 FUW
+MQ_OPEN_MAX POSIX SC 1 LMU 8
+MQ_PRIO_MAX POSIX SC 1 LMU 32
+MSEM_LOCKID C QQ 1 L
+MULTI_PROCESS POSIX SC 1 FU
+NACLS_MAX SVID SC 1 0
+NAME_MAX POSIX PC 1 LMU 14 cc{
+ int main()
+ {
+ #ifdef MAXNAMLEN
+ printf("%d", MAXNAMLEN);
+ #else
+ #if !defined(remove) && (!_lib_remove || _lib_unlink)
+ #define remove unlink
+ #endif
+ int i;
+ int n;
+ int v;
+ char name[256];
+ for (i = 0; i < sizeof(name); i++)
+ name[i] = 'F';
+ name[8] = '.';
+ name[sizeof(name) - 1] = 0;
+ if ((n = creat(name, 0666)) >= 0)
+ {
+ close(n);
+ for (v = 12; v < sizeof(name); v++)
+ {
+ name[v] = 0;
+ if (remove(name) >= 0) break;
+ name[v] = 'F';
+ }
+ }
+ else for (v = 12; v < sizeof(name); v++)
+ {
+ name[v] = 0;
+ if ((n = creat(name, 0666)) >= 0)
+ {
+ close(n);
+ remove(name);
+ name[v] = 'F';
+ }
+ else
+ {
+ v--;
+ break;
+ }
+ }
+ printf("%d", v);
+ return 0;
+ }
+ #endif
+}
+NGROUPS_MAX POSIX SC 1 CDLMU 8 cc{
+ #if _lib_getgroups
+ int main()
+ {
+ int n;
+ gid_t g;
+ if ((n = getgroups(0, &g)) < 0)
+ #if defined(NGROUPS) && (NGROUPS-0) > 0
+ n = NGROUPS;
+ #else
+ return 1;
+ #endif
+ printf("%d", n);
+ return 0;
+ }
+ #endif
+}
+NL_ARGMAX XOPEN XX 1 L 9
+NL_LANGMAX XOPEN XX 1 L 14
+NL_MAX C QQ 1 L
+NL_MSGMAX XOPEN XX 1 L 32767
+NL_NMAX XOPEN XX 1 L 1
+NL_SETMAX XOPEN XX 1 L 255
+NL_SPECMAX C QQ 1 L
+NL_TEXTMAX XOPEN XX 1 L LINE_MAX
+NO_TRUNC POSIX PC 1 FUW
+NPROCESSORS_CONF SVID SC 1 0
+NPROCESSORS_MAX SVID SC 1 0
+NPROCESSORS_ONLN SVID SC 1 0
+NPROC_CONF C QQ 1 L
+NPROC_ONLN C QQ 1 L
+NSS_BUFLEN_GROUP C QQ 1 L
+NSS_BUFLEN_PASSWD C QQ 1 L
+NUM_PROCESSORS C QQ 1 L
+NZERO XOPEN XX 1 L 20
+OPEN_MAX POSIX SC 1 CDLMUX 16 cc{
+ #if _lib_getdtablesize
+ extern int getdtablesize(void);
+ int main()
+ {
+ printf("%d", getdtablesize());
+ return 0;
+ }
+ #else
+ int main()
+ {
+ int i;
+ int n;
+ int v;
+ n = 0;
+ v = 2;
+ while ((i = dup(0)) >= 0)
+ {
+ if (!n) n = i;
+ if (i > v) v = i;
+ }
+ while (n <= v) close(n++);
+ printf("%d", v);
+ return 0;
+ }
+ #endif
+}
+OPEN_MAX_CEIL AST XX 1 L OPEN_MAX
+OSREL_MAJ C QQ 1 L
+OSREL_MIN C QQ 1 L
+OSREL_PATCH C QQ 1 L
+OS_BASE SVID SI 1 O
+OS_PROVIDER SVID SI 1 O
+OS_VERSION AES SC 1 FSU
+PAGESIZE POSIX SC 1 MU PAGESIZE PAGE_SIZE 4096 cc{
+ int main()
+ {
+ #if _WIN32
+ printf("%ld", 64*1024L);
+ return 0;
+ #else
+ #if _lib_getpagesize
+ #if _npt_getpagesize
+ extern size_t getpagesize(void);
+ #endif
+ printf("%d", getpagesize());
+ return 0;
+ #endif
+ #else
+ return 1;
+ #endif
+ }
+}
+PAGE_SIZE POSIX SC 1 MU _AST_PAGESIZE
+PASS_MAX SVID SC 1 CDLMU 8
+PATH POSIX CS 1 CMU "/bin:/usr/bin"
+PATH_MAX POSIX PC 1 CDLMUX MAXPATHLEN 1024
+PBS POSIX SC 2 FUW
+PBS_ACCOUNTING POSIX SC 2 FUW
+PBS_CHECKPOINT POSIX SC 2 FUW
+PBS_LOCATE POSIX SC 2 FUW
+PBS_MESSAGE POSIX SC 2 FUW
+PBS_TRACK POSIX SC 2 FUW
+PHYS_PAGES SUN SC 1 0
+PID_MAX SVID SC 1 LMU 30000 cc{
+ int main()
+ {
+ long v;
+ int fd;
+ int n;
+ char buf[1024];
+#ifdef PID_MAX
+ v = PID_MAX;
+#else
+ v = 99999;
+#endif
+ if ((fd = open("/proc/sys/kernel/pid_max", 0)) >= 0 && (n = read(fd, buf, sizeof(buf)-1)) > 1)
+ {
+ buf[n] = 0;
+ v = strtol(buf, (char**)0, 0);
+ }
+ else
+ {
+#ifdef __sgi
+ v = 0x7fffffff;
+#endif
+ }
+ printf("%ld", v);
+ return 0;
+ }
+}
+PII POSIX SC 1 FU
+PII_INTERNET POSIX SC 1 FU
+PII_INTERNET_DGRAM POSIX SC 1 FU
+PII_INTERNET_STREAM POSIX SC 1 FU
+PII_OSI POSIX SC 1 FU
+PII_OSI_CLTS POSIX SC 1 FU
+PII_OSI_COTS POSIX SC 1 FU
+PII_OSI_M POSIX SC 1 FU
+PII_SOCKET POSIX SC 1 FU
+PII_XTI POSIX SC 1 FU
+PIPE_BUF POSIX PC 1 LMU 512
+POLL POSIX SC 1 FU
+PRIORITIZED_IO POSIX SC 1 FUW
+PRIORITY_SCHEDULING POSIX SC 1 CDFUW
+PRIO_IO POSIX PC 1 FUW
+PROC_RSRC_MGR C QQ 1 L
+PTHREAD_DESTRUCTOR_ITERATIONS C QQ 1 L
+PTHREAD_KEYS_MAX C QQ 1 L
+PTHREAD_STACK_MIN C QQ 1 L
+PTHREAD_THREADS_MAX C QQ 1 L
+PTRDIFF_MAX C XX 1 LMU stdint.h 65535
+PTRDIFF_MIN C XX 1 LMU stdint.h -65535
+RAW_SOCKETS POSIX SC 1 FUW
+READER_WRITER_LOCKS POSIX SC 1 FUW
+REALTIME XOPEN SC 1 FU
+REALTIME_SIGNALS POSIX SC 1 CDFUW
+REALTIME_THREADS XOPEN SC 1 FU
+REC_INCR_XFER_SIZE POSIX PC 1 LVW
+REC_MAX_XFER_SIZE POSIX PC 1 LVW
+REC_MIN_XFER_SIZE POSIX PC 1 LVW
+REC_XFER_ALIGN POSIX PC 1 LVW
+REENTRANT_FUNCTIONS POSIX SC 1 FU
+REGEXP POSIX SC 1 FUW
+REGEX_VERSION POSIX SC 1 F 20030916
+RELEASE AST XX 1 L
+RESOURCE_LIMITS POSIX SC 1 FU
+RE_DUP_MAX POSIX SC 2 LMN 255
+RTSIG_MAX POSIX SC 1 LMU 8
+SAVED_IDS POSIX SC 1 FUW cc{
+ #if _lib_setuid && !_lib_setreuid
+ int main()
+ {
+ printf("1");
+ return 0;
+ }
+ #endif
+}
+SCHAR_MAX C XX 1 L 127
+SCHAR_MIN C XX 1 L -127
+SECURITY_CLASS C QQ 1 L
+SELECT POSIX SC 1 FU
+SEMAPHORES POSIX SC 1 CDFUW
+SEM_NSEMS_MAX POSIX SC 1 LMU 256
+SEM_VALUE_MAX POSIX SC 1 LMU 32767
+SF_BUFSIZE AST XX 1 MUX sh{
+ sed -e '/[ ]*#[ ]*define[ ][ ]*SF_BUFSIZE[ ]/!d' -e 's/^[^0-9]*//' -e 's/[^0-9]*$//' $PACKAGEROOT/src/lib/libast/include/sfio.h
+}
+SH AST CS 1 MU sh{
+ ifs=$IFS
+ IFS=:
+ set '' `$CONF_getconf PATH 2>/dev/null` /bin /usr/bin /sbin /usr/sbin
+ shift
+ path=$*
+ IFS=$ifs
+ for s in ksh ksh93 sh
+ do for d in $path
+ do if test -x $d/$s
+ then case $s in
+ ksh) case `$d/$s '--?-author' 2>&1` in
+ *'David Korn'*) ;;
+ *) continue ;;
+ esac
+ ;;
+ esac
+ echo '"'$d/$s'"'
+ exit
+ fi
+ done
+ done
+ echo '"/bin/sh"'
+}
+SHARED_MEMORY_OBJECTS POSIX SC 1 CDFUW
+SHELL POSIX SC 1 FUVW
+SHM XOPEN SC 1 FSUW
+SHRT_MAX C XX 1 L 32767
+SHRT_MIN C XX 1 L -32767
+SIG_ATOMIC_MAX C XX 1 L signal.h
+SIG_ATOMIC_MIN C XX 1 L signal.h
+SIGQUEUE_MAX POSIX SC 1 LMU 32
+SIGQUEUE_MAX POSIX SC 1 LMU 32
+SIGRT_MAX SVID SC 1 0
+SIGRT_MIN SVID SC 1 0
+SIZE_MAX C XX 1 LMX stdint.h UINT_MAX 65535
+SLVM_MAXNODES C QQ 1 L
+SOCK_MAXBUF C QQ 1 0
+SOFTPOWER C QQ 1 L
+SPAWN POSIX SC 1 FUW
+SPIN_LOCKS POSIX SC 1 FUW
+SPORADIC_SERVER POSIX SC 1 FUW
+SRPC_DOMAIN C QQ 1 0
+SS_REPL_MAX POSIX SC 1 FUW
+SSIZE_MAX POSIX XX 1 LMUX INT_MAX 32767
+STD_BLK SVID SC 1 LMU 1024
+STREAM_MAX POSIX SC 1 LMU OPEN_MAX 8
+STREAMS XOPEN SC 1 FSUW
+SW_DEV POSIX SC 2 CFUW
+SYMLINK_MAX POSIX PC 1 LMU 255 cc{
+ int main()
+ {
+ printf("%d", PATH_MAX-1);
+ return 0;
+ }
+}
+SYMLINKS POSIX PC 2 FUW
+SYMLOOP_MAX POSIX SC 1 LMU 8
+SYNCHRONIZED_IO POSIX SC 1 CDFUW
+SYNC_IO POSIX PC 1 FUW
+SYSNAME SVID SI 1 O
+SYSPID_MAX SVID SC 1 LMU 2
+THREADS POSIX SC 1 CDFUW
+THREADS_PRIO_CEILING POSIX SC 1 FUW
+THREADS_PRIO_INHERIT POSIX SC 1 FUW
+THREAD_ATTR_STACKADDR POSIX SC 1 CDFUW
+THREAD_ATTR_STACKSIZE POSIX SC 1 CDFUW
+THREAD_CPUTIME POSIX SC 1 FUW
+THREAD_DESTRUCTOR_ITERATIONS POSIX SC 1 LMUW PTHREAD_DESTRUCTOR_ITERATIONS 4
+THREAD_KEYS_MAX POSIX SC 1 LMUW PTHREAD_KEYS_MAX 128
+THREAD_PRIORITY_SCHEDULING POSIX SC 1 CDFUW
+THREAD_PRIO_INHERIT POSIX SC 1 CDFUW
+THREAD_PRIO_PROTECT POSIX SC 1 CDFUW
+THREAD_PROCESS_SHARED POSIX SC 1 CDFUW
+THREAD_SAFE_FUNCTIONS POSIX SC 1 CDFUW
+THREAD_SPORADIC_SERVER POSIX SC 1 FUW
+THREAD_STACK_MIN POSIX SC 1 LUW PTHREAD_STACK_MIN
+THREAD_THREADS_MAX POSIX SC 1 LMUW PTHREAD_THREADS_MAX 64
+TIMEOUTS POSIX SC 1 FUW
+TIMERS POSIX SC 1 CDFUW
+TIMER_MAX POSIX SC 1 LMU 32
+TMP AST CS 1 MU "/tmp"
+TMP_MAX C SC 1 LMU 10000
+TRACE POSIX SC 1 FUW
+TRACE_EVENT_FILTER POSIX SC 1 FUW
+TRACE_EVENT_NAME_MAX POSIX SC 1 FUVW
+TRACE_INHERIT POSIX SC 1 FUW
+TRACE_LOG POSIX SC 1 FUW
+TRACE_NAME_MAX POSIX SC 1 FUVW
+TRACE_SYS_MAX POSIX SC 1 FUVW
+TRACE_USER_EVENT_MAX POSIX SC 1 FUVW
+TTY_NAME_MAX POSIX SC 1 LMU 9
+TYPED_MEMORY_OBJECTS POSIX SC 1 FUW
+TZNAME_MAX POSIX SC 1 CDLMU 6
+T_IOV_MAX C QQ 1 0
+UCHAR_MAX C XX 1 L 255
+UCHAR_MIN C XX 1 L
+UID_MAX SVID SC 1 LMU 60002
+UINT_MAX C XX 1 L 65535
+UIO_MAXIOV C QQ 1 0
+ULLONG_MAX C XX 1 L
+ULONG_MAX C XX 1 L 4294967295
+UNIX XOPEN SC 1 FSUW
+UPE POSIX SC 2 CFUW
+USER_LIMIT SVID SI 1 O
+USHRT_MAX C XX 1 L 65535
+V6_ILP32_OFF32 POSIX SC 1 W
+V6_ILP32_OFFBIG POSIX SC 1 W
+V6_LP64_OFF64 POSIX SC 1 W
+V6_LPBIG_OFFBIG POSIX SC 1 W
+VDISABLE POSIX PC 1 FUW
+VERSION POSIX SC 1 CDFSU 200112
+VERSION POSIX SC 2 CDFSU 200112
+VERSION XOPEN SC 1 CDFSU 600
+VERSION AST XX 1 MS _AST_VERSION
+VERSION SVID SI 1 S
+VERSION XPG SC 3 DFSU
+VERSION XPG SC 4 DFSU
+VERSION_88 C XX 1 L
+VERSION_88 POSIX SC 1 FSU
+VERSION_90 C XX 1 L
+VERSION_90 POSIX SC 1 FSU
+VERSION_93 C XX 1 L
+VERSION_93 POSIX SC 1 FSU
+WCHAR_MAX C XX 1 L stddef.h
+WCHAR_MIN C XX 1 L stddef.h
+WINT_MIN C XX 1 L wchar.h
+WINT_MAX C XX 1 L wchar.h
+WORD_BIT XOPEN XX 1 L (8*sizeof(int))
+XCU_VERSION XOPEN SC 1 CDFSU
+XPG2 XOPEN XX 1 FU
+XPG3 XOPEN XX 1 FU
+XPG4 XOPEN XX 1 FU
+
+# vendor prefixes
+
+VERSION GNU XX 1 S
+VERSION TRUSTEDBSD XX 1 S
diff --git a/src/lib/libast/comp/creat64.c b/src/lib/libast/comp/creat64.c
new file mode 100644
index 0000000..7917f2f
--- /dev/null
+++ b/src/lib/libast/comp/creat64.c
@@ -0,0 +1,38 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if defined(_lib_creat64) || !defined(_lib_open64)
+
+NoN(creat64)
+
+#else
+
+int
+creat64(const char* path, mode_t mode)
+{
+ return open64(path, O_WRONLY|O_CREAT|O_TRUNC, mode);
+}
+
+#endif
diff --git a/src/lib/libast/comp/dirname.c b/src/lib/libast/comp/dirname.c
new file mode 100644
index 0000000..b03d734
--- /dev/null
+++ b/src/lib/libast/comp/dirname.c
@@ -0,0 +1,61 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * dirname(3) implementation
+ */
+
+#include <ast_std.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char *dirname(register char *pathname)
+{
+ register char *last;
+ /* go to end of path */
+ for(last=pathname; *last; last++);
+ /* back over trailing '/' */
+ while(last>pathname && *--last=='/');
+ /* back over non-slash chars */
+ for(;last>pathname && *last!='/';last--);
+ if(last==pathname)
+ {
+ /* all '/' or "" */
+ if(*last!='/')
+ *last = '.';
+ /* preserve // */
+ else if(last[1]=='/')
+ last++;
+ }
+ else
+ {
+ /* back over trailing '/' */
+ for(;*last=='/' && last > pathname; last--);
+ /* preserve // */
+ if(last==pathname && *pathname=='/' && pathname[1]=='/')
+ last++;
+ }
+ *(last + 1) = 0;
+ return(pathname);
+}
diff --git a/src/lib/libast/comp/dup2.c b/src/lib/libast/comp/dup2.c
new file mode 100644
index 0000000..6999972
--- /dev/null
+++ b/src/lib/libast/comp/dup2.c
@@ -0,0 +1,46 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_dup2
+
+NoN(dup2)
+
+#else
+
+#include <error.h>
+
+int
+dup2(int d1, int d2)
+{
+ int save_errno;
+
+ if (d1 == d2) return(d1);
+ save_errno = errno;
+ close(d2);
+ errno = save_errno;
+ return(fcntl(d1, F_DUPFD, d2));
+}
+
+#endif
diff --git a/src/lib/libast/comp/eaccess.c b/src/lib/libast/comp/eaccess.c
new file mode 100644
index 0000000..1fe44a7
--- /dev/null
+++ b/src/lib/libast/comp/eaccess.c
@@ -0,0 +1,139 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * access() euid/egid implementation
+ */
+
+#include <ast.h>
+#include <errno.h>
+#include <ls.h>
+
+#include "FEATURE/eaccess"
+
+#if _lib_eaccess
+
+NoN(eaccess)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+eaccess(const char* path, register int flags)
+{
+#ifdef EFF_ONLY_OK
+ return access(path, flags|EFF_ONLY_OK);
+#else
+#if _lib_euidaccess
+ return euidaccess(path, flags);
+#else
+ register int mode;
+ struct stat st;
+
+ static int init;
+ static uid_t ruid;
+ static uid_t euid;
+ static gid_t rgid;
+ static gid_t egid;
+
+ if (!init)
+ {
+ ruid = getuid();
+ euid = geteuid();
+ rgid = getgid();
+ egid = getegid();
+ init = (ruid == euid && rgid == egid) ? 1 : -1;
+ }
+ if (init > 0 || flags == F_OK)
+ return access(path, flags);
+ if (stat(path, &st))
+ return -1;
+ mode = 0;
+ if (euid == 0)
+ {
+ if (!S_ISREG(st.st_mode) || !(flags & X_OK) || (st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
+ return 0;
+ goto nope;
+ }
+ else if (euid == st.st_uid)
+ {
+ if (flags & R_OK)
+ mode |= S_IRUSR;
+ if (flags & W_OK)
+ mode |= S_IWUSR;
+ if (flags & X_OK)
+ mode |= S_IXUSR;
+ }
+ else if (egid == st.st_gid)
+ {
+#if _lib_getgroups
+ setgroup:
+#endif
+ if (flags & R_OK)
+ mode |= S_IRGRP;
+ if (flags & W_OK)
+ mode |= S_IWGRP;
+ if (flags & X_OK)
+ mode |= S_IXGRP;
+ }
+ else
+ {
+#if _lib_getgroups
+ register int n;
+
+ static int ngroups = -2;
+ static gid_t* groups;
+
+ if (ngroups == -2)
+ {
+ if ((ngroups = getgroups(0, (gid_t*)0)) <= 0)
+ ngroups = NGROUPS_MAX;
+ if (!(groups = newof(0, gid_t, ngroups + 1, 0)))
+ ngroups = -1;
+ else
+ ngroups = getgroups(ngroups, groups);
+ }
+ n = ngroups;
+ while (--n >= 0)
+ if (groups[n] == st.st_gid)
+ goto setgroup;
+#endif
+ if (flags & R_OK)
+ mode |= S_IROTH;
+ if (flags & W_OK)
+ mode |= S_IWOTH;
+ if (flags & X_OK)
+ mode |= S_IXOTH;
+ }
+ if ((st.st_mode & mode) == mode)
+ return 0;
+ nope:
+ errno = EACCES;
+ return -1;
+#endif
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/errno.c b/src/lib/libast/comp/errno.c
new file mode 100644
index 0000000..374a720
--- /dev/null
+++ b/src/lib/libast/comp/errno.c
@@ -0,0 +1,40 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _tst_errno
+
+NoN(errno)
+
+#else
+
+/*
+ * this avoids multiple definitions with some libc's
+ * that define both an ast library supplied routine and
+ * errno in the same .o
+ */
+
+int errno;
+
+#endif
diff --git a/src/lib/libast/comp/execlp.c b/src/lib/libast/comp/execlp.c
new file mode 100644
index 0000000..42de6ef
--- /dev/null
+++ b/src/lib/libast/comp/execlp.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast_lib.h>
+
+#if _lib_execlp
+
+#include <ast.h>
+
+NoN(execlp)
+
+#else
+
+#if defined(__EXPORT__)
+__EXPORT__ int execlp(const char*, const char*, ...);
+#endif
+
+#include <ast.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+execlp(const char* name, const char* arg, ...)
+{
+ return execvp(name, (char *const*)&arg);
+}
+
+#endif
diff --git a/src/lib/libast/comp/execve.c b/src/lib/libast/comp/execve.c
new file mode 100644
index 0000000..9d7e2ff
--- /dev/null
+++ b/src/lib/libast/comp/execve.c
@@ -0,0 +1,70 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_execve
+
+NoN(execve)
+
+#else
+
+#include <sig.h>
+#include <wait.h>
+#include <error.h>
+
+static pid_t childpid;
+
+static void
+execsig(int sig)
+{
+ kill(childpid, sig);
+ signal(sig, execsig);
+}
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+execve(const char* path, char* const argv[], char* const arge[])
+{
+ int status;
+
+ if ((childpid = spawnve(path, argv, arge)) < 0)
+ return(-1);
+ for (status = 0; status < 64; status++)
+ signal(status, execsig);
+ while (waitpid(childpid, &status, 0) == -1)
+ if (errno != EINTR) return(-1);
+ if (WIFSIGNALED(status))
+ {
+ signal(WTERMSIG(status), SIG_DFL);
+ kill(getpid(), WTERMSIG(status));
+ pause();
+ }
+ else status = WEXITSTATUS(status);
+ exit(status);
+}
+
+#endif
diff --git a/src/lib/libast/comp/execvp.c b/src/lib/libast/comp/execvp.c
new file mode 100644
index 0000000..1e34172
--- /dev/null
+++ b/src/lib/libast/comp/execvp.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast_lib.h>
+
+#if _lib_execvp
+
+#include <ast.h>
+
+NoN(execvp)
+
+#else
+
+#if defined(__EXPORT__)
+__EXPORT__ int execvp(const char*, char* const[]);
+#endif
+
+#include <ast.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+execvp(const char* name, char* const argv[])
+{
+ return execvpe(name, argv, environ);
+}
+
+#endif
diff --git a/src/lib/libast/comp/execvpe.c b/src/lib/libast/comp/execvpe.c
new file mode 100644
index 0000000..c711c50
--- /dev/null
+++ b/src/lib/libast/comp/execvpe.c
@@ -0,0 +1,78 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast_lib.h>
+
+#if _lib_execvpe
+
+#include <ast.h>
+
+NoN(execvpe)
+
+#else
+
+#if defined(__EXPORT__)
+__EXPORT__ int execvpe(const char*, char* const[], char* const[]);
+#endif
+
+#include <ast.h>
+#include <errno.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+execvpe(const char* name, char* const argv[], char* const envv[])
+{
+ register const char* path = name;
+ char buffer[PATH_MAX];
+
+ if (*path != '/' && !(path = pathpath(name, NULL, PATH_REGULAR|PATH_EXECUTE, buffer, sizeof(buffer))))
+ path = name;
+ execve(path, argv, envv);
+ if (errno == ENOEXEC)
+ {
+ register char** newargv;
+ register char** ov;
+ register char** nv;
+
+ for (ov = (char**)argv; *ov++;);
+ if (newargv = newof(0, char*, ov + 1 - (char**)argv, 0))
+ {
+ nv = newargv;
+ *nv++ = "sh";
+ *nv++ = (char*)path;
+ ov = (char**)argv;
+ while (*nv++ = *++ov);
+ path = pathshell();
+ execve(path, newargv, envv);
+ free(newargv);
+ }
+ else
+ errno = ENOMEM;
+ }
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/fakelink.h b/src/lib/libast/comp/fakelink.h
new file mode 100644
index 0000000..5683541
--- /dev/null
+++ b/src/lib/libast/comp/fakelink.h
@@ -0,0 +1,34 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * AT&T Bell Laboratories
+ *
+ * fake symbolic link private interface
+ */
+
+#ifndef _FAKELINK_H
+#define _FAKELINK_H
+
+#define FAKELINK_MAGIC "!<symlink>"
+
+#endif
diff --git a/src/lib/libast/comp/fcntl.c b/src/lib/libast/comp/fcntl.c
new file mode 100644
index 0000000..70adfee
--- /dev/null
+++ b/src/lib/libast/comp/fcntl.c
@@ -0,0 +1,98 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * -last fcntl
+ */
+
+#include <ast.h>
+
+#ifndef fcntl
+
+NoN(fcntl)
+
+#else
+
+#include <ls.h>
+#include <ast_tty.h>
+#include <error.h>
+
+#if F_SETFD >= _ast_F_LOCAL
+#if _sys_filio
+#include <sys/filio.h>
+#endif
+#endif
+
+#if _lib_fcntl
+#undef fcntl
+extern int fcntl(int, int, ...);
+#endif
+
+int
+_ast_fcntl(int fd, int op, ...)
+{
+ int n;
+ int save_errno;
+ struct stat st;
+ va_list ap;
+
+ save_errno = errno;
+ va_start(ap, op);
+ if (op >= _ast_F_LOCAL) switch (op)
+ {
+#if F_DUPFD >= _ast_F_LOCAL
+ case F_DUPFD:
+ n = va_arg(ap, int);
+ op = dup2(fd, n);
+ break;
+#endif
+#if F_GETFL >= _ast_F_LOCAL
+ case F_GETFL:
+ op = fstat(fd, &st);
+ break;
+#endif
+#if F_SETFD >= _ast_F_LOCAL && defined(FIOCLEX)
+ case F_SETFD:
+ n = va_arg(ap, int);
+ op = ioctl(fd, n == FD_CLOEXEC ? FIOCLEX : FIONCLEX, 0);
+ break;
+#endif
+ default:
+ errno = EINVAL;
+ op = -1;
+ break;
+ }
+ else
+#if _lib_fcntl
+ op = fcntl(fd, op, va_arg(ap, int));
+#else
+ {
+ errno = EINVAL;
+ op = -1;
+ }
+#endif
+ va_end(ap);
+ return(op);
+}
+
+#endif
diff --git a/src/lib/libast/comp/fmtmsg.h b/src/lib/libast/comp/fmtmsg.h
new file mode 100644
index 0000000..9360c41
--- /dev/null
+++ b/src/lib/libast/comp/fmtmsg.h
@@ -0,0 +1,141 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * fmtmsg interface definitions
+ */
+
+#ifndef _FMTMSG_H
+#define _FMTMSG_H
+
+#define MM_VERB_ENV "MSGVERB" /* keyword filter env var */
+#define MM_SEVERITY_ENV "SEV_LEVEL" /* alternate severity env var */
+
+/* max component length */
+
+#define MM_LABEL_1_MAX 10 /* label field 1 length */
+#define MM_LABEL_2_MAX 14 /* label field 2 length */
+
+/* classification type */
+
+#define MM_HARD 0x00000001L /* hardware */
+#define MM_SOFT 0x00000002L /* software */
+#define MM_FIRM 0x00000004L /* firmware */
+
+/* classification source */
+
+#define MM_APPL 0x00000010L /* application */
+#define MM_UTIL 0x00000020L /* utility */
+#define MM_OPSYS 0x00000040L /* kernel */
+
+/* classification display */
+
+#define MM_PRINT 0x00000100L /* stderr */
+#define MM_CONSOLE 0x00000200L /* console */
+
+/* classification status */
+
+#define MM_RECOVER 0x00001000L /* recoverable */
+#define MM_NRECOV 0x00002000L /* non-recoverable */
+
+/* severity */
+
+#define MM_NOSEV 0x0 /* no severity */
+#define MM_HALT 0x1 /* severe fault */
+#define MM_ERROR 0x2 /* fault */
+#define MM_WARNING 0x4 /* could be a problem */
+#define MM_INFO 0x8 /* not an error (noise?) */
+
+/* fmtmsg return value */
+
+#define MM_OK 0 /* succeeded */
+#define MM_NOTOK 3 /* failed completely */
+#define MM_NOMSG 1 /* stderr message failed */
+#define MM_NOCON 2 /* console message failed */
+
+/* null argument values -- 0 just doesn't get any respect */
+
+#define MM_NULLLBL (char*)0 /* label */
+#define MM_NULLSEV 0 /* severity */
+#define MM_NULLMC 0L /* class */
+#define MM_NULLTXT (char*)0 /* text */
+#define MM_NULLACT (char*)0 /* action */
+#define MM_NULLTAG (char*)0 /* tag */
+
+#ifdef MM_TABLES
+
+/* encoding support */
+
+typedef struct
+{
+ const char* name;
+ const char* display;
+ unsigned int value;
+} MM_table_t;
+
+#define mm_class _mm_class
+#define mm_severity _mm_severity()
+#define mm_verb _mm_verb
+
+#define MM_all 0xff
+#define MM_action 0x01
+#define MM_class 0x02
+#define MM_label 0x04
+#define MM_severity 0x08
+#define MM_source 0x10
+#define MM_status 0x20
+#define MM_tag 0x40
+#define MM_text 0x80
+
+#define MM_default (MM_action|MM_label|MM_severity|MM_tag|MM_text)
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+#if !_BLD_ast && defined(__IMPORT__)
+#define extern extern __IMPORT__
+#endif
+
+extern const MM_table_t mm_class[];
+extern const MM_table_t mm_verb[];
+
+#undef extern
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern const MM_table_t* mm_severity;
+
+#undef extern
+
+#endif
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int fmtmsg(long, const char*, int, const char*, const char*, const char*);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/fmtmsglib.c b/src/lib/libast/comp/fmtmsglib.c
new file mode 100644
index 0000000..3484223
--- /dev/null
+++ b/src/lib/libast/comp/fmtmsglib.c
@@ -0,0 +1,335 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * fmtmsg implementation
+ */
+
+#include <ast.h>
+
+#if _lib_fmtmsg
+
+NoN(fmtmsg)
+
+#else
+
+#define MM_TABLES
+
+#include <fmtmsg.h>
+
+#define INIT_VERB 0x1
+#define INIT_CONSOLE 0x2
+
+static struct
+{
+ int console;
+ unsigned int init;
+ unsigned int mask;
+} mm;
+
+const MM_table_t mm_class[] =
+{
+ "null", 0, 0,
+ "hard", "HARDWARE", MM_HARD,
+ "soft", "SOFTWARE", MM_SOFT,
+ "firm", "FIRMWARE", MM_FIRM,
+ "appl", "APPLICATION", MM_APPL,
+ "util", "UTILITY", MM_UTIL,
+ "opsys", "KERNEL", MM_OPSYS,
+ "print", 0, MM_PRINT,
+ "console", 0, MM_CONSOLE,
+ "recov", "RECOVERABLE", MM_RECOVER,
+ "nrecov", "PANIC", MM_NRECOV,
+ 0, 0, 0
+};
+
+static const MM_table_t mm_severity_init[] =
+{
+ "nosev", 0, MM_NOSEV,
+ "halt", "HALT", MM_HALT,
+ "error", "ERROR", MM_ERROR,
+ "warn", "WARNING", MM_WARNING,
+ "info", "INFO", MM_INFO,
+ 0, 0, 0
+};
+
+const MM_table_t mm_verb[] =
+{
+ "all", 0, MM_all,
+ "action", 0, MM_action,
+ "class", 0, MM_class,
+ "default", 0, MM_default,
+ "label", 0, MM_label,
+ "severity", 0, MM_severity,
+ "source", 0, MM_source,
+ "tag", 0, MM_tag,
+ "text", 0, MM_text,
+ 0, 0, 0
+};
+
+const MM_table_t*
+_mm_severity(void)
+{
+ static MM_table_t* severity;
+
+ if (!severity)
+ {
+ register char* s;
+ register MM_table_t* p;
+ register int n;
+ register int c;
+ char* e;
+ MM_table_t* q;
+
+ n = 0;
+ if ((s = getenv(MM_SEVERITY_ENV)) && *s)
+ {
+ e = s;
+ c = 0;
+ for (;;)
+ {
+ switch (*s++)
+ {
+ case 0:
+ break;
+ case ',':
+ if (++c > 2)
+ {
+ n = 0;
+ break;
+ }
+ continue;
+ case ':':
+ if (c != 2)
+ {
+ n = 0;
+ break;
+ }
+ c = 0;
+ n++;
+ continue;
+ default:
+ continue;
+ }
+ break;
+ }
+ if (c == 2)
+ n++;
+ else n = 0;
+ if (n)
+ {
+ for (p = (MM_table_t*)mm_severity_init; p->name; p++);
+ n += p - (MM_table_t*)mm_severity_init + 1;
+ if (severity = newof(0, MM_table_t, n, s - e))
+ {
+ s = (char*)severity + n * sizeof(MM_table_t);
+ strcpy(s, e);
+ p = severity;
+ for (q = (MM_table_t*)mm_severity_init; q->name; q++)
+ *p++ = *q;
+ p->name = s;
+ c = 0;
+ for (;;)
+ {
+ switch (*s++)
+ {
+ case 0:
+ break;
+ case ',':
+ switch (c++)
+ {
+ case 0:
+ *(s - 1) = 0;
+ p->value = strtol(s, NiL, 0);
+ break;
+ case 1:
+ p->display = s;
+ break;
+ }
+ continue;
+ case ':':
+ c = 0;
+ *(s - 1) = 0;
+ (++p)->name = s;
+ continue;
+ default:
+ continue;
+ }
+ break;
+ }
+ }
+ }
+ }
+ if (!severity)
+ severity = (MM_table_t*)mm_severity_init;
+ }
+ return (const MM_table_t*)severity;
+}
+
+static char*
+display(register const MM_table_t* tab, int value, int mask)
+{
+ while (tab->name)
+ {
+ if (value == tab->value || mask && (value & tab->value))
+ return (char*)tab->display;
+ tab++;
+ }
+ return 0;
+}
+
+int
+fmtmsg(long classification, const char* label, int severity, const char* text, const char* action, const char* tag)
+{
+ register int c;
+ register char* s;
+ register char* t;
+ register MM_table_t* p;
+ int n;
+ int m;
+ int r;
+ int fd;
+ unsigned int mask;
+ Sfio_t* sp;
+ char lab[MM_LABEL_1_MAX + MM_LABEL_2_MAX + 3];
+
+ if (!mm.init)
+ {
+ mm.init = INIT_VERB;
+ if (!(s = getenv(MM_VERB_ENV)))
+ mm.mask = MM_default;
+ else for (;;)
+ {
+ if (t = strchr(s, ':'))
+ *t = 0;
+ if (!(p = (MM_table_t*)strlook(mm_verb, sizeof(MM_table_t), s)))
+ {
+ mm.mask = MM_default;
+ if (t)
+ *t = ':';
+ break;
+ }
+ mm.mask |= p->value;
+ if (!t)
+ break;
+ *t++ = ':';
+ s = t;
+ }
+ }
+ if (!(classification & (MM_CONSOLE|MM_PRINT)))
+ return 0;
+ if (!(sp = sfstropen()))
+ return MM_NOTOK;
+ r = 0;
+ if (s = (char*)label)
+ {
+ if (t = strchr(s, ':'))
+ {
+ if ((n = t - s) > MM_LABEL_1_MAX)
+ n = MM_LABEL_1_MAX;
+ sfprintf(sp, "%*.*s:", n, n, s);
+ s = ++t;
+ if ((n = strlen(t)) > MM_LABEL_2_MAX)
+ n = MM_LABEL_2_MAX;
+ sfprintf(sp, "%*.*s", n, n, s);
+ }
+ else
+ {
+ if ((n = strlen(t)) > MM_LABEL_1_MAX)
+ n = MM_LABEL_1_MAX;
+ sfprintf(sp, "%*.*s", n, n, s);
+ }
+ if (!(s = sfstruse(sp)))
+ {
+ sfstrclose(sp);
+ return MM_NOTOK;
+ }
+ strcpy(lab, s);
+ }
+ for (;;)
+ {
+ if (classification & MM_CONSOLE)
+ {
+ classification &= ~MM_CONSOLE;
+ if (!(mm.init & INIT_CONSOLE))
+ mm.console = open("/dev/console", O_WRONLY|O_APPEND|O_NOCTTY);
+ if (mm.console < 0)
+ {
+ r |= MM_NOCON;
+ continue;
+ }
+ c = MM_NOCON;
+ fd = mm.console;
+ mask = MM_all;
+ }
+ else if (classification & MM_PRINT)
+ {
+ classification &= ~MM_PRINT;
+ c = MM_NOMSG;
+ fd = 2;
+ mask = mm.mask;
+ }
+ else break;
+ if ((mask & MM_label) && label)
+ sfprintf(sp, "%s: ", lab);
+ if ((mask & MM_severity) && (s = display(mm_severity, severity, 0)))
+ sfprintf(sp, "%s: ", s);
+ n = sfstrtell(sp);
+ if ((mask & MM_text) && text)
+ sfprintf(sp, "%s\n", text);
+ else sfputc(sp, '\n');
+ if ((mask & MM_action) && action || (mask & MM_tag) && (label || tag))
+ {
+ if (fd != mm.console && (n -= 8) > 0)
+ sfprintf(sp, "%*.*s", n, n, "");
+ sfprintf(sp, "TO FIX:");
+ if ((mask & MM_action) && action)
+ sfprintf(sp, " %s", action);
+ if ((mask & MM_tag) && (label || tag))
+ {
+ sfprintf(sp, " ");
+ if (!tag || label && !strchr(tag, ':'))
+ sfprintf(sp, "%s%s", lab, tag ? ":" : "");
+ if (tag)
+ sfprintf(sp, "%s", tag);
+ }
+ if (mask & (MM_class|MM_source|MM_status))
+ {
+ sfputc(sp, ' ');
+ if ((mask & MM_source) && (m = classification & (MM_APPL|MM_UTIL|MM_OPSYS)) && (s = display(mm_class, m, 1)))
+ sfprintf(sp, " %s", s);
+ if ((mask & MM_class) && (m = classification & (MM_HARD|MM_SOFT|MM_FIRM)) && (s = display(mm_class, m, 1)))
+ sfprintf(sp, " %s", s);
+ if ((mask & MM_status) && (m = classification & (MM_RECOVER|MM_NRECOV)) && (s = display(mm_class, m, 1)))
+ sfprintf(sp, " %s", s);
+ }
+ sfputc(sp, '\n');
+ }
+ n = sfstrtell(sp);
+ if (!(s = sfstruse(sp)) || write(fd, s, n) != n)
+ r |= c;
+ }
+ sfstrclose(sp);
+ return r;
+}
+
+#endif
diff --git a/src/lib/libast/comp/fnmatch.c b/src/lib/libast/comp/fnmatch.c
new file mode 100644
index 0000000..6c31998
--- /dev/null
+++ b/src/lib/libast/comp/fnmatch.c
@@ -0,0 +1,79 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * fnmatch implementation
+ */
+
+#include <ast_lib.h>
+
+#include <ast.h>
+#include <regex.h>
+#include <fnmatch.h>
+
+typedef struct
+{
+ int fnm; /* fnmatch flag */
+ int reg; /* regex flag */
+} Map_t;
+
+static const Map_t map[] =
+{
+ FNM_AUGMENTED, REG_AUGMENTED,
+ FNM_ICASE, REG_ICASE,
+ FNM_NOESCAPE, REG_SHELL_ESCAPED,
+ FNM_PATHNAME, REG_SHELL_PATH,
+ FNM_PERIOD, REG_SHELL_DOT,
+};
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+fnmatch(const char* pattern, const char* subject, register int flags)
+{
+ register int reflags = REG_SHELL|REG_LEFT;
+ register const Map_t* mp;
+ regex_t re;
+ regmatch_t match;
+
+ for (mp = map; mp < &map[elementsof(map)]; mp++)
+ if (flags & mp->fnm)
+ reflags |= mp->reg;
+ if (flags & FNM_LEADING_DIR)
+ {
+ if (!(reflags = regcomp(&re, pattern, reflags)))
+ {
+ reflags = regexec(&re, subject, 1, &match, 0);
+ regfree(&re);
+ if (!reflags && (reflags = subject[match.rm_eo]))
+ reflags = reflags == '/' ? 0 : FNM_NOMATCH;
+ }
+ }
+ else if (!(reflags = regcomp(&re, pattern, reflags|REG_RIGHT)))
+ {
+ reflags = regexec(&re, subject, 0, NiL, 0);
+ regfree(&re);
+ }
+ return reflags;
+}
diff --git a/src/lib/libast/comp/fnmatch.h b/src/lib/libast/comp/fnmatch.h
new file mode 100644
index 0000000..945e645
--- /dev/null
+++ b/src/lib/libast/comp/fnmatch.h
@@ -0,0 +1,61 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * posix fnmatch interface definitions
+ */
+
+#ifndef _FNMATCH_H
+#define _FNMATCH_H
+
+#include <ast_common.h>
+
+/* fnmatch flags */
+
+#define FNM_NOESCAPE 0x0001 /* \ is literal */
+#define FNM_PATHNAME 0x0002 /* explicit match for / */
+#define FNM_PERIOD 0x0004 /* explicit match for leading . */
+#define FNM_NOSYS 0x0010 /* not implemented */
+
+/* nonstandard fnmatch() flags */
+
+#define FNM_AUGMENTED 0x0008 /* enable ! & ( | ) */
+#define FNM_ICASE 0x0020 /* ignore case in match */
+#define FNM_LEADING_DIR 0x0040 /* match up to implicit / */
+
+#define FNM_CASEFOLD FNM_ICASE /* gnu/bsd compatibility */
+#define FNM_IGNORECASE FNM_ICASE /* gnu/bsd compatibility */
+#define FNM_FILE_NAME FNM_PATHNAME /* gnu compatibility */
+
+/* fnmatch error codes -- other non-zero values from <regex.h> */
+
+#define FNM_NOMATCH 1 /* == REG_NOMATCH */
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int fnmatch(const char*, const char*, int);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/frexp.c b/src/lib/libast/comp/frexp.c
new file mode 100644
index 0000000..02cd50f
--- /dev/null
+++ b/src/lib/libast/comp/frexp.c
@@ -0,0 +1,153 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * frexp/ldexp implementation
+ */
+
+#include <ast.h>
+
+#include "FEATURE/float"
+
+#if _lib_frexp && _lib_ldexp
+
+NoN(frexp)
+
+#else
+
+#if defined(_ast_dbl_exp_index) && defined(_ast_dbl_exp_shift)
+
+#define INIT() _ast_dbl_exp_t _pow_
+#define pow2(i) (_pow_.f=1,_pow_.e[_ast_dbl_exp_index]+=((i)<<_ast_dbl_exp_shift),_pow_.f)
+
+#else
+
+static double pow2tab[DBL_MAX_EXP + 1];
+
+static int
+init(void)
+{
+ register int x;
+ double g;
+
+ g = 1;
+ for (x = 0; x < elementsof(pow2tab); x++)
+ {
+ pow2tab[x] = g;
+ g *= 2;
+ }
+ return 0;
+}
+
+#define INIT() (pow2tab[0]?0:init())
+
+#define pow2(i) pow2tab[i]
+
+#endif
+
+#if !_lib_frexp
+
+extern double
+frexp(double f, int* p)
+{
+ register int k;
+ register int x;
+ double g;
+
+ INIT();
+
+ /*
+ * normalize
+ */
+
+ x = k = DBL_MAX_EXP / 2;
+ if (f < 1)
+ {
+ g = 1.0L / f;
+ for (;;)
+ {
+ k = (k + 1) / 2;
+ if (g < pow2(x))
+ x -= k;
+ else if (k == 1 && g < pow2(x+1))
+ break;
+ else
+ x += k;
+ }
+ if (g == pow2(x))
+ x--;
+ x = -x;
+ }
+ else if (f > 1)
+ {
+ for (;;)
+ {
+ k = (k + 1) / 2;
+ if (f > pow2(x))
+ x += k;
+ else if (k == 1 && f > pow2(x-1))
+ break;
+ else
+ x -= k;
+ }
+ if (f == pow2(x))
+ x++;
+ }
+ else
+ x = 1;
+ *p = x;
+
+ /*
+ * shift
+ */
+
+ x = -x;
+ if (x < 0)
+ f /= pow2(-x);
+ else if (x < DBL_MAX_EXP)
+ f *= pow2(x);
+ else
+ f = (f * pow2(DBL_MAX_EXP - 1)) * pow2(x - (DBL_MAX_EXP - 1));
+ return f;
+}
+
+#endif
+
+#if !_lib_ldexp
+
+extern double
+ldexp(double f, register int x)
+{
+ INIT();
+ if (x < 0)
+ f /= pow2(-x);
+ else if (x < DBL_MAX_EXP)
+ f *= pow2(x);
+ else
+ f = (f * pow2(DBL_MAX_EXP - 1)) * pow2(x - (DBL_MAX_EXP - 1));
+ return f;
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/frexpl.c b/src/lib/libast/comp/frexpl.c
new file mode 100644
index 0000000..5d90ad9
--- /dev/null
+++ b/src/lib/libast/comp/frexpl.c
@@ -0,0 +1,161 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * frexpl/ldexpl implementation
+ */
+
+#include <ast.h>
+
+#include "FEATURE/float"
+
+#if _lib_frexpl && _lib_ldexpl
+
+NoN(frexpl)
+
+#else
+
+#ifndef LDBL_MAX_EXP
+#define LDBL_MAX_EXP DBL_MAX_EXP
+#endif
+
+#if defined(_ast_fltmax_exp_index) && defined(_ast_fltmax_exp_shift)
+
+#define INIT() _ast_fltmax_exp_t _pow_
+#define pow2(i) (_pow_.f=1,_pow_.e[_ast_fltmax_exp_index]+=((i)<<_ast_fltmax_exp_shift),_pow_.f)
+
+#else
+
+static _ast_fltmax_t pow2tab[LDBL_MAX_EXP + 1];
+
+static int
+init(void)
+{
+ register int x;
+ _ast_fltmax_t g;
+
+ g = 1;
+ for (x = 0; x < elementsof(pow2tab); x++)
+ {
+ pow2tab[x] = g;
+ g *= 2;
+ }
+ return 0;
+}
+
+#define INIT() (pow2tab[0]?0:init())
+
+#define pow2(i) (pow2tab[i])
+
+#endif
+
+#if !_lib_frexpl
+
+#undef frexpl
+
+extern _ast_fltmax_t
+frexpl(_ast_fltmax_t f, int* p)
+{
+ register int k;
+ register int x;
+ _ast_fltmax_t g;
+
+ INIT();
+
+ /*
+ * normalize
+ */
+
+ x = k = LDBL_MAX_EXP / 2;
+ if (f < 1)
+ {
+ g = 1.0L / f;
+ for (;;)
+ {
+ k = (k + 1) / 2;
+ if (g < pow2(x))
+ x -= k;
+ else if (k == 1 && g < pow2(x+1))
+ break;
+ else
+ x += k;
+ }
+ if (g == pow2(x))
+ x--;
+ x = -x;
+ }
+ else if (f > 1)
+ {
+ for (;;)
+ {
+ k = (k + 1) / 2;
+ if (f > pow2(x))
+ x += k;
+ else if (k == 1 && f > pow2(x-1))
+ break;
+ else
+ x -= k;
+ }
+ if (f == pow2(x))
+ x++;
+ }
+ else
+ x = 1;
+ *p = x;
+
+ /*
+ * shift
+ */
+
+ x = -x;
+ if (x < 0)
+ f /= pow2(-x);
+ else if (x < LDBL_MAX_EXP)
+ f *= pow2(x);
+ else
+ f = (f * pow2(LDBL_MAX_EXP - 1)) * pow2(x - (LDBL_MAX_EXP - 1));
+ return f;
+}
+
+#endif
+
+#if !_lib_ldexpl
+
+#undef ldexpl
+
+extern _ast_fltmax_t
+ldexpl(_ast_fltmax_t f, register int x)
+{
+ INIT();
+ if (x < 0)
+ f /= pow2(-x);
+ else if (x < LDBL_MAX_EXP)
+ f *= pow2(x);
+ else
+ f = (f * pow2(LDBL_MAX_EXP - 1)) * pow2(x - (LDBL_MAX_EXP - 1));
+ return f;
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/fsync.c b/src/lib/libast/comp/fsync.c
new file mode 100644
index 0000000..4223fa0
--- /dev/null
+++ b/src/lib/libast/comp/fsync.c
@@ -0,0 +1,46 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_fsync
+
+NoN(fsync)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+fsync(int fd)
+{
+ NoP(fd);
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/ftw.c b/src/lib/libast/comp/ftw.c
new file mode 100644
index 0000000..4722628
--- /dev/null
+++ b/src/lib/libast/comp/ftw.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * ftw implementation
+ */
+
+#include <ast.h>
+#include <ftw.h>
+
+static int (*ftw_userf)(const char*, const struct stat*, int);
+
+static int
+ftw_user(Ftw_t* ftw)
+{
+ register int n = ftw->info;
+
+ if (n & (FTW_C|FTW_NX))
+ n = FTW_DNR;
+ else if (n & FTW_SL)
+ n = FTW_NS;
+ return (*ftw_userf)(ftw->path, &ftw->statb, n);
+}
+
+int
+ftw(const char* path, int(*userf)(const char*, const struct stat*, int), int depth)
+{
+ NoP(depth);
+ ftw_userf = userf;
+ return ftwalk(path, ftw_user, FTW_DOT, NiL);
+}
diff --git a/src/lib/libast/comp/ftw.h b/src/lib/libast/comp/ftw.h
new file mode 100644
index 0000000..a61f548
--- /dev/null
+++ b/src/lib/libast/comp/ftw.h
@@ -0,0 +1,60 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * ftw,nftw over ftwalk
+ */
+
+#ifndef _FTW_H
+#define _FTW_H
+
+#define FTW FTWALK
+#include <ftwalk.h>
+#undef FTW
+
+#define FTW_SLN (FTW_SL|FTW_NR)
+
+#define FTW_PHYS (FTW_PHYSICAL)
+#define FTW_CHDIR (FTW_DOT)
+#define FTW_DEPTH (FTW_POST)
+#define FTW_OPEN (0)
+
+struct FTW
+{
+ int quit;
+ int base;
+ int level;
+};
+
+#define FTW_SKD FTW_SKIP
+#define FTW_PRUNE FTW_SKIP
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int ftw(const char*, int(*)(const char*, const struct stat*, int), int);
+extern int nftw(const char*, int(*)(const char*, const struct stat*, int, struct FTW*), int, int);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/getdate.c b/src/lib/libast/comp/getdate.c
new file mode 100644
index 0000000..455c5fb
--- /dev/null
+++ b/src/lib/libast/comp/getdate.c
@@ -0,0 +1,83 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * getdate implementation
+ */
+
+#define getdate ______getdate
+
+#include <ast.h>
+#include <tm.h>
+
+#undef getdate
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#undef _lib_getdate /* we can pass X/Open */
+
+#if _lib_getdate
+
+NoN(getdate)
+
+#else
+
+#ifndef getdate_err
+__DEFINE__(int, getdate_err, 0);
+#endif
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern struct tm*
+getdate(const char* s)
+{
+ char* e;
+ char* f;
+ time_t t;
+ Tm_t* tm;
+
+ static struct tm ts;
+
+ t = tmscan(s, &e, NiL, &f, NiL, TM_PEDANTIC);
+ if (*e || *f)
+ {
+ /* of course we all know what 7 means */
+ getdate_err = 7;
+ return 0;
+ }
+ tm = tmmake(&t);
+ ts.tm_sec = tm->tm_sec;
+ ts.tm_min = tm->tm_min;
+ ts.tm_hour = tm->tm_hour;
+ ts.tm_mday = tm->tm_mday;
+ ts.tm_mon = tm->tm_mon;
+ ts.tm_year = tm->tm_year;
+ ts.tm_wday = tm->tm_wday;
+ ts.tm_yday = tm->tm_yday;
+ ts.tm_isdst = tm->tm_isdst;
+ return &ts;
+}
+
+#endif
diff --git a/src/lib/libast/comp/getgroups.c b/src/lib/libast/comp/getgroups.c
new file mode 100644
index 0000000..8b90bf0
--- /dev/null
+++ b/src/lib/libast/comp/getgroups.c
@@ -0,0 +1,78 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if !defined(getgroups) && defined(_lib_getgroups)
+
+NoN(getgroups)
+
+#else
+
+#include <error.h>
+
+#if defined(getgroups)
+#undef getgroups
+#define ast_getgroups _ast_getgroups
+#define botched 1
+extern int getgroups(int, int*);
+#else
+#define ast_getgroups getgroups
+#endif
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+ast_getgroups(int len, gid_t* set)
+{
+#if botched
+#if NGROUPS_MAX < 1
+#undef NGROUPS_MAX
+#define NGROUPS_MAX 1
+#endif
+ register int i;
+ int big[NGROUPS_MAX];
+#else
+#undef NGROUPS_MAX
+#define NGROUPS_MAX 1
+#endif
+ if (!len) return(NGROUPS_MAX);
+ if (len < 0 || !set)
+ {
+ errno = EINVAL;
+ return(-1);
+ }
+#if botched
+ len = getgroups(len > NGROUPS_MAX ? NGROUPS_MAX : len, big);
+ for (i = 0; i < len; i++)
+ set[i] = big[i];
+ return(len);
+#else
+ *set = getgid();
+ return(1);
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/getlogin.c b/src/lib/libast/comp/getlogin.c
new file mode 100644
index 0000000..7611dbb
--- /dev/null
+++ b/src/lib/libast/comp/getlogin.c
@@ -0,0 +1,42 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_getlogin
+
+NoN(getlogin)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char*
+getlogin(void)
+{
+ return fmtuid(getuid());
+}
+
+#endif
diff --git a/src/lib/libast/comp/getopt.c b/src/lib/libast/comp/getopt.c
new file mode 100644
index 0000000..c5c6f19
--- /dev/null
+++ b/src/lib/libast/comp/getopt.c
@@ -0,0 +1,78 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#undef _lib_getopt /* we can satisfy the api */
+
+#if _lib_getopt
+
+NoN(getopt)
+
+#else
+
+#undef _BLD_ast /* enable ast imports since we're user static */
+
+#include <error.h>
+#include <option.h>
+
+int opterr = 1;
+int optind = 1;
+int optopt = 0;
+char* optarg = 0;
+
+static int lastoptind;
+
+extern int
+getopt(int argc, char* const* argv, const char* optstring)
+{
+ int n;
+
+ NoP(argc);
+ opt_info.index = (optind > 1 || optind == lastoptind) ? optind : 0;
+ if (opt_info.index >= argc)
+ return -1;
+ switch (n = optget((char**)argv, optstring))
+ {
+ case ':':
+ n = '?';
+ /*FALLTHROUGH*/
+ case '?':
+ if (opterr && (!optstring || *optstring != ':'))
+ {
+ if (!error_info.id)
+ error_info.id = argv[0];
+ errormsg(NiL, 2, opt_info.arg);
+ }
+ optopt = opt_info.option[1];
+ break;
+ case 0:
+ n = -1;
+ break;
+ }
+ optarg = opt_info.arg;
+ lastoptind = optind = opt_info.index;
+ return n;
+}
+
+#endif
diff --git a/src/lib/libast/comp/getopt.h b/src/lib/libast/comp/getopt.h
new file mode 100644
index 0000000..110ce39
--- /dev/null
+++ b/src/lib/libast/comp/getopt.h
@@ -0,0 +1,51 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * gnu getopt interface
+ */
+
+#ifndef _GETOPT_H
+#ifdef _AST_STD_I
+#define _GETOPT_H -1
+#else
+#define _GETOPT_H 1
+
+#include <ast_getopt.h>
+
+#define no_argument 0
+#define required_argument 1
+#define optional_argument 2
+
+struct option
+{
+ const char* name;
+ int has_arg;
+ int* flag;
+ int val;
+};
+
+extern int getopt_long(int, char* const*, const char*, const struct option*, int*);
+extern int getopt_long_only(int, char* const*, const char*, const struct option*, int*);
+
+#endif
+#endif
diff --git a/src/lib/libast/comp/getoptl.c b/src/lib/libast/comp/getoptl.c
new file mode 100644
index 0000000..edfa4f1
--- /dev/null
+++ b/src/lib/libast/comp/getoptl.c
@@ -0,0 +1,151 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+#include <ast_getopt.h>
+
+#undef _BLD_ast /* enable ast imports since we're user static */
+
+#include <error.h>
+#include <option.h>
+#include <getopt.h>
+#include <ctype.h>
+
+static const char* lastoptstring;
+static const struct option* lastlongopts;
+static char* usage;
+static Sfio_t* up;
+
+static int lastoptind;
+
+static int
+golly(int argc, char* const* argv, const char* optstring, const struct option* longopts, int* longindex, int flags)
+{
+ register char* s;
+ register const struct option* o;
+ register int c;
+ char* t;
+
+ if (!up || optstring != lastoptstring || longopts != lastlongopts)
+ {
+ if (!up && !(up = sfstropen()) || !(t = strdup(optstring)))
+ return -1;
+ sfprintf(up, "[-1p%d]", flags);
+ for (o = longopts; o->name; o++)
+ {
+ if (o->flag || o->val <= 0 || o->val > UCHAR_MAX || !isalnum(o->val))
+ sfprintf(up, "\n[%d:%s]", UCHAR_MAX + 1 + (o - longopts), o->name);
+ else
+ {
+ sfprintf(up, "\n[%c:%s]", o->val, o->name);
+ if (s = strchr(t, o->val))
+ {
+ *s++ = ' ';
+ if (*s == ':')
+ {
+ *s++ = ' ';
+ if (*s == ':')
+ *s = ' ';
+ }
+ }
+ }
+ if (o->has_arg)
+ {
+ sfputc(up, ':');
+ if (o->has_arg == optional_argument)
+ sfputc(up, '?');
+ sfprintf(up, "[string]");
+ }
+ }
+ s = t;
+ while (c = *s++)
+ if (c != ' ')
+ {
+ sfprintf(up, "\n[%c]", c);
+ if (*s == ':')
+ {
+ sfputc(up, *s);
+ if (*++s == ':')
+ {
+ sfputc(up, '?');
+ s++;
+ }
+ sfputc(up, '[');
+ sfputc(up, ']');
+ }
+ }
+ sfputc(up, '\n');
+ free(t);
+ if (!(usage = sfstruse(up)))
+ return -1;
+ lastoptstring = optstring;
+ lastlongopts = longopts;
+ }
+ opt_info.index = (optind > 1 || optind == lastoptind) ? optind : 0;
+ if (opt_info.index >= argc || !(c = optget((char**)argv, usage)))
+ {
+ sfstrclose(up);
+ up = 0;
+ c = -1;
+ }
+ else
+ {
+ if (c == ':' || c == '?')
+ {
+ if (opterr && (!optstring || *optstring != ':'))
+ {
+ if (!error_info.id)
+ error_info.id = argv[0];
+ errormsg(NiL, c == '?' ? (ERROR_USAGE|4) : 2, "%s", opt_info.arg);
+ }
+ optopt = opt_info.option[1];
+ c = '?';
+ }
+ optarg = opt_info.arg;
+ if (c < 0)
+ {
+ o = longopts - c - UCHAR_MAX - 1;
+ if (o->flag)
+ {
+ *o->flag = o->val;
+ c = 0;
+ }
+ else
+ c = o->val;
+ }
+ }
+ lastoptind = optind = opt_info.index;
+ return c;
+}
+
+extern int
+getopt_long(int argc, char* const* argv, const char* optstring, const struct option* longopts, int* longindex)
+{
+ return golly(argc, argv, optstring, longopts, longindex, 2);
+}
+
+extern int
+getopt_long_only(int argc, char* const* argv, const char* optstring, const struct option* longopts, int* longindex)
+{
+ return golly(argc, argv, optstring, longopts, longindex, 1);
+}
diff --git a/src/lib/libast/comp/getpgrp.c b/src/lib/libast/comp/getpgrp.c
new file mode 100644
index 0000000..b38ad8a
--- /dev/null
+++ b/src/lib/libast/comp/getpgrp.c
@@ -0,0 +1,47 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#define getpgrp ______getpgrp
+
+#include <ast_std.h>
+
+#undef getpgrp
+
+/*
+ * bsd int getpgrp(int);
+ * s5 int getpgrp(void);
+ * posix pid_t getpgrp(void);
+ * user SOL
+ */
+
+extern int getpgrp(int);
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+_ast_getpgrp(void)
+{
+ return getpgrp(0);
+}
diff --git a/src/lib/libast/comp/getsubopt.c b/src/lib/libast/comp/getsubopt.c
new file mode 100644
index 0000000..9d7162c
--- /dev/null
+++ b/src/lib/libast/comp/getsubopt.c
@@ -0,0 +1,84 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * Xopen 4.2 compatibility
+ */
+
+#include <ast.h>
+
+#undef _lib_getsubopt /* we can satisfy the api */
+
+#if _lib_getsubopt
+
+NoN(getsubopt)
+
+#else
+
+#undef _BLD_ast /* enable ast imports since we're user static */
+
+#include <error.h>
+
+extern int
+getsubopt(register char** op, char* const* tp, char** vp)
+{
+ register char* b;
+ register char* s;
+ register char* v;
+
+ if (*(b = *op))
+ {
+ v = 0;
+ s = b;
+ for (;;)
+ {
+ switch (*s++)
+ {
+ case 0:
+ s--;
+ break;
+ case ',':
+ *(s - 1) = 0;
+ break;
+ case '=':
+ if (!v)
+ {
+ *(s - 1) = 0;
+ v = s;
+ }
+ continue;
+ default:
+ continue;
+ }
+ break;
+ }
+ *op = s;
+ *vp = v;
+ for (op = (char**)tp; *op; op++)
+ if (streq(b, *op))
+ return op - (char**)tp;
+ }
+ *vp = b;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/getwd.c b/src/lib/libast/comp/getwd.c
new file mode 100644
index 0000000..e600155
--- /dev/null
+++ b/src/lib/libast/comp/getwd.c
@@ -0,0 +1,37 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * getwd() using getcwd()
+ *
+ * some getwd()'s are incredible
+ */
+
+#include <ast.h>
+
+char*
+getwd(char* path)
+{
+ if (getcwd(path, PATH_MAX)) return(path);
+ strcpy(path, "getwd: error in . or ..");
+ return(0);
+}
diff --git a/src/lib/libast/comp/gross.c b/src/lib/libast/comp/gross.c
new file mode 100644
index 0000000..cf5be0d
--- /dev/null
+++ b/src/lib/libast/comp/gross.c
@@ -0,0 +1,99 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * porting hacks here
+ */
+
+#include <ast.h>
+#include <ls.h>
+
+#include "FEATURE/hack"
+
+void _STUB_gross(){}
+
+#if _lcl_xstat
+
+extern int fstat(int fd, struct stat* st)
+{
+#if _lib___fxstat
+ return __fxstat(_STAT_VER, fd, st);
+#else
+ return _fxstat(_STAT_VER, fd, st);
+#endif
+}
+
+extern int lstat(const char* path, struct stat* st)
+{
+#if _lib___lxstat
+ return __lxstat(_STAT_VER, path, st);
+#else
+ return _lxstat(_STAT_VER, path, st);
+#endif
+}
+
+extern int stat(const char* path, struct stat* st)
+{
+#if _lib___xstat
+ return __xstat(_STAT_VER, path, st);
+#else
+ return _xstat(_STAT_VER, path, st);
+#endif
+}
+
+#endif
+
+#if _lcl_xstat64
+
+extern int fstat64(int fd, struct stat64* st)
+{
+#if _lib___fxstat64
+ return __fxstat64(_STAT_VER, fd, st);
+#else
+ return _fxstat64(_STAT_VER, fd, st);
+#endif
+}
+
+extern int lstat64(const char* path, struct stat64* st)
+{
+#if _lib___lxstat64
+ return __lxstat64(_STAT_VER, path, st);
+#else
+ return _lxstat64(_STAT_VER, path, st);
+#endif
+}
+
+extern int stat64(const char* path, struct stat64* st)
+{
+#if _lib___xstat64
+ return __xstat64(_STAT_VER, path, st);
+#else
+ return _xstat64(_STAT_VER, path, st);
+#endif
+}
+
+#endif
+
+#if __sgi && _hdr_locale_attr
+
+#include "gross_sgi.h"
+
+#endif
diff --git a/src/lib/libast/comp/gross_sgi.h b/src/lib/libast/comp/gross_sgi.h
new file mode 100644
index 0000000..7469789
--- /dev/null
+++ b/src/lib/libast/comp/gross_sgi.h
@@ -0,0 +1,188 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#if __sgi && _hdr_locale_attr
+
+/*
+ * irix 6.5 introduced __libc_attr referenced by
+ * ctype and locale macros; this hack lets
+ * 6.5 a.outs run on irix < 6.5
+ *
+ * NOTE: this hack also freezes the US locale
+ */
+
+#include <locale_attr.h>
+
+static __ctype_t _ast_ctype_tbl =
+{
+ {
+ 0x00000000, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x80000028, 0x00000028,
+ 0x00000028, 0x00000028, 0x00000028, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x00000020, 0x00000020, 0x00000020,
+ 0x00000020, 0x80008008, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000084, 0x00000084, 0x00000084,
+ 0x00000084, 0x00000084, 0x00000084, 0x00000084,
+ 0x00000084, 0x00000084, 0x00000084, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000081, 0x00000081,
+ 0x00000081, 0x00000081, 0x00000081, 0x00000081,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000001, 0x00000001, 0x00000001, 0x00000001,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000010, 0x00000010, 0x00000082, 0x00000082,
+ 0x00000082, 0x00000082, 0x00000082, 0x00000082,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000002, 0x00000002, 0x00000002, 0x00000002,
+ 0x00000010, 0x00000010, 0x00000010, 0x00000010,
+ 0x00000020, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000, 0x00000000, 0x00000000, 0x00000000,
+ 0x00000000,
+ },
+ {
+ -1, 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, 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, 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,
+ },
+ {
+ -1, 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, 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, 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,
+ },
+ {
+ 000, 000, 000, 000, 000, 000, 000,
+ },
+};
+
+extern __attr_t ___libc_attr =
+{
+ &_ast_ctype_tbl,
+ { 0 },
+ { 0 },
+ { 1 },
+};
+
+#pragma weak __libc_attr = ___libc_attr
+
+#endif
diff --git a/src/lib/libast/comp/hsearch.c b/src/lib/libast/comp/hsearch.c
new file mode 100644
index 0000000..43953e4
--- /dev/null
+++ b/src/lib/libast/comp/hsearch.c
@@ -0,0 +1,138 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * hsearch() for systems that have <search.h> but no hsearch()
+ * why would such a system provide the interface but not the
+ * implementation? that's what happens when one slimes their
+ * way through standards compliance
+ *
+ * NOTE: please excuse the crude feature test
+ */
+
+#if !_UWIN
+
+void _STUB_hsearch(){}
+
+#else
+
+#if _PACKAGE_ast
+#include <ast.h>
+#endif
+
+#define hcreate ______hcreate
+#define hdestroy ______hdestroy
+#define hsearch ______hsearch
+
+#include <search.h>
+
+#undef hcreate
+#undef hdestroy
+#undef hsearch
+
+#include "dthdr.h"
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+/* POSIX hsearch library based on libdt
+** Written by Kiem-Phong Vo (AT&T Research, 07/19/95)
+*/
+
+/* type of objects in hash table */
+typedef struct _hash_s
+{ Dtlink_t link;
+ ENTRY item;
+} Hash_t;
+
+/* object delete function */
+#if __STD_C
+static void hashfree(Dt_t* dt, Void_t* obj, Dtdisc_t* disc)
+#else
+static void hashfree(dt, obj, disc)
+Dt_t* dt;
+Void_t* obj;
+Dtdisc_t* disc;
+#endif
+{
+ free(((Hash_t*)obj)->item.key);
+ free(obj);
+}
+
+static Dt_t* Hashtab; /* object dictionary */
+static Dtdisc_t Hashdisc = /* discipline */
+{ sizeof(Dtlink_t), -1,
+ 0,
+ NIL(Dtmake_f), hashfree,
+ NIL(Dtcompar_f), /* always use strcmp */
+ NIL(Dthash_f),
+ NIL(Dtmemory_f),
+ NIL(Dtevent_f)
+};
+
+extern
+#if __STD_C
+int hcreate(size_t nel)
+#else
+int hcreate(nel)
+size_t nel;
+#endif
+{
+ if(Hashtab) /* already opened */
+ return 0;
+
+ if(!(Hashtab = dtopen(&Hashdisc,Dtset)) )
+ return 0;
+
+ return 1;
+}
+
+extern void hdestroy()
+{ if(Hashtab)
+ dtclose(Hashtab);
+ Hashtab = NIL(Dt_t*);
+}
+
+extern
+#if __STD_C
+ENTRY* hsearch(ENTRY item, ACTION action)
+#else
+ENTRY* hsearch(item, action)
+ENTRY item;
+ACTION action;
+#endif
+{
+ reg Hash_t* o;
+
+ if(!Hashtab)
+ return NIL(ENTRY*);
+
+ if(!(o = (Hash_t*)dtmatch(Hashtab,item.key)) && action == ENTER &&
+ (o = (Hash_t*)malloc(sizeof(Hash_t)) ) )
+ { o->item = item;
+ o = (Hash_t*)dtinsert(Hashtab,o);
+ }
+
+ return o ? &(o->item) : NIL(ENTRY*);
+}
+
+#endif
diff --git a/src/lib/libast/comp/iconv.c b/src/lib/libast/comp/iconv.c
new file mode 100644
index 0000000..ba24988
--- /dev/null
+++ b/src/lib/libast/comp/iconv.c
@@ -0,0 +1,1599 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2012 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * Glenn Fowler
+ * AT&T Research
+ *
+ * iconv intercept
+ * minimally provides { utf*<=>bin ascii<=>ebcdic* }
+ */
+
+#include <ast.h>
+#include <dirent.h>
+
+#define DEBUG_TRACE 0
+#define _ICONV_LIST_PRIVATE_
+
+#include <ccode.h>
+#include <ctype.h>
+#include <iconv.h>
+
+#include "lclib.h"
+
+#if !_lib_iconv_open
+
+#define _ast_iconv_t iconv_t
+#define _ast_iconv_f iconv_f
+#define _ast_iconv_list_t iconv_list_t
+#define _ast_iconv_open iconv_open
+#define _ast_iconv iconv
+#define _ast_iconv_close iconv_close
+#define _ast_iconv_list iconv_list
+#define _ast_iconv_move iconv_move
+#define _ast_iconv_name iconv_name
+#define _ast_iconv_write iconv_write
+
+#endif
+
+#ifndef E2BIG
+#define E2BIG ENOMEM
+#endif
+#ifndef EILSEQ
+#define EILSEQ EIO
+#endif
+
+#define RETURN(e,n,fn) \
+ if (*fn && !e) e = E2BIG; \
+ if (e) { errno = e; return (size_t)(-1); } \
+ return n;
+
+typedef struct Map_s
+{
+ char* name;
+ const unsigned char* map;
+ _ast_iconv_f fun;
+ int index;
+} Map_t;
+
+typedef struct Conv_s
+{
+ iconv_t cvt;
+ char* buf;
+ size_t size;
+ Map_t from;
+ Map_t to;
+} Conv_t;
+
+static Conv_t* freelist[4];
+static int freeindex;
+
+static const char name_local[] = "local";
+static const char name_native[] = "native";
+
+static const _ast_iconv_list_t codes[] =
+{
+ {
+ "utf",
+ "un|unicode|utf",
+ "multibyte 8-bit unicode",
+ "UTF-%s",
+ "8",
+ CC_UTF,
+ },
+
+ {
+ "ume",
+ "um|ume|utf?(-)7",
+ "multibyte 7-bit unicode",
+ "UTF-7",
+ 0,
+ CC_UME,
+ },
+
+ {
+ "euc",
+ "(big|euc)*",
+ "euc family",
+ 0,
+ 0,
+ CC_ICONV,
+ },
+
+ {
+ "dos",
+ "dos?(-)?(855)",
+ "dos code page",
+ "DOS855",
+ 0,
+ CC_ICONV,
+ },
+
+ {
+ "ucs",
+ "ucs?(-)?(2)?(be)|utf-16?(be)",
+ "unicode runes",
+ "UCS-%s",
+ "2",
+ CC_UCS,
+ },
+
+ {
+ "ucs-le",
+ "ucs?(-)?(2)le|utf-16le",
+ "little endian unicode runes",
+ "UCS-%sLE",
+ "2",
+ CC_SCU,
+ },
+
+ { 0 },
+};
+
+#if _UWIN
+
+#include <ast_windows.h>
+
+#ifndef CP_UCS2
+#define CP_UCS2 0x0000
+#endif
+
+static char _win_maps[] = "/reg/local_machine/SOFTWARE/Classes/MIME/Database/Charset";
+
+/*
+ * return the codeset index given its name or alias
+ * the map is in the what? oh, the registry
+ */
+
+static int
+_win_codeset(const char* name)
+{
+ register char* s;
+ char* e;
+ int n;
+ Sfio_t* sp;
+ char aka[128];
+ char tmp[128];
+
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _win_codeset name=%s", __LINE__, name);
+#endif
+ if (name == name_native)
+ return CP_ACP;
+ if (!strcasecmp(name, "utf") || !strcasecmp(name, "utf8") || !strcasecmp(name, "utf-8"))
+ return CP_UTF8;
+ if (!strcasecmp(name, "ucs") || !strcasecmp(name, "ucs2") || !strcasecmp(name, "ucs-2"))
+ return CP_UCS2;
+ if (name[0] == '0' && name[1] == 'x' && (n = strtol(name, &e, 0)) > 0 && !*e)
+ return n;
+ for (;;)
+ {
+ sfsprintf(tmp, sizeof(tmp), "%s/%s", _win_maps, name);
+ if (!(sp = sfopen(0, tmp, "r")))
+ {
+ s = (char*)name;
+ if ((s[0] == 'c' || s[0] == 'C') && (s[1] == 'p' || s[1] == 'P'))
+ s += 2;
+ if (!isdigit(s[0]))
+ break;
+ sfsprintf(tmp, sizeof(tmp), "%s/windows-%s", _win_maps, s);
+ if (!(sp = sfopen(0, tmp, "r")))
+ break;
+ }
+ for (;;)
+ {
+ if (!(s = sfgetr(sp, '\n', 0)))
+ {
+ sfclose(sp);
+ return -1;
+ }
+ if (!strncasecmp(s, "AliasForCharSet=", 16))
+ {
+ n = sfvalue(sp) - 17;
+ s += 16;
+ if (n >= sizeof(aka))
+ n = sizeof(aka) - 1;
+ memcpy(aka, s, n);
+ aka[n] = 0;
+ sfclose(sp);
+ name = (const char*)aka;
+ break;
+ }
+ if (!strncasecmp(s, "CodePage=", 9))
+ {
+ s += 9;
+ n = strtol(s, 0, 0);
+ sfclose(sp);
+ return n;
+ }
+ }
+ }
+ return -1;
+}
+
+/*
+ * get and check the codeset indices
+ */
+
+static _ast_iconv_t
+_win_iconv_open(register Conv_t* cc, const char* t, const char* f)
+{
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _win_iconv_open f=%s t=%s\n", __LINE__, f, t);
+#endif
+ if ((cc->from.index = _win_codeset(f)) < 0)
+ return (_ast_iconv_t)(-1);
+ if ((cc->to.index = _win_codeset(t)) < 0)
+ return (_ast_iconv_t)(-1);
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _win_iconv_open f=0x%04x t=0x%04x\n", __LINE__, cc->from.index, cc->to.index);
+#endif
+ return (_ast_iconv_t)cc;
+}
+
+/*
+ * even though the indices already check out
+ * they could still be rejected
+ */
+
+static size_t
+_win_iconv(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ Conv_t* cc = (Conv_t*)cd;
+ size_t un;
+ size_t tz;
+ size_t fz;
+ size_t bz;
+ size_t pz;
+ size_t oz;
+ LPWSTR ub;
+
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _win_iconv from=0x%04x to=0x%04x\n", __LINE__, cc->from.index, cc->to.index);
+#endif
+ if (cc->from.index == cc->to.index || cc->from.index != CP_UCS2 && cc->to.index == 0)
+ {
+ /*
+ * easy
+ */
+
+ fz = tz = (*fn < *tn) ? *fn : *tn;
+ memcpy(*tb, *fb, fz);
+ }
+ else
+ {
+ ub = 0;
+ un = *fn;
+
+ /*
+ * from => ucs-2
+ */
+
+ if (cc->to.index == CP_UCS2)
+ {
+ if ((tz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)*tb, *tn)) && tz <= *tn)
+ {
+ fz = *fn;
+ tz *= sizeof(WCHAR);
+ }
+ else
+ {
+ /*
+ * target too small
+ * binary search on input size to make it fit
+ */
+
+ oz = 0;
+ pz = *fn / 2;
+ fz = *fn - pz;
+ for (;;)
+ {
+ while (!(tz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)fz, (LPWSTR)*tb, 0)))
+ if (++fz >= *fn)
+ goto nope;
+ tz *= sizeof(WCHAR);
+ if (tz == *tn)
+ break;
+ if (!(pz /= 2))
+ {
+ if (!(fz = oz))
+ goto nope;
+ break;
+ }
+ if (tz > *tn)
+ fz -= pz;
+ else
+ {
+ oz = fz;
+ fz += pz;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (cc->from.index == CP_UCS2)
+ {
+ un = *fn / sizeof(WCHAR);
+ ub = (LPWSTR)*fb;
+ }
+ else if (!(un = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)*tb, 0)))
+ goto nope;
+ else if (!(ub = (LPWSTR)malloc(un * sizeof(WCHAR))))
+ goto nope;
+ else if (!(un = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)*fn, (LPWSTR)ub, un)))
+ goto nope;
+
+ /*
+ * ucs-2 => to
+ */
+
+ if (tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, un, *tb, *tn, 0, 0))
+ fz = *fn;
+ else
+ {
+ /*
+ * target too small
+ * binary search on input size to make it fit
+ */
+
+ oz = 0;
+ pz = *fn / 2;
+ bz = *fn - pz;
+ for (;;)
+ {
+ while (!(fz = MultiByteToWideChar(cc->from.index, 0, (LPCSTR)*fb, (int)bz, (LPWSTR)ub, un)))
+ if (++bz > *fn)
+ goto nope;
+ if (!(tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, fz, *tb, 0, 0, 0)))
+ goto nope;
+ if (tz == *tn)
+ break;
+ if (!(pz /= 2))
+ {
+ if (!(fz = oz))
+ goto nope;
+ break;
+ }
+ if (tz > *tn)
+ bz -= pz;
+ else
+ {
+ oz = bz;
+ bz += pz;
+ }
+ }
+ if (!(tz = WideCharToMultiByte(cc->to.index, 0, (LPCWSTR)ub, fz, *tb, tz, 0, 0)))
+ goto nope;
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _win_iconv *fn=%u fz=%u[%u] *tn=%u tz=%u\n", __LINE__, *fn, fz, fz * sizeof(WCHAR), *tn, tz);
+#endif
+#if 0
+ fz *= sizeof(WCHAR);
+#endif
+ }
+ if (ub != (LPWSTR)*fb)
+ free(ub);
+ }
+ }
+ *fb += fz;
+ *fn -= fz;
+ *tb += tz;
+ *tn -= tz;
+ return fz;
+ nope:
+ if (ub && ub != (LPWSTR)*fb)
+ free(ub);
+ errno = EINVAL;
+ return (size_t)(-1);
+}
+
+#endif
+
+/*
+ * return canonical character code set name for m
+ * if b!=0 then canonical name placed in b of size n
+ * <ccode.h> index returned
+ */
+
+int
+_ast_iconv_name(register const char* m, register char* b, size_t n)
+{
+ register const _ast_iconv_list_t* cp;
+ const _ast_iconv_list_t* bp;
+ register int c;
+ register char* e;
+ int sub[2];
+ char buf[16];
+#if DEBUG_TRACE
+ char* o;
+#endif
+
+ if (!b)
+ {
+ b = buf;
+ n = sizeof(buf);
+ }
+#if DEBUG_TRACE
+ o = b;
+#endif
+ e = b + n - 1;
+ bp = 0;
+ n = 0;
+ cp = ccmaplist(NiL);
+#if DEBUG_TRACE
+if (error_info.trace < DEBUG_TRACE) sfprintf(sfstderr, "%s: debug-%d: AHA%d _ast_iconv_name m=\"%s\"\n", error_info.id, error_info.trace, __LINE__, m);
+#endif
+ for (;;)
+ {
+#if DEBUG_TRACE
+if (error_info.trace < DEBUG_TRACE) sfprintf(sfstderr, "%s: debug-%d: AHA%d _ast_iconv_name n=%d bp=%p cp=%p ccode=%d name=\"%s\"\n", error_info.id, error_info.trace, __LINE__, n, bp, cp, cp->ccode, cp->name);
+#endif
+ if (strgrpmatch(m, cp->match, sub, elementsof(sub) / 2, STR_MAXIMAL|STR_LEFT|STR_ICASE))
+ {
+ if (!(c = m[sub[1]]))
+ {
+ bp = cp;
+ break;
+ }
+ if (sub[1] > n && !isalpha(c))
+ {
+ bp = cp;
+ n = sub[1];
+ }
+ }
+ if (cp->ccode < 0)
+ {
+ if (!(++cp)->name)
+ break;
+ }
+ else if (!(cp = (const _ast_iconv_list_t*)ccmaplist((_ast_iconv_list_t*)cp)))
+ cp = codes;
+ }
+ if (cp = bp)
+ {
+ if (cp->canon)
+ {
+ if (cp->index)
+ {
+ for (m += sub[1]; *m && !isalnum(*m); m++);
+ if (!isdigit(*m))
+ m = cp->index;
+ }
+ else
+ m = "1";
+ b += sfsprintf(b, e - b, cp->canon, m);
+ }
+ else if (cp->ccode == CC_NATIVE)
+ {
+ if ((locales[AST_LC_CTYPE]->flags & LC_default) || !locales[AST_LC_CTYPE]->charset || !(m = locales[AST_LC_CTYPE]->charset->code) || streq(m, "iso8859-1"))
+ switch (CC_NATIVE)
+ {
+ case CC_EBCDIC:
+ m = (const char*)"EBCDIC";
+ break;
+ case CC_EBCDIC_I:
+ m = (const char*)"EBCDIC-I";
+ break;
+ case CC_EBCDIC_O:
+ m = (const char*)"EBCDIC-O";
+ break;
+ default:
+ m = (const char*)"ISO-8859-1";
+ break;
+ }
+ b += sfsprintf(b, e - b, "%s", m);
+ }
+ *b = 0;
+#if DEBUG_TRACE
+if (error_info.trace < DEBUG_TRACE) sfprintf(sfstderr, "%s: debug-%d: AHA%d _ast_iconv_name ccode=%d canon=\"%s\"\n", error_info.id, error_info.trace, __LINE__, cp->ccode, o);
+#endif
+ return cp->ccode;
+ }
+ while (b < e && (c = *m++))
+ {
+ if (islower(c))
+ c = toupper(c);
+ *b++ = c;
+ }
+ *b = 0;
+#if DEBUG_TRACE
+if (error_info.trace < DEBUG_TRACE) sfprintf(sfstderr, "%s: debug-%d: AHA%d _ast_iconv_name ccode=%d canon=\"%s\"\n", error_info.id, error_info.trace, __LINE__, CC_ICONV, o);
+#endif
+ return CC_ICONV;
+}
+
+/*
+ * convert utf-8 to bin
+ */
+
+static size_t
+utf2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register unsigned char* p;
+ register int c;
+ register int w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (t < te && f < fe)
+ {
+ p = f;
+ c = *f++;
+ if (c & 0x80)
+ {
+ if (!(c & 0x40))
+ {
+ f = p;
+ e = EILSEQ;
+ break;
+ }
+ if (c & 0x20)
+ {
+ w = (c & 0x0F) << 12;
+ if (f >= fe)
+ {
+ f = p;
+ e = EINVAL;
+ break;
+ }
+ c = *f++;
+ if (c & 0x40)
+ {
+ f = p;
+ e = EILSEQ;
+ break;
+ }
+ w |= (c & 0x3F) << 6;
+ }
+ else
+ w = (c & 0x1F) << 6;
+ if (f >= fe)
+ {
+ f = p;
+ e = EINVAL;
+ break;
+ }
+ c = *f++;
+ w |= (c & 0x3F);
+ }
+ else
+ w = c;
+ *t++ = w;
+ }
+ *fn -= (char*)f - (*fb);
+ *fb = (char*)f;
+ *tn -= (n = (char*)t - (*tb));
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert bin to utf-8
+ */
+
+static size_t
+bin2utf(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int c;
+ wchar_t w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (f < fe && t < te)
+ {
+ if (!mbwide())
+ {
+ c = 1;
+ w = *f;
+ }
+ else if ((c = (*_ast_info.mb_towc)(&w, (char*)f, fe - f)) < 0)
+ {
+ e = EINVAL;
+ break;
+ }
+ else if (!c)
+ c = 1;
+ if (!(w & ~0x7F))
+ *t++ = w;
+ else
+ {
+ if (!(w & ~0x7FF))
+ {
+ if (t >= (te - 2))
+ {
+ e = E2BIG;
+ break;
+ }
+ *t++ = 0xC0 + (w >> 6);
+ }
+ else if (!(w & ~0xffff))
+ {
+ if (t >= (te - 3))
+ {
+ e = E2BIG;
+ break;
+ }
+ *t++ = 0xE0 + (w >> 12);
+ *t++ = 0x80 + ((w >> 6 ) & 0x3F);
+ }
+ else
+ {
+ e = EILSEQ;
+ break;
+ }
+ *t++ = 0x80 + (w & 0x3F);
+ }
+ f += c;
+ }
+ *fn -= (n = (char*)f - (*fb));
+ *fb = (char*)f;
+ *tn -= (char*)t - (*tb);
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+static const unsigned char ume_D[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'(),-./:?!\"#$%&*;<=>@[]^_`{|} \t\n";
+
+static const unsigned char ume_M[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static unsigned char ume_d[UCHAR_MAX+1];
+
+static unsigned char ume_m[UCHAR_MAX+1];
+
+#define NOE 0xFF
+#define UMEINIT() (ume_d[ume_D[0]]?0:umeinit())
+
+/*
+ * initialize the ume tables
+ */
+
+static int
+umeinit(void)
+{
+ register const unsigned char* s;
+ register int i;
+ register int c;
+
+ if (!ume_d[ume_D[0]])
+ {
+ s = ume_D;
+ while (c = *s++)
+ ume_d[c] = 1;
+ memset(ume_m, NOE, sizeof(ume_m));
+ for (i = 0; c = ume_M[i]; i++)
+ ume_m[c] = i;
+ }
+ return 0;
+}
+
+/*
+ * convert utf-7 to bin
+ */
+
+static size_t
+ume2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register unsigned char* p;
+ register int s;
+ register int c;
+ register int w;
+ size_t n;
+ int e;
+
+ e = 0;
+ UMEINIT();
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ s = 0;
+ while (f < fe && t < te)
+ {
+ p = f;
+ c = *f++;
+ if (s)
+ {
+ if (c == '-' && s > 1)
+ s = 0;
+ else if ((w = ume_m[c]) == NOE)
+ {
+ s = 0;
+ *t++ = c;
+ }
+ else if (f >= (fe - 2))
+ {
+ f = p;
+ e = EINVAL;
+ break;
+ }
+ else
+ {
+ s = 2;
+ w = (w << 6) | ume_m[*f++];
+ w = (w << 6) | ume_m[*f++];
+ if (!(w & ~0xFF))
+ *t++ = w;
+ else if (t >= (te - 1))
+ {
+ f = p;
+ e = E2BIG;
+ break;
+ }
+ else
+ {
+ *t++ = (w >> 8) & 0xFF;
+ *t++ = w & 0xFF;
+ }
+ }
+ }
+ else if (c == '+')
+ s = 1;
+ else
+ *t++ = c;
+ }
+ *fn -= (char*)f - (*fb);
+ *fb = (char*)f;
+ *tn -= (n = (char*)t - (*tb));
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert bin to utf-7
+ */
+
+static size_t
+bin2ume(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int c;
+ register int s;
+ wchar_t w;
+ size_t n;
+ int e;
+
+ e = 0;
+ UMEINIT();
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ s = 0;
+ while (f < fe && t < (te - s))
+ {
+ if (!mbwide())
+ {
+ c = 1;
+ w = *f;
+ }
+ else if ((c = (*_ast_info.mb_towc)(&w, (char*)f, fe - f)) < 0)
+ {
+ e = EINVAL;
+ break;
+ }
+ else if (!c)
+ c = 1;
+ if (!(w & ~0x7F) && ume_d[w])
+ {
+ if (s)
+ {
+ s = 0;
+ *t++ = '-';
+ }
+ *t++ = w;
+ }
+ else if (t >= (te - (4 + s)))
+ {
+ e = E2BIG;
+ break;
+ }
+ else
+ {
+ if (!s)
+ {
+ s = 1;
+ *t++ = '+';
+ }
+ *t++ = ume_M[(w >> 12) & 0x3F];
+ *t++ = ume_M[(w >> 6) & 0x3F];
+ *t++ = ume_M[w & 0x3F];
+ }
+ f += c;
+ }
+ if (s)
+ *t++ = '-';
+ *fn -= (n = (char*)f - (*fb));
+ *fb = (char*)f;
+ *tn -= (char*)t - (*tb);
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert ucs-2 to bin with no byte swap
+ */
+
+static size_t
+ucs2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (f < (fe - 1) && t < te)
+ {
+ w = *f++;
+ w = (w << 8) | *f++;
+ if (!(w & ~0xFF))
+ *t++ = w;
+ else if (t >= (te - 1))
+ {
+ f -= 2;
+ e = E2BIG;
+ break;
+ }
+ else
+ {
+ *t++ = (w >> 8) & 0xFF;
+ *t++ = w & 0xFF;
+ }
+ }
+ *fn -= (char*)f - (*fb);
+ *fb = (char*)f;
+ *tn -= (n = (char*)t - (*tb));
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert bin to ucs-2 with no byte swap
+ */
+
+static size_t
+bin2ucs(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int c;
+ wchar_t w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (f < fe && t < (te - 1))
+ {
+ if (!mbwide())
+ {
+ c = 1;
+ w = *f;
+ }
+ if ((c = (*_ast_info.mb_towc)(&w, (char*)f, fe - f)) < 0)
+ {
+ e = EINVAL;
+ break;
+ }
+ else if (!c)
+ c = 1;
+ *t++ = (w >> 8) & 0xFF;
+ *t++ = w & 0xFF;
+ f += c;
+ }
+ *fn -= (n = (char*)f - (*fb));
+ *fb = (char*)f;
+ *tn -= (char*)t - (*tb);
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert ucs-2 to bin with byte swap
+ */
+
+static size_t
+scu2bin(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (f < (fe - 1) && t < te)
+ {
+ w = *f++;
+ w = w | (*f++ << 8);
+ if (!(w & ~0xFF))
+ *t++ = w;
+ else if (t >= (te - 1))
+ {
+ f -= 2;
+ e = E2BIG;
+ break;
+ }
+ else
+ {
+ *t++ = (w >> 8) & 0xFF;
+ *t++ = w & 0xFF;
+ }
+ }
+ *fn -= (char*)f - (*fb);
+ *fb = (char*)f;
+ *tn -= (n = (char*)t - (*tb));
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * convert bin to ucs-2 with byte swap
+ */
+
+static size_t
+bin2scu(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ register unsigned char* f;
+ register unsigned char* fe;
+ register unsigned char* t;
+ register unsigned char* te;
+ register int c;
+ wchar_t w;
+ size_t n;
+ int e;
+
+ e = 0;
+ f = (unsigned char*)(*fb);
+ fe = f + (*fn);
+ t = (unsigned char*)(*tb);
+ te = t + (*tn);
+ while (f < fe && t < (te - 1))
+ {
+ if (!mbwide())
+ {
+ c = 1;
+ w = *f;
+ }
+ else if ((c = (*_ast_info.mb_towc)(&w, (char*)f, fe - f)) < 0)
+ {
+ e = EINVAL;
+ break;
+ }
+ else if (!c)
+ c = 1;
+ *t++ = w & 0xFF;
+ *t++ = (w >> 8) & 0xFF;
+ f += c;
+ }
+ *fn -= (n = (char*)f - (*fb));
+ *fb = (char*)f;
+ *tn -= (char*)t - (*tb);
+ *tb = (char*)t;
+ RETURN(e, n, fn);
+}
+
+/*
+ * open a character code conversion map from f to t
+ */
+
+_ast_iconv_t
+_ast_iconv_open(const char* t, const char* f)
+{
+ register Conv_t* cc;
+ int fc;
+ int tc;
+ int i;
+
+ char fr[64];
+ char to[64];
+
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _ast_iconv_open f=%s t=%s\n", __LINE__, f, t);
+#endif
+ if (!t || !*t || *t == '-' && !*(t + 1) || !strcasecmp(t, name_local) || !strcasecmp(t, name_native))
+ t = name_native;
+ if (!f || !*f || *f == '-' && !*(f + 1) || !strcasecmp(t, name_local) || !strcasecmp(f, name_native))
+ f = name_native;
+
+ /*
+ * the ast identify is always (iconv_t)(0)
+ */
+
+ if (t == f)
+ return (iconv_t)(0);
+ fc = _ast_iconv_name(f, fr, sizeof(fr));
+ tc = _ast_iconv_name(t, to, sizeof(to));
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d _ast_iconv_open f=%s:%s:%d t=%s:%s:%d\n", __LINE__, f, fr, fc, t, to, tc);
+#endif
+ if (fc != CC_ICONV && fc == tc || streq(fr, to))
+ return (iconv_t)(0);
+
+ /*
+ * first check the free list
+ */
+
+ for (i = 0; i < elementsof(freelist); i++)
+ if ((cc = freelist[i]) && streq(to, cc->to.name) && streq(fr, cc->from.name))
+ {
+ freelist[i] = 0;
+#if _lib_iconv_open
+ /*
+ * reset the shift state if any
+ */
+
+ if (cc->cvt != (iconv_t)(-1))
+ iconv(cc->cvt, NiL, NiL, NiL, NiL);
+#endif
+ return cc;
+ }
+
+ /*
+ * allocate a new one
+ */
+
+ if (!(cc = newof(0, Conv_t, 1, strlen(to) + strlen(fr) + 2)))
+ return (iconv_t)(-1);
+ cc->to.name = (char*)(cc + 1);
+ cc->from.name = strcopy(cc->to.name, to) + 1;
+ strcpy(cc->from.name, fr);
+ cc->cvt = (iconv_t)(-1);
+
+ /*
+ * 8 bit maps are the easiest
+ */
+
+ if (fc >= 0 && tc >= 0)
+ cc->from.map = ccmap(fc, tc);
+#if _lib_iconv_open
+ else if ((cc->cvt = iconv_open(t, f)) != (iconv_t)(-1) || (cc->cvt = iconv_open(to, fr)) != (iconv_t)(-1))
+ cc->from.fun = (_ast_iconv_f)iconv;
+#endif
+#if _UWIN
+ else if ((cc->cvt = _win_iconv_open(cc, t, f)) != (_ast_iconv_t)(-1) || (cc->cvt = _win_iconv_open(cc, to, fr)) != (_ast_iconv_t)(-1))
+ cc->from.fun = (_ast_iconv_f)_win_iconv;
+#endif
+ else
+ {
+ switch (fc)
+ {
+ case CC_UTF:
+ cc->from.fun = utf2bin;
+ break;
+ case CC_UME:
+ cc->from.fun = ume2bin;
+ break;
+ case CC_UCS:
+ cc->from.fun = ucs2bin;
+ break;
+ case CC_SCU:
+ cc->from.fun = scu2bin;
+ break;
+ case CC_ASCII:
+ break;
+ default:
+ if (fc < 0)
+ goto nope;
+ cc->from.map = ccmap(fc, CC_ASCII);
+ break;
+ }
+ switch (tc)
+ {
+ case CC_UTF:
+ cc->to.fun = bin2utf;
+ break;
+ case CC_UME:
+ cc->to.fun = bin2ume;
+ break;
+ case CC_UCS:
+ cc->to.fun = bin2ucs;
+ break;
+ case CC_SCU:
+ cc->to.fun = bin2scu;
+ break;
+ case CC_ASCII:
+ break;
+ default:
+ if (tc < 0)
+ goto nope;
+ cc->to.map = ccmap(CC_ASCII, tc);
+ break;
+ }
+ }
+ return (iconv_t)cc;
+ nope:
+ return (iconv_t)(-1);
+}
+
+/*
+ * close a character code conversion map
+ */
+
+int
+_ast_iconv_close(_ast_iconv_t cd)
+{
+ Conv_t* cc;
+ Conv_t* oc;
+ int i;
+ int r = 0;
+
+ if (cd == (_ast_iconv_t)(-1))
+ return -1;
+ if (!(cc = (Conv_t*)cd))
+ return 0;
+
+ /*
+ * add to the free list
+ */
+
+ i = freeindex;
+ for (;;)
+ {
+ if (++ i >= elementsof(freelist))
+ i = 0;
+ if (!freelist[i])
+ break;
+ if (i == freeindex)
+ {
+ if (++ i >= elementsof(freelist))
+ i = 0;
+
+ /*
+ * close the oldest
+ */
+
+ if (oc = freelist[i])
+ {
+#if _lib_iconv_open
+ if (oc->cvt != (iconv_t)(-1))
+ r = iconv_close(oc->cvt);
+#endif
+ if (oc->buf)
+ free(oc->buf);
+ free(oc);
+ }
+ break;
+ }
+ }
+ freelist[freeindex = i] = cc;
+ return r;
+}
+
+/*
+ * copy *fb size *fn to *tb size *tn
+ * fb,fn tb,tn updated on return
+ */
+
+size_t
+_ast_iconv(_ast_iconv_t cd, char** fb, size_t* fn, char** tb, size_t* tn)
+{
+ Conv_t* cc = (Conv_t*)cd;
+ register unsigned char* f;
+ register unsigned char* t;
+ register unsigned char* e;
+ register const unsigned char* m;
+ register size_t n;
+ char* b;
+ char* tfb;
+ size_t tfn;
+ size_t i;
+
+ if (!fb || !*fb)
+ {
+ /* TODO: reset to the initial state */
+ if (!tb || !*tb)
+ return 0;
+ /* TODO: write the initial state shift sequence */
+ return 0;
+ }
+ n = *tn;
+ if (cc)
+ {
+ if (cc->from.fun)
+ {
+ if (cc->to.fun)
+ {
+ if (!cc->buf && !(cc->buf = oldof(0, char, cc->size = SF_BUFSIZE, 0)))
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ b = cc->buf;
+ i = cc->size;
+ tfb = *fb;
+ tfn = *fn;
+ if ((*cc->from.fun)(cc->cvt, &tfb, &tfn, &b, &i) == (size_t)(-1))
+ return -1;
+ tfn = b - cc->buf;
+ tfb = cc->buf;
+ n = (*cc->to.fun)(cc->cvt, &tfb, &tfn, tb, tn);
+ i = tfb - cc->buf;
+ *fb += i;
+ *fn -= i;
+ return n;
+ }
+ if ((*cc->from.fun)(cc->cvt, fb, fn, tb, tn) == (size_t)(-1))
+ return -1;
+ n -= *tn;
+ if (m = cc->to.map)
+ {
+ e = (unsigned char*)(*tb);
+ for (t = e - n; t < e; t++)
+ *t = m[*t];
+ }
+ return n;
+ }
+ else if (cc->to.fun)
+ {
+ if (!(m = cc->from.map))
+ return (*cc->to.fun)(cc->cvt, fb, fn, tb, tn);
+ if (!cc->buf && !(cc->buf = oldof(0, char, cc->size = SF_BUFSIZE, 0)))
+ {
+ errno = ENOMEM;
+ return -1;
+ }
+ if ((n = *fn) > cc->size)
+ n = cc->size;
+ f = (unsigned char*)(*fb);
+ e = f + n;
+ t = (unsigned char*)(b = cc->buf);
+ while (f < e)
+ *t++ = m[*f++];
+ n = (*cc->to.fun)(cc->cvt, &b, fn, tb, tn);
+ *fb += b - cc->buf;
+ return n;
+ }
+ }
+ if (n > *fn)
+ n = *fn;
+ if (cc && (m = cc->from.map))
+ {
+ f = (unsigned char*)(*fb);
+ e = f + n;
+ t = (unsigned char*)(*tb);
+ while (f < e)
+ *t++ = m[*f++];
+ }
+ else
+ memcpy(*tb, *fb, n);
+ *fb += n;
+ *fn -= n;
+ *tb += n;
+ *tn -= n;
+ return n;
+}
+
+#define OK ((size_t)-1)
+
+/*
+ * write *fb size *fn to op
+ * fb,fn updated on return
+ * total bytes written to op returned
+ */
+
+ssize_t
+_ast_iconv_write(_ast_iconv_t cd, Sfio_t* op, char** fb, size_t* fn, Iconv_disc_t* disc)
+{
+ char* fo = *fb;
+ char* tb;
+ char* ts;
+ size_t* e;
+ size_t tn;
+ size_t r;
+ int ok;
+ Iconv_disc_t compat;
+
+ /*
+ * the old api had optional size_t* instead of Iconv_disc_t*
+ */
+
+ if (!disc || disc->version < 20110101L || disc->version >= 30000101L)
+ {
+ e = (size_t*)disc;
+ disc = &compat;
+ iconv_init(disc, 0);
+ }
+ else
+ e = 0;
+ r = 0;
+ tn = 0;
+ ok = 1;
+ while (ok && *fn > 0)
+ {
+ if (!(tb = (char*)sfreserve(op, -(tn + 1), SF_WRITE|SF_LOCKR)) || !(tn = sfvalue(op)))
+ {
+ if (!r)
+ r = -1;
+ break;
+ }
+ ts = tb;
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d iconv_write ts=%p tn=%d", __LINE__, ts, tn);
+ for (;;)
+#else
+ while (*fn > 0 && _ast_iconv(cd, fb, fn, &ts, &tn) == (size_t)(-1))
+#endif
+ {
+#if DEBUG_TRACE
+ ssize_t _r;
+error(DEBUG_TRACE, "AHA#%d iconv_write %d => %d `%-.*s'", __LINE__, *fn, tn, *fn, *fb);
+ _r = _ast_iconv(cd, fb, fn, &ts, &tn);
+error(DEBUG_TRACE, "AHA#%d iconv_write %d => %d [%d]", __LINE__, *fn, tn, _r);
+ if (_r != (size_t)(-1) || !fn)
+ break;
+#endif
+ switch (errno)
+ {
+ case E2BIG:
+ break;
+ case EINVAL:
+ if (disc->errorf)
+ (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "incomplete multibyte sequence at offset %I*u", sizeof(fo), *fb - fo);
+ goto bad;
+ default:
+ if (disc->errorf)
+ (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "invalid multibyte sequence at offset %I*u", sizeof(fo), *fb - fo);
+ bad:
+ disc->errors++;
+ if (!(disc->flags & ICONV_FATAL))
+ {
+ if (!(disc->flags & ICONV_OMIT) && tn > 0)
+ {
+ *ts++ = (disc->fill >= 0) ? disc->fill : **fb;
+ tn--;
+ }
+ (*fb)++;
+ (*fn)--;
+ continue;
+ }
+ ok = 0;
+ break;
+ }
+ break;
+ }
+#if DEBUG_TRACE
+error(DEBUG_TRACE, "AHA#%d iconv_write %d", __LINE__, ts - tb);
+#endif
+ sfwrite(op, tb, ts - tb);
+ r += ts - tb;
+ }
+ if (e)
+ *e = disc->errors;
+ return r;
+}
+
+/*
+ * move n bytes from ip to op
+ */
+
+ssize_t
+_ast_iconv_move(_ast_iconv_t cd, Sfio_t* ip, Sfio_t* op, size_t n, Iconv_disc_t* disc)
+{
+ char* fb;
+ char* fs;
+ char* tb;
+ char* ts;
+ size_t* e;
+ size_t fe;
+ size_t fn;
+ size_t fo;
+ size_t ft;
+ size_t tn;
+ size_t i;
+ ssize_t r = 0;
+ int ok = 1;
+ int locked;
+ Iconv_disc_t compat;
+
+ /*
+ * the old api had optional size_t* instead of Iconv_disc_t*
+ */
+
+ if (!disc || disc->version < 20110101L || disc->version >= 30000101L)
+ {
+ e = (size_t*)disc;
+ disc = &compat;
+ iconv_init(disc, 0);
+ }
+ else
+ e = 0;
+ tb = 0;
+ fe = OK;
+ ft = 0;
+ fn = n;
+ do
+ {
+ if (n != SF_UNBOUND)
+ n = -((ssize_t)(n & (((size_t)(~0))>>1)));
+ if ((!(fb = (char*)sfreserve(ip, n, locked = SF_LOCKR)) || !(fo = sfvalue(ip))) &&
+ (!(fb = (char*)sfreserve(ip, n, locked = 0)) || !(fo = sfvalue(ip))))
+ break;
+ fs = fb;
+ fn = fo;
+ if (!(tb = (char*)sfreserve(op, SF_UNBOUND, SF_WRITE|SF_LOCKR)))
+ {
+ if (!r)
+ r = -1;
+ break;
+ }
+ ts = tb;
+ tn = sfvalue(op);
+ while (fn > 0 && _ast_iconv(cd, &fs, &fn, &ts, &tn) == (size_t)(-1))
+ {
+ switch (errno)
+ {
+ case E2BIG:
+ break;
+ case EINVAL:
+ if (fe == ft + (fo - fn))
+ {
+ fe = OK;
+ if (disc->errorf)
+ (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "incomplete multibyte sequence at offset %I*u", sizeof(ft), ft + (fo - fn));
+ goto bad;
+ }
+ fe = ft;
+ break;
+ default:
+ if (disc->errorf)
+ (*disc->errorf)(NiL, disc, ERROR_SYSTEM|2, "invalid multibyte sequence at offset %I*u", sizeof(ft), ft + (fo - fn));
+ bad:
+ disc->errors++;
+ if (!(disc->flags & ICONV_FATAL))
+ {
+ if (!(disc->flags & ICONV_OMIT) && tn > 0)
+ {
+ *ts++ = (disc->fill >= 0) ? disc->fill : *fs;
+ tn--;
+ }
+ fs++;
+ fn--;
+ continue;
+ }
+ ok = 0;
+ break;
+ }
+ break;
+ }
+ sfwrite(op, tb, ts - tb);
+ r += ts - tb;
+ ts = tb;
+ if (locked)
+ sfread(ip, fb, fs - fb);
+ else
+ for (i = fn; --i >= (fs - fb);)
+ sfungetc(ip, fb[i]);
+ if (n != SF_UNBOUND)
+ {
+ if (n <= (fs - fb))
+ break;
+ n -= fs - fb;
+ }
+ ft += (fs - fb);
+ if (fn == fo)
+ fn++;
+ } while (ok);
+ if (fb && locked)
+ sfread(ip, fb, 0);
+ if (tb)
+ {
+ sfwrite(op, tb, 0);
+ if (ts > tb)
+ {
+ sfwrite(op, tb, ts - tb);
+ r += ts - tb;
+ }
+ }
+ if (e)
+ *e = disc->errors;
+ return r;
+}
+
+/*
+ * iconv_list_t iterator
+ * call with arg 0 to start
+ * prev return value is current arg
+ */
+
+_ast_iconv_list_t*
+_ast_iconv_list(_ast_iconv_list_t* cp)
+{
+#if _UWIN
+ struct dirent* ent;
+
+ if (!cp)
+ {
+ if (!(cp = newof(0, _ast_iconv_list_t, 1, 0)))
+ return ccmaplist(NiL);
+ if (!(cp->data = opendir(_win_maps)))
+ {
+ free(cp);
+ return ccmaplist(NiL);
+ }
+ }
+ if (cp->data)
+ {
+ if (ent = readdir((DIR*)cp->data))
+ {
+ cp->name = cp->match = cp->desc = (const char*)ent->d_name;
+ return cp;
+ }
+ closedir((DIR*)cp->data);
+ free(cp);
+ return ccmaplist(NiL);
+ }
+#else
+ if (!cp)
+ return ccmaplist(NiL);
+#endif
+ if (cp->ccode >= 0)
+ return (cp = ccmaplist(cp)) ? cp : (_ast_iconv_list_t*)codes;
+ return (++cp)->name ? cp : (_ast_iconv_list_t*)0;
+}
diff --git a/src/lib/libast/comp/killpg.c b/src/lib/libast/comp/killpg.c
new file mode 100644
index 0000000..725a1f9
--- /dev/null
+++ b/src/lib/libast/comp/killpg.c
@@ -0,0 +1,40 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_killpg
+
+NoN(killpg)
+
+#else
+
+#include <sig.h>
+
+int
+killpg(pid_t g, int s)
+{
+ return(kill(-g, s));
+}
+
+#endif
diff --git a/src/lib/libast/comp/libgen.h b/src/lib/libast/comp/libgen.h
new file mode 100644
index 0000000..a2bb92a
--- /dev/null
+++ b/src/lib/libast/comp/libgen.h
@@ -0,0 +1,52 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * libgen interface definitions
+ */
+
+#ifndef _LIBGEN_H
+#define _LIBGEN_H
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+#if !_BLD_ast && defined(__IMPORT__)
+#define extern extern __IMPORT__
+#endif
+
+extern char* __loc1;
+
+#undef extern
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char* regcmp(const char*, ...);
+extern char* regex(const char*, const char*, ...);
+extern char* basename(char*);
+extern char* dirname(char*);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/link.c b/src/lib/libast/comp/link.c
new file mode 100644
index 0000000..571806f
--- /dev/null
+++ b/src/lib/libast/comp/link.c
@@ -0,0 +1,47 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_link
+
+NoN(link)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+link(const char* from, const char* to)
+{
+ NoP(from);
+ NoP(to);
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/localeconv.c b/src/lib/libast/comp/localeconv.c
new file mode 100644
index 0000000..8cdc841
--- /dev/null
+++ b/src/lib/libast/comp/localeconv.c
@@ -0,0 +1,100 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * localeconv() intercept
+ */
+
+#include "lclib.h"
+
+#undef localeconv
+
+static char null[] = "";
+
+static struct lconv debug_lconv =
+{
+ ",",
+ ".",
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+};
+
+static struct lconv default_lconv =
+{
+ ".",
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ &null[0],
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+ CHAR_MAX,
+};
+
+#if !_lib_localeconv
+
+struct lconv*
+localeconv(void)
+{
+ return &default_lconv;
+}
+
+#endif
+
+/*
+ * localeconv() intercept
+ */
+
+struct lconv*
+_ast_localeconv(void)
+{
+ if ((locales[AST_LC_MONETARY]->flags | locales[AST_LC_NUMERIC]->flags) & LC_debug)
+ return &debug_lconv;
+ if ((locales[AST_LC_NUMERIC]->flags & (LC_default|LC_local)) == LC_local)
+ return locales[AST_LC_NUMERIC]->territory == &lc_territories[0] ? &default_lconv : &debug_lconv;
+ return localeconv();
+}
diff --git a/src/lib/libast/comp/lstat.c b/src/lib/libast/comp/lstat.c
new file mode 100644
index 0000000..7531215
--- /dev/null
+++ b/src/lib/libast/comp/lstat.c
@@ -0,0 +1,39 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+#include <ls.h>
+
+#if _lib_lstat
+
+NoN(lstat)
+
+#else
+
+int
+lstat(const char* path, struct stat* st)
+{
+ return(stat(path, st));
+}
+
+#endif
diff --git a/src/lib/libast/comp/memccpy.c b/src/lib/libast/comp/memccpy.c
new file mode 100644
index 0000000..c973a2d
--- /dev/null
+++ b/src/lib/libast/comp/memccpy.c
@@ -0,0 +1,51 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memccpy && !_UWIN
+
+NoN(memccpy)
+
+#else
+
+/*
+ * Copy s2 to s1, stopping if character c is copied. Copy no more than n bytes.
+ * Return a pointer to the byte after character c in the copy,
+ * or 0 if c is not found in the first n bytes.
+ */
+
+void*
+memccpy(void* as1, const void* as2, register int c, size_t n)
+{
+ register char* s1 = (char*)as1;
+ register const char* s2 = (char*)as2;
+ register const char* ep = s2 + n;
+
+ while (s2 < ep)
+ if ((*s1++ = *s2++) == c)
+ return(s1);
+ return(0);
+}
+
+#endif
diff --git a/src/lib/libast/comp/memchr.c b/src/lib/libast/comp/memchr.c
new file mode 100644
index 0000000..d294059
--- /dev/null
+++ b/src/lib/libast/comp/memchr.c
@@ -0,0 +1,49 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memchr
+
+NoN(memchr)
+
+#else
+
+/*
+ * Return the ptr in sp at which the character c appears;
+ * 0 if not found in n chars; don't stop at \0.
+ */
+
+void*
+memchr(const void* asp, register int c, size_t n)
+{
+ register const char* sp = (char*)asp;
+ register const char* ep = sp + n;
+
+ while (sp < ep)
+ if (*sp++ == c)
+ return(--sp);
+ return(0);
+}
+
+#endif
diff --git a/src/lib/libast/comp/memcmp.c b/src/lib/libast/comp/memcmp.c
new file mode 100644
index 0000000..b74540c
--- /dev/null
+++ b/src/lib/libast/comp/memcmp.c
@@ -0,0 +1,45 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memcmp
+
+NoN(memcmp)
+
+#else
+
+int
+memcmp(const void* ab1, const void* ab2, size_t n)
+{
+ register const unsigned char* b1 = (const unsigned char*)ab1;
+ register const unsigned char* b2 = (const unsigned char*)ab2;
+ register const unsigned char* e = b1 + n;
+
+ while (b1 < e)
+ if (*b1++ != *b2++)
+ return(*--b1 - *--b2);
+ return(0);
+}
+
+#endif
diff --git a/src/lib/libast/comp/memcpy.c b/src/lib/libast/comp/memcpy.c
new file mode 100644
index 0000000..25fa0b7
--- /dev/null
+++ b/src/lib/libast/comp/memcpy.c
@@ -0,0 +1,60 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memcpy
+
+NoN(memcpy)
+
+#else
+
+#undef memcpy
+
+#if _lib_bcopy
+
+extern void bcopy(void*, void*, size_t);
+
+void*
+memcpy(void* s1, void* s2, size_t n)
+{
+ bcopy(s2, s1, n);
+ return(s1);
+}
+
+#else
+
+void*
+memcpy(void* as1, const void* as2, register size_t n)
+{
+ register char* s1 = (char*)as1;
+ register const char* s2 = (const char*)as2;
+
+ while (n-- > 0)
+ *s1++ = *s2++;
+ return(as1);
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/memmove.c b/src/lib/libast/comp/memmove.c
new file mode 100644
index 0000000..9d5ba59
--- /dev/null
+++ b/src/lib/libast/comp/memmove.c
@@ -0,0 +1,53 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memmove
+
+NoN(memmove)
+
+#else
+
+void*
+memmove(void* to, const void* from, register size_t n)
+{
+ register char* out = (char*)to;
+ register char* in = (char*)from;
+
+ if (n <= 0) /* works if size_t is signed or not */
+ ;
+ else if (in + n <= out || out + n <= in)
+ return(memcpy(to, from, n)); /* hope it's fast*/
+ else if (out < in)
+ do *out++ = *in++; while (--n > 0);
+ else
+ {
+ out += n;
+ in += n;
+ do *--out = *--in; while(--n > 0);
+ }
+ return(to);
+}
+
+#endif
diff --git a/src/lib/libast/comp/memset.c b/src/lib/libast/comp/memset.c
new file mode 100644
index 0000000..359d157
--- /dev/null
+++ b/src/lib/libast/comp/memset.c
@@ -0,0 +1,42 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_memset
+
+NoN(memset)
+
+#else
+
+void*
+memset(void* asp, register int c, register size_t n)
+{
+ register char* sp = (char*)asp;
+
+ while (n-- > 0)
+ *sp++ = c;
+ return(asp);
+}
+
+#endif
diff --git a/src/lib/libast/comp/mkdir.c b/src/lib/libast/comp/mkdir.c
new file mode 100644
index 0000000..37e8e51
--- /dev/null
+++ b/src/lib/libast/comp/mkdir.c
@@ -0,0 +1,62 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_mkdir
+
+NoN(mkdir)
+
+#else
+
+#include <ls.h>
+#include <wait.h>
+#include <error.h>
+
+int
+mkdir(const char* path, mode_t mode)
+{
+ register int n;
+ char* av[3];
+
+ static char* cmd[] = { "/bin/mkdir", "/usr/5bin/mkdir", 0 };
+
+
+ n = errno;
+ if (!access(path, F_OK))
+ {
+ errno = EEXIST;
+ return(-1);
+ }
+ if (errno != ENOENT) return(-1);
+ errno = n;
+ av[0] = "mkdir";
+ av[1] = path;
+ av[2] = 0;
+ for (n = 0; n < elementsof(cmd); n++)
+ if (procclose(procopen(cmd[n], av, NiL, NiL, 0)) != -1)
+ break;
+ return(chmod(path, mode));
+}
+
+#endif
diff --git a/src/lib/libast/comp/mkfifo.c b/src/lib/libast/comp/mkfifo.c
new file mode 100644
index 0000000..e4b26a4
--- /dev/null
+++ b/src/lib/libast/comp/mkfifo.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_mkfifo
+
+NoN(mkfifo)
+
+#else
+
+#include <ls.h>
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+mkfifo(const char* path, mode_t mode)
+{
+#ifdef S_IFIFO
+ return mknod(path, S_IFIFO|(mode & ~S_IFMT), 0);
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/mknod.c b/src/lib/libast/comp/mknod.c
new file mode 100644
index 0000000..8172a13
--- /dev/null
+++ b/src/lib/libast/comp/mknod.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+#include <ls.h>
+
+#if _lib_mknod
+
+NoN(mknod)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+mknod(const char* path, mode_t mode, dev_t dev)
+{
+ if (S_ISFIFO(mode))
+ return mkfifo(path, mode);
+ if (S_ISDIR(mode))
+ return mkdir(path, mode);
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/mktemp.c b/src/lib/libast/comp/mktemp.c
new file mode 100644
index 0000000..c29dc90
--- /dev/null
+++ b/src/lib/libast/comp/mktemp.c
@@ -0,0 +1,85 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * mktemp,mkstemp implementation
+ */
+
+#define mktemp ______mktemp
+#define mkstemp ______mkstemp
+
+#include <ast.h>
+#include <stdio.h>
+
+#undef mktemp
+#undef mkstemp
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+static char*
+temp(char* buf, int* fdp)
+{
+ char* s;
+ char* d;
+ int n;
+ size_t len;
+
+ len = strlen(buf);
+ if (s = strrchr(buf, '/'))
+ {
+ *s++ = 0;
+ d = buf;
+ }
+ else
+ {
+ s = buf;
+ d = "";
+ }
+ if ((n = strlen(s)) < 6 || strcmp(s + n - 6, "XXXXXX"))
+ *buf = 0;
+ else
+ {
+ *(s + n - 6) = 0;
+ if (!pathtemp(buf, len, d, s, fdp))
+ *buf = 0;
+ }
+ return buf;
+}
+
+extern char*
+mktemp(char* buf)
+{
+ return temp(buf, NiL);
+}
+
+extern int
+mkstemp(char* buf)
+{
+ int fd;
+
+ return *temp(buf, &fd) ? fd : -1;
+}
diff --git a/src/lib/libast/comp/mktime.c b/src/lib/libast/comp/mktime.c
new file mode 100644
index 0000000..c39ca40
--- /dev/null
+++ b/src/lib/libast/comp/mktime.c
@@ -0,0 +1,77 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * mktime implementation
+ */
+
+#define mktime ______mktime
+
+#include <ast.h>
+#include <tm.h>
+
+#undef mktime
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#undef _lib_mktime /* we can pass X/Open */
+
+#if _lib_mktime
+
+NoN(mktime)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern time_t
+mktime(struct tm* ts)
+{
+ time_t t;
+ Tm_t tm;
+
+ tm.tm_sec = ts->tm_sec;
+ tm.tm_min = ts->tm_min;
+ tm.tm_hour = ts->tm_hour;
+ tm.tm_mday = ts->tm_mday;
+ tm.tm_mon = ts->tm_mon;
+ tm.tm_year = ts->tm_year;
+ tm.tm_wday = ts->tm_wday;
+ tm.tm_yday = ts->tm_yday;
+ tm.tm_isdst = ts->tm_isdst;
+ t = tmtime(&tm, TM_LOCALZONE);
+ ts->tm_sec = tm.tm_sec;
+ ts->tm_min = tm.tm_min;
+ ts->tm_hour = tm.tm_hour;
+ ts->tm_mday = tm.tm_mday;
+ ts->tm_mon = tm.tm_mon;
+ ts->tm_year = tm.tm_year;
+ ts->tm_wday = tm.tm_wday;
+ ts->tm_yday = tm.tm_yday;
+ ts->tm_isdst = tm.tm_isdst;
+ return t;
+}
+
+#endif
diff --git a/src/lib/libast/comp/mount.c b/src/lib/libast/comp/mount.c
new file mode 100644
index 0000000..eaf27e5
--- /dev/null
+++ b/src/lib/libast/comp/mount.c
@@ -0,0 +1,49 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_mount
+
+NoN(mount)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+mount(const char* a, char* b, int c, void* d)
+{
+ NoP(a);
+ NoP(b);
+ NoP(c);
+ NoP(d);
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/nftw.c b/src/lib/libast/comp/nftw.c
new file mode 100644
index 0000000..6c8c97a
--- /dev/null
+++ b/src/lib/libast/comp/nftw.c
@@ -0,0 +1,61 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * nftw implementation
+ */
+
+#include <ast.h>
+#include <ftw.h>
+
+static int nftw_flags;
+static int (*nftw_userf)(const char*, const struct stat*, int, struct FTW*);
+
+static int
+nftw_user(Ftw_t* ftw)
+{
+ register int n = ftw->info;
+ struct FTW nftw;
+ struct stat st;
+
+ if (n & (FTW_C|FTW_NX))
+ n = FTW_DNR;
+ else if ((n & FTW_SL) && (!(nftw_flags & FTW_PHYSICAL) || stat(ftw->path, &st)))
+ n = FTW_SLN;
+ nftw.base = ftw->pathlen - ftw->namelen;
+ nftw.level = ftw->level;
+ nftw.quit = 0;
+ n = (*nftw_userf)(ftw->path, &ftw->statb, n, &nftw);
+ ftw->status = nftw.quit;
+ return n;
+}
+
+int
+nftw(const char* path, int(*userf)(const char*, const struct stat*, int, struct FTW*), int depth, int flags)
+{
+ NoP(depth);
+ nftw_userf = userf;
+ if (flags & FTW_CHDIR) flags &= ~FTW_DOT;
+ else flags |= FTW_DOT;
+ nftw_flags = flags;
+ return ftwalk(path, nftw_user, flags, NiL);
+}
diff --git a/src/lib/libast/comp/omitted.c b/src/lib/libast/comp/omitted.c
new file mode 100644
index 0000000..b517965
--- /dev/null
+++ b/src/lib/libast/comp/omitted.c
@@ -0,0 +1,1152 @@
+#pragma prototyped noticed
+
+/*
+ * workarounds to bring the native interface close to posix and x/open
+ */
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:hide utime utimes
+#else
+#define utime ______utime
+#define utimes ______utimes
+#endif
+
+#include <ast.h>
+#include <error.h>
+#include <tm.h>
+
+#include "FEATURE/omitted"
+
+#undef OMITTED
+
+#if _win32_botch
+
+#define OMITTED 1
+
+#include <ls.h>
+#include <utime.h>
+
+#if __CYGWIN__
+#include <ast_windows.h>
+#if _win32_botch_execve || _lib_spawn_mode
+#define CONVERT 1
+#endif
+#endif
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:nohide utime utimes
+#else
+#undef utime
+#undef utimes
+#endif
+
+#ifndef MAX_PATH
+#define MAX_PATH PATH_MAX
+#endif
+
+/*
+ * these workarounds assume each system call foo() has a _foo() entry
+ * which is true for __CYGWIN__ and __EMX__ (both gnu based)
+ *
+ * the workarounds handle:
+ *
+ * (1) .exe suffix inconsistencies
+ * (2) /bin/sh reference in execve() and spawnve()
+ * (3) bogus getpagesize() return values
+ * (4) a fork() bug that screws up shell fork()+script
+ *
+ * NOTE: Not all workarounds can be handled by unix syscall intercepts.
+ * In particular, { ksh nmake } have workarounds for case-ignorant
+ * filesystems and { libast } has workarounds for win32 locale info.
+ */
+
+#undef _pathconf
+#undef pathconf
+#undef stat
+
+extern int _access(const char*, int);
+extern unsigned int _alarm(unsigned int);
+extern int _chmod(const char*, mode_t);
+extern int _close(int);
+extern pid_t _execve(const char*, char* const*, char* const*);
+extern uid_t _getuid(void);
+extern int _link(const char*, const char*);
+extern int _open(const char*, int, ...);
+extern long _pathconf(const char*, int);
+extern ssize_t _read(int, void*, size_t);
+extern int _rename(const char*, const char*);
+extern pid_t _spawnve(int, const char*, char* const*, char* const*);
+extern int _stat(const char*, struct stat*);
+extern int _unlink(const char*);
+extern int _utime(const char*, const struct utimbuf*);
+extern int _utimes(const char*, const struct timeval*);
+extern ssize_t _write(int, const void*, size_t);
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+#if _win32_botch_access
+#define sysaccess _access
+#else
+#define sysaccess access
+#endif
+#if _win32_botch_alarm
+#define sysalarm _alarm
+#else
+#define sysalarm alarm
+#endif
+#if _win32_botch_chmod
+#define syschmod _chmod
+#else
+#define syschmod chmod
+#endif
+#if _win32_botch_copy
+#define sysclose _close
+#else
+#define sysclose close
+#endif
+#if _win32_botch_execve || _lib_spawn_mode
+#define sysexecve _execve
+#else
+#define sysexecve execve
+#endif
+#if CONVERT
+#define sysgetuid _getuid
+#else
+#define sysgetuid getuid
+#endif
+#if _win32_botch_link
+#define syslink _link
+#else
+#define syslink link
+#endif
+#if _win32_botch_open || _win32_botch_copy
+#define sysopen _open
+#else
+#define sysopen open
+#endif
+#if _win32_botch_pathconf
+#define syspathconf _pathconf
+#else
+#define syspathconf pathconf
+#endif
+#define sysread _read
+#if _win32_botch_rename
+#define sysrename _rename
+#else
+#define sysrename rename
+#endif
+#if _lib_spawn_mode
+#define sysspawnve _spawnve
+#else
+#define sysspawnve spawnve
+#endif
+#if _win32_botch_stat
+#define sysstat _stat
+#else
+#define sysstat stat
+#endif
+#if _win32_botch_truncate
+#define systruncate _truncate
+#else
+#define systruncate truncate
+#endif
+#if _win32_botch_unlink
+#define sysunlink _unlink
+#else
+#define sysunlink unlink
+#endif
+#if _win32_botch_utime
+#define sysutime _utime
+#define sysutimes _utimes
+#else
+#define sysutime utime
+#define sysutimes utimes
+#endif
+#if _win32_botch_copy
+#define syswrite _write
+#else
+#define syswrite write
+#endif
+
+static char*
+suffix(register const char* path)
+{
+ register const char* s = path + strlen(path);
+ register int c;
+
+ while (s > path)
+ if ((c = *--s) == '.')
+ return (char*)s + 1;
+ else if (c == '/' || c == '\\')
+ break;
+ return 0;
+}
+
+static int
+execrate(const char* path, char* buf, int size, int physical)
+{
+ char* s;
+ int n;
+ int oerrno;
+
+ if (suffix(path))
+ return 0;
+ oerrno = errno;
+ if (physical || strlen(path) >= size || !(s = pathcanon(strcpy(buf, path), size, PATH_PHYSICAL|PATH_DOTDOT|PATH_EXISTS)))
+ snprintf(buf, size, "%s.exe", path);
+ else if (!suffix(buf) && ((buf + size) - s) >= 4)
+ strcpy(s, ".exe");
+ errno = oerrno;
+ return 1;
+}
+
+/*
+ * return 0 if path is magic, -1 otherwise
+ * ux!=0 set to 1 if path is unix executable
+ * ux!=0 also retains errno for -1 return
+ */
+
+static int
+magic(const char* path, int* ux)
+{
+ int fd;
+ int r;
+ int n;
+ int m;
+ int oerrno;
+#if CONVERT
+ unsigned char buf[512];
+#else
+ unsigned char buf[2];
+#endif
+
+ oerrno = errno;
+ if ((fd = sysopen(path, O_RDONLY, 0)) >= 0)
+ {
+#if CONVERT
+ if (ux)
+ n = sizeof(buf);
+ else
+#endif
+ n = 2;
+ r = (m = sysread(fd, buf, n)) >= 2 && (buf[1] == 0x5a && (buf[0] == 0x4c || buf[0] == 0x4d) || ux && buf[0] == '#' && buf[1] == '!' && (*ux = 1) && !(ux = 0)) ? 0 : -1;
+ sysclose(fd);
+ if (ux)
+ {
+ if (r)
+ oerrno = ENOEXEC;
+ else if (m > 61 && (n = buf[60] | (buf[61]<<8) + 92) < (m - 1))
+ *ux = (buf[n] | (buf[n+1]<<8)) == 3;
+ else
+ *ux = 0;
+ }
+ }
+ else if (!ux)
+ r = -1;
+ else if (errno == ENOENT)
+ {
+ oerrno = errno;
+ r = -1;
+ }
+ else
+ {
+ r = 0;
+ *ux = 0;
+ }
+ errno = oerrno;
+ return r;
+}
+
+#if _win32_botch_access
+
+extern int
+access(const char* path, int op)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = sysaccess(path, op)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ r = sysaccess(buf, op);
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_alarm
+
+extern unsigned int
+alarm(unsigned int s)
+{
+ unsigned int n;
+ unsigned int r;
+
+ static unsigned int a;
+
+ n = (unsigned int)time(NiL);
+ if (a <= n)
+ r = 0;
+ else
+ r = a - n;
+ a = n + s - 1;
+ (void)sysalarm(s);
+ return r;
+}
+
+#endif
+
+#if _win32_botch_chmod
+
+extern int
+chmod(const char* path, mode_t mode)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ if ((r = syschmod(path, mode)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ return syschmod(buf, mode);
+ }
+ if (!(r = syschmod(path, mode)) &&
+ (mode & (S_IXUSR|S_IXGRP|S_IXOTH)) &&
+ !suffix(path) &&
+ (strlen(path) + 4) < sizeof(buf))
+ {
+ oerrno = errno;
+ if (!magic(path, NiL))
+ {
+ snprintf(buf, sizeof(buf), "%s.exe", path);
+ sysrename(path, buf);
+ }
+ errno = oerrno;
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_execve || _lib_spawn_mode
+
+#if _lib_spawn_mode
+
+/*
+ * can anyone get const prototype args straight?
+ */
+
+#define execve ______execve
+#define spawnve ______spawnve
+
+#include <process.h>
+
+#undef execve
+#undef spawnve
+
+#endif
+
+#if CONVERT
+
+/*
+ * this intercept converts dos env vars to unix
+ * we'd rather intercept main but can't twist cc to do it
+ * getuid() gets ksh to do the right thing and
+ * that's our main concern
+ *
+ * DOSPATHVARS='a b c' convert { a b c }
+ */
+
+static int convertinit;
+
+/*
+ * convertvars[0] names the list of env var names
+ * convertvars[i] are not converted
+ */
+
+static const char* convertvars[] = { "DOSPATHVARS", "PATH" };
+
+static int
+convert(register const char* d, const char* s)
+{
+ register const char* t;
+ register const char* v;
+ int i;
+
+ for (i = 0; i < elementsof(convertvars); i++)
+ {
+ for (v = convertvars[i], t = s; *t && *t == *v; t++, v++);
+ if (*t == '=' && *v == 0)
+ return 0;
+ }
+ for (;;)
+ {
+ while (*d == ' ' || *d == '\t')
+ d++;
+ if (!*d)
+ break;
+ for (t = s; *t && *t == *d; d++, t++);
+ if (*t == '=' && (*d == ' ' || *d == '\t' || *d == 0))
+ return t - s + 1;
+ while (*d && *d != ' ' && *d != '\t')
+ d++;
+ }
+ return 0;
+}
+
+uid_t
+getuid(void)
+{
+ register char* d;
+ register char* s;
+ register char* t;
+ register char** e;
+ int n;
+ int m;
+
+ if (!convertinit++ && (d = getenv(convertvars[0])))
+ for (e = environ; s = *e; e++)
+ if ((n = convert(d, s)) && (m = cygwin_win32_to_posix_path_list_buf_size(s + n)) > 0)
+ {
+ if (!(t = malloc(n + m + 1)))
+ break;
+ *e = t;
+ memcpy(t, s, n);
+ cygwin_win32_to_posix_path_list(s + n, t + n);
+ }
+ return sysgetuid();
+}
+
+#endif
+
+#ifndef _P_OVERLAY
+#define _P_OVERLAY (-1)
+#endif
+
+#define DEBUG 1
+
+static pid_t
+runve(int mode, const char* path, char* const* argv, char* const* envv)
+{
+ register char* s;
+ register char** p;
+ register char** v;
+
+ void* m1;
+ void* m2;
+ pid_t pid;
+ int oerrno;
+ int ux;
+ int n;
+#if defined(_P_DETACH) && defined(_P_NOWAIT)
+ int pgrp;
+#endif
+#if CONVERT
+ char* d;
+ char* t;
+ int m;
+#endif
+ struct stat st;
+ char buf[PATH_MAX];
+ char tmp[PATH_MAX];
+
+#if DEBUG
+ static int trace;
+#endif
+
+#if defined(_P_DETACH) && defined(_P_NOWAIT)
+ if (mode == _P_DETACH)
+ {
+ /*
+ * 2004-02-29 cygwin _P_DETACH is useless:
+ * spawn*() returns 0 instead of the spawned pid
+ * spawned { pgid sid } are the same as the parent
+ */
+
+ mode = _P_NOWAIT;
+ pgrp = 1;
+ }
+ else
+ pgrp = 0;
+#endif
+ if (!envv)
+ envv = (char* const*)environ;
+ m1 = m2 = 0;
+ oerrno = errno;
+#if DEBUG
+ if (!trace)
+ trace = (s = getenv("_AST_exec_trace")) ? *s : 'n';
+#endif
+ if (execrate(path, buf, sizeof(buf), 0))
+ {
+ if (!sysstat(buf, &st))
+ path = (const char*)buf;
+ else
+ errno = oerrno;
+ }
+ if (path != (const char*)buf && sysstat(path, &st))
+ return -1;
+ if (!S_ISREG(st.st_mode) || !(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)))
+ {
+ errno = EACCES;
+ return -1;
+ }
+ if (magic(path, &ux))
+ {
+#if _CYGWIN_fork_works
+ errno = ENOEXEC;
+ return -1;
+#else
+ ux = 1;
+ p = (char**)argv;
+ while (*p++);
+ if (!(v = (char**)malloc((p - (char**)argv + 2) * sizeof(char*))))
+ {
+ errno = EAGAIN;
+ return -1;
+ }
+ m1 = v;
+ p = v;
+ *p++ = (char*)path;
+ *p++ = (char*)path;
+ path = (const char*)pathshell();
+ if (*argv)
+ argv++;
+ while (*p++ = (char*)*argv++);
+ argv = (char* const*)v;
+#endif
+ }
+
+ /*
+ * the win32 dll search order is
+ * (1) the directory of path
+ * (2) .
+ * (3) /c/(WINNT|WINDOWS)/system32 /c/(WINNT|WINDOWS)
+ * (4) the directories on $PATH
+ * there are no cygwin dlls in (3), so if (1) and (2) fail
+ * to produce the required dlls its up to (4)
+ *
+ * the standard allows PATH to be anything once the path
+ * to an executable is determined; this code ensures that PATH
+ * contains /bin so that at least the cygwin dll, required
+ * by all cygwin executables, will be found
+ */
+
+ if (p = (char**)envv)
+ {
+ n = 1;
+ while (s = *p++)
+ if (strneq(s, "PATH=", 5))
+ {
+ s += 5;
+ do
+ {
+ s = pathcat(s, ':', NiL, "", tmp, sizeof(tmp));
+ if (streq(tmp, "/usr/bin/") || streq(tmp, "/bin/"))
+ {
+ n = 0;
+ break;
+ }
+ } while (s);
+ if (n)
+ {
+ n = 0;
+ snprintf(tmp, sizeof(tmp), "%s:/bin", *(p - 1));
+ *(p - 1) = tmp;
+ }
+ break;
+ }
+ if (n)
+ {
+ n = p - (char**)envv + 1;
+ p = (char**)envv;
+ if (v = (char**)malloc(n * sizeof(char*)))
+ {
+ m2 = v;
+ envv = (char* const*)v;
+ *v++ = strcpy(tmp, "PATH=/bin");
+ while (*v++ = *p++);
+ }
+ }
+#if CONVERT
+ if (!ux && (d = getenv(convertvars[0])))
+ for (p = (char**)envv; s = *p; p++)
+ if ((n = convert(d, s)) && (m = cygwin_posix_to_win32_path_list_buf_size(s + n)) > 0)
+ {
+ if (!(t = malloc(n + m + 1)))
+ break;
+ *p = t;
+ memcpy(t, s, n);
+ cygwin_posix_to_win32_path_list(s + n, t + n);
+ }
+#endif
+ }
+
+#if DEBUG
+ if (trace == 'a' || trace == 'e')
+ {
+ sfprintf(sfstderr, "%s %s [", mode == _P_OVERLAY ? "_execve" : "_spawnve", path);
+ for (n = 0; argv[n]; n++)
+ sfprintf(sfstderr, " '%s'", argv[n]);
+ if (trace == 'e')
+ {
+ sfprintf(sfstderr, " ] [");
+ for (n = 0; envv[n]; n++)
+ sfprintf(sfstderr, " '%s'", envv[n]);
+ }
+ sfprintf(sfstderr, " ]\n");
+ sfsync(sfstderr);
+ }
+#endif
+#if _lib_spawn_mode
+ if (mode != _P_OVERLAY)
+ {
+ pid = sysspawnve(mode, path, argv, envv);
+#if defined(_P_DETACH) && defined(_P_NOWAIT)
+ if (pid > 0 && pgrp)
+ setpgid(pid, 0);
+#endif
+ }
+ else
+#endif
+ {
+#if defined(_P_DETACH) && defined(_P_NOWAIT)
+ if (pgrp)
+ setpgid(0, 0);
+#endif
+ pid = sysexecve(path, argv, envv);
+ }
+ if (m1)
+ free(m1);
+ if (m2)
+ free(m2);
+ return pid;
+}
+
+#if _win32_botch_execve
+
+extern pid_t
+execve(const char* path, char* const* argv, char* const* envv)
+{
+ return runve(_P_OVERLAY, path, argv, envv);
+}
+
+#endif
+
+#if _lib_spawn_mode
+
+extern pid_t
+spawnve(int mode, const char* path, char* const* argv, char* const* envv)
+{
+ return runve(mode, path, argv, envv);
+}
+
+#endif
+
+#endif
+
+#if _win32_botch_getpagesize
+
+extern size_t
+getpagesize(void)
+{
+ return 64 * 1024;
+}
+
+#endif
+
+#if _win32_botch_link
+
+extern int
+link(const char* fp, const char* tp)
+{
+ int r;
+ int oerrno;
+ char fb[PATH_MAX];
+ char tb[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = syslink(fp, tp)) && errno == ENOENT && execrate(fp, fb, sizeof(fb), 1))
+ {
+ if (execrate(tp, tb, sizeof(tb), 1))
+ tp = tb;
+ errno = oerrno;
+ r = syslink(fb, tp);
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_open || _win32_botch_copy
+
+#if _win32_botch_copy
+
+/*
+ * this should intercept the important cases
+ * dup*() and exec*() fd's will not be intercepted
+ */
+
+typedef struct Exe_test_s
+{
+ int test;
+ ino_t ino;
+ char path[PATH_MAX];
+} Exe_test_t;
+
+static Exe_test_t* exe[16];
+
+extern int
+close(int fd)
+{
+ int r;
+ int oerrno;
+ struct stat st;
+ char buf[PATH_MAX];
+
+ if (fd >= 0 && fd < elementsof(exe) && exe[fd])
+ {
+ r = exe[fd]->test;
+ exe[fd]->test = 0;
+ if (r > 0 && !fstat(fd, &st) && st.st_ino == exe[fd]->ino)
+ {
+ if (r = sysclose(fd))
+ return r;
+ oerrno = errno;
+ if (!stat(exe[fd]->path, &st) && st.st_ino == exe[fd]->ino)
+ {
+ snprintf(buf, sizeof(buf), "%s.exe", exe[fd]->path);
+ sysrename(exe[fd]->path, buf);
+ }
+ errno = oerrno;
+ return 0;
+ }
+ }
+ return sysclose(fd);
+}
+
+extern ssize_t
+write(int fd, const void* buf, size_t n)
+{
+ if (fd >= 0 && fd < elementsof(exe) && exe[fd] && exe[fd]->test < 0)
+ exe[fd]->test = n >= 2 && ((unsigned char*)buf)[1] == 0x5a && (((unsigned char*)buf)[0] == 0x4c || ((unsigned char*)buf)[0] == 0x4d) && !lseek(fd, (off_t)0, SEEK_CUR);
+ return syswrite(fd, buf, n);
+}
+
+#endif
+
+extern int
+open(const char* path, int flags, ...)
+{
+ int fd;
+ int mode;
+ int oerrno;
+ char buf[PATH_MAX];
+#if _win32_botch_copy
+ struct stat st;
+#endif
+ va_list ap;
+
+ va_start(ap, flags);
+ mode = (flags & O_CREAT) ? va_arg(ap, int) : 0;
+ oerrno = errno;
+ fd = sysopen(path, flags, mode);
+#if _win32_botch_open
+ if (fd < 0 && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ fd = sysopen(buf, flags, mode);
+ }
+#endif
+#if _win32_botch_copy
+ if (fd >= 0 && fd < elementsof(exe) && strlen(path) < PATH_MAX &&
+ (flags & (O_CREAT|O_TRUNC)) == (O_CREAT|O_TRUNC) && (mode & 0111))
+ {
+ if (!suffix(path) && !fstat(fd, &st) && (exe[fd] || (exe[fd] = (Exe_test_t*)malloc(sizeof(Exe_test_t)))))
+ {
+ exe[fd]->test = -1;
+ exe[fd]->ino = st.st_ino;
+ strcpy(exe[fd]->path, path);
+ }
+ errno = oerrno;
+ }
+#endif
+ va_end(ap);
+ return fd;
+}
+
+#endif
+
+#if _win32_botch_pathconf
+
+extern long
+pathconf(const char* path, int op)
+{
+ if (sysaccess(path, F_OK))
+ return -1;
+ return syspathconf(path, op);
+}
+
+#endif
+
+#if _win32_botch_rename
+
+extern int
+rename(const char* fp, const char* tp)
+{
+ int r;
+ int oerrno;
+ char fb[PATH_MAX];
+ char tb[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = sysrename(fp, tp)) && errno == ENOENT && execrate(fp, fb, sizeof(fb), 1))
+ {
+ if (execrate(tp, tb, sizeof(tb), 1))
+ tp = tb;
+ errno = oerrno;
+ r = sysrename(fb, tp);
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_stat
+
+extern int
+stat(const char* path, struct stat* st)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = sysstat(path, st)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ r = sysstat(buf, st);
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_truncate
+
+extern int
+truncate(const char* path, off_t offset)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = systruncate(path, offset)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ r = systruncate(buf, offset);
+ }
+ return r;
+}
+
+#endif
+
+#if _win32_botch_unlink
+
+extern int
+unlink(const char* path)
+{
+ int r;
+ int drive;
+ int mask;
+ int suffix;
+ int stop;
+ int oerrno;
+ unsigned long base;
+ char buf[PATH_MAX];
+ char tmp[MAX_PATH];
+
+#define DELETED_DIR_1 7
+#define DELETED_DIR_2 16
+
+ static char deleted[] = "%c:\\temp\\.deleted\\%08x.%03x";
+
+ static int count = 0;
+
+#if __CYGWIN__
+
+ DWORD fattr = FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE;
+ DWORD share = FILE_SHARE_DELETE;
+ HANDLE hp;
+ struct stat st;
+ char nat[MAX_PATH];
+
+ oerrno = errno;
+ if (lstat(path, &st) || !S_ISREG(st.st_mode))
+ goto try_unlink;
+ cygwin_conv_to_full_win32_path(path, nat);
+ if (!strncasecmp(nat + 1, ":\\temp\\", 7))
+ goto try_unlink;
+ drive = nat[0];
+ path = (const char*)nat;
+ for (;;)
+ {
+ hp = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE, NULL);
+ if (hp != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(hp);
+ errno = oerrno;
+ return 0;
+ }
+ if (GetLastError() != ERROR_FILE_NOT_FOUND)
+ break;
+ if (path == (const char*)buf || !execrate(path, buf, sizeof(buf), 1))
+ {
+ errno = ENOENT;
+ return -1;
+ }
+ path = (const char*)buf;
+ }
+#else
+ if (sysaccess(path, 0))
+#if _win32_botch_access
+ {
+ if (errno != ENOENT || !execrate(path, buf, sizeof(buf), 1) || sysaccess(buf, 0))
+ return -1;
+ path = (const char*)buf;
+ }
+#else
+ return -1;
+#endif
+ drive = 'C':
+#endif
+
+ /*
+ * rename to a `deleted' path just in case the file is open
+ * otherwise directory readers may choke on phantom entries
+ */
+
+ base = ((getuid() & 0xffff) << 16) | (time(NiL) & 0xffff);
+ suffix = (getpid() & 0xfff) + count++;
+ snprintf(tmp, sizeof(tmp), deleted, drive, base, suffix);
+ if (!sysrename(path, tmp))
+ {
+ path = (const char*)tmp;
+ goto try_delete;
+ }
+ if (errno != ENOTDIR && errno != ENOENT)
+ goto try_unlink;
+ tmp[DELETED_DIR_2] = 0;
+ if (sysaccess(tmp, 0))
+ {
+ mask = umask(0);
+ tmp[DELETED_DIR_1] = 0;
+ if (sysaccess(tmp, 0) && mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO))
+ {
+ umask(mask);
+ goto try_unlink;
+ }
+ tmp[DELETED_DIR_1] = '\\';
+ r = mkdir(tmp, S_IRWXU|S_IRWXG|S_IRWXO);
+ umask(mask);
+ if (r)
+ goto try_unlink;
+ errno = 0;
+ }
+ tmp[DELETED_DIR_2] = '\\';
+ if (!errno && !sysrename(path, tmp))
+ {
+ path = (const char*)tmp;
+ goto try_delete;
+ }
+#if !__CYGWIN__
+ if (errno == ENOENT)
+ {
+#if !_win32_botch_access
+ if (execrate(path, buf, sizeof(buf), 1) && !sysrename(buf, tmp))
+ path = (const char*)tmp;
+#endif
+ goto try_unlink;
+ }
+#endif
+ stop = suffix;
+ do
+ {
+ snprintf(tmp, sizeof(tmp), deleted, drive, base, suffix);
+ if (!sysrename(path, tmp))
+ {
+ path = (const char*)tmp;
+ goto try_delete;
+ }
+ if (++suffix > 0xfff)
+ suffix = 0;
+ } while (suffix != stop);
+ try_delete:
+#if __CYGWIN__
+ hp = CreateFile(path, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_DELETE_ON_CLOSE, NULL);
+ if (hp != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(hp);
+ errno = oerrno;
+ return 0;
+ }
+#endif
+ try_unlink:
+ errno = oerrno;
+ return sysunlink(path);
+}
+
+#endif
+
+#if _win32_botch_utime
+
+#if __CYGWIN__
+
+/*
+ * cygwin refuses to set st_ctime for some operations
+ * this rejects that refusal
+ */
+
+static void
+ctime_now(const char* path)
+{
+ HANDLE hp;
+ SYSTEMTIME st;
+ FILETIME ct;
+ WIN32_FIND_DATA ff;
+ struct stat fs;
+ int oerrno;
+ char tmp[MAX_PATH];
+
+ if (sysstat(path, &fs) || (fs.st_mode & S_IWUSR) || syschmod(path, (fs.st_mode | S_IWUSR) & S_IPERM))
+ fs.st_mode = 0;
+ cygwin_conv_to_win32_path(path, tmp);
+ hp = CreateFile(tmp, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (hp && hp != INVALID_HANDLE_VALUE)
+ {
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st, &ct);
+ SetFileTime(hp, &ct, 0, 0);
+ CloseHandle(hp);
+ }
+ if (fs.st_mode)
+ syschmod(path, fs.st_mode & S_IPERM);
+ errno = oerrno;
+}
+
+#else
+
+#define ctime_now(p)
+
+#endif
+
+extern int
+utimes(const char* path, const struct timeval* ut)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = sysutimes(path, ut)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ r = sysutimes(path = buf, ut);
+ }
+ if (!r)
+ ctime_now(path);
+ return r;
+}
+
+extern int
+utime(const char* path, const struct utimbuf* ut)
+{
+ int r;
+ int oerrno;
+ char buf[PATH_MAX];
+
+ oerrno = errno;
+ if ((r = sysutime(path, ut)) && errno == ENOENT && execrate(path, buf, sizeof(buf), 0))
+ {
+ errno = oerrno;
+ r = sysutime(path = buf, ut);
+ }
+ if (!r)
+ ctime_now(path);
+ return r;
+}
+
+#endif
+
+#endif
+
+/*
+ * some systems (sun) miss a few functions required by their
+ * own bsd-like macros
+ */
+
+#if !_lib_bzero || defined(bzero)
+
+#undef bzero
+
+void
+bzero(void* b, size_t n)
+{
+ memset(b, 0, n);
+}
+
+#endif
+
+#if !_lib_getpagesize || defined(getpagesize)
+
+#ifndef OMITTED
+#define OMITTED 1
+#endif
+
+#undef getpagesize
+
+#ifdef _SC_PAGESIZE
+#undef _AST_PAGESIZE
+#define _AST_PAGESIZE (int)sysconf(_SC_PAGESIZE)
+#else
+#ifndef _AST_PAGESIZE
+#define _AST_PAGESIZE 4096
+#endif
+#endif
+
+int
+getpagesize()
+{
+ return _AST_PAGESIZE;
+}
+
+#endif
+
+#if __CYGWIN__ && defined(__IMPORT__) && defined(__EXPORT__)
+
+#ifndef OMITTED
+#define OMITTED 1
+#endif
+
+/*
+ * a few _imp__FUNCTION symbols are needed to avoid
+ * static link multiple definitions
+ */
+
+#ifndef strtod
+__EXPORT__ double (*_imp__strtod)(const char*, char**) = strtod;
+#endif
+
+#endif
+
+#ifndef OMITTED
+
+NoN(omitted)
+
+#endif
diff --git a/src/lib/libast/comp/open.c b/src/lib/libast/comp/open.c
new file mode 100644
index 0000000..6e2530f
--- /dev/null
+++ b/src/lib/libast/comp/open.c
@@ -0,0 +1,119 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * -last 3 arg open
+ */
+
+#include <ast.h>
+
+#if !defined(open) || !defined(_ast_O_LOCAL)
+
+NoN(open)
+
+#else
+
+#undef open
+
+extern int open(const char*, int, ...);
+
+#include <ls.h>
+#include <error.h>
+
+#ifdef O_NOCTTY
+#include <ast_tty.h>
+#endif
+
+int
+_ast_open(const char* path, int op, ...)
+{
+ int fd;
+ int mode;
+ int save_errno;
+ struct stat st;
+ va_list ap;
+
+ save_errno = errno;
+ va_start(ap, op);
+ mode = (op & O_CREAT) ? va_arg(ap, int) : S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
+ va_end(ap);
+ if (op & ~(_ast_O_LOCAL-1))
+ {
+ if (!(op & O_CREAT))
+ op &= ~O_EXCL;
+ for (;;)
+ {
+ if (op & O_TRUNC)
+ {
+ if ((op & O_EXCL) && !access(path, F_OK))
+ {
+ errno = EEXIST;
+ return(-1);
+ }
+ if ((fd = creat(path, (op & O_EXCL) ? 0 : mode)) < 0)
+ return(-1);
+ if (op & O_EXCL)
+ {
+ if (fstat(fd, &st) || (st.st_mode & S_IPERM))
+ {
+ errno = EEXIST;
+ close(fd);
+ return(-1);
+ }
+#if _lib_fchmod
+ if (mode && fchmod(fd, mode))
+#else
+ if (mode && chmod(path, mode))
+#endif
+ errno = save_errno;
+ }
+ if ((op & O_ACCMODE) == O_RDWR)
+ {
+ close(fd);
+ op &= ~(O_CREAT|O_TRUNC);
+ continue;
+ }
+ }
+ else if ((fd = open(path, op & (_ast_O_LOCAL-1), mode)) < 0)
+ {
+ if (op & O_CREAT)
+ {
+ op |= O_TRUNC;
+ continue;
+ }
+ return(-1);
+ }
+ else if ((op & O_APPEND) && lseek(fd, 0L, SEEK_END) == -1L)
+ errno = save_errno;
+#if O_NOCTTY
+ if ((op & O_NOCTTY) && ioctl(fd, TIOCNOTTY, 0))
+ errno = save_errno;
+#endif
+ break;
+ }
+ }
+ else fd = open(path, op, mode);
+ return(fd);
+}
+
+#endif
diff --git a/src/lib/libast/comp/openlog.c b/src/lib/libast/comp/openlog.c
new file mode 100644
index 0000000..518d441
--- /dev/null
+++ b/src/lib/libast/comp/openlog.c
@@ -0,0 +1,58 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * openlog implementation
+ */
+
+#include <ast.h>
+
+#if _lib_syslog
+
+NoN(openlog)
+
+#else
+
+#include "sysloglib.h"
+
+void
+openlog(const char* ident, int flags, int facility)
+{
+ int n;
+
+ if (ident)
+ {
+ n = strlen(ident);
+ if (n >= sizeof(log.ident))
+ n = sizeof(log.ident) - 1;
+ memcpy(log.ident, ident, n);
+ log.ident[n] = 0;
+ }
+ else
+ log.ident[0] = 0;
+ log.facility = facility;
+ log.flags = flags;
+ if (!(log.flags & LOG_ODELAY))
+ sendlog(NiL);
+}
+
+#endif
diff --git a/src/lib/libast/comp/putenv.c b/src/lib/libast/comp/putenv.c
new file mode 100644
index 0000000..72b0f61
--- /dev/null
+++ b/src/lib/libast/comp/putenv.c
@@ -0,0 +1,53 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#define putenv ______putenv
+
+#if _UWIN
+#define _STDLIB_H_ 1
+#endif
+
+#include <ast.h>
+
+#undef putenv
+
+#if _lib_putenv
+
+NoN(putenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+putenv(const char* s)
+{
+ return setenviron(s) ? 0 : -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/re_comp.c b/src/lib/libast/comp/re_comp.c
new file mode 100644
index 0000000..ad31f24
--- /dev/null
+++ b/src/lib/libast/comp/re_comp.c
@@ -0,0 +1,81 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * re_comp implementation
+ */
+
+#include <ast.h>
+#include <re_comp.h>
+#include <regex.h>
+
+#undef error
+#undef valid
+
+static struct
+{
+ char error[64];
+ regex_t re;
+ int valid;
+} state;
+
+char*
+re_comp(const char* pattern)
+{
+ register int r;
+
+ if (!pattern || !*pattern)
+ {
+ if (state.valid)
+ return 0;
+ r = REG_BADPAT;
+ }
+ else
+ {
+ if (state.valid)
+ {
+ state.valid = 0;
+ regfree(&state.re);
+ }
+ if (!(r = regcomp(&state.re, pattern, REG_LENIENT|REG_NOSUB|REG_NULL)))
+ {
+ state.valid = 1;
+ return 0;
+ }
+ }
+ regerror(r, &state.re, state.error, sizeof(state.error));
+ return state.error;
+}
+
+int
+re_exec(const char* subject)
+{
+ if (state.valid && subject)
+ switch (regexec(&state.re, subject, 0, NiL, 0))
+ {
+ case 0:
+ return 1;
+ case REG_NOMATCH:
+ return 0;
+ }
+ return -1;
+}
diff --git a/src/lib/libast/comp/re_comp.h b/src/lib/libast/comp/re_comp.h
new file mode 100644
index 0000000..616fb4c
--- /dev/null
+++ b/src/lib/libast/comp/re_comp.h
@@ -0,0 +1,41 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * re_comp interface definitions
+ *
+ * OBSOLETE: use <regex.h>
+ */
+
+#ifndef _RE_COMP_H
+#define _RE_COMP_H
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char* re_comp(const char*);
+extern int re_exec(const char*);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/readlink.c b/src/lib/libast/comp/readlink.c
new file mode 100644
index 0000000..df2129e
--- /dev/null
+++ b/src/lib/libast/comp/readlink.c
@@ -0,0 +1,61 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_readlink
+
+NoN(readlink)
+
+#else
+
+#include "fakelink.h"
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+readlink(const char* path, char* buf, int siz)
+{
+ int fd;
+ int n;
+
+ if (siz > sizeof(FAKELINK_MAGIC))
+ {
+ if ((fd = open(path, O_RDONLY)) < 0)
+ return -1;
+ if (read(fd, buf, sizeof(FAKELINK_MAGIC)) == sizeof(FAKELINK_MAGIC) && !strcmp(buf, FAKELINK_MAGIC) && (n = read(fd, buf, siz)) > 0 && !buf[n - 1])
+ {
+ close(fd);
+ return n;
+ }
+ close(fd);
+ }
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/realpath.c b/src/lib/libast/comp/realpath.c
new file mode 100644
index 0000000..54c8703
--- /dev/null
+++ b/src/lib/libast/comp/realpath.c
@@ -0,0 +1,48 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * realpath implementation
+ */
+
+#define realpath ______realpath
+#define resolvepath ______resolvepath
+
+#include <ast.h>
+
+#undef realpath
+#undef resolvepath
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+extern int resolvepath(const char*, char*, size_t);
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char*
+realpath(const char* file, char* path)
+{
+ return resolvepath(file, path, PATH_MAX) > 0 ? path : (char*)0;
+}
diff --git a/src/lib/libast/comp/regcmp.c b/src/lib/libast/comp/regcmp.c
new file mode 100644
index 0000000..ddf5498
--- /dev/null
+++ b/src/lib/libast/comp/regcmp.c
@@ -0,0 +1,224 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * regcmp implementation
+ */
+
+#include <ast.h>
+#include <libgen.h>
+#include <regex.h>
+#include <align.h>
+
+#define INC (2*1024)
+#define TOT (16*1024)
+#define SUB 10
+
+typedef struct
+{
+ char* cur;
+ regex_t re;
+ unsigned char sub[SUB];
+ int nsub;
+ size_t size;
+ char buf[ALIGN_BOUND2];
+} Regex_t;
+
+__DEFINE__(char*, __loc1, 0);
+
+static void*
+block(void* handle, void* data, size_t size)
+{
+ register Regex_t* re = (Regex_t*)handle;
+
+ if (data || (size = roundof(size, ALIGN_BOUND2)) > (re->buf + re->size - re->cur))
+ return 0;
+ data = (void*)re->cur;
+ re->cur += size;
+ return data;
+}
+
+char*
+regcmp(const char* pattern, ...)
+{
+ register char* s;
+ register Regex_t* re;
+ register size_t n;
+ register int c;
+ register int p;
+ int b;
+ int e;
+ int i;
+ int j;
+ int nsub;
+ register Sfio_t* sp;
+ unsigned char paren[128];
+ unsigned char sub[SUB];
+ va_list ap;
+
+ va_start(ap, pattern);
+ if (pattern || !*pattern || !(sp = sfstropen()))
+ e = 1;
+ else
+ {
+ e = 0;
+ memset(paren, 0, sizeof(paren));
+ n = 0;
+ p = -1;
+ b = 0;
+ nsub = 0;
+ s = (char*)pattern;
+ do
+ {
+ while (c = *s++)
+ {
+ if (c == '\\')
+ {
+ sfputc(sp, c);
+ if (!(c = *s++))
+ break;
+ }
+ else if (b)
+ {
+ if (c == ']')
+ b = 0;
+ }
+ else if (c == '[')
+ {
+ b = 1;
+ if (*s == '^')
+ {
+ sfputc(sp, c);
+ c = *s++;
+ }
+ if (*s == ']')
+ {
+ sfputc(sp, c);
+ c = *s++;
+ }
+ }
+ else if (c == '(')
+ {
+ /*
+ * someone explain in one sentence why
+ * a cast is needed to make this work
+ */
+
+ if (p < (int)(elementsof(paren) - 1))
+ p++;
+ paren[p] = ++n;
+ }
+ else if (c == ')' && p >= 0)
+ {
+ for (i = p; i > 0; i--)
+ if (paren[i])
+ break;
+ if (*s == '$' && (j = *(s + 1)) >= '0' && j <= '9')
+ {
+ s += 2;
+ j -= '0';
+ if (nsub <= j)
+ {
+ if (!nsub)
+ memset(sub, 0, sizeof(sub));
+ nsub = j + 1;
+ }
+ sub[j] = paren[i] + 1;
+ }
+ paren[i] = 0;
+ }
+ sfputc(sp, c);
+ }
+ } while (s = va_arg(ap, char*));
+ }
+ va_end(ap);
+ if (e)
+ return 0;
+ if (!(s = sfstruse(sp)))
+ {
+ sfstrclose(sp);
+ return 0;
+ }
+ re = 0;
+ n = 0;
+ do
+ {
+ if ((n += INC) > TOT || !(re = newof(re, Regex_t, 0, n)))
+ {
+ if (re)
+ free(re);
+ sfstrclose(sp);
+ return 0;
+ }
+ re->cur = re->buf;
+ re->size = n + ALIGN_BOUND2 - sizeof(Regex_t);
+ regalloc(re, block, REG_NOFREE);
+ c = regcomp(&re->re, s, REG_EXTENDED|REG_LENIENT|REG_NULL);
+ regalloc(NiL, NiL, 0);
+ } while (c == REG_ESPACE);
+ sfstrclose(sp);
+ if (c)
+ {
+ free(re);
+ return 0;
+ }
+ if (re->nsub = nsub)
+ memcpy(re->sub, sub, (nsub + 1) * sizeof(sub[0]));
+ return (char*)re;
+}
+
+char*
+regex(const char* handle, const char* subject, ...)
+{
+ register Regex_t* re;
+ register int n;
+ register int i;
+ register int k;
+ char* sub[SUB + 1];
+ regmatch_t match[SUB + 1];
+ va_list ap;
+
+ va_start(ap, subject);
+ if (!(re = (Regex_t*)handle) || !subject)
+ k = 1;
+ else
+ {
+ k = 0;
+ for (n = 0; n < re->nsub; n++)
+ sub[n] = va_arg(ap, char*);
+ }
+ va_end(ap);
+ if (k)
+ return 0;
+ if (regexec(&re->re, subject, SUB + 1, match, 0))
+ return 0;
+ for (n = 0; n < re->nsub; n++)
+ if (i = re->sub[n])
+ {
+ i--;
+ k = match[i].rm_eo - match[i].rm_so;
+ strlcpy(sub[n], subject + match[i].rm_so, k);
+ *(sub[n] + k) = 0;
+ }
+ __loc1 = (char*)subject + match[0].rm_so;
+ return (char*)subject + match[0].rm_eo;
+}
diff --git a/src/lib/libast/comp/regexp.c b/src/lib/libast/comp/regexp.c
new file mode 100644
index 0000000..d2e33a4
--- /dev/null
+++ b/src/lib/libast/comp/regexp.c
@@ -0,0 +1,123 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * <regexp.h> library support
+ */
+
+#define _REGEXP_DECLARE
+
+#include <ast.h>
+#include <regexp.h>
+#include <regex.h>
+#include <align.h>
+
+typedef struct
+{
+ regex_t re;
+ char* buf;
+ char* cur;
+ unsigned int size;
+} Env_t;
+
+static void*
+block(void* handle, void* data, size_t size)
+{
+ register Env_t* env = (Env_t*)handle;
+
+ if (data || (size = roundof(size, ALIGN_BOUND2)) > (env->buf + env->size - env->cur))
+ return 0;
+ data = (void*)env->cur;
+ env->cur += size;
+ return data;
+}
+
+int
+_re_comp(regexp_t* re, const char* pattern, char* handle, unsigned int size)
+{
+ register Env_t* env = (Env_t*)handle;
+ register int n;
+
+ if (size <= sizeof(Env_t))
+ return 50;
+ env->buf = env->cur = (char*)env + sizeof(Env_t);
+ env->size = size - sizeof(Env_t);
+ regalloc(env, block, REG_NOFREE);
+ n = regcomp(&env->re, pattern, REG_LENIENT|REG_NULL);
+ switch (n)
+ {
+ case 0:
+ break;
+ case REG_ERANGE:
+ n = 11;
+ break;
+ case REG_BADBR:
+ n = 16;
+ break;
+ case REG_ESUBREG:
+ n = 25;
+ break;
+ case REG_EPAREN:
+ n = 42;
+ break;
+ case REG_EBRACK:
+ n = 49;
+ break;
+ default:
+ n = 50;
+ break;
+ }
+ re->re_nbra = env->re.re_nsub;
+ return n;
+}
+
+int
+_re_exec(regexp_t* re, const char* subject, const char* handle, int anchor)
+{
+ register Env_t* env = (Env_t*)handle;
+ register int n;
+ regmatch_t match[elementsof(re->re_braslist)+1];
+
+ if (regexec(&env->re, subject, elementsof(match), match, 0) || anchor && match[0].rm_so)
+ return 0;
+ re->re_loc1 = (char*)subject + match[0].rm_so;
+ re->re_loc2 = (char*)subject + match[0].rm_eo;
+ for (n = 1; n <= env->re.re_nsub; n++)
+ {
+ re->re_braslist[n-1] = (char*)subject + match[n].rm_so;
+ re->re_braelist[n-1] = (char*)subject + match[n].rm_eo;
+ }
+ return 1;
+}
+
+char*
+_re_putc(int c)
+{
+ static Sfio_t* sp;
+
+ if (!sp && !(sp = sfstropen()))
+ return 0;
+ if (!c)
+ return sfstruse(sp);
+ sfputc(sp, c);
+ return 0;
+}
diff --git a/src/lib/libast/comp/regexp.h b/src/lib/libast/comp/regexp.h
new file mode 100644
index 0000000..93b7185
--- /dev/null
+++ b/src/lib/libast/comp/regexp.h
@@ -0,0 +1,129 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * regexp interface and partial implementation
+ * what a novel approach
+ * don't do it again
+ *
+ * OBSOLETE: use <regex.h>
+ */
+
+#ifndef _REGEXP_H
+#define _REGEXP_H
+
+#define NBRA 9
+
+typedef struct
+{
+ char* re_braslist[NBRA];
+ char* re_braelist[NBRA];
+ char* re_loc1;
+ char* re_loc2;
+ char* re_locs;
+ int re_circf;
+ int re_nbra;
+ int re_nodelim;
+ int re_sed;
+} regexp_t;
+
+#define braslist _re_info.re_braslist
+#define braelist _re_info.re_braelist
+#define circf _re_info.re_circf
+#define loc1 _re_info.re_loc1
+#define loc2 _re_info.re_loc2
+#define locs _re_info.re_locs
+#define nbra _re_info.re_nbra
+#define nodelim _re_info.re_nodelim
+#define sed _re_info.re_sed
+
+#define advance(a,b) _re_exec(&_re_info,a,b,1)
+#define compile(a,b,c,d) _re_read(&_re_info,a,b,c,d)
+#define step(a,b) _re_exec(&_re_info,a,b,0)
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int _re_comp(regexp_t*, const char*, char*, unsigned int);
+extern int _re_exec(regexp_t*, const char*, const char*, int);
+extern char* _re_putc(int);
+extern char* _re_read(regexp_t*, const char*, char*, const char*, int);
+
+#undef extern
+
+#ifndef _REGEXP_DECLARE
+
+regexp_t _re_info;
+
+char*
+_re_read(register regexp_t* re, const char* instring, char* ep, const char* endbuf, int seof)
+{
+ register int c;
+
+ static const char* prev;
+
+#ifdef INIT
+ INIT;
+#endif
+
+ re->re_nodelim = 0;
+ if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
+ {
+ if (c != seof)
+ {
+ UNGETC(c);
+ re->re_nodelim = 1;
+ }
+ if (!re->re_sed && !prev)
+ { ERROR(41); }
+ RETURN((char*)endbuf);
+ }
+ UNGETC(c);
+ prev = 0;
+ for (;;)
+ {
+ if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
+ {
+ if (re->re_sed)
+ { ERROR(36); }
+ UNGETC(c);
+ re->re_nodelim = 1;
+ break;
+ }
+ if (c == '\\')
+ {
+ _re_putc(c);
+ if ((c = GETC()) == seof || c == '\n' || c == -1 || c == 0)
+ { ERROR(36); }
+ }
+ _re_putc(c);
+ }
+ if (c = _re_comp(re, _re_putc(0), ep, (char*)endbuf - ep))
+ { ERROR(c); }
+ prev = endbuf;
+ RETURN((char*)prev);
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/remove.c b/src/lib/libast/comp/remove.c
new file mode 100644
index 0000000..32a8e32
--- /dev/null
+++ b/src/lib/libast/comp/remove.c
@@ -0,0 +1,49 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#define remove ______remove
+
+#include <ast.h>
+
+#undef remove
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if _std_remove || !_lib_unlink
+
+NoN(remove)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+remove(const char* path)
+{
+ return unlink(path);
+}
+
+#endif
diff --git a/src/lib/libast/comp/rename.c b/src/lib/libast/comp/rename.c
new file mode 100644
index 0000000..2ab3770
--- /dev/null
+++ b/src/lib/libast/comp/rename.c
@@ -0,0 +1,98 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_rename
+
+NoN(rename)
+
+#else
+
+#include <error.h>
+#include <proc.h>
+
+#ifdef EPERM
+
+static int
+mvdir(const char* from, const char* to)
+{
+ char* argv[4];
+ int oerrno;
+
+ static const char mvdir[] = "/usr/lib/mv_dir";
+
+ oerrno = errno;
+ if (!eaccess(mvdir, X_OK))
+ {
+ argv[0] = mvdir;
+ argv[1] = from;
+ argv[2] = to;
+ argv[3] = 0;
+ if (!procrun(argv[0], argv, 0))
+ {
+ errno = oerrno;
+ return 0;
+ }
+ }
+ errno = EPERM;
+ return -1;
+}
+
+#endif
+
+int
+rename(const char* from, const char* to)
+{
+ int oerrno;
+ int ooerrno;
+
+ ooerrno = errno;
+ while (link(from, to))
+ {
+#ifdef EPERM
+ if (errno == EPERM)
+ {
+ errno = ooerrno;
+ return mvdir(from, to);
+ }
+#endif
+ oerrno = errno;
+ if (unlink(to))
+ {
+#ifdef EPERM
+ if (errno == EPERM)
+ {
+ errno = ooerrno;
+ return mvdir(from, to);
+ }
+#endif
+ errno = oerrno;
+ return -1;
+ }
+ }
+ errno = ooerrno;
+ return unlink(from);
+}
+
+#endif
diff --git a/src/lib/libast/comp/resolvepath.c b/src/lib/libast/comp/resolvepath.c
new file mode 100644
index 0000000..a5cc4c9
--- /dev/null
+++ b/src/lib/libast/comp/resolvepath.c
@@ -0,0 +1,72 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * resolvepath implementation
+ */
+
+#define resolvepath ______resolvepath
+
+#include <ast.h>
+#include <error.h>
+
+#undef resolvepath
+
+#undef _def_map_ast
+#include <ast_map.h>
+#undef _AST_API_H
+#include <ast_api.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+resolvepath(const char* file, char* path, size_t size)
+{
+ register char* s;
+ register int n;
+ register int r;
+
+ r = *file != '/';
+ n = strlen(file) + r + 1;
+ if (n >= size)
+ {
+#ifdef ENAMETOOLONG
+ errno = ENAMETOOLONG;
+#else
+ errno = ENOMEM;
+#endif
+ return 0;
+ }
+ if (!r)
+ s = path;
+ else if (!getcwd(path, size - n))
+ return 0;
+ else
+ {
+ s = path + strlen(path);
+ *s++ = '/';
+ }
+ strlcpy(s, file, size - (s - path));
+ return (s = pathcanon(path, size, PATH_PHYSICAL|PATH_DOTDOT|PATH_EXISTS)) ? (s - path) : -1;
+}
diff --git a/src/lib/libast/comp/rmdir.c b/src/lib/libast/comp/rmdir.c
new file mode 100644
index 0000000..9b3270d
--- /dev/null
+++ b/src/lib/libast/comp/rmdir.c
@@ -0,0 +1,66 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_rmdir
+
+NoN(rmdir)
+
+#else
+
+#include <ls.h>
+#include <error.h>
+
+int
+rmdir(const char* path)
+{
+ register int n;
+ struct stat st;
+ char* av[3];
+
+ static char* cmd[] = { "/bin/rmdir", "/usr/5bin/rmdir", 0 };
+
+ if (stat(path, &st) < 0) return(-1);
+ if (!S_ISDIR(st.st_mode))
+ {
+ errno = ENOTDIR;
+ return(-1);
+ }
+ av[0] = "rmdir";
+ av[1] = path;
+ av[2] = 0;
+ for (n = 0; n < elementsof(cmd); n++)
+ if (procclose(procopen(cmd[n], av, NiL, NiL, 0)) != -1)
+ break;
+ n = errno;
+ if (access(path, F_OK) < 0)
+ {
+ errno = n;
+ return(0);
+ }
+ errno = EPERM;
+ return(-1);
+}
+
+#endif
diff --git a/src/lib/libast/comp/setenv.c b/src/lib/libast/comp/setenv.c
new file mode 100644
index 0000000..c2e3d65
--- /dev/null
+++ b/src/lib/libast/comp/setenv.c
@@ -0,0 +1,58 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#define setenv ______setenv
+
+#include <ast.h>
+
+#undef setenv
+#undef _lib_setenv /* procopen() calls setenv() */
+
+#if _lib_setenv
+
+NoN(setenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+setenv(const char* name, const char* value, int overwrite)
+{
+ char* s;
+
+ if (overwrite || !getenv(name))
+ {
+ if (!(s = sfprints("%s=%s", name, value)) || !(s = strdup(s)))
+ return -1;
+ return setenviron(s) ? 0 : -1;
+ }
+ return 0;
+}
+
+#endif
diff --git a/src/lib/libast/comp/setlocale.c b/src/lib/libast/comp/setlocale.c
new file mode 100644
index 0000000..b2bc760
--- /dev/null
+++ b/src/lib/libast/comp/setlocale.c
@@ -0,0 +1,2865 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * setlocale() intercept
+ * maintains a bitmask of non-default categories
+ * and a permanent locale namespace for pointer comparison
+ * and persistent private data for locale related functions
+ */
+
+#include <ast_standards.h>
+
+#include "lclib.h"
+
+#include <ast_wchar.h>
+#include <ctype.h>
+#include <mc.h>
+#include <namval.h>
+
+#if ( _lib_wcwidth || _lib_wctomb ) && _hdr_wctype
+#include <wctype.h>
+#endif
+
+#if _lib_wcwidth
+#undef wcwidth
+#else
+#define wcwidth 0
+#endif
+
+#if _lib_wctomb
+#undef wctomb
+#else
+#define wctomb 0
+#endif
+
+#ifdef mblen
+#undef mblen
+extern int mblen(const char*, size_t);
+#endif
+
+#undef mbtowc
+#undef setlocale
+#undef strcmp
+#undef strcoll
+#undef strxfrm
+#undef valid
+
+#ifndef AST_LC_CANONICAL
+#define AST_LC_CANONICAL LC_abbreviated
+#endif
+
+static void
+header(void)
+{
+ static int done = 0;
+
+ if (!done)
+ {
+ done = 1;
+ sfprintf(sfstderr, "locale %17s %16s %16s %16s %s\n", "CATEGORY", "AST", "SYSTEM", "PREVIOUS", "ATTRIBUTES");
+ }
+}
+
+#if _UWIN
+
+#include <ast_windows.h>
+
+#undef _lib_setlocale
+#define _lib_setlocale 1
+
+#define setlocale(c,l) native_setlocale(c,l)
+
+extern char* uwin_setlocale(int, const char*);
+
+/*
+ * convert locale to native locale name in buf
+ */
+
+static char*
+native_locale(const char* locale, char* buf, size_t siz)
+{
+ Lc_t* lc;
+ const Lc_attribute_list_t* ap;
+ int i;
+ unsigned long lcid;
+ unsigned long lang;
+ unsigned long ctry;
+ char lbuf[128];
+ char cbuf[128];
+
+ if (locale && *locale)
+ {
+ if (!(lc = lcmake(locale)))
+ return 0;
+ lang = lc->language->index;
+ ctry = 0;
+ for (ap = lc->attributes; ap; ap = ap->next)
+ if (ctry = ap->attribute->index)
+ break;
+ if (!ctry)
+ {
+ for (i = 0; i < elementsof(lc->territory->languages); i++)
+ if (lc->territory->languages[i] == lc->language)
+ {
+ ctry = lc->territory->indices[i];
+ break;
+ }
+ if (!ctry)
+ {
+ if (!lang)
+ return 0;
+ ctry = SUBLANG_DEFAULT;
+ }
+ }
+ lcid = MAKELCID(MAKELANGID(lang, ctry), SORT_DEFAULT);
+ }
+ else
+ lcid = GetUserDefaultLCID();
+ if (GetLocaleInfo(lcid, LOCALE_SENGLANGUAGE, lbuf, sizeof(lbuf)) <= 0 ||
+ GetLocaleInfo(lcid, LOCALE_SENGCOUNTRY, cbuf, sizeof(cbuf)) <= 0)
+ return 0;
+ if (lc->charset->ms)
+ sfsprintf(buf, siz, "%s_%s.%s", lbuf, cbuf, lc->charset->ms);
+ else
+ sfsprintf(buf, siz, "%s_%s", lbuf, cbuf);
+ return buf;
+}
+
+/*
+ * locale!=0 here
+ */
+
+static char*
+native_setlocale(int category, const char* locale)
+{
+ char* usr;
+ char* sys;
+ char buf[256];
+
+ if (!(usr = native_locale(locale, buf, sizeof(buf))))
+ return 0;
+
+ /*
+ * win32 doesn't have LC_MESSAGES
+ */
+
+ if (category == LC_MESSAGES)
+ return (char*)locale;
+ sys = uwin_setlocale(category, usr);
+ if (ast.locale.set & AST_LC_debug)
+ sfprintf(sfstderr, "locale uwin %17s %-24s %-24s\n", lc_categories[lcindex(category, 0)].name, usr, sys);
+ return sys;
+}
+
+#else
+
+#define native_locale(a,b,c) ((char*)0)
+
+#endif
+
+/*
+ * LC_COLLATE and LC_CTYPE native support
+ */
+
+#if !_lib_mbtowc || MB_LEN_MAX <= 1
+#define mblen 0
+#define mbtowc 0
+#endif
+
+#if !_lib_strcoll
+#define strcoll 0
+#endif
+
+#if !_lib_strxfrm
+#define strxfrm 0
+#endif
+
+/*
+ * LC_COLLATE and LC_CTYPE debug support
+ *
+ * mutibyte debug encoding
+ *
+ * DL0 [ '0' .. '4' ] c1 ... c4 DR0
+ * DL1 [ '0' .. '4' ] c1 ... c4 DR1
+ *
+ * with these ligatures
+ *
+ * ch CH sst SST
+ *
+ * and private collation order
+ *
+ * wide character display width is the low order 3 bits
+ * wctomb() uses DL1...DR1
+ */
+
+#define DEBUG_MB_CUR_MAX 7
+
+#if DEBUG_MB_CUR_MAX < MB_LEN_MAX
+#undef DEBUG_MB_CUR_MAX
+#define DEBUG_MB_CUR_MAX MB_LEN_MAX
+#endif
+
+#define DL0 '<'
+#define DL1 0xab /* 8-bit mini << on xterm */
+#define DR0 '>'
+#define DR1 0xbb /* 8-bit mini >> on xterm */
+
+#define DB ((int)sizeof(wchar_t)*8-1)
+#define DC 7 /* wchar_t embedded char bits */
+#define DX (DB/DC) /* wchar_t max embedded chars */
+#define DZ (DB-DX*DC+1) /* wchar_t embedded size bits */
+#define DD 3 /* # mb delimiter chars <n...> */
+
+static unsigned char debug_order[] =
+{
+ 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,
+ 99, 100, 101, 102, 98, 103, 104, 105,
+ 106, 107, 108, 43, 109, 44, 42, 110,
+ 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 111, 112, 113, 114, 115, 116,
+ 117, 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, 118, 119, 120, 121, 97,
+ 122, 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, 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
+debug_mbtowc(register wchar_t* p, register const char* s, size_t n)
+{
+ register const char* q;
+ register const char* r;
+ register int w;
+ register int dr;
+ wchar_t c;
+
+ if (n < 1)
+ return -1;
+ if (!s || !*s)
+ return 0;
+ switch (((unsigned char*)s)[0])
+ {
+ case DL0:
+ dr = DR0;
+ break;
+ case DL1:
+ dr = DR1;
+ break;
+ default:
+ single:
+ if (p)
+ *p = ((unsigned char*)s)[0] & ((1<<DC)-1);
+ return 1;
+ }
+ if (n < 2)
+ return -1;
+ if ((w = ((unsigned char*)s)[1]) < '0' || w > ('0' + DX))
+ goto single;
+ if ((w -= '0' - DD) > n)
+ return -1;
+ r = s + w - 1;
+ q = s += 2;
+ while (q < r && *q)
+ q++;
+ if (q != r || *((unsigned char*)q) != dr)
+ return -1;
+ if (p)
+ {
+ c = 1;
+ while (--q >= s)
+ {
+ c <<= DC;
+ c |= *((unsigned char*)q);
+ }
+ c <<= DZ;
+ c |= (w - DD);
+ *p = c;
+ }
+ return w;
+}
+
+static int
+debug_wctomb(char* s, wchar_t c)
+{
+ int w;
+ int i;
+ int k;
+
+ w = 0;
+ if (c >= 0 && c <= UCHAR_MAX)
+ {
+ w++;
+ if (s)
+ *s = c;
+ }
+ else if ((i = c & ((1<<DZ)-1)) > DX)
+ return -1;
+ else
+ {
+ w++;
+ if (s)
+ *s++ = DL0;
+ c >>= DZ;
+ w++;
+ if (s)
+ *s++ = i + '0';
+ while (i--)
+ {
+ w++;
+ if (s)
+ *s++ = (k = c & ((1<<DC)-1)) ? k : '?';
+ c >>= DC;
+ }
+ w++;
+ if (s)
+ *s++ = DR0;
+ }
+ return w;
+}
+
+static int
+debug_mblen(const char* s, size_t n)
+{
+ return debug_mbtowc(NiL, s, n);
+}
+
+static int
+debug_wcwidth(wchar_t c)
+{
+ if (c >= 0 && c <= UCHAR_MAX)
+ return 1;
+ if ((c &= ((1<<DZ)-1)) > DX)
+ return -1;
+ return c + DD;
+}
+
+static int
+debug_alpha(wchar_t c)
+{
+ return isalpha((c >> DZ) & ((1<<DC)-1));
+}
+
+static size_t
+debug_strxfrm(register char* t, register const char* s, size_t n)
+{
+ register const char* q;
+ register const char* r;
+ register char* e;
+ char* o;
+ register size_t z;
+ register int w;
+
+ o = t;
+ z = 0;
+ if (e = t)
+ e += n;
+ while (s[0])
+ {
+ if ((((unsigned char*)s)[0] == DL0 || ((unsigned char*)s)[0] == DL1) && (w = s[1]) >= '0' && w <= ('0' + DC))
+ {
+ w -= '0';
+ q = s + 2;
+ r = q + w;
+ while (q < r && *q)
+ q++;
+ if (*((unsigned char*)q) == DR0 || *((unsigned char*)q) == DR1)
+ {
+ if (t)
+ {
+ for (q = s + 2; q < r; q++)
+ if (t < e)
+ *t++ = debug_order[*q];
+ while (w++ < DX)
+ if (t < e)
+ *t++ = 1;
+ }
+ s = r + 1;
+ z += DX;
+ continue;
+ }
+ }
+ if ((s[0] == 'c' || s[0] == 'C') && (s[1] == 'h' || s[1] == 'H'))
+ {
+ if (t)
+ {
+ if (t < e)
+ *t++ = debug_order[s[0]];
+ if (t < e)
+ *t++ = debug_order[s[1]];
+ if (t < e)
+ *t++ = 1;
+ if (t < e)
+ *t++ = 1;
+ }
+ s += 2;
+ z += DX;
+ continue;
+ }
+ if ((s[0] == 's' || s[0] == 'S') && (s[1] == 's' || s[1] == 'S') && (s[2] == 't' || s[2] == 'T'))
+ {
+ if (t)
+ {
+ if (t < e)
+ *t++ = debug_order[s[0]];
+ if (t < e)
+ *t++ = debug_order[s[1]];
+ if (t < e)
+ *t++ = debug_order[s[2]];
+ if (t < e)
+ *t++ = 1;
+ }
+ s += 3;
+ z += DX;
+ continue;
+ }
+ if (t)
+ {
+ if (t < e)
+ *t++ = debug_order[s[0]];
+ if (t < e)
+ *t++ = 1;
+ if (t < e)
+ *t++ = 1;
+ if (t < e)
+ *t++ = 1;
+ }
+ s++;
+ z += DX;
+ }
+ if (!t)
+ return z;
+ if (t < e)
+ *t = 0;
+ return t - o;
+}
+
+static int
+debug_strcoll(const char* a, const char* b)
+{
+ char ab[1024];
+ char bb[1024];
+
+ debug_strxfrm(ab, a, sizeof(ab) - 1);
+ ab[sizeof(ab)-1] = 0;
+ debug_strxfrm(bb, b, sizeof(bb) - 1);
+ bb[sizeof(bb)-1] = 0;
+ return strcmp(ab, bb);
+}
+
+/*
+ * default locale
+ */
+
+static int
+default_wcwidth(wchar_t w)
+{
+ return w >= 0 && w <= 255 && !iscntrl(w) ? 1 : -1;
+}
+
+/*
+ * called when LC_COLLATE initialized or changes
+ */
+
+static int
+set_collate(Lc_category_t* cp)
+{
+ if (locales[cp->internal]->flags & LC_debug)
+ {
+ ast.collate = debug_strcoll;
+ ast.mb_xfrm = debug_strxfrm;
+ }
+ else if (locales[cp->internal]->flags & LC_default)
+ {
+ ast.collate = strcmp;
+ ast.mb_xfrm = 0;
+ }
+ else
+ {
+ ast.collate = strcoll;
+ ast.mb_xfrm = strxfrm;
+ }
+ return 0;
+}
+
+/*
+ * workaround the interesting sjis that translates unshifted 7 bit ascii!
+ */
+
+#if _hdr_wchar && _typ_mbstate_t && _lib_mbrtowc
+
+#define mb_state_zero ((mbstate_t*)&ast.pad[sizeof(ast.pad)-2*sizeof(mbstate_t)])
+#define mb_state ((mbstate_t*)&ast.pad[sizeof(ast.pad)-sizeof(mbstate_t)])
+
+static int
+sjis_mbtowc(register wchar_t* p, register const char* s, size_t n)
+{
+ if (n && p && s && (*s == '\\' || *s == '~') && !memcmp(mb_state, mb_state_zero, sizeof(mbstate_t)))
+ {
+ *p = *s;
+ return 1;
+ }
+ return mbrtowc(p, s, n, mb_state);
+}
+
+#endif
+
+#if 0
+
+#define utf8_wctomb wctomb
+
+#else
+
+static int
+utf8_wctomb(char* u, wchar_t w)
+{
+ if (!u)
+ return 0;
+ if (w >= (1<<11))
+ {
+ *u++ = 0xe0|(w>>12);
+ *u++ = 0x80|((w>>6)&0x3f);
+ *u++ = 0x80|(w&0x3f);
+ return 3;
+ }
+ if (w >= (1<<7))
+ {
+ *u++ = 0xc0|(w>>6);
+ *u++ = 0x80|(w&0x3f);
+ return 2;
+ }
+ *u++ = w;
+ return 1;
+}
+
+#endif
+
+static const uint32_t utf8mask[] =
+{
+ 0x00000000,
+ 0x00000000,
+ 0xffffff80,
+ 0xfffff800,
+ 0xffff0000,
+ 0xffe00000,
+ 0xfc000000,
+};
+
+static const signed char utf8tab[256] =
+{
+ 0, 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, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6,-1,-1,
+};
+
+static int
+utf8_mbtowc(wchar_t* wp, const char* str, size_t n)
+{
+ register unsigned char* sp = (unsigned char*)str;
+ register int m;
+ register int i;
+ register int c;
+ register wchar_t w = 0;
+
+ if (!sp || !n)
+ return 0;
+ if ((m = utf8tab[*sp]) > 0)
+ {
+ if (m > n)
+ return -1;
+ if (wp)
+ {
+ if (m == 1)
+ {
+ *wp = *sp;
+ return 1;
+ }
+ w = *sp & ((1<<(8-m))-1);
+ for (i = m - 1; i > 0; i--)
+ {
+ c = *++sp;
+ if ((c&0xc0) != 0x80)
+ goto invalid;
+ w = (w<<6) | (c&0x3f);
+ }
+ if (!(utf8mask[m] & w) || w >= 0xd800 && (w <= 0xdfff || w >= 0xfffe && w <= 0xffff))
+ goto invalid;
+ *wp = w;
+ }
+ return m;
+ }
+ if (!*sp)
+ return 0;
+ invalid:
+#ifdef EILSEQ
+ errno = EILSEQ;
+#endif
+ ast.mb_sync = (const char*)sp - str;
+ return -1;
+}
+
+static int
+utf8_mblen(const char* str, size_t n)
+{
+ wchar_t w;
+
+ return utf8_mbtowc(&w, str, n);
+}
+
+static const unsigned char utf8_wcw[] =
+{
+ 0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x55,0x55,0x55,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0xff,0xff,0xff,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xff,0xf5,0xdf,0xdf,
+ 0xff,0x55,0xd5,0x5d,0x55,0x55,0x55,0x55,0x75,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0xd5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x15,0xc0,0x50,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0xd5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0xf5,0xff,
+ 0x55,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0xd5,0x57,0x55,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0xd7,0xff,0x03,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x30,0x10,
+ 0x41,0xfc,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0x55,0xfd,0xff,0xff,
+ 0xff,0xff,0xff,0xfd,0xff,0xff,0x7f,0x7f,0x57,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,
+ 0x55,0x55,0x15,0x00,0x00,0xf0,0xff,0xff,0x55,0x55,0x55,0x55,0x54,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x05,0x00,0x00,0x00,0x14,0x04,0xf0,0x55,0x55,0x55,0xd5,
+ 0x55,0x55,0x55,0x35,0x51,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0xc0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x05,0x00,0x00,0xf4,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x43,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0x54,
+ 0x01,0x00,0x54,0xf1,0x01,0xfc,0x55,0x55,0x05,0x55,0x55,0x55,0xfd,0xff,0xff,0xff,
+ 0x53,0x57,0x55,0x7d,0x7d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0xdd,0x5f,0xf5,0x5c,
+ 0x01,0x7c,0x7d,0xf1,0xff,0x7f,0xff,0x75,0x05,0x5f,0x55,0x55,0x55,0x55,0xd5,0xff,
+ 0xcf,0x57,0xd5,0x7f,0x7d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x5d,0xd7,0xf5,0x5c,
+ 0xc1,0x3f,0x3c,0xf0,0xff,0xff,0x57,0xdd,0xff,0x5f,0x55,0x55,0x50,0xfd,0xff,0xff,
+ 0x43,0x57,0x55,0x77,0x75,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x5d,0x57,0xf5,0x54,
+ 0x01,0x30,0x74,0xf1,0xfd,0xff,0xff,0xff,0xfd,0x5f,0x55,0x55,0xff,0xff,0xff,0xff,
+ 0x53,0x57,0x55,0x7d,0x7d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x5d,0x5f,0xf5,0x14,
+ 0x01,0x7f,0x7d,0xf1,0xff,0x4f,0xff,0x75,0xf5,0x5f,0x55,0x55,0xfd,0xff,0xff,0xff,
+ 0x4f,0x57,0xd5,0x5f,0x5d,0xf5,0xd7,0x5d,0x7f,0xfd,0xd5,0x5f,0x55,0x75,0xf5,0x5f,
+ 0xd4,0x5f,0x5d,0xf1,0xff,0x7f,0xff,0xff,0xff,0x7f,0x55,0x55,0xd5,0xff,0xff,0xff,
+ 0x57,0x57,0x55,0x5d,0x5d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x55,0x57,0xf5,0x0f,
+ 0x54,0x0d,0x0c,0xf0,0xff,0xc3,0xff,0xff,0xf5,0x5f,0x55,0x55,0xff,0xff,0xff,0xff,
+ 0x5f,0x57,0x55,0x5d,0x5d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x55,0x57,0xf5,0x1f,
+ 0x55,0x4d,0x5d,0xf0,0xff,0xd7,0xff,0xdf,0xf5,0x5f,0x55,0x55,0xff,0xff,0xff,0xff,
+ 0x5f,0x57,0x55,0x5d,0x5d,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x55,0x55,0xf5,0x5f,
+ 0x01,0x5f,0x5d,0xf1,0xff,0x7f,0xff,0xff,0xf5,0x5f,0x55,0x55,0xff,0xff,0xff,0xff,
+ 0x5f,0x57,0x55,0x55,0x55,0xd5,0x5f,0x55,0x55,0x55,0x55,0x55,0x75,0x55,0x55,0xf7,
+ 0x55,0xd5,0xcf,0x7f,0x05,0xcc,0x55,0x55,0xff,0xff,0xff,0xff,0x5f,0xfd,0xff,0xff,
+ 0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x51,0x00,0xc0,0x7f,
+ 0x55,0x15,0x00,0x40,0x55,0x55,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xd7,0x7d,0xdd,0xf7,0xff,0x55,0x57,0x55,0x57,0x77,0x5f,0x57,0x51,0x00,0x30,0xf4,
+ 0x55,0xdd,0x00,0xf0,0x55,0x55,0xf5,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x50,0x55,0x55,0x55,0x55,0x55,0x55,0x11,0x51,0x55,
+ 0x55,0x55,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0x03,0x00,0x00,0x40,
+ 0x00,0x04,0x55,0xff,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5c,
+ 0x55,0x45,0x55,0x7d,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x75,0x55,0xd7,0x01,0xc4,0x0f,0xf1,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xf5,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x7d,0xff,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xfa,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xff,
+ 0x55,0xd5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xd5,0x5d,0xf5,0x55,0xd5,0x5d,0xf5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xd5,0x5d,0xf5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0x5d,0xf5,0x55,0xd5,
+ 0x5d,0xf5,0x55,0xd5,0x55,0xd5,0x55,0x55,0x55,0x55,0x55,0xd5,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0xd5,0x5d,0xf5,0x55,0xd5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xd5,0x55,0x55,0x55,0x55,0xd5,0xff,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0xff,0xff,
+ 0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfd,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x5d,0x05,0xfc,0xff,0xff,0x55,0x55,0x55,0x55,0x05,0xd4,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x05,0xff,0xff,0xff,0x55,0x55,0x55,0x5d,0x0d,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x15,0x00,0x50,
+ 0x55,0x45,0x01,0x00,0x00,0x55,0x55,0xfd,0x55,0x55,0xf5,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x15,0xc0,0x55,0x55,0xf5,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf1,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0xf5,0x55,0xf5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xf5,0x55,0xf5,0x55,0x55,0x77,0x77,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x5d,0x55,0x55,
+ 0x55,0x5d,0x55,0x55,0x55,0x5f,0x55,0x57,0x55,0x55,0x55,0x55,0x5f,0x5d,0x55,0xd5,
+ 0x55,0x55,0x15,0x00,0x55,0x55,0x55,0x55,0x55,0x55,0x0f,0x40,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0xd5,0x7f,0xff,0x7f,0x00,0xff,0x0f,0x00,0xf5,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0xd5,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0xf5,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0x57,
+ 0x55,0x55,0x55,0xff,0x7f,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x69,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0xd5,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x5f,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,
+ 0x55,0x55,0xf5,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x57,0x5d,0xf5,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x57,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x77,0xd5,0xdf,0x55,0xd5,0x57,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0xfd,0x55,0x55,0x55,0x55,0x55,0x55,0x57,0x55,0x55,0xd5,
+ 0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xff,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,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0xaa,0xaa,0xfe,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,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aa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x00,0x00,0x00,0x00,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xfa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xea,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x55,0xd5,0xff,0xff,0x7f,0x55,0xff,0x47,0x55,0x55,0x55,0x55,0x55,0xd5,0x55,0xdd,
+ 0x75,0x5d,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf5,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x7f,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0xff,0xff,0xff,0xff,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x5f,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x55,0x55,0x55,0xfd,
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xea,0xab,0xaa,0xea,0xaa,0xaa,0xaa,0xaa,0xea,0xaa,0xff,0x55,0x5d,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x3d,
+ 0xab,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,
+ 0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x56,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
+ 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xd5,
+ 0x5f,0x55,0x5f,0x55,0x5f,0x55,0x5f,0xfd,0xaa,0xea,0x55,0xd5,0xff,0xff,0x03,0xf5
+};
+
+static int
+utf8_wcwidth(wchar_t c)
+{
+ int n;
+
+ return (n = (utf8_wcw[(c >> 2) & 0x3fff] >> ((c & 0x3) << 1)) & 0x3) == 3 ? -1 : n;
+}
+
+static const unsigned char utf8_wam[] =
+{
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,0xfe,0xff,0xff,0x07,
+ 0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x04,0xff,0xff,0x7f,0xff,0xff,0xff,0x7f,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xfd,0xff,0x0f,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x3f,0xff,0xf9,0x03,0x00,0x03,0x00,0x1f,0x40,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x04,
+ 0x40,0xd7,0xff,0xff,0xfb,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x3f,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0x03,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0xff,0xff,0x3f,0x03,
+ 0xff,0xff,0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0x7f,0x02,0xfe,0xff,0xff,0xff,
+ 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x07,0x07,0x00,
+ 0x00,0x00,0x00,0x00,0xfe,0xff,0xff,0x07,0xff,0x07,0x00,0x00,0xff,0xc3,0xfe,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2f,0x00,0x60,0x00,0xff,0x1f,
+ 0x00,0x00,0xfd,0xff,0xff,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0x3f,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xe0,0xff,0xff,0xff,0xff,0xff,0xff,0x23,0x00,0x00,0x01,0xff,0xc3,0xff,0x00,0x00,
+ 0xe0,0x9f,0xf9,0xff,0xff,0xfd,0xc5,0x03,0x00,0x00,0x00,0xb0,0xc3,0xff,0x03,0x00,
+ 0xe0,0x87,0xf9,0xff,0xff,0xfd,0x6d,0x03,0x00,0x00,0x00,0x5e,0xc0,0xff,0x1c,0x00,
+ 0xe0,0xaf,0xfb,0xff,0xff,0xfd,0xed,0x23,0x00,0x00,0x01,0x00,0xc1,0xff,0x00,0x00,
+ 0xe0,0x9f,0xf9,0xff,0xff,0xfd,0xcd,0x23,0x00,0x00,0x00,0xb0,0xc3,0xff,0x00,0x00,
+ 0xe8,0xc7,0x3d,0xd6,0x18,0xc7,0xbf,0x03,0x00,0x00,0x00,0x00,0x80,0xff,0x00,0x00,
+ 0xe0,0xdf,0xfd,0xff,0xff,0xfd,0xef,0x03,0x00,0x00,0x00,0x00,0xc3,0xff,0x00,0x00,
+ 0xe0,0xdf,0xfd,0xff,0xff,0xfd,0xef,0x03,0x00,0x00,0x00,0x40,0xc3,0xff,0x00,0x00,
+ 0xe0,0xdf,0xfd,0xff,0xff,0xfd,0xff,0x03,0x00,0x00,0x00,0x00,0xc3,0xff,0x00,0x00,
+ 0xe0,0xff,0x7f,0xfc,0xff,0xff,0xfb,0x2f,0x7f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xfe,0xff,0xff,0xff,0xff,0x7f,0xff,0x07,0xbf,0x7f,0xff,0x03,0x00,0x00,0x00,0x00,
+ 0x96,0x25,0xf0,0xfe,0xae,0xec,0x0d,0x20,0x5f,0x00,0xff,0x33,0x00,0x00,0x00,0x00,
+ 0x01,0x00,0x00,0x00,0xff,0x03,0x00,0x00,0xff,0xfe,0xff,0xff,0xff,0x07,0x00,0x00,
+ 0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xfb,0x06,0x00,0x00,0xff,0x03,0x3f,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x3f,0x00,0xff,0xff,0xff,0xff,0xff,0x01,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x83,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
+ 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0x3d,0x7f,0x3d,0xff,0xff,0xff,0xff,
+ 0x7f,0x3d,0xff,0xff,0xff,0x7f,0x3d,0x7f,0x3d,0x7f,0x7f,0xff,0xff,0x7f,0xff,0xff,
+ 0xff,0x7f,0x3d,0x7f,0xff,0xff,0xff,0xff,0x7f,0xff,0xff,0x07,0x00,0xfe,0x03,0x00,
+ 0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,0x00,
+ 0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9f,0x7f,0x00,
+ 0xfe,0xff,0xff,0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xc7,0x01,0x00,
+ 0xff,0xdf,0x03,0x00,0xff,0xff,0x03,0x00,0xff,0xff,0x03,0x00,0xff,0xdf,0x01,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x80,0x10,0xff,0x03,0x00,0x00,
+ 0x00,0x00,0xff,0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0x0f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,
+ 0xff,0xff,0x3f,0x3f,0xff,0xff,0xff,0xff,0x3f,0x3f,0xff,0xaa,0xff,0xff,0xff,0x3f,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xdf,0x5f,0xdc,0x1f,0xcf,0x0f,0xff,0x1f,0xdc,0x1f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x80,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x84,0xfc,0x2f,0x3e,0x50,0xbf,0xfb,0xe3,0xe0,0x03,0x00,0x00,0xff,0xff,0xff,0xff,
+ 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xe0,0x00,0x00,0x00,0xfe,0x03,0x3e,0x1f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0x7f,0xe0,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf7,
+ 0xe0,0xff,0xff,0xff,0xff,0x1f,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x7f,0x00,0x00,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0x3f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x07,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x7f,0x00,0xf8,0xa0,0xff,0xfd,0x7f,0x5f,0xdb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0x03,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,
+ 0xff,0xff,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0xff,0x0f,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xdf,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x1f,
+ 0x00,0x00,0xff,0x03,0xfe,0xff,0xff,0x07,0xfe,0xff,0xff,0x07,0xc0,0xff,0xff,0xff,
+ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xfc,0xfc,0xfc,0x1c,0x00,0x00,0x00,0x00
+};
+
+static int
+utf8_alpha(wchar_t c)
+{
+ return !!(utf8_wam[(c >> 3) & 0x1fff] & (1 << (c & 0x7)));
+}
+
+#if !_hdr_wchar || !_lib_wctype || !_lib_iswctype
+#undef iswalpha
+#define iswalpha default_iswalpha
+static int
+iswalpha(wchar_t c)
+{
+ return c <= 0x7f ? isalpha(c) : 0;
+}
+#endif
+
+typedef int (*Isw_f)(wchar_t);
+
+/*
+ * called when LC_CTYPE initialized or changes
+ */
+
+static int
+set_ctype(Lc_category_t* cp)
+{
+ ast.mb_sync = 0;
+ ast.mb_alpha = (Isw_f)iswalpha;
+#if AHA
+ if ((ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) && !(ast.locale.set & AST_LC_internal))
+ sfprintf(sfstderr, "locale setf %17s %16s\n", cp->name, locales[cp->internal]->name);
+#endif
+ if (locales[cp->internal]->flags & LC_debug)
+ {
+ ast.mb_cur_max = DEBUG_MB_CUR_MAX;
+ ast.mb_len = debug_mblen;
+ ast.mb_towc = debug_mbtowc;
+ ast.mb_width = debug_wcwidth;
+ ast.mb_conv = debug_wctomb;
+ ast.mb_alpha = debug_alpha;
+ }
+ else if ((locales[cp->internal]->flags & LC_utf8) && !(ast.locale.set & AST_LC_test))
+ {
+ ast.mb_cur_max = 6;
+ ast.mb_len = utf8_mblen;
+ ast.mb_towc = utf8_mbtowc;
+ if ((locales[cp->internal]->flags & LC_local) || !(ast.mb_width = wcwidth))
+ ast.mb_width = utf8_wcwidth;
+ ast.mb_conv = utf8_wctomb;
+ ast.mb_alpha = utf8_alpha;
+ }
+ else if ((locales[cp->internal]->flags & LC_default) || (ast.mb_cur_max = MB_CUR_MAX) <= 1 || !(ast.mb_len = mblen) || !(ast.mb_towc = mbtowc))
+ {
+ ast.mb_cur_max = 1;
+ ast.mb_len = 0;
+ ast.mb_towc = 0;
+ ast.mb_width = default_wcwidth;
+ ast.mb_conv = 0;
+ }
+ else
+ {
+ if (!(ast.mb_width = wcwidth))
+ ast.mb_width = default_wcwidth;
+ ast.mb_conv = wctomb;
+#ifdef mb_state
+ {
+ /*
+ * check for sjis that translates unshifted 7 bit ascii!
+ */
+
+ char* s;
+ char buf[2];
+
+ mbinit();
+ buf[1] = 0;
+ *(s = buf) = '\\';
+ if (mbchar(s) != buf[0])
+ {
+ memcpy(mb_state, mb_state_zero, sizeof(mbstate_t));
+ ast.mb_towc = sjis_mbtowc;
+ }
+ }
+#endif
+ }
+ return 0;
+}
+
+/*
+ * called when LC_NUMERIC initialized or changes
+ */
+
+static int
+set_numeric(Lc_category_t* cp)
+{
+ register int category = cp->internal;
+ struct lconv* lp;
+ Lc_numeric_t* dp;
+
+ static Lc_numeric_t default_numeric = { '.', -1 };
+ static Lc_numeric_t eu_numeric = { ',', '.' };
+ static Lc_numeric_t us_numeric = { '.', ',' };
+
+#if AHA
+ if ((ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) && !(ast.locale.set & AST_LC_internal))
+ sfprintf(sfstderr, "locale setf %17s %16s\n", cp->name, locales[cp->internal]->name);
+#endif
+ if (!LCINFO(category)->data)
+ {
+ if (locales[cp->internal]->flags & LC_local)
+ dp = locales[cp->internal]->territory == &lc_territories[0] ? &default_numeric : *locales[cp->internal]->territory->code == 'e' ? &eu_numeric : &us_numeric;
+ else if ((lp = localeconv()) && (dp = newof(0, Lc_numeric_t, 1, 0)))
+ {
+ dp->decimal = lp->decimal_point && *lp->decimal_point ? *(unsigned char*)lp->decimal_point : '.';
+ dp->thousand = lp->thousands_sep && *lp->thousands_sep ? *(unsigned char*)lp->thousands_sep : -1;
+ }
+ else
+ dp = &default_numeric;
+ LCINFO(category)->data = (void*)dp;
+ }
+ return 0;
+}
+
+/*
+ * this table is indexed by AST_LC_[A-Z]*
+ */
+
+Lc_category_t lc_categories[] =
+{
+{ "LC_ALL", LC_ALL, AST_LC_ALL, 0 },
+{ "LC_COLLATE", LC_COLLATE, AST_LC_COLLATE, set_collate },
+{ "LC_CTYPE", LC_CTYPE, AST_LC_CTYPE, set_ctype },
+{ "LC_MESSAGES", LC_MESSAGES, AST_LC_MESSAGES, 0 },
+{ "LC_MONETARY", LC_MONETARY, AST_LC_MONETARY, 0 },
+{ "LC_NUMERIC", LC_NUMERIC, AST_LC_NUMERIC, set_numeric },
+{ "LC_TIME", LC_TIME, AST_LC_TIME, 0 },
+{ "LC_IDENTIFICATION",LC_IDENTIFICATION,AST_LC_IDENTIFICATION,0 },
+{ "LC_ADDRESS", LC_ADDRESS, AST_LC_ADDRESS, 0 },
+{ "LC_NAME", LC_NAME, AST_LC_NAME, 0 },
+{ "LC_TELEPHONE", LC_TELEPHONE, AST_LC_TELEPHONE, 0 },
+{ "LC_XLITERATE", LC_XLITERATE, AST_LC_XLITERATE, 0 },
+{ "LC_MEASUREMENT", LC_MEASUREMENT, AST_LC_MEASUREMENT, 0 },
+{ "LC_PAPER", LC_PAPER, AST_LC_PAPER, 0 },
+};
+
+static Lc_t* lang;
+static Lc_t* lc_all;
+
+typedef struct Unamval_s
+{
+ char* name;
+ unsigned int value;
+} Unamval_t;
+
+static const Unamval_t options[] =
+{
+ "debug", AST_LC_debug,
+ "find", AST_LC_find,
+ "setlocale", AST_LC_setlocale,
+ "test", AST_LC_test,
+ "translate", AST_LC_translate,
+ 0, 0
+};
+
+/*
+ * called by stropt() to set options
+ */
+
+static int
+setopt(void* a, const void* p, int n, const char* v)
+{
+ if (p)
+ {
+ if (n)
+ ast.locale.set |= ((Unamval_t*)p)->value;
+ else
+ ast.locale.set &= ~((Unamval_t*)p)->value;
+ }
+ return 0;
+}
+
+#if !_lib_setlocale
+
+#define setlocale(c,l) default_setlocale(c,l)
+
+static char*
+default_setlocale(int category, const char* locale)
+{
+ Lc_t* lc;
+
+ if (locale)
+ {
+ if (!(lc = lcmake(locale)) || !(lc->flags & LC_default))
+ return 0;
+ locales[0]->flags &= ~lc->flags;
+ locales[1]->flags &= ~lc->flags;
+ return lc->name;
+ }
+ return (locales[1]->flags & (1<<category)) ? locales[1]->name : locales[0]->name;
+}
+
+#endif
+
+#if !_UWIN
+
+/*
+ * workaround for systems that shall not be named (solaris,freebsd)
+ * the call free() with addresses that look like the came from the stack
+ */
+
+extern int _vmkeep(int);
+
+static char*
+_sys_setlocale(int category, const char* locale)
+{
+ char* r;
+ int k;
+
+ k = _vmkeep(1);
+ r = setlocale(category, locale);
+ (void)_vmkeep(k);
+ return r;
+}
+
+#define setlocale(a,b) _sys_setlocale(a,b)
+
+#endif
+
+/*
+ * set a single AST_LC_* locale category
+ * the caller must validate category
+ * lc==0 restores the previous state
+ */
+
+static char*
+single(int category, Lc_t* lc, unsigned int flags)
+{
+ const char* sys;
+ int i;
+
+#if AHA
+ if ((ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) && !(ast.locale.set & AST_LC_internal))
+ sfprintf(sfstderr, "locale single %16s %16s flags %04x\n", lc_categories[category].name, lc ? lc->name : 0, flags);
+#endif
+ if (flags & (LC_setenv|LC_setlocale))
+ {
+ if (!(ast.locale.set & AST_LC_internal))
+ lc_categories[category].prev = lc;
+ if ((flags & LC_setenv) && lc_all && locales[category])
+ {
+ if (lc_categories[category].setf)
+ (*lc_categories[category].setf)(&lc_categories[category]);
+ return (char*)locales[category]->name;
+ }
+ }
+ if (!lc && (!(lc_categories[category].flags & LC_setlocale) || !(lc = lc_categories[category].prev)) && !(lc = lc_all) && !(lc = lc_categories[category].prev) && !(lc = lang))
+ lc = lcmake(NiL);
+ sys = 0;
+ if (locales[category] != lc)
+ {
+ if (lc_categories[category].external == -lc_categories[category].internal)
+ {
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (locales[i] == lc)
+ {
+ sys = (char*)lc->name;
+ break;
+ }
+ }
+ else if (lc->flags & (LC_debug|LC_local))
+ sys = setlocale(lc_categories[category].external, lcmake(NiL)->name);
+ else if (!(sys = setlocale(lc_categories[category].external, lc->name)) &&
+ (streq(lc->name, lc->code) || !(sys = setlocale(lc_categories[category].external, lc->code))) &&
+ !streq(lc->code, lc->language->code))
+ sys = setlocale(lc_categories[category].external, lc->language->code);
+ if (sys)
+ lc->flags |= LC_checked;
+ else
+ {
+ /*
+ * check for local override
+ * currently this means an LC_MESSAGES dir exists
+ */
+
+ if (!(lc->flags & LC_checked))
+ {
+ char path[PATH_MAX];
+
+ if (mcfind(lc->code, NiL, LC_MESSAGES, 0, path, sizeof(path)))
+ lc->flags |= LC_local;
+ lc->flags |= LC_checked;
+ }
+ if (!(lc->flags & LC_local))
+ return 0;
+ if (lc_categories[category].external != -lc_categories[category].internal)
+ setlocale(lc_categories[category].external, lcmake(NiL)->name);
+ }
+ locales[category] = lc;
+ if (lc_categories[category].setf && (*lc_categories[category].setf)(&lc_categories[category]))
+ {
+ locales[category] = lc_categories[category].prev;
+ return 0;
+ }
+ if ((lc->flags & LC_default) || category == AST_LC_MESSAGES && lc->name[0] == 'e' && lc->name[1] == 'n' && (lc->name[2] == 0 || lc->name[2] == '_' && lc->name[3] == 'U'))
+ ast.locale.set &= ~(1<<category);
+ else
+ ast.locale.set |= (1<<category);
+
+ }
+ else if (lc_categories[category].flags ^ flags)
+ {
+ lc_categories[category].flags &= ~(LC_setenv|LC_setlocale);
+ lc_categories[category].flags |= flags;
+ }
+ else
+ {
+ if (lc_categories[category].setf)
+ (*lc_categories[category].setf)(&lc_categories[category]);
+ return (char*)lc->name;
+ }
+ if ((ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) && !(ast.locale.set & AST_LC_internal))
+ {
+ header();
+ sfprintf(sfstderr, "locale set %17s %16s %16s %16s", lc_categories[category].name, lc->name, sys, lc_categories[category].prev ? lc_categories[category].prev->name : NiL);
+ if (category == AST_LC_CTYPE)
+ sfprintf(sfstderr, " MB_CUR_MAX=%d%s%s%s%s%s"
+ , ast.mb_cur_max
+ , ast.mb_len == debug_mblen ? " debug_mblen" : ast.mb_len == utf8_mblen ? " utf8_mblen" : ast.mb_len == mblen ? " mblen" : ""
+ , ast.mb_towc == debug_mbtowc ? " debug_mbtowc" : ast.mb_towc == utf8_mbtowc ? " utf8_mbtowc" : ast.mb_towc == mbtowc ? " mbtowc"
+#ifdef mb_state
+ : ast.mb_towc == sjis_mbtowc ? " sjis_mbtowc"
+#endif
+ : ""
+ , ast.mb_width == debug_wcwidth ? " debug_wcwidth" : ast.mb_width == utf8_wcwidth ? " utf8_wcwidth" : ast.mb_width == wcwidth ? " wcwidth" : ast.mb_width == default_wcwidth ? " default_wcwidth" : ""
+ , ast.mb_conv == debug_wctomb ? " debug_wctomb" : ast.mb_conv == utf8_wctomb ? " utf8_wctomb" : ast.mb_conv == wctomb ? " wctomb" : ""
+ , ast.mb_alpha == debug_alpha ? " debug_alpha" : ast.mb_alpha == utf8_alpha ? " utf8_alpha" : ast.mb_alpha == (Isw_f)iswalpha ? " iswalpha" : ""
+ );
+ else if (category == AST_LC_NUMERIC)
+ {
+ Lc_numeric_t* dp = (Lc_numeric_t*)LCINFO(category)->data;
+
+ sfprintf(sfstderr, " decimal='%c' thousands='%c'", dp->decimal, dp->thousand >= 0 ? dp->thousand : 'X');
+ }
+ if ((locales[category]->flags | lc_categories[category].flags) & LC_default)
+ sfprintf(sfstderr, " default");
+ if ((locales[category]->flags | lc_categories[category].flags) & LC_local)
+ sfprintf(sfstderr, " local");
+ if ((locales[category]->flags | lc_categories[category].flags) & LC_setlocale)
+ sfprintf(sfstderr, " setlocale");
+ if ((locales[category]->flags | lc_categories[category].flags) & LC_setenv)
+ sfprintf(sfstderr, " setenv");
+ sfprintf(sfstderr, "\n");
+ }
+ return (char*)lc->name;
+}
+
+/*
+ * set composite AST_LC_ALL locale categories
+ * return <0:composite-error 0:not-composite >0:composite-ok
+ */
+
+static int
+composite(register const char* s, int initialize)
+{
+ register const char* t;
+ register int i;
+ register int j;
+ register int k;
+ int n;
+ int m;
+ const char* w;
+ Lc_t* p;
+ int cat[AST_LC_COUNT];
+ int stk[AST_LC_COUNT];
+ char buf[PATH_MAX / 2];
+
+ k = n = 0;
+ while (s[0] == 'L' && s[1] == 'C' && s[2] == '_')
+ {
+ n++;
+ j = 0;
+ w = s;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ {
+ s = w;
+ t = lc_categories[i].name;
+ while (*t && *s++ == *t++);
+ if (!*t && *s++ == '=')
+ {
+ cat[j++] = i;
+ if (s[0] != 'L' || s[1] != 'C' || s[2] != '_')
+ break;
+ w = s;
+ i = -1;
+ }
+ }
+ for (s = w; *s && *s != '='; s++);
+ if (!*s)
+ {
+ for (i = 0; i < k; i++)
+ single(stk[i], NiL, 0);
+ return -1;
+ }
+ w = ++s;
+ for (;;)
+ {
+ if (!*s)
+ {
+ p = lcmake(w);
+ break;
+ }
+ else if (*s++ == ';')
+ {
+ if ((m = s - w - 1) >= sizeof(buf))
+ m = sizeof(buf) - 1;
+ memcpy(buf, w, m);
+ buf[m] = 0;
+ p = lcmake(buf);
+ break;
+ }
+ }
+ for (i = 0; i < j; i++)
+ if (!initialize)
+ {
+ if (!single(cat[i], p, 0))
+ {
+ for (i = 0; i < k; i++)
+ single(stk[i], NiL, 0);
+ return -1;
+ }
+ stk[k++] = cat[i];
+ }
+ else if (!lc_categories[cat[i]].prev && !(ast.locale.set & AST_LC_internal))
+ lc_categories[cat[i]].prev = p;
+ }
+ while (s[0] == '/' && s[1] && n < (AST_LC_COUNT - 1))
+ {
+ n++;
+ for (w = ++s; *s && *s != '/'; s++);
+ if (!*s)
+ p = lcmake(w);
+ else
+ {
+ if ((j = s - w - 1) >= sizeof(buf))
+ j = sizeof(buf) - 1;
+ memcpy(buf, w, j);
+ buf[j] = 0;
+ p = lcmake(buf);
+ }
+ if (!initialize)
+ {
+ if (!single(n, p, 0))
+ {
+ for (i = 1; i < n; i++)
+ single(i, NiL, 0);
+ return -1;
+ }
+ }
+ else if (!lc_categories[n].prev && !(ast.locale.set & AST_LC_internal))
+ lc_categories[n].prev = p;
+ }
+ return n;
+}
+
+/*
+ * setlocale() intercept
+ *
+ * locale:
+ * 0 query
+ * "" initialize from environment (if LC_ALL)
+ * "" AST_LC_setenv: value unset (defer to LANG)
+ * "*" AST_LC_setenv: value set (defer to LC_ALL)
+ * * set (override LC_ALL)
+ */
+
+char*
+_ast_setlocale(int category, const char* locale)
+{
+ register char* s;
+ register int i;
+ register int j;
+ int k;
+ int f;
+ Lc_t* p;
+ int cat[AST_LC_COUNT];
+
+ static Sfio_t* sp;
+ static int initialized;
+ static const char local[] = "local";
+
+ if ((category = lcindex(category, 0)) < 0)
+ return 0;
+ if (!locale)
+ {
+ /*
+ * return the current state
+ */
+
+ compose:
+ if (category != AST_LC_ALL && category != AST_LC_LANG)
+ return (char*)locales[category]->name;
+ if (!sp && !(sp = sfstropen()))
+ return 0;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ cat[i] = -1;
+ for (i = 1, k = 0; i < AST_LC_COUNT; i++)
+ if (cat[i] < 0)
+ {
+ k++;
+ cat[i] = i;
+ for (j = i + 1; j < AST_LC_COUNT; j++)
+ if (locales[j] == locales[i])
+ cat[j] = i;
+ }
+ if (k == 1)
+ return (char*)locales[1]->name;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (cat[i] >= 0 && !(locales[i]->flags & LC_default))
+ {
+ if (sfstrtell(sp))
+ sfprintf(sp, ";");
+ for (j = i, k = cat[i]; j < AST_LC_COUNT; j++)
+ if (cat[j] == k)
+ {
+ cat[j] = -1;
+ sfprintf(sp, "%s=", lc_categories[j].name);
+ }
+ sfprintf(sp, "%s", locales[i]->name);
+ }
+ if (!sfstrtell(sp))
+ return (char*)locales[0]->name;
+ return sfstruse(sp);
+ }
+ if (!ast.locale.serial++)
+ {
+ stropt(getenv("LC_OPTIONS"), options, sizeof(*options), setopt, NiL);
+ initialized = 0;
+ }
+ if ((ast.locale.set & (AST_LC_debug|AST_LC_setlocale)) && !(ast.locale.set & AST_LC_internal))
+ {
+ header();
+ sfprintf(sfstderr, "locale user %17s %16s %16s %16s%s%s\n", category == AST_LC_LANG ? "LANG" : lc_categories[category].name, locale && !*locale ? "''" : locale, "", "", initialized ? "" : " initial", (ast.locale.set & AST_LC_setenv) ? " setenv" : "");
+ }
+ if (ast.locale.set & AST_LC_setenv)
+ {
+ f = LC_setenv;
+ p = *locale ? lcmake(locale) : (Lc_t*)0;
+ }
+ else if (*locale)
+ {
+ f = LC_setlocale;
+ p = lcmake(locale);
+ }
+ else if (category == AST_LC_ALL)
+ {
+ if (!initialized)
+ {
+ char* u;
+ char tmp[256];
+
+ /*
+ * initialize from the environment
+ * precedence determined by X/Open
+ */
+
+ u = 0;
+ if ((s = getenv("LANG")) && *s)
+ {
+ if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp)))))
+ s = u;
+ lang = lcmake(s);
+ }
+ else
+ lang = 0;
+ if ((s = getenv("LC_ALL")) && *s)
+ {
+ if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp)))))
+ s = u;
+ lc_all = lcmake(s);
+ }
+ else
+ lc_all = 0;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (lc_categories[i].flags & LC_setlocale)
+ /* explicitly set by setlocale() */;
+ else if ((s = getenv(lc_categories[i].name)) && *s)
+ {
+ if (streq(s, local) && (u || (u = native_locale(locale, tmp, sizeof(tmp)))))
+ s = u;
+ lc_categories[i].prev = lcmake(s);
+ }
+ else
+ lc_categories[i].prev = 0;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (!single(i, lc_all && !(lc_categories[i].flags & LC_setlocale) ? lc_all : lc_categories[i].prev, 0))
+ {
+ while (i--)
+ single(i, NiL, 0);
+ return 0;
+ }
+ if (ast.locale.set & AST_LC_debug)
+ for (i = 1; i < AST_LC_COUNT; i++)
+ sfprintf(sfstderr, "locale env %17s %16s %16s %16s\n", lc_categories[i].name, locales[i]->name, "", lc_categories[i].prev ? lc_categories[i].prev->name : (char*)0);
+ initialized = 1;
+ }
+ goto compose;
+ }
+ else if (category == AST_LC_LANG || !(p = lc_categories[category].prev))
+ {
+ f = 0;
+ p = lcmake("C");
+ }
+ else
+ f = 0;
+ if (category == AST_LC_LANG)
+ {
+ if (lang != p)
+ {
+ lang = p;
+ if (!lc_all)
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (!single(i, lc_categories[i].prev, 0))
+ {
+ while (i--)
+ single(i, NiL, 0);
+ return 0;
+ }
+ }
+ }
+ else if (category != AST_LC_ALL)
+ {
+ if (f || !lc_all)
+ return single(category, p, f);
+ if (p && !(ast.locale.set & AST_LC_internal))
+ lc_categories[category].prev = p;
+ return (char*)locales[category]->name;
+ }
+ else if (composite(locale, 0) < 0)
+ return 0;
+ else if (lc_all != p)
+ {
+ lc_all = p;
+ for (i = 1; i < AST_LC_COUNT; i++)
+ if (!single(i, lc_all && !(lc_categories[i].flags & LC_setlocale) ? lc_all : lc_categories[i].prev, 0))
+ {
+ while (i--)
+ single(i, NiL, 0);
+ return 0;
+ }
+ }
+ goto compose;
+}
diff --git a/src/lib/libast/comp/setlogmask.c b/src/lib/libast/comp/setlogmask.c
new file mode 100644
index 0000000..f1851a7
--- /dev/null
+++ b/src/lib/libast/comp/setlogmask.c
@@ -0,0 +1,48 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * syslog implementation
+ */
+
+#include <ast.h>
+
+#if _lib_syslog
+
+NoN(setlogmask)
+
+#else
+
+#include "sysloglib.h"
+
+int
+setlogmask(int mask)
+{
+ int old_mask;
+
+ old_mask = log.mask;
+ if (mask)
+ log.mask = mask;
+ return old_mask;
+}
+
+#endif
diff --git a/src/lib/libast/comp/setpgid.c b/src/lib/libast/comp/setpgid.c
new file mode 100644
index 0000000..c966919
--- /dev/null
+++ b/src/lib/libast/comp/setpgid.c
@@ -0,0 +1,80 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_setpgid
+
+NoN(setpgid)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+#if _lib_setpgrp2
+#define setpgrp setpgrp2
+#else
+#if _lib_BSDsetpgrp
+#define _lib_setpgrp2 1
+#define setpgrp BSDsetpgrp
+#else
+#if _lib_wait3
+#define _lib_setpgrp2 1
+#endif
+#endif
+#endif
+
+#if _lib_setpgrp2
+extern int setpgrp(int, int);
+#else
+extern int setpgrp(void);
+#endif
+
+/*
+ * set process group id
+ */
+
+int
+setpgid(pid_t pid, pid_t pgid)
+{
+#if _lib_setpgrp2
+ return(setpgrp(pid, pgid));
+#else
+#if _lib_setpgrp
+ int caller = getpid();
+
+ if ((pid == 0 || pid == caller) && (pgid == 0 || pgid == caller))
+ return(setpgrp());
+ errno = EINVAL;
+#else
+ errno = ENOSYS;
+#endif
+ return(-1);
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/setsid.c b/src/lib/libast/comp/setsid.c
new file mode 100644
index 0000000..10544bb
--- /dev/null
+++ b/src/lib/libast/comp/setsid.c
@@ -0,0 +1,90 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_setsid
+
+NoN(setsid)
+
+#else
+
+#include <ast_tty.h>
+#include <error.h>
+
+/*
+ * become new process group leader and drop control tty
+ */
+
+pid_t
+setsid(void)
+{
+ int pg;
+#ifdef TIOCNOTTY
+ int fd;
+#endif
+
+ /*
+ * become a new process group leader
+ */
+
+ if ((pg = getpid()) == getpgrp())
+ {
+ errno = EPERM;
+ return(-1);
+ }
+ setpgid(pg, pg);
+#ifdef TIOCNOTTY
+
+ /*
+ * drop the control tty
+ */
+
+ if ((fd = open("/dev/tty", O_RDONLY)) >= 0)
+ {
+ ioctl(fd, TIOCNOTTY, 0);
+ close(fd);
+ }
+#else
+
+ /*
+ * second child in s5 to avoid reacquiring the control tty
+ */
+
+#if _lib_fork && HUH920711 /* some s5's botch this */
+ switch (fork())
+ {
+ case -1:
+ exit(1);
+ case 0:
+ break;
+ default:
+ exit(0);
+ }
+#endif
+
+#endif
+ return(pg);
+}
+
+#endif
diff --git a/src/lib/libast/comp/sigflag.c b/src/lib/libast/comp/sigflag.c
new file mode 100644
index 0000000..05ea22b
--- /dev/null
+++ b/src/lib/libast/comp/sigflag.c
@@ -0,0 +1,52 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_sigflag
+
+NoN(sigflag)
+
+#else
+
+#include <sig.h>
+
+int
+sigflag(int sig, int flags, int set)
+{
+#if _lib_sigaction
+ struct sigaction sa;
+
+ if (sigaction(sig, NiL, &sa))
+ return -1;
+ if (set)
+ sa.sa_flags |= flags;
+ else
+ sa.sa_flags &= ~flags;
+ return sigaction(sig, &sa, NiL);
+#else
+ return -1;
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/sigunblock.c b/src/lib/libast/comp/sigunblock.c
new file mode 100644
index 0000000..dfcb28b
--- /dev/null
+++ b/src/lib/libast/comp/sigunblock.c
@@ -0,0 +1,63 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_sigunblock
+
+NoN(sigunblock)
+
+#else
+
+#include <sig.h>
+
+#ifndef SIG_UNBLOCK
+#undef _lib_sigprocmask
+#endif
+
+int
+sigunblock(int s)
+{
+#if _lib_sigprocmask
+ int op;
+ sigset_t mask;
+
+ sigemptyset(&mask);
+ if (s)
+ {
+ sigaddset(&mask, s);
+ op = SIG_UNBLOCK;
+ }
+ else op = SIG_SETMASK;
+ return(sigprocmask(op, &mask, NiL));
+#else
+#if _lib_sigsetmask
+ return(sigsetmask(s ? (sigsetmask(0L) & ~sigmask(s)) : 0L));
+#else
+ NoP(s);
+ return(0);
+#endif
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/spawnveg.c b/src/lib/libast/comp/spawnveg.c
new file mode 100644
index 0000000..6117e3a
--- /dev/null
+++ b/src/lib/libast/comp/spawnveg.c
@@ -0,0 +1,296 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2012 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * spawnveg -- spawnve with process group or session control
+ *
+ * pgid <0 setsid() [session group leader]
+ * 0 nothing [retain session and process group]
+ * 1 setpgid(0,0) [process group leader]
+ * >1 setpgid(0,pgid) [join process group]
+ */
+
+#include <ast.h>
+
+#if _lib_spawnveg
+
+NoN(spawnveg)
+
+#else
+
+#if _lib_posix_spawn > 1 /* reports underlying exec() errors */
+
+#include <spawn.h>
+#include <error.h>
+#include <wait.h>
+
+pid_t
+spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid)
+{
+ int err;
+ pid_t pid;
+ posix_spawnattr_t attr;
+
+ if (err = posix_spawnattr_init(&attr))
+ goto nope;
+ if (pgid)
+ {
+ if (pgid <= 1)
+ pgid = 0;
+ if (err = posix_spawnattr_setpgroup(&attr, pgid))
+ goto bad;
+ if (err = posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETPGROUP))
+ goto bad;
+ }
+ if (err = posix_spawn(&pid, path, NiL, &attr, argv, envv ? envv : environ))
+ goto bad;
+ posix_spawnattr_destroy(&attr);
+#if _lib_posix_spawn < 2
+ if (waitpid(pid, &err, WNOHANG|WNOWAIT) == pid && EXIT_STATUS(err) == 127)
+ {
+ while (waitpid(pid, NiL, 0) == -1 && errno == EINTR);
+ if (!access(path, X_OK))
+ errno = ENOEXEC;
+ pid = -1;
+ }
+#endif
+ return pid;
+ bad:
+ posix_spawnattr_destroy(&attr);
+ nope:
+ errno = err;
+ return -1;
+}
+
+#else
+
+#if _lib_spawn_mode
+
+#include <process.h>
+
+#ifndef P_NOWAIT
+#define P_NOWAIT _P_NOWAIT
+#endif
+#ifndef P_DETACH
+#define P_DETACH _P_DETACH
+#endif
+
+pid_t
+spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid)
+{
+ return spawnve(pgid ? P_DETACH : P_NOWAIT, path, argv, envv ? envv : environ);
+}
+
+#else
+
+#if _lib_spawn && _hdr_spawn && _mem_pgroup_inheritance
+
+#include <spawn.h>
+
+/*
+ * open-edition/mvs/zos fork+exec+(setpgid)
+ */
+
+pid_t
+spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid)
+{
+ struct inheritance inherit;
+
+ inherit.flags = 0;
+ if (pgid)
+ {
+ inherit.flags |= SPAWN_SETGROUP;
+ inherit.pgroup = (pgid > 1) ? pgid : SPAWN_NEWPGROUP;
+ }
+ return spawn(path, 0, (int*)0, &inherit, (const char**)argv, (const char**)envv);
+}
+
+#else
+
+#include <error.h>
+#include <wait.h>
+#include <sig.h>
+#include <ast_tty.h>
+#include <ast_vfork.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+#if _lib_spawnve && _hdr_process
+#include <process.h>
+#if defined(P_NOWAIT) || defined(_P_NOWAIT)
+#undef _lib_spawnve
+#endif
+#endif
+
+#if !_lib_vfork
+#undef _real_vfork
+#endif
+
+/*
+ * fork+exec+(setsid|setpgid)
+ */
+
+pid_t
+spawnveg(const char* path, char* const argv[], char* const envv[], pid_t pgid)
+{
+#if _lib_fork || _lib_vfork
+ int n;
+ int m;
+ pid_t pid;
+ pid_t rid;
+#if _real_vfork
+ volatile int exec_errno;
+ volatile int* volatile exec_errno_ptr;
+#else
+ int err[2];
+#endif
+#endif
+
+#if 0
+ if (access(path, X_OK))
+ return -1;
+#endif
+ if (!envv)
+ envv = environ;
+#if _lib_spawnve
+#if _lib_fork || _lib_vfork
+ if (!pgid)
+#endif
+ return spawnve(path, argv, envv);
+#endif
+#if _lib_fork || _lib_vfork
+ n = errno;
+#if _real_vfork
+ exec_errno = 0;
+ exec_errno_ptr = &exec_errno;
+#else
+ if (pipe(err) < 0)
+ err[0] = -1;
+ else
+ {
+ fcntl(err[0], F_SETFD, FD_CLOEXEC);
+ fcntl(err[1], F_SETFD, FD_CLOEXEC);
+ }
+#endif
+ sigcritical(SIG_REG_EXEC|SIG_REG_PROC);
+#if _lib_vfork
+ pid = vfork();
+#else
+ pid = fork();
+#endif
+ if (pid == -1)
+ n = errno;
+ else if (!pid)
+ {
+ sigcritical(0);
+ if (pgid == -1)
+ setsid();
+ else if (pgid)
+ {
+ m = 0;
+ if (pgid == 1 || pgid == -2 && (m = 1))
+ pgid = getpid();
+ if (setpgid(0, pgid) < 0 && errno == EPERM)
+ setpgid(pgid, 0);
+#if _lib_tcgetpgrp
+ if (m)
+ tcsetpgrp(2, pgid);
+#else
+#ifdef TIOCSPGRP
+ if (m)
+ ioctl(2, TIOCSPGRP, &pgid);
+#endif
+#endif
+ }
+ execve(path, argv, envv);
+#if _real_vfork
+ *exec_errno_ptr = errno;
+#else
+ if (err[0] != -1)
+ {
+ m = errno;
+ write(err[1], &m, sizeof(m));
+ }
+#endif
+ _exit(errno == ENOENT ? EXIT_NOTFOUND : EXIT_NOEXEC);
+ }
+ rid = pid;
+#if _real_vfork
+ if (pid != -1 && (m = *exec_errno_ptr))
+ {
+ while (waitpid(pid, NiL, 0) == -1 && errno == EINTR);
+ rid = pid = -1;
+ n = m;
+ }
+#else
+ if (err[0] != -1)
+ {
+ close(err[1]);
+ if (pid != -1)
+ {
+ m = 0;
+ while (read(err[0], &m, sizeof(m)) == -1)
+ if (errno != EINTR)
+ {
+ m = errno;
+ break;
+ }
+ if (m)
+ {
+ while (waitpid(pid, &n, 0) && errno == EINTR);
+ rid = pid = -1;
+ n = m;
+ }
+ }
+ close(err[0]);
+ }
+#endif
+ sigcritical(0);
+ if (pid != -1 && pgid > 0)
+ {
+ /*
+ * parent and child are in a race here
+ */
+
+ if (pgid == 1)
+ pgid = pid;
+ if (setpgid(pid, pgid) < 0 && pid != pgid && errno == EPERM)
+ setpgid(pid, pid);
+ }
+ errno = n;
+ return rid;
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#endif
+
+#endif
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/statvfs.c b/src/lib/libast/comp/statvfs.c
new file mode 100644
index 0000000..b9bbf68
--- /dev/null
+++ b/src/lib/libast/comp/statvfs.c
@@ -0,0 +1,163 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+#include <ls.h>
+
+#if _lib_statvfs
+
+NoN(statvfs)
+
+#else
+
+#include <error.h>
+
+#define HUH (-1)
+
+#if _lib_statfs && _mem_f_files_statfs && ( _sys_statfs || _sys_vfs || _sys_mount )
+
+#if _sys_statfs
+#include <sys/statfs.h>
+#else
+#if _sys_vfs
+#include <sys/vfs.h>
+#else
+#if _sys_mount
+#if _lib_getmntinfo
+#include <sys/param.h> /* expect some macro redefinitions here */
+#endif
+#include <sys/mount.h>
+#endif
+#endif
+#endif
+
+#if _lib_statfs4
+#define FSTATFS(a,b) fstatfs(a,b,sizeof(struct statfs),0)
+#define STATFS(a,b) statfs(a,b,sizeof(struct statfs),0)
+#else
+#define FSTATFS(a,b) fstatfs(a,b)
+#define STATFS(a,b) statfs(a,b)
+#endif
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+static void
+us2v(register struct statfs* ufs, register struct stat* st, register struct statvfs* vfs)
+{
+ memset(vfs, 0, sizeof(*vfs));
+ vfs->f_bsize = vfs->f_frsize = ufs->f_bsize;
+ vfs->f_blocks = ufs->f_blocks;
+ vfs->f_bfree = ufs->f_bfree;
+ vfs->f_bavail =
+#if _mem_f_bavail_statfs
+ ufs->f_bavail;
+#else
+ ufs->f_bfree;
+#endif
+ vfs->f_files = ufs->f_files;
+ vfs->f_ffree = ufs->f_ffree;
+ vfs->f_favail = (ufs->f_ffree > 10) ? (ufs->f_ffree - 10) : 0;
+ vfs->f_fsid = st->st_dev;
+ strlcpy(vfs->f_basetype, FS_default, sizeof(vfs->f_basetype) - 1);
+ vfs->f_namemax = 14;
+ strlcpy(vfs->f_fstr, vfs->f_basetype, sizeof(vfs->f_fstr) - 1);
+}
+
+extern int
+fstatvfs(int fd, struct statvfs* vfs)
+{
+ struct statfs ufs;
+ struct stat st;
+
+ if (FSTATFS(fd, &ufs) || fstat(fd, &st))
+ return(-1);
+ us2v(&ufs, &st, vfs);
+ return(0);
+}
+
+extern int
+statvfs(const char* path, struct statvfs* vfs)
+{
+ struct statfs ufs;
+ struct stat st;
+
+ if (STATFS(path, &ufs) || stat(path, &st))
+ return(-1);
+ us2v(&ufs, &st, vfs);
+ return(0);
+}
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+static void
+s2v(register struct stat* st, register struct statvfs* vfs)
+{
+ memset(vfs, 0, sizeof(*vfs));
+ vfs->f_bsize = vfs->f_frsize =
+#if _mem_st_blksize_stat
+ st->st_blksize;
+#else
+ 512;
+#endif
+ vfs->f_blocks = HUH;
+ vfs->f_bfree = HUH;
+ vfs->f_files = HUH;
+ vfs->f_ffree = HUH;
+ vfs->f_favail = HUH;
+ vfs->f_fsid = st->st_dev;
+ strlcpy(vfs->f_basetype, FS_default, sizeof(vfs->f_basetype));
+ vfs->f_namemax = 14;
+ strlcpy(vfs->f_fstr, vfs->f_basetype, sizeof(vfs->f_fstr));
+}
+
+extern int
+fstatvfs(int fd, struct statvfs* vfs)
+{
+ struct stat st;
+
+ if (fstat(fd, &st))
+ return(-1);
+ s2v(&st, vfs);
+ return(0);
+}
+
+extern int
+statvfs(const char* path, struct statvfs* vfs)
+{
+ struct stat st;
+
+ if (stat(path, &st))
+ return(-1);
+ s2v(&st, vfs);
+ return(0);
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/strcasecmp.c b/src/lib/libast/comp/strcasecmp.c
new file mode 100644
index 0000000..0ea1869
--- /dev/null
+++ b/src/lib/libast/comp/strcasecmp.c
@@ -0,0 +1,58 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_strcasecmp
+
+NoN(strcasecmp)
+
+#else
+
+#include <ctype.h>
+
+#undef strcasecmp
+
+int
+strcasecmp(register const char* a, register const char* b)
+{
+ register int ac;
+ register int bc;
+ register int d;
+
+ for (;;)
+ {
+ ac = *a++;
+ if (isupper(ac))
+ ac = tolower(ac);
+ bc = *b++;
+ if (isupper(bc))
+ bc = tolower(bc);
+ if (d = ac - bc)
+ return d;
+ if (!ac)
+ return 0;
+ }
+}
+
+#endif
diff --git a/src/lib/libast/comp/strchr.c b/src/lib/libast/comp/strchr.c
new file mode 100644
index 0000000..7b556c5
--- /dev/null
+++ b/src/lib/libast/comp/strchr.c
@@ -0,0 +1,57 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_strchr
+
+NoN(strchr)
+
+#else
+
+#undef strchr
+
+#if _lib_index
+
+#undef index
+
+extern char* index(const char*, int);
+
+char*
+strchr(const char* s, int c)
+{
+ return(index(s, c));
+}
+
+#else
+
+char*
+strchr(register const char* s, register int c)
+{
+ do if (*s == c) return((char*)s); while(*s++);
+ return(0);
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/strftime.c b/src/lib/libast/comp/strftime.c
new file mode 100644
index 0000000..5c8d5bd
--- /dev/null
+++ b/src/lib/libast/comp/strftime.c
@@ -0,0 +1,104 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * strftime implementation
+ */
+
+#define strftime ______strftime
+
+#include <ast.h>
+#include <tm.h>
+
+#undef strftime
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#undef _lib_strftime /* we can pass X/Open */
+
+#if _lib_strftime
+
+NoN(strftime)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern size_t
+strftime(char* buf, size_t len, const char* format, const struct tm* tm)
+{
+ register char* s;
+ time_t t;
+ Tm_t tl;
+
+ memset(&tl, 0, sizeof(tl));
+
+ /*
+ * nl_langinfo() may call strftime() with bogus tm except for
+ * one value -- what a way to go
+ */
+
+ if (tm->tm_sec < 0 || tm->tm_sec > 60 ||
+ tm->tm_min < 0 || tm->tm_min > 59 ||
+ tm->tm_hour < 0 || tm->tm_hour > 23 ||
+ tm->tm_wday < 0 || tm->tm_wday > 6 ||
+ tm->tm_mday < 1 || tm->tm_mday > 31 ||
+ tm->tm_mon < 0 || tm->tm_mon > 11 ||
+ tm->tm_year < 0 || tm->tm_year > (2138 - 1900))
+ {
+ if (tm->tm_sec >= 0 && tm->tm_sec <= 60)
+ tl.tm_sec = tm->tm_sec;
+ if (tm->tm_min >= 0 && tm->tm_min <= 59)
+ tl.tm_min = tm->tm_min;
+ if (tm->tm_hour >= 0 && tm->tm_hour <= 23)
+ tl.tm_hour = tm->tm_hour;
+ if (tm->tm_wday >= 0 && tm->tm_wday <= 6)
+ tl.tm_wday = tm->tm_wday;
+ if (tm->tm_mday >= 0 && tm->tm_mday <= 31)
+ tl.tm_mday = tm->tm_mday;
+ if (tm->tm_mon >= 0 && tm->tm_mon <= 11)
+ tl.tm_mon = tm->tm_mon;
+ if (tm->tm_year >= 0 && tm->tm_year <= (2138 - 1900))
+ tl.tm_year = tm->tm_year;
+ }
+ else
+ {
+ tl.tm_sec = tm->tm_sec;
+ tl.tm_min = tm->tm_min;
+ tl.tm_hour = tm->tm_hour;
+ tl.tm_mday = tm->tm_mday;
+ tl.tm_mon = tm->tm_mon;
+ tl.tm_year = tm->tm_year;
+ tl.tm_wday = tm->tm_wday;
+ tl.tm_yday = tm->tm_yday;
+ tl.tm_isdst = tm->tm_isdst;
+ }
+ t = tmtime(&tl, TM_LOCALZONE);
+ if (!(s = tmfmt(buf, len, format, &t)))
+ return 0;
+ return s - buf;
+}
+
+#endif
diff --git a/src/lib/libast/comp/strncasecmp.c b/src/lib/libast/comp/strncasecmp.c
new file mode 100644
index 0000000..c312526
--- /dev/null
+++ b/src/lib/libast/comp/strncasecmp.c
@@ -0,0 +1,62 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_strncasecmp
+
+NoN(strncasecmp)
+
+#else
+
+#include <ctype.h>
+
+#undef strncasecmp
+
+int
+strncasecmp(register const char* a, register const char* b, size_t n)
+{
+ register const char* e;
+ register int ac;
+ register int bc;
+ register int d;
+
+ e = a + n;
+ for (;;)
+ {
+ if (a >= e)
+ return 0;
+ ac = *a++;
+ if (isupper(ac))
+ ac = tolower(ac);
+ bc = *b++;
+ if (isupper(bc))
+ bc = tolower(bc);
+ if (d = ac - bc)
+ return d;
+ if (!ac)
+ return 0;
+ }
+}
+
+#endif
diff --git a/src/lib/libast/comp/strptime.c b/src/lib/libast/comp/strptime.c
new file mode 100644
index 0000000..981c98b
--- /dev/null
+++ b/src/lib/libast/comp/strptime.c
@@ -0,0 +1,82 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * strptime implementation
+ */
+
+#define strptime ______strptime
+
+#include <ast.h>
+#include <tmx.h>
+
+#undef strptime
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if _lib_strptime
+
+NoN(strptime)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char*
+strptime(const char* s, const char* format, struct tm* ts)
+{
+ char* e;
+ char* f;
+ time_t t;
+ Tm_t tm;
+
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_sec = ts->tm_sec;
+ tm.tm_min = ts->tm_min;
+ tm.tm_hour = ts->tm_hour;
+ tm.tm_mday = ts->tm_mday;
+ tm.tm_mon = ts->tm_mon;
+ tm.tm_year = ts->tm_year;
+ tm.tm_wday = ts->tm_wday;
+ tm.tm_yday = ts->tm_yday;
+ tm.tm_isdst = ts->tm_isdst;
+ t = tmtime(&tm, TM_LOCALZONE);
+ t = tmscan(s, &e, format, &f, &t, 0);
+ if (e == (char*)s || *f)
+ return 0;
+ tmxtm(&tm, tmxclock(&t), NiL);
+ ts->tm_sec = tm.tm_sec;
+ ts->tm_min = tm.tm_min;
+ ts->tm_hour = tm.tm_hour;
+ ts->tm_mday = tm.tm_mday;
+ ts->tm_mon = tm.tm_mon;
+ ts->tm_year = tm.tm_year;
+ ts->tm_wday = tm.tm_wday;
+ ts->tm_yday = tm.tm_yday;
+ ts->tm_isdst = tm.tm_isdst;
+ return e;
+}
+
+#endif
diff --git a/src/lib/libast/comp/strrchr.c b/src/lib/libast/comp/strrchr.c
new file mode 100644
index 0000000..4e192ce
--- /dev/null
+++ b/src/lib/libast/comp/strrchr.c
@@ -0,0 +1,60 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_strrchr
+
+NoN(strrchr)
+
+#else
+
+#undef strrchr
+
+#if _lib_rindex
+
+#undef rindex
+
+extern char* rindex(const char*, int);
+
+char*
+strrchr(const char* s, int c)
+{
+ return(rindex(s, c));
+}
+
+#else
+
+char*
+strrchr(register const char* s, register int c)
+{
+ register const char* r;
+
+ r = 0;
+ do if (*s == c) r = s; while(*s++);
+ return((char*)r);
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/strstr.c b/src/lib/libast/comp/strstr.c
new file mode 100644
index 0000000..aa50058
--- /dev/null
+++ b/src/lib/libast/comp/strstr.c
@@ -0,0 +1,76 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:hide strstr
+#else
+#define strstr ______strstr
+#endif
+
+#include <ast.h>
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:nohide strstr
+#else
+#undef strstr
+#endif
+
+#if _lib_strstr
+
+NoN(strstr)
+
+#else
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char*
+strstr(register const char* s1, register const char* s2)
+{
+ register int c1;
+ register int c2;
+ register const char* t1;
+ register const char* t2;
+
+ if (s2)
+ {
+ if (!*s2)
+ return (char*)s1;
+ c2 = *s2++;
+ while (c1 = *s1++)
+ if (c1 == c2)
+ {
+ t1 = s1;
+ t2 = s2;
+ do
+ {
+ if (!*t2)
+ return (char*)s1 - 1;
+ } while (*t1++ == *t2++);
+ }
+ }
+ return 0;
+}
+
+#endif
diff --git a/src/lib/libast/comp/strtod.c b/src/lib/libast/comp/strtod.c
new file mode 100644
index 0000000..f0fb9af
--- /dev/null
+++ b/src/lib/libast/comp/strtod.c
@@ -0,0 +1,31 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtod() implementation
+ */
+
+#include <ast.h>
+
+#define S2F_function strtod
+#define S2F_type 1
+
+#include "sfstrtof.h"
diff --git a/src/lib/libast/comp/strtol.c b/src/lib/libast/comp/strtol.c
new file mode 100644
index 0000000..de0367f
--- /dev/null
+++ b/src/lib/libast/comp/strtol.c
@@ -0,0 +1,34 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtol() implementation
+ */
+
+#if ! __CYGWIN__ /* 1.3.* static link conflict -- no iffe for this yet */
+
+#define S2I_function strtol
+#define S2I_number long
+#define S2I_unumber unsigned long
+
+#include "strtoi.h"
+
+#endif
diff --git a/src/lib/libast/comp/strtold.c b/src/lib/libast/comp/strtold.c
new file mode 100644
index 0000000..8f8c5b5
--- /dev/null
+++ b/src/lib/libast/comp/strtold.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtold() implementation
+ */
+
+#define S2F_function strtold
+#define S2F_type 2
+
+/*
+ * ast strtold() => strtod() when double == long double
+ */
+
+#define _AST_STD_H 1
+
+#include <ast_common.h>
+
+#if _ast_fltmax_double
+#define strtold ______strtold
+#endif
+
+#include <ast_lib.h>
+#include <ast_sys.h>
+
+#if _ast_fltmax_double
+#undef strtold
+#endif
+
+#undef _AST_STD_H
+
+#include "sfstrtof.h"
diff --git a/src/lib/libast/comp/strtoll.c b/src/lib/libast/comp/strtoll.c
new file mode 100644
index 0000000..b5cf852
--- /dev/null
+++ b/src/lib/libast/comp/strtoll.c
@@ -0,0 +1,44 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtoll() implementation
+ */
+
+#define strtoll ______strtoll
+
+#include <ast.h>
+
+#undef strtoll
+
+#if !_UWIN
+
+#undef _def_map_ast
+
+#include <ast_map.h>
+
+#endif
+
+#define S2I_function strtoll
+#define S2I_number intmax_t
+#define S2I_unumber uintmax_t
+
+#include "strtoi.h"
diff --git a/src/lib/libast/comp/strtoul.c b/src/lib/libast/comp/strtoul.c
new file mode 100644
index 0000000..82d964a
--- /dev/null
+++ b/src/lib/libast/comp/strtoul.c
@@ -0,0 +1,35 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtoul() implementation
+ */
+
+#if ! __CYGWIN__ /* 1.3.* static link conflict -- no iffe for this yet */
+
+#define S2I_function strtoul
+#define S2I_number long
+#define S2I_unumber unsigned long
+#define S2I_unsigned 1
+
+#include "strtoi.h"
+
+#endif
diff --git a/src/lib/libast/comp/strtoull.c b/src/lib/libast/comp/strtoull.c
new file mode 100644
index 0000000..bc197f6
--- /dev/null
+++ b/src/lib/libast/comp/strtoull.c
@@ -0,0 +1,45 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * strtoull() implementation
+ */
+
+#define strtoull ______strtoull
+
+#include <ast.h>
+
+#undef strtoull
+
+#if !_UWIN
+
+#undef _def_map_ast
+
+#include <ast_map.h>
+
+#endif
+
+#define S2I_function strtoull
+#define S2I_number intmax_t
+#define S2I_unumber uintmax_t
+#define S2I_unsigned 1
+
+#include "strtoi.h"
diff --git a/src/lib/libast/comp/swab.c b/src/lib/libast/comp/swab.c
new file mode 100644
index 0000000..4bc905d
--- /dev/null
+++ b/src/lib/libast/comp/swab.c
@@ -0,0 +1,60 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * swab implementation
+ */
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:hide swab
+#else
+#define swab ______swab
+#endif
+
+#include <ast.h>
+
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:nohide swab
+#else
+#undef swab
+#endif
+
+#if _lib_swab
+
+NoN(swab)
+
+#else
+
+#include <swap.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern void
+swab(const void* src, void* dst, ssize_t n)
+{
+ if (n > 1)
+ swapmem(1, src, dst, n & ~1);
+}
+
+#endif
diff --git a/src/lib/libast/comp/symlink.c b/src/lib/libast/comp/symlink.c
new file mode 100644
index 0000000..b0a5787
--- /dev/null
+++ b/src/lib/libast/comp/symlink.c
@@ -0,0 +1,59 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_symlink
+
+NoN(symlink)
+
+#else
+
+#include "fakelink.h"
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+int
+symlink(const char* a, char* b)
+{
+ if (*a == '/' && (*(a + 1) == 'd' || *(a + 1) == 'p' || *(a + 1) == 'n') && (!strncmp(a, "/dev/tcp/", 9) || !strncmp(a, "/dev/udp/", 9) || !strncmp(a, "/proc/", 6) || !strncmp(a, "/n/", 3)))
+ {
+ int n;
+ int fd;
+
+ if ((fd = open(b, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) < 0)
+ return -1;
+ n = strlen(a) + 1;
+ n = (write(fd, FAKELINK_MAGIC, sizeof(FAKELINK_MAGIC)) != sizeof(FAKELINK_MAGIC) || write(fd, a, n) != n) ? -1 : 0;
+ close(fd);
+ return n;
+ }
+ errno = ENOSYS;
+ return -1;
+}
+
+#endif
diff --git a/src/lib/libast/comp/syslog.c b/src/lib/libast/comp/syslog.c
new file mode 100644
index 0000000..08554e1
--- /dev/null
+++ b/src/lib/libast/comp/syslog.c
@@ -0,0 +1,367 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * syslog implementation
+ */
+
+#include <ast.h>
+
+#if _lib_syslog
+
+NoN(syslog)
+
+#else
+
+#define LOG_TABLES
+
+#include "sysloglib.h"
+
+#include <error.h>
+#include <tm.h>
+
+Syslog_state_t log = { LOG_USER, -1, 0, ~0 };
+
+static const Namval_t attempt[] =
+{
+#if _UWIN
+ "/var/log/syslog", 0,
+#endif
+ "/dev/log", 0,
+ "var/log/syslog", 0,
+ "lib/syslog/log", 0,
+ "/dev/console", LOG_CONS,
+};
+
+const Namval_t log_facility[] =
+{
+ "default", 0,
+ "user", LOG_USER,
+ "kernel", LOG_KERN,
+ "mail", LOG_MAIL,
+ "daemon", LOG_DAEMON,
+ "security", LOG_AUTH,
+ "syslog", LOG_SYSLOG,
+ "lpr", LOG_LPR,
+ "news", LOG_NEWS,
+ "uucp", LOG_UUCP,
+ "cron", LOG_CRON,
+ "audit", LOG_AUDIT,
+ "logalert", LOG_LFMT,
+#ifdef LOG_SYSTEM2
+ "system2", LOG_SYSTEM2,
+#endif
+#ifdef LOG_SYSTEM1
+ "system1", LOG_SYSTEM1,
+#endif
+#ifdef LOG_SYSTEM0
+ "system0", LOG_SYSTEM0,
+#endif
+ 0, 0
+};
+
+const Namval_t log_severity[] =
+{
+ "panic", LOG_EMERG,
+ "alert", LOG_ALERT,
+ "critical", LOG_CRIT,
+ "error", LOG_ERR,
+ "warning", LOG_WARNING,
+ "notice", LOG_NOTICE,
+ "info", LOG_INFO,
+ "debug", LOG_DEBUG,
+ 0, 0
+};
+
+#if _UWIN
+
+/*
+ * open /dev/(fdp|tcp|udp)/HOST/SERVICE for read
+ */
+
+#include <ctype.h>
+#include <ls.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netdb.h>
+#include <netinet/in.h>
+
+#if !defined(htons) && !_lib_htons
+# define htons(x) (x)
+#endif
+#if !defined(htonl) && !_lib_htonl
+# define htonl(x) (x)
+#endif
+
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK 0x7f000001L
+#endif
+
+/*
+ * convert s to sockaddr_in
+ * -1 returned on error
+ */
+
+static int
+str2inet(register char* s, char* prot, struct sockaddr_in* addr)
+{
+ register int c;
+ register int v;
+ register int n = 0;
+ unsigned long a = 0;
+ unsigned short p = 0;
+
+ if (!memcmp(s, "local/", 6))
+ {
+ a = INADDR_LOOPBACK;
+ n = 4;
+ s += 6;
+ }
+ else if (!isdigit(*s))
+ {
+ struct hostent* hp;
+ char* e = strchr(s, '/');
+
+ if (!(e = strchr(s, '/')))
+ return -1;
+ *e = 0;
+ hp = gethostbyname(s);
+ *e = '/';
+ if (!hp || hp->h_addrtype != AF_INET || hp->h_length > sizeof(struct in_addr))
+ return -1;
+ a = (unsigned long)((struct in_addr*)hp->h_addr)->s_addr;
+ n = 6;
+ s = e + 1;
+ }
+ for (;;)
+ {
+ v = 0;
+ while ((c = *s++) >= '0' && c <= '9')
+ v = v * 10 + c - '0';
+ if (++n <= 4)
+ a = (a << 8) | (v & 0xff);
+ else
+ {
+ if (n <= 5)
+ a = htonl(a);
+ if (c)
+ {
+ struct servent* sp;
+
+ if (!(sp = getservbyname(s - 1, prot)))
+ return -1;
+ p = sp->s_port;
+ }
+ else
+ p = htons(v);
+ break;
+ }
+ if (c != '.' && c != '/')
+ return -1;
+ }
+ memset((char*)addr, 0, sizeof(*addr));
+ addr->sin_family = AF_INET;
+ addr->sin_addr.s_addr = a;
+ addr->sin_port = p;
+ return 0;
+}
+
+/*
+ * call this after open fails to see if path is a socket
+ */
+
+int
+sockopen(const char* path)
+{
+ int fd;
+ struct sockaddr_in addr;
+ char buf[PATH_MAX];
+
+ if (pathgetlink(path, buf, sizeof(buf)) <= 0)
+ {
+ if (strlen(path) >= sizeof(buf))
+ return -1;
+ strcpy(buf, path);
+ }
+#if LOCAL
+ {
+ int ul;
+ struct sockaddr_un ua;
+ struct stat st;
+
+ if ((ul = strlen(buf)) < sizeof(ua.sun_path) && !stat(buf, &st) && S_ISSOCK(st.st_mode))
+ {
+ if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
+ return -1;
+ ua.sun_family = AF_UNIX;
+ strcpy(ua.sun_path, buf);
+ ul += sizeof(ua.sun_family) + 1;
+ if (!connect(fd, (struct sockaddr*)&ua, ul))
+ return fd;
+ close(fd);
+ return -1;
+ }
+ }
+#endif
+ if (!strmatch(buf, "/dev/(tcp|udp)/*/*"))
+ return -1;
+ buf[8] = 0;
+ if (str2inet(buf + 9, buf + 5, &addr))
+ return -1;
+ if ((fd = socket(AF_INET, buf[5] == 't' ? SOCK_STREAM : SOCK_DGRAM, 0)) < 0)
+ return -1;
+ if (connect(fd, (struct sockaddr*)&addr, sizeof(addr)))
+ {
+ close(fd);
+ return -1;
+ }
+ return fd;
+}
+
+#else
+
+int
+sockopen(const char* path)
+{
+ return -1;
+}
+
+#endif
+
+void
+sendlog(const char* msg)
+{
+ register char* s;
+ register Namval_t* p;
+ register int n;
+
+ n = msg ? strlen(msg) : 0;
+ for (;;)
+ {
+ if (log.fd < 0)
+ {
+ char buf[PATH_MAX];
+
+ if (log.attempt >= elementsof(attempt))
+ break;
+ p = (Namval_t*)&attempt[log.attempt++];
+ if (p->value && !(p->value & log.flags))
+ continue;
+ if (*(s = p->name) != '/' && !(s = pathpath(buf, s, "", PATH_REGULAR|PATH_READ, sizeof(buf))))
+ continue;
+ if ((log.fd = open(s, O_WRONLY|O_APPEND|O_NOCTTY)) < 0 && (log.fd = sockopen(s)) < 0)
+ continue;
+ fcntl(log.fd, F_SETFD, FD_CLOEXEC);
+ }
+ if (!n || write(log.fd, msg, n) > 0)
+ break;
+ close(log.fd);
+ log.fd = -1;
+ }
+ if (n && (log.flags & LOG_PERROR))
+ write(2, msg, n);
+}
+
+static int
+extend(Sfio_t* sp, void* vp, Sffmt_t* dp)
+{
+ if (dp->fmt == 'm')
+ {
+ dp->flags |= SFFMT_VALUE;
+ dp->fmt = 's';
+ dp->size = -1;
+ *((char**)vp) = fmterror(errno);
+ }
+ return 0;
+}
+
+void
+vsyslog(int priority, const char* format, va_list ap)
+{
+ register int c;
+ register char* s;
+ Sfio_t* sp;
+ Sffmt_t fmt;
+ char buf[16];
+
+ if (!LOG_FACILITY(priority))
+ priority |= log.facility;
+ if (!(priority & log.mask))
+ return;
+ if (sp = sfstropen())
+ {
+ sfputr(sp, fmttime("%b %d %H:%M:%S", time(NiL)), -1);
+ if (log.flags & LOG_LEVEL)
+ {
+ if ((c = LOG_SEVERITY(priority)) < elementsof(log_severity))
+ s = (char*)log_severity[c].name;
+ else
+ sfsprintf(s = buf, sizeof(buf), "debug%d", c);
+ sfprintf(sp, " %-8s ", s);
+ if ((c = LOG_FACILITY(priority)) < elementsof(log_facility))
+ s = (char*)log_facility[c].name;
+ else
+ sfsprintf(s = buf, sizeof(buf), "local%d", c);
+ sfprintf(sp, " %-8s ", s);
+ }
+#if _lib_gethostname
+ if (!*log.host && gethostname(log.host, sizeof(log.host)-1))
+ strcpy(log.host, "localhost");
+ sfprintf(sp, " %s", log.host);
+#endif
+ if (*log.ident)
+ sfprintf(sp, " %s", log.ident);
+ if (log.flags & LOG_PID)
+ {
+ if (!*log.ident)
+ sfprintf(sp, " ");
+ sfprintf(sp, "[%d]", getpid());
+ }
+ if (format)
+ {
+ sfprintf(sp, ": ");
+ memset(&fmt, 0, sizeof(fmt));
+ fmt.version = SFIO_VERSION;
+ fmt.form = (char*)format;
+ fmt.extf = extend;
+ va_copy(fmt.args, ap);
+ sfprintf(sp, "%!", &fmt);
+ }
+ if ((s = sfstrseek(sp, 0, SEEK_CUR)) && *(s - 1) != '\n')
+ sfputc(sp, '\n');
+ if (s = sfstruse(sp))
+ sendlog(s);
+ sfstrclose(sp);
+ }
+}
+
+void
+syslog(int priority, const char* format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vsyslog(priority, format, ap);
+ va_end(ap);
+}
+
+#endif
diff --git a/src/lib/libast/comp/syslog.h b/src/lib/libast/comp/syslog.h
new file mode 100644
index 0000000..4856034
--- /dev/null
+++ b/src/lib/libast/comp/syslog.h
@@ -0,0 +1,132 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * posix syslog interface definitions
+ */
+
+#ifndef _SYSLOG_H
+#define _SYSLOG_H
+
+#include <stdarg.h>
+
+#define LOG_PRIBITS 3 /* priority bits */
+#define LOG_FACBITS 7 /* facility bits */
+
+#define LOG_PRIMASK ((1<<LOG_PRIBITS)-1)
+#define LOG_FACMASK (((1<<LOG_FACBITS)-1)<<LOG_PRIBITS)
+
+#define LOG_PRI(p) ((p)&((1<<LOG_PRIBITS)-1))
+#define LOG_FAC(p) (((p)>>LOG_PRIBITS)&((1<<LOG_FACBITS)-1))
+
+#define LOG_MAKEPRI(f,p) (((f)<<LOG_PRIBITS)|(p))
+
+/* syslog priority severity levels */
+
+#define LOG_EMERG 0 /* panic condition */
+#define LOG_ALERT 1 /* should be corrected immediately */
+#define LOG_CRIT 2 /* critical condition */
+#define LOG_ERR 3 /* error condition */
+#define LOG_WARNING 4 /* warning condition */
+#define LOG_NOTICE 5 /* no error but may need intervention */
+#define LOG_INFO 6 /* informational message */
+#define LOG_DEBUG 7 /* debug message */
+
+/* setlogmask masks */
+
+#define LOG_MASK(s) (1<<(s)) /* individual severity s */
+#define LOG_UPTO(s) ((1<<((s)+1))-1)/* up to and including s */
+
+/* syslog facilities */
+
+#define LOG_KERN (0<<LOG_PRIBITS) /* kernel */
+#define LOG_USER (1<<LOG_PRIBITS) /* user process -- default */
+#define LOG_MAIL (2<<LOG_PRIBITS) /* mail */
+#define LOG_DAEMON (3<<LOG_PRIBITS) /* daemon */
+#define LOG_AUTH (4<<LOG_PRIBITS) /* security/authorization */
+#define LOG_SYSLOG (5<<LOG_PRIBITS) /* syslog internal */
+#define LOG_LPR (6<<LOG_PRIBITS) /* line printer */
+#define LOG_NEWS (7<<LOG_PRIBITS) /* network news */
+#define LOG_UUCP (8<<LOG_PRIBITS) /* uucp */
+#define LOG_CRON (9<<LOG_PRIBITS) /* cron */
+#define LOG_AUDIT (13<<LOG_PRIBITS) /* audit daemon */
+#define LOG_LFMT (14<<LOG_PRIBITS) /* logalert */
+#define LOG_LOCAL0 (16<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL1 (17<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL2 (18<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL3 (19<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL4 (20<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL5 (21<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL6 (22<<LOG_PRIBITS) /* reserved for local use */
+#define LOG_LOCAL7 (23<<LOG_PRIBITS) /* reserved for local use */
+
+#define LOG_NFACILITIES 24
+
+/* openlog flags */
+
+#define LOG_PID 0x01 /* log the pid with each message */
+#define LOG_CONS 0x02 /* log to console if errors in sending */
+#define LOG_NDELAY 0x08 /* open right now */
+#define LOG_ODELAY 0x04 /* delay open until syslog() is called */
+#define LOG_NOWAIT 0x10 /* don't wait() for any child processes */
+#define LOG_PERROR 0x20 /* log to stderr too */
+#define LOG_LEVEL 0x40 /* tag messages with facility/level */
+
+#ifdef LOG_TABLES
+
+/* encoding support */
+
+#include <ast_namval.h>
+
+#define log_facility _log_facility
+#define log_severity _log_severity
+
+#define LOG_FACILITY(p) LOG_FAC(p) /* get facility index from pri */
+#define LOG_SEVERITY(p) LOG_PRI(p) /* get severity from pri */
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+#if !_BLD_ast && defined(__IMPORT__)
+#define extern extern __IMPORT__
+#endif
+
+extern const Namval_t log_facility[];
+extern const Namval_t log_severity[];
+
+#undef extern
+
+#endif
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern void closelog(void);
+extern void openlog(const char*, int, int);
+extern int setlogmask(int);
+extern void syslog(int, const char*, ...);
+extern void vsyslog(int, const char*, va_list);
+
+#undef extern
+
+#endif
diff --git a/src/lib/libast/comp/sysloglib.h b/src/lib/libast/comp/sysloglib.h
new file mode 100644
index 0000000..5a894c4
--- /dev/null
+++ b/src/lib/libast/comp/sysloglib.h
@@ -0,0 +1,54 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * posix syslog implementation definitions
+ */
+
+#ifndef _SYSLOGLIB_H
+#define _SYSLOGLIB_H
+
+#include <syslog.h>
+
+#define log _log_info_
+#define sendlog _log_send_
+
+/*
+ * NOTE: syslog() has a static initializer for Syslog_state_t log
+ */
+
+typedef struct
+{
+ int facility; /* openlog facility */
+ int fd; /* log to this fd */
+ int flags; /* openlog flags */
+ unsigned int mask; /* setlogmask mask */
+ int attempt; /* logfile attempt state */
+ char ident[64]; /* openlog ident */
+ char host[64]; /* openlog host name */
+} Syslog_state_t;
+
+extern Syslog_state_t log;
+
+extern void sendlog(const char*);
+
+#endif
diff --git a/src/lib/libast/comp/system.c b/src/lib/libast/comp/system.c
new file mode 100644
index 0000000..c0a3aa3
--- /dev/null
+++ b/src/lib/libast/comp/system.c
@@ -0,0 +1,55 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * ast library system(3)
+ */
+
+#define system ______system
+
+#define _STDLIB_H_ 1 /* uwin workaround */
+
+#include <ast.h>
+#include <proc.h>
+
+#undef system
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int
+system(const char* cmd)
+{
+ char* sh[4];
+
+ if (!cmd)
+ return !eaccess(pathshell(), X_OK);
+ sh[0] = "sh";
+ sh[1] = "-c";
+ sh[2] = (char*)cmd;
+ sh[3] = 0;
+ return procrun(NiL, sh, 0);
+}
diff --git a/src/lib/libast/comp/tempnam.c b/src/lib/libast/comp/tempnam.c
new file mode 100644
index 0000000..3cf375c
--- /dev/null
+++ b/src/lib/libast/comp/tempnam.c
@@ -0,0 +1,58 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * tempnam implementation
+ */
+
+#include <ast_std.h>
+
+#ifdef tempnam
+#define _def_tempnam 1
+#else
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:hide tempnam
+#else
+#define tempnam ______tempnam
+#endif
+#endif
+
+#include <ast.h>
+#include <stdio.h>
+
+#if !_def_tempnam
+#if defined(__STDPP__directive) && defined(__STDPP__hide)
+__STDPP__directive pragma pp:nohide tempnam
+#else
+#undef tempnam
+#endif
+#endif
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern char*
+tempnam(const char* dir, const char* pfx)
+{
+ return pathtmp(NiL, dir, pfx, NiL);
+}
diff --git a/src/lib/libast/comp/tmpnam.c b/src/lib/libast/comp/tmpnam.c
new file mode 100644
index 0000000..543ccdb
--- /dev/null
+++ b/src/lib/libast/comp/tmpnam.c
@@ -0,0 +1,51 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * tmpnam implementation
+ */
+
+#define tmpnam ______tmpnam
+
+#include <ast.h>
+#include <stdio.h>
+
+#undef tmpnam
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+#ifndef L_tmpnam
+#define L_tmpnam 25
+#endif
+
+extern char*
+tmpnam(char* s)
+{
+ static char buf[L_tmpnam];
+
+ return pathtemp(s ? s : buf, L_tmpnam, NiL, "tn", NiL);
+}
diff --git a/src/lib/libast/comp/transition.c b/src/lib/libast/comp/transition.c
new file mode 100644
index 0000000..ba65370
--- /dev/null
+++ b/src/lib/libast/comp/transition.c
@@ -0,0 +1,86 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * transient code to aid transition between releases
+ */
+
+#include <ast.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+#define STUB 1
+
+/*
+ * 2006-09-28
+ *
+ * on some systems the _std_strtol iffe changed (due to a faulty
+ * test prototype) and the cause programs dynamically linked to
+ * an updated -last to fail at runtime with missing _ast_strtol etc.
+ */
+
+#if !_std_strtol
+
+#ifndef strtol
+#undef STUB
+extern long
+_ast_strtol(const char* a, char** b, int c)
+{
+ return strtol(a, b, c);
+}
+#endif
+
+#ifndef strtoul
+#undef STUB
+extern unsigned long
+_ast_strtoul(const char* a, char** b, int c)
+{
+ return strtoul(a, b, c);
+}
+#endif
+
+#ifndef strtoll
+#undef STUB
+extern intmax_t
+_ast_strtoll(const char* a, char** b, int c)
+{
+ return strtoll(a, b, c);
+}
+#endif
+
+#ifndef strtoull
+#undef STUB
+extern uintmax_t
+_ast_strtoull(const char* a, char** b, int c)
+{
+ return strtoull(a, b, c);
+}
+#endif
+
+#endif
+
+#if STUB
+NoN(transition)
+#endif
diff --git a/src/lib/libast/comp/tsearch.c b/src/lib/libast/comp/tsearch.c
new file mode 100644
index 0000000..486f082
--- /dev/null
+++ b/src/lib/libast/comp/tsearch.c
@@ -0,0 +1,240 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+/*
+ * tsearch() for systems that have <search.h> but no tsearch()
+ * why would such a system provide the interface but not the
+ * implementation? that's what happens when one slimes their
+ * way through standards compliance
+ *
+ * NOTE: please excuse the crude feature test
+ */
+
+#if !_UWIN
+
+void _STUB_tsearch(){}
+
+#else
+
+#if _PACKAGE_ast
+#include <ast.h>
+#endif
+
+#define tdelete ______tdelete
+#define tfind ______tfind
+#define tsearch ______tsearch
+#define twalk ______twalk
+
+#include <search.h>
+
+#undef tdelete
+#undef tfind
+#undef tsearch
+#undef twalk
+
+#include "dthdr.h"
+
+extern Void_t* dtfinger(Dt_t*);
+
+/* POSIX tsearch library based on libcdt
+** Written by Kiem-Phong Vo (AT&T Research, 07/19/95)
+*/
+
+typedef struct _tree_s
+{ Dtlink_t link;
+ Void_t* key;
+} Tree_t;
+
+typedef struct _treedisc_s
+{ Dtdisc_t disc;
+ int(* comparf)_ARG_((const Void_t*, const Void_t*));
+} Treedisc_t;
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+/* compare function */
+#if __STD_C
+static int treecompare(Dt_t* dt, char* one, char* two, Dtdisc_t* disc)
+#else
+static int treecompare(dt, one, two, disc)
+Dt_t* dt;
+char* one;
+char* two;
+Dtdisc_t* disc;
+#endif
+{
+ return (*((Treedisc_t*)disc)->comparf)((Void_t*)one,(Void_t*)two);
+}
+
+static Treedisc_t Treedisc =
+{ { sizeof(Dtlink_t), -1, /* object is key */
+ 0,
+ NIL(Dtmake_f), NIL(Dtfree_f),
+ treecompare,
+ NIL(Dthash_f),
+ NIL(Dtmemory_f),
+ NIL(Dtevent_f)
+ },
+ 0
+};
+
+extern
+#if __STD_C
+Void_t* tsearch(const Void_t* key, Void_t** rootp,
+ int(*comparf)(const Void_t*,const Void_t*) )
+#else
+Void_t* tsearch(key, rootp, comparf)
+Void_t* key;
+Void_t** rootp;
+int(* comparf)();
+#endif
+{
+ reg Dt_t* dt;
+ reg Tree_t* o;
+
+ if(!rootp ||
+ (!(dt = *((Dt_t**)rootp)) && !(dt = dtopen((Dtdisc_t*)(&Treedisc),Dtoset))) )
+ return NIL(Void_t*);
+
+ /* dangerous to set comparf on each call but that's tsearch */
+ Treedisc.comparf = comparf;
+
+ if(!(o = (Tree_t*)dtmatch(dt,key)) )
+ { if(!(o = (Tree_t*)malloc(sizeof(Tree_t))) )
+ return NIL(Void_t*);
+ o->key = (Void_t*)key;
+ dtinsert(dt,o);
+ }
+
+ if(o)
+ *rootp = (Void_t*)dt;
+ else if(*rootp == NIL(Void_t*) )
+ dtclose(dt);
+
+ return (Void_t*)(&o->key);
+}
+
+extern
+#if __STD_C
+Void_t* tfind(const Void_t* key, Void_t*const* rootp,
+ int(*comparf)(const Void_t*, const Void_t*) )
+#else
+Void_t* tfind(key, rootp, comparf)
+Void_t* key;
+Void_t** rootp;
+int(* comparf)();
+#endif
+{
+ reg Dt_t* dt;
+ reg Tree_t* o;
+
+ if(!rootp || !(dt = *((Dt_t**)rootp)) )
+ return NIL(Void_t*);
+ Treedisc.comparf = comparf;
+
+ return (o = (Tree_t*)dtmatch(dt,key)) ? (Void_t*)(&o->key) : NIL(Void_t*);
+}
+
+/* the original tdelete() specifies that it will return the parent pointer
+** in the tree if there is one. Since we are using a splay tree, a deleted
+** node is always rotated to the root first. So this implementation always
+** returns the key of the new root.
+*/
+extern
+#if __STD_C
+Void_t* tdelete(const Void_t* key, Void_t** rootp,
+ int(*comparf)(const Void_t*, const Void_t*) )
+#else
+Void_t* tdelete(key, rootp, comparf)
+Void_t* key;
+Void_t** rootp;
+int(* comparf)();
+#endif
+{
+ reg Dt_t* dt;
+ reg Tree_t* o;
+ Tree_t obj;
+
+ if(!rootp || !(dt = *((Dt_t**)rootp)) )
+ return NIL(Void_t*);
+
+ Treedisc.comparf = comparf;
+
+ obj.key = (Void_t*)key;
+ dtdelete(dt,&obj);
+
+ if(!(o = dtfinger(dt)) )
+ { dtclose(dt);
+ *rootp = NIL(Void_t*);
+ }
+
+ return o ? (Void_t*)(&o->key) : NIL(Void_t*);
+}
+
+/* the below routine assumes a particular layout of Dtlink_t.
+** If this ever gets changed, this routine should be redone.
+*/
+#define lchild link.lh.__left
+#define rchild link.rh.__rght
+
+#if __STD_C
+static void _twalk(Tree_t* obj, void(*action)(const Void_t*,VISIT,int), int level)
+#else
+static void _twalk(obj,action,level)
+Tree_t* obj;
+void(* action)();
+int level;
+#endif
+{ if(!obj->lchild && !obj->rchild)
+ (*action)((Void_t*)obj,leaf,level);
+ else
+ { (*action)((Void_t*)obj,preorder,level);
+ if(obj->lchild)
+ _twalk((Tree_t*)obj->lchild,action,level+1);
+ (*action)((Void_t*)obj,postorder,level);
+ if(obj->rchild)
+ _twalk((Tree_t*)obj->rchild,action,level+1);
+ (*action)((Void_t*)obj,endorder,level);
+ }
+}
+
+/* the original twalk allows specifying arbitrary node to start traversal.
+** Since our root is a dictionary structure, the search here will start
+** at whichever node happens to be current root.
+*/
+extern
+#if __STD_C
+void twalk(const Void_t* root, void(*action)(const Void_t*,VISIT,int) )
+#else
+void twalk(root, action)
+Void_t* root;
+void(* action)();
+#endif
+{
+ reg Tree_t* o;
+
+ if(root && (o = (Tree_t*)dtfinger((Dt_t*)root)) )
+ _twalk(o,action,0);
+}
+
+#endif
diff --git a/src/lib/libast/comp/unlink.c b/src/lib/libast/comp/unlink.c
new file mode 100644
index 0000000..5450848
--- /dev/null
+++ b/src/lib/libast/comp/unlink.c
@@ -0,0 +1,38 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_unlink
+
+NoN(unlink)
+
+#else
+
+int
+unlink(const char* path)
+{
+ return(remove(path));
+}
+
+#endif
diff --git a/src/lib/libast/comp/unsetenv.c b/src/lib/libast/comp/unsetenv.c
new file mode 100644
index 0000000..867892a
--- /dev/null
+++ b/src/lib/libast/comp/unsetenv.c
@@ -0,0 +1,50 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#define unsetenv ______unsetenv
+
+#include <ast.h>
+
+#undef unsetenv
+
+#if _lib_unsetenv
+
+NoN(unsetenv)
+
+#else
+
+#undef _def_map_ast
+#include <ast_map.h>
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern void
+unsetenv(const char *name)
+{
+ if (!strchr(name, '='))
+ setenviron(name);
+}
+
+#endif
diff --git a/src/lib/libast/comp/vfork.c b/src/lib/libast/comp/vfork.c
new file mode 100644
index 0000000..dfe2fd6
--- /dev/null
+++ b/src/lib/libast/comp/vfork.c
@@ -0,0 +1,55 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+#include <ast.h>
+
+#if _lib_vfork
+
+NoN(vfork)
+
+#else
+
+#include <error.h>
+
+#ifndef ENOSYS
+#define ENOSYS EINVAL
+#endif
+
+#undef vfork
+
+#if defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern pid_t
+vfork(void)
+{
+#if _lib_fork
+ return(fork());
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+#endif
diff --git a/src/lib/libast/comp/waitpid.c b/src/lib/libast/comp/waitpid.c
new file mode 100644
index 0000000..2995b19
--- /dev/null
+++ b/src/lib/libast/comp/waitpid.c
@@ -0,0 +1,199 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * POSIX waitpid()
+ *
+ * pid < -1 WUNTRACED may not be fully supported
+ * process group specifics ignored by non-{waitpid,wait4}
+ */
+
+#include <ast.h>
+#include <wait.h>
+
+#if _lib_waitpid
+
+NoN(waitpid)
+
+#else
+
+#if _lib_wait4
+
+struct rusage;
+
+extern int wait4(int, int*, int, struct rusage*);
+
+pid_t
+waitpid(pid_t pid, int* status, int flags)
+{
+ return(wait4(pid, status, flags, NiL));
+}
+
+#else
+
+#undef SIGCLD
+
+#if _lib_wait3
+
+extern int wait3(int*, int, struct rusage*);
+
+#else
+
+#if _lib_wait2
+
+#define wait3(s,f,u) wait2(s,f)
+
+extern int wait2(int*, int);
+
+#else
+
+#include <sig.h>
+
+#define wait3(s,f,u) wait(s)
+
+static int caught;
+
+static void
+catch(sig)
+int sig;
+{
+ NoP(sig);
+ caught = 1;
+}
+
+#endif
+
+#endif
+
+#include <error.h>
+
+struct zombie
+{
+ struct zombie* next;
+ int status;
+ pid_t pid;
+};
+
+pid_t
+waitpid(pid_t pid, int* status, int flags)
+{
+ register struct zombie* zp;
+ register struct zombie* pp;
+ register int p;
+ int s;
+#if !_lib_wait2 && !_lib_wait3
+#if !defined(SIGCLD)
+ int n;
+ int oerrno;
+#endif
+ Sig_handler_t handler;
+#endif
+
+ static struct zombie* zombies;
+
+ pp = 0;
+ zp = zombies;
+ while (zp)
+ {
+ if (zp->pid >= 0 && (zp->pid == pid || pid <= 0))
+ {
+ if (pp) pp->next = zp->next;
+ else zombies = zp->next;
+ if (status) *status = zp->status;
+ pid = zp->pid;
+ free(zp);
+ return(pid);
+ }
+ }
+ if (pid > 0 && kill(pid, 0) < 0) return(-1);
+ for (;;)
+ {
+#if !_lib_wait2 && !_lib_wait3
+#if !defined(SIGCLD)
+ oerrno = errno;
+#endif
+ if (flags & WNOHANG)
+ {
+ caught = 0;
+#if defined(SIGCLD)
+ handler = signal(SIGCLD, catch);
+ if (!caught)
+ {
+ signal(SIGCLD, handler);
+ return(0);
+ }
+#else
+#if defined(SIGALRM)
+ handler = signal(SIGALRM, catch);
+ n = alarm(1);
+#endif
+#endif
+ }
+#endif
+ p = wait3(&s, flags, NiL);
+#if !_lib_wait3
+#if !_lib_wait2
+#if defined(SIGCLD)
+ if (flags & WNOHANG) signal(SIGCLD, handler);
+#else
+#if defined(SIGALRM)
+ if (flags & WNOHANG)
+ {
+ if (n == 0 && !caught || n == 1) alarm(n);
+ else if (n > 1) alarm(n - caught);
+ signal(SIGALRM, handler);
+ }
+ if (p == -1 && errno == EINTR)
+ {
+ errno = oerrno;
+ p = 0;
+ s = 0;
+ }
+#endif
+#endif
+#else
+ if (p == -1 && errno == EINVAL && (flags & ~WNOHANG))
+ p = wait3(&s, flags & WNOHANG, NiL);
+#endif
+#endif
+ if (p <= 0)
+ {
+ if (p == 0 && status) *status = s;
+ return(p);
+ }
+ if (pid <= 0 || p == pid)
+ {
+ if (status) *status = s;
+ return(p);
+ }
+ if (!(zp = newof(0, struct zombie, 1, 0))) return(-1);
+ zp->pid = p;
+ zp->status = s;
+ zp->next = zombies;
+ zombies = zp;
+ }
+ /*NOTREACHED*/
+}
+
+#endif
+
+#endif
diff --git a/src/lib/libast/comp/wc.c b/src/lib/libast/comp/wc.c
new file mode 100644
index 0000000..521b55a
--- /dev/null
+++ b/src/lib/libast/comp/wc.c
@@ -0,0 +1,139 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+
+/*
+ * NOTE: mbs* and wcs* are provided to avoid link errors only
+ */
+
+#include <ast.h>
+#include <wchar.h>
+
+#define STUB 1
+
+#if !_lib_mbtowc
+#undef STUB
+size_t
+mbtowc(wchar_t* t, const char* s, size_t n)
+{
+ if (t && n > 0)
+ *t = *s;
+ return 1;
+}
+#endif
+
+#if !_lib_mbrtowc
+#undef STUB
+size_t
+mbrtowc(wchar_t* t, const char* s, size_t n, mbstate_t* q)
+{
+#if _lib_mbtowc
+#undef STUB
+ memset(q, 0, sizeof(*q));
+ return mbtowc(t, s, n);
+#else
+ *q = 0;
+ if (t && n > 0)
+ *t = *s;
+ return 1;
+#endif
+}
+#endif
+
+#if !_lib_mbstowcs
+#undef STUB
+size_t
+mbstowcs(wchar_t* t, const char* s, size_t n)
+{
+ register wchar_t* p = t;
+ register wchar_t* e = t + n;
+ register unsigned char* u = (unsigned char*)s;
+
+ if (t)
+ while (p < e && (*p++ = *u++));
+ else
+ while (p++, *u++);
+ return p - t;
+}
+#endif
+
+#if !_lib_wctomb
+#undef STUB
+int
+wctomb(char* s, wchar_t c)
+{
+ if (s)
+ *s = c;
+ return 1;
+}
+#endif
+
+#if !_lib_wcrtomb
+#undef STUB
+size_t
+wcrtomb(char* s, wchar_t c, mbstate_t* q)
+{
+#if _lib_wctomb
+#undef STUB
+ memset(q, 0, sizeof(*q));
+ return wctomb(s, c);
+#else
+ if (s)
+ *s = c;
+ *q = 0;
+ return 1;
+#endif
+}
+#endif
+
+#if !_lib_wcslen
+#undef STUB
+size_t
+wcslen(const wchar_t* s)
+{
+ register const wchar_t* p = s;
+
+ while (*p)
+ p++;
+ return p - s;
+}
+#endif
+
+#if !_lib_wcstombs
+#undef STUB
+size_t
+wcstombs(char* t, register const wchar_t* s, size_t n)
+{
+ register char* p = t;
+ register char* e = t + n;
+
+ if (t)
+ while (p < e && (*p++ = *s++));
+ else
+ while (p++, *s++);
+ return p - t;
+}
+#endif
+
+#if STUB
+NoN(wc)
+#endif
diff --git a/src/lib/libast/comp/wordexp.c b/src/lib/libast/comp/wordexp.c
new file mode 100644
index 0000000..33016dc
--- /dev/null
+++ b/src/lib/libast/comp/wordexp.c
@@ -0,0 +1,217 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * POSIX 1003.2 wordexp implementation
+ */
+
+#include <ast.h>
+#include <wordexp.h>
+#include <stak.h>
+
+struct list
+{
+ struct list *next;
+};
+
+/*
+ * elimnates shell quoting as inserted with sh_fmtq
+ * result relaces <string>
+ * length of resulting string is returned.
+ */
+static int sh_unquote(char* string)
+{
+ register char *sp=string, *dp;
+ register int c;
+ while((c= *sp) && c!='\'')
+ sp++;
+ if(c==0)
+ return(sp-string);
+ if((dp=sp) > string && sp[-1]=='$')
+ {
+ register int n=stresc(sp+1);
+ /* copy all but trailing ' */
+ while(--n>0)
+ *dp++ = *++sp;
+ }
+ else
+ {
+ while((c= *++sp) && c!='\'')
+ *dp++ = c;
+ }
+ *dp=0;
+ return(dp-string);
+}
+
+int wordexp(const char *string, wordexp_t *wdarg, register int flags)
+{
+ register Sfio_t *iop;
+ register char *cp=(char*)string;
+ register int c,quoted=0,literal=0,ac=0;
+ int offset;
+ char *savebase,**av;
+ if(offset=staktell())
+ savebase = stakfreeze(0);
+ if(flags&WRDE_REUSE)
+ wordfree(wdarg);
+ else if(!(flags&WRDE_APPEND))
+ {
+ wdarg->we_wordv = 0;
+ wdarg->we_wordc = 0;
+ }
+ if(flags&WRDE_UNDEF)
+ stakwrite("set -u\n",7);
+ if(!(flags&WRDE_SHOWERR))
+ stakwrite("exec 2> /dev/null\n",18);
+ stakwrite("print -f \"%q\\n\" ",16);
+ if(*cp=='#')
+ stakputc('\\');
+ while(c = *cp++)
+ {
+ if(c=='\'' && !quoted)
+ literal = !literal;
+ else if(!literal)
+ {
+ if(c=='\\' && (!quoted || strchr("\\\"`\n$",c)))
+ {
+ stakputc('\\');
+ if(c= *cp)
+ cp++;
+ else
+ c = '\\';
+ }
+ else if(c=='"')
+ quoted = !quoted;
+ else if(c=='`' || (c=='$' && *cp=='('))
+ {
+ if(flags&WRDE_NOCMD)
+ {
+ c=WRDE_CMDSUB;
+ goto err;
+ }
+ /* only the shell can parse the rest */
+ stakputs(cp-1);
+ break;
+ }
+ else if(!quoted && strchr("|&\n;<>"+ac,c))
+ {
+ c=WRDE_BADCHAR;
+ goto err;
+ }
+ else if(c=='(') /* allow | and & inside pattern */
+ ac=2;
+ }
+ stakputc(c);
+ }
+ stakputc(0);
+ if(!(iop = sfpopen((Sfio_t*)0,stakptr(0),"r")))
+ {
+ c = WRDE_NOSHELL;
+ goto err;
+ }
+ stakseek(0);
+ ac = 0;
+ while((c=sfgetc(iop)) != EOF)
+ {
+ if(c=='\'')
+ quoted = ! quoted;
+ else if(!quoted && (c==' ' || c=='\n'))
+ {
+ ac++;
+ c = 0;
+ }
+ stakputc(c);
+ }
+ if(c=sfclose(iop))
+ {
+ if(c==3 || !(flags&WRDE_UNDEF))
+ c=WRDE_SYNTAX;
+ else
+ c=WRDE_BADVAL;
+ goto err;
+ }
+ c = ac+2;
+ if(flags&WRDE_DOOFFS)
+ c += wdarg->we_offs;
+ if(flags&WRDE_APPEND)
+ av = (char**)realloc((void*)&wdarg->we_wordv[-1], (wdarg->we_wordc+c)*sizeof(char*));
+ else if(av = (char**)malloc(c*sizeof(char*)))
+ {
+ if(flags&WRDE_DOOFFS)
+ memset((void*)av,0,(wdarg->we_offs+1)*sizeof(char*));
+ else
+ av[0] = 0;
+ }
+ if(!av)
+ return(WRDE_NOSPACE);
+ c = staktell();
+ if(!(cp = (char*)malloc(sizeof(char*)+c)))
+ {
+ c=WRDE_NOSPACE;
+ goto err;
+ }
+ ((struct list*)cp)->next = (struct list*)(*av);
+ *av++ = (char*)cp;
+ cp += sizeof(char*);
+ wdarg->we_wordv = av;
+ if(flags&WRDE_APPEND)
+ av += wdarg->we_wordc;
+ wdarg->we_wordc += ac;
+ if(flags&WRDE_DOOFFS)
+ av += wdarg->we_offs;
+ memcpy((void*)cp,stakptr(offset),c);
+ while(ac-- > 0)
+ {
+ *av++ = cp;
+ sh_unquote(cp);
+ while(c= *cp++);
+ }
+ *av = 0;
+ c=0;
+err:
+ if(offset)
+ stakset(savebase,offset);
+ else
+ stakseek(0);
+ return(c);
+}
+
+/*
+ * free fields in <wdarg>
+ */
+int wordfree(register wordexp_t *wdarg)
+{
+ struct list *arg, *argnext;
+ if(wdarg->we_wordv)
+ {
+ argnext = (struct list*)wdarg->we_wordv[-1];
+ while(arg=argnext)
+ {
+ argnext = arg->next;
+ free((void*)arg);
+ }
+ free((void*)&wdarg->we_wordv[-1]);
+ wdarg->we_wordv = 0;
+ }
+ wdarg->we_wordc=0;
+ return(0);
+}
diff --git a/src/lib/libast/comp/wordexp.h b/src/lib/libast/comp/wordexp.h
new file mode 100644
index 0000000..69a1bb4
--- /dev/null
+++ b/src/lib/libast/comp/wordexp.h
@@ -0,0 +1,63 @@
+/***********************************************************************
+* *
+* This software is part of the ast package *
+* Copyright (c) 1985-2011 AT&T Intellectual Property *
+* and is licensed under the *
+* Eclipse Public License, Version 1.0 *
+* by AT&T Intellectual Property *
+* *
+* A copy of the License is available at *
+* http://www.eclipse.org/org/documents/epl-v10.html *
+* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
+* *
+* Information and Software Systems Research *
+* AT&T Research *
+* Florham Park NJ *
+* *
+* Glenn Fowler <gsf@research.att.com> *
+* David Korn <dgk@research.att.com> *
+* Phong Vo <kpv@research.att.com> *
+* *
+***********************************************************************/
+#pragma prototyped
+/*
+ * posix wordexp interface definitions
+ */
+
+#ifndef _WORDEXP_H
+#define _WORDEXP_H
+
+#include <ast_common.h>
+
+#define WRDE_APPEND 01
+#define WRDE_DOOFFS 02
+#define WRDE_NOCMD 04
+#define WRDE_NOSYS 0100
+#define WRDE_REUSE 010
+#define WRDE_SHOWERR 020
+#define WRDE_UNDEF 040
+
+#define WRDE_BADCHAR 1
+#define WRDE_BADVAL 2
+#define WRDE_CMDSUB 3
+#define WRDE_NOSPACE 4
+#define WRDE_SYNTAX 5
+#define WRDE_NOSHELL 6
+
+typedef struct _wdarg
+{
+ size_t we_wordc;
+ char **we_wordv;
+ size_t we_offs;
+} wordexp_t;
+
+#if _BLD_ast && defined(__EXPORT__)
+#define extern __EXPORT__
+#endif
+
+extern int wordexp(const char*, wordexp_t*, int);
+extern int wordfree(wordexp_t*);
+
+#undef extern
+
+#endif /* _WORDEXP_H */