api: add remaining functions
authornsz <nsz@port70.net>
Sat, 20 Oct 2012 20:57:06 +0000 (22:57 +0200)
committernsz <nsz@port70.net>
Sat, 20 Oct 2012 20:57:06 +0000 (22:57 +0200)
19 files changed:
src/api/Makefile
src/api/sys_stat.c
src/api/sys_statvfs.c [new file with mode: 0644]
src/api/sys_time.c [new file with mode: 0644]
src/api/sys_times.c [new file with mode: 0644]
src/api/sys_types.c [new file with mode: 0644]
src/api/sys_un.c [new file with mode: 0644]
src/api/sys_utsname.c [new file with mode: 0644]
src/api/sys_wait.c [new file with mode: 0644]
src/api/syslog.c [new file with mode: 0644]
src/api/tar.c [new file with mode: 0644]
src/api/termios.c [new file with mode: 0644]
src/api/tgmath.c [new file with mode: 0644]
src/api/time.c [new file with mode: 0644]
src/api/unistd.c [new file with mode: 0644]
src/api/utmpx.c [new file with mode: 0644]
src/api/wchar.c [new file with mode: 0644]
src/api/wctype.c [new file with mode: 0644]
src/api/wordexp.c [new file with mode: 0644]

index a3332b2..1c3ab0c 100644 (file)
@@ -1,4 +1,4 @@
-CFLAGS+=-std=c99 -pedantic -Wall -Werror -Wno-unused -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
+CFLAGS+=-std=c99 -Wall -Werror -Wno-unused -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700
 
 all:
        for i in *.c; do \
index bebf08e..2e6b6fa 100644 (file)
@@ -33,8 +33,8 @@ F(blksize_t, st_blksize)
 F(blkcnt_t, st_blocks)
 
 F(time_t, st_atime)
-T(time_t, st_mtime)
-T(time_t, st_ctime)
+F(time_t, st_mtime)
+F(time_t, st_ctime)
 }
 C(S_IRWXU)
 C(S_IRUSR)
diff --git a/src/api/sys_statvfs.c b/src/api/sys_statvfs.c
new file mode 100644 (file)
index 0000000..d43e503
--- /dev/null
@@ -0,0 +1,27 @@
+#include <sys/statvfs.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(fsblkcnt_t)
+T(fsfilcnt_t)
+{
+struct statvfs x;
+F(unsigned long, f_bsize)
+F(unsigned long, f_frsize)
+F(fsblkcnt_t,f_blocks)
+F(fsblkcnt_t,f_bfree)
+F(fsblkcnt_t,f_bavail)
+F(fsfilcnt_t,f_files)
+F(fsfilcnt_t,f_ffree)
+F(fsfilcnt_t,f_favail)
+F(unsigned long, f_fsid)
+F(unsigned long, f_flag)
+F(unsigned long, f_namemax)
+}
+C(ST_RDONLY)
+C(ST_NOSUID)
+int(*p_fstatvfs)(int,struct statvfs*) = fstatvfs;
+int(*p_statvfs)(const char*restrict,struct statvfs*restrict) = statvfs;
+}
diff --git a/src/api/sys_time.c b/src/api/sys_time.c
new file mode 100644 (file)
index 0000000..7aa0893
--- /dev/null
@@ -0,0 +1,29 @@
+#include <sys/time.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(suseconds_t)
+T(fd_set)
+{
+struct timeval x;
+F(time_t, tv_sec)
+F(suseconds_t,tv_usec)
+}
+C(FD_SETSIZE)
+#ifndef FD_CLR
+void(*p_FD_CLR)(int,fd_set*) = FD_CLR;
+#endif
+#ifndef FD_ISSET
+int(*p_FD_ISSET)(int,fd_set*) = FD_ISSET;
+#endif
+#ifndef FD_SET
+void(*p_FD_SET)(int,fd_set*) = FD_SET;
+#endif
+#ifndef FD_ZERO
+void(*p_FD_ZERO)(fd_set*) = FD_ZERO;
+#endif
+int(*p_select)(int,fd_set*restrict,fd_set*restrict,fd_set*restrict,struct timeval*restrict) = select;
+int(*p_utimes)(const char*,const struct timeval[]) = utimes;
+}
diff --git a/src/api/sys_times.c b/src/api/sys_times.c
new file mode 100644 (file)
index 0000000..323631b
--- /dev/null
@@ -0,0 +1,16 @@
+#include <sys/times.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(clock_t)
+{
+struct tms x;
+F(clock_t,tms_utime)
+F(clock_t,tms_stime)
+F(clock_t,tms_cutime)
+F(clock_t,tms_cstime)
+}
+clock_t(*p_times)(struct tms*) = times;
+}
diff --git a/src/api/sys_types.c b/src/api/sys_types.c
new file mode 100644 (file)
index 0000000..f7c634d
--- /dev/null
@@ -0,0 +1,43 @@
+#include <sys/types.h>
+#define T(t) (t*)0;
+#define N(t) {t x = 1;}
+static void f()
+{
+N(blkcnt_t)
+N(blksize_t)
+N(clock_t)
+N(clockid_t)
+N(dev_t)
+N(gid_t)
+N(id_t)
+N(ino_t)
+N(mode_t)
+N(nlink_t)
+N(off_t)
+N(pid_t)
+N(size_t)
+N(ssize_t)
+N(time_t)
+N(timer_t)
+N(uid_t)
+#ifdef _XOPEN_SOURCE
+N(fsblkcnt_t)
+N(fsfilcnt_t)
+N(key_t)
+N(suseconds_t)
+#endif
+T(pthread_attr_t)
+T(pthread_barrier_t)
+T(pthread_barrierattr_t)
+T(pthread_cond_t)
+T(pthread_condattr_t)
+T(pthread_key_t)
+T(pthread_mutex_t)
+T(pthread_mutexattr_t)
+T(pthread_once_t)
+T(pthread_rwlock_t)
+T(pthread_rwlockattr_t)
+T(pthread_spinlock_t)
+T(pthread_t)
+}
+
diff --git a/src/api/sys_un.c b/src/api/sys_un.c
new file mode 100644 (file)
index 0000000..74b764a
--- /dev/null
@@ -0,0 +1,13 @@
+#include <sys/un.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+static void f()
+{
+T(sa_family_t)
+{
+struct sockaddr_un x;
+F(sa_family_t,sun_family)
+F(char, sun_path[0])
+}
+}
+
diff --git a/src/api/sys_utsname.c b/src/api/sys_utsname.c
new file mode 100644 (file)
index 0000000..a3fdce7
--- /dev/null
@@ -0,0 +1,14 @@
+#include <sys/utsname.h>
+#define F(t,n) {t *y = &x.n;}
+static void f()
+{
+{
+struct utsname x;
+F(char,sysname[1])
+F(char,nodename[1])
+F(char,release[1])
+F(char,version[1])
+F(char,machine[1])
+}
+int(*p_uname)(struct utsname*) = uname;
+}
diff --git a/src/api/sys_wait.c b/src/api/sys_wait.c
new file mode 100644 (file)
index 0000000..0211393
--- /dev/null
@@ -0,0 +1,31 @@
+#include <sys/wait.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(id_t)
+T(pid_t)
+T(siginfo_t)
+C(WEXITSTATUS(0))
+C(WIFEXITED(0))
+C(WIFSIGNALED(0))
+C(WIFSTOPPED(0))
+C(WNOHANG)
+C(WSTOPSIG(0))
+C(WTERMSIG(0))
+C(WUNTRACED)
+#ifdef _XOPEN_SOURCE
+C(WCONTINUED)
+C(WIFCONTINUED(0))
+#endif
+C(WEXITED)
+C(WNOWAIT)
+C(WSTOPPED)
+{idtype_t x = P_ALL;}
+{idtype_t x = P_PGID;}
+{idtype_t x = P_PID;}
+pid_t(*p_wait)(int*) = wait;
+int(*p_waitid)(idtype_t,id_t,siginfo_t*,int) = waitid;
+pid_t(*p_waitpid)(pid_t,int*,int) = waitpid;
+}
diff --git a/src/api/syslog.c b/src/api/syslog.c
new file mode 100644 (file)
index 0000000..c659ec1
--- /dev/null
@@ -0,0 +1,42 @@
+#include <syslog.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+C(LOG_PID)
+C(LOG_CONS)
+C(LOG_NDELAY)
+C(LOG_ODELAY)
+C(LOG_NOWAIT)
+C(LOG_KERN)
+C(LOG_USER)
+C(LOG_MAIL)
+C(LOG_NEWS)
+C(LOG_UUCP)
+C(LOG_DAEMON)
+C(LOG_AUTH)
+C(LOG_CRON)
+C(LOG_LPR)
+C(LOG_LOCAL0)
+C(LOG_LOCAL1)
+C(LOG_LOCAL2)
+C(LOG_LOCAL3)
+C(LOG_LOCAL4)
+C(LOG_LOCAL5)
+C(LOG_LOCAL6)
+C(LOG_LOCAL7)
+{int i = LOG_MASK(0);}
+C(LOG_EMERG)
+C(LOG_ALERT)
+C(LOG_CRIT)
+C(LOG_ERR)
+C(LOG_WARNING)
+C(LOG_NOTICE)
+C(LOG_INFO)
+C(LOG_DEBUG)
+void(*p_closelog)(void) = closelog;
+void(*p_openlog)(const char*,int,int) = openlog;
+int(*p_setlogmask)(int) = setlogmask;
+void(*p_syslog)(int,const char*,...) = syslog;
+}
diff --git a/src/api/tar.c b/src/api/tar.c
new file mode 100644 (file)
index 0000000..b649041
--- /dev/null
@@ -0,0 +1,33 @@
+#include <tar.h>
+#define C(n) switch(n){case n:;}
+static void f()
+{
+{char s[] = "" TMAGIC;}
+C(TMAGLEN)
+{char s[] = "" TVERSION;}
+C(TVERSLEN)
+C(REGTYPE)
+C(AREGTYPE)
+C(LNKTYPE)
+C(SYMTYPE)
+C(CHRTYPE)
+C(BLKTYPE)
+C(DIRTYPE)
+C(FIFOTYPE)
+C(CONTTYPE)
+C(TSUID)
+C(TSGID)
+#ifdef _XOPEN_SOURCE
+C(TSVTX)
+#endif
+C(TUREAD)
+C(TUWRITE)
+C(TUEXEC)
+C(TGREAD)
+C(TGWRITE)
+C(TGEXEC)
+C(TOREAD)
+C(TOWRITE)
+C(TOEXEC)
+}
+
diff --git a/src/api/termios.c b/src/api/termios.c
new file mode 100644 (file)
index 0000000..a138767
--- /dev/null
@@ -0,0 +1,131 @@
+#include <termios.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(cc_t)
+T(speed_t)
+T(tcflag_t)
+T(pid_t)
+{
+struct termios x;
+F(tcflag_t,c_iflag)
+F(tcflag_t,c_oflag)
+F(tcflag_t,c_cflag)
+F(tcflag_t,c_lflag)
+F(cc_t,c_cc[NCCS])
+}
+C(NCCS)
+C(VEOF)
+C(VEOL)
+C(VERASE)
+C(VINTR)
+C(VKILL)
+C(VMIN)
+C(VQUIT)
+C(VSTART)
+C(VSTOP)
+C(VSUSP)
+C(VTIME)
+C(BRKINT)
+C(ICRNL)
+C(IGNBRK)
+C(IGNCR)
+C(IGNPAR)
+C(INLCR)
+C(INPCK)
+C(ISTRIP)
+C(IXANY)
+C(IXOFF)
+C(IXON)
+C(PARMRK)
+C(OPOST)
+#ifdef _XOPEN_SOURCE
+C(ONLCR)
+C(OCRNL)
+C(ONOCR)
+C(ONLRET)
+C(OFDEL)
+C(OFILL)
+C(NLDLY)
+C(NL0)
+C(NL1)
+C(CRDLY)
+C(CR0)
+C(CR1)
+C(CR2)
+C(CR3)
+C(TABDLY)
+C(TAB0)
+C(TAB1)
+C(TAB2)
+C(TAB3)
+C(BSDLY)
+C(BS0)
+C(BS1)
+C(VTDLY)
+C(VT0)
+C(VT1)
+C(FFDLY)
+C(FF0)
+C(FF1)
+#endif
+C(B0)
+C(B50)
+C(B75)
+C(B110)
+C(B134)
+C(B150)
+C(B200)
+C(B300)
+C(B600)
+C(B1200)
+C(B1800)
+C(B2400)
+C(B4800)
+C(B9600)
+C(B19200)
+C(B38400)
+C(CSIZE)
+C(CS5)
+C(CS6)
+C(CS7)
+C(CS8)
+C(CSTOPB)
+C(CREAD)
+C(PARENB)
+C(PARODD)
+C(HUPCL)
+C(CLOCAL)
+C(ECHO)
+C(ECHOE)
+C(ECHOK)
+C(ECHONL)
+C(ICANON)
+C(IEXTEN)
+C(ISIG)
+C(NOFLSH)
+C(TOSTOP)
+C(TCSANOW)
+C(TCSADRAIN)
+C(TCSAFLUSH)
+C(TCIFLUSH)
+C(TCIOFLUSH)
+C(TCOFLUSH)
+C(TCIOFF)
+C(TCION)
+C(TCOOFF)
+C(TCOON)
+speed_t(*p_cfgetispeed)(const struct termios*) = cfgetispeed;
+speed_t(*p_cfgetospeed)(const struct termios*) = cfgetospeed;
+int(*p_cfsetispeed)(struct termios*,speed_t) = cfsetispeed;
+int(*p_cfsetospeed)(struct termios*,speed_t) = cfsetospeed;
+int(*p_tcdrain)(int) = tcdrain;
+int(*p_tcflow)(int,int) = tcflow;
+int(*p_tcflush)(int,int) = tcflush;
+int(*p_tcgetattr)(int,struct termios*) = tcgetattr;
+pid_t(*p_tcgetsid)(int) = tcgetsid;
+int(*p_tcsendbreak)(int,int) = tcsendbreak;
+int(*p_tcsetattr)(int,int,const struct termios*) = tcsetattr;
+}
diff --git a/src/api/tgmath.c b/src/api/tgmath.c
new file mode 100644 (file)
index 0000000..b2a876b
--- /dev/null
@@ -0,0 +1,307 @@
+#include <tgmath.h>
+static void f()
+{
+double x=0, y=0, z=0;
+int i;
+#ifdef acos
+{double r = acos(x);}
+#else
+#error no acos(x)
+#endif
+#ifdef acosh
+{double r = acosh(x);}
+#else
+#error no acosh(x)
+#endif
+#ifdef asin
+{double r = asin(x);}
+#else
+#error no asin(x)
+#endif
+#ifdef asinh
+{double r = asinh(x);}
+#else
+#error no asinh(x)
+#endif
+#ifdef atan
+{double r = atan(x);}
+#else
+#error no atan(x)
+#endif
+#ifdef atan2
+{double r = atan2(x,y);}
+#else
+#error no atan2(x,y)
+#endif
+#ifdef atanh
+{double r = atanh(x);}
+#else
+#error no atanh(x)
+#endif
+#ifdef carg
+{double r = carg(x);}
+#else
+#error no carg(x)
+#endif
+#ifdef cbrt
+{double r = cbrt(x);}
+#else
+#error no cbrt(x)
+#endif
+#ifdef ceil
+{double r = ceil(x);}
+#else
+#error no ceil(x)
+#endif
+#ifdef cimag
+{double r = cimag(x);}
+#else
+#error no cimag(x)
+#endif
+#ifdef conj
+{double r = conj(x);}
+#else
+#error no conj(x)
+#endif
+#ifdef copysign
+{double r = copysign(x,y);}
+#else
+#error no copysign(x,y)
+#endif
+#ifdef cos
+{double r = cos(x);}
+#else
+#error no cos(x)
+#endif
+#ifdef cosh
+{double r = cosh(x);}
+#else
+#error no cosh(x)
+#endif
+#ifdef cproj
+{double r = cproj(x);}
+#else
+#error no cproj(x)
+#endif
+#ifdef creal
+{double r = creal(x);}
+#else
+#error no creal(x)
+#endif
+#ifdef erf
+{double r = erf(x);}
+#else
+#error no erf(x)
+#endif
+#ifdef erfc
+{double r = erfc(x);}
+#else
+#error no erfc(x)
+#endif
+#ifdef exp
+{double r = exp(x);}
+#else
+#error no exp(x)
+#endif
+#ifdef exp2
+{double r = exp2(x);}
+#else
+#error no exp2(x)
+#endif
+#ifdef expm1
+{double r = expm1(x);}
+#else
+#error no expm1(x)
+#endif
+#ifdef fabs
+{double r = fabs(x);}
+#else
+#error no fabs(x)
+#endif
+#ifdef fdim
+{double r = fdim(x,y);}
+#else
+#error no fdim(x,y)
+#endif
+#ifdef floor
+{double r = floor(x);}
+#else
+#error no floor(x)
+#endif
+#ifdef fma
+{double r = fma(x,y,z);}
+#else
+#error no fma(x,y,z)
+#endif
+#ifdef fmax
+{double r = fmax(x,y);}
+#else
+#error no fmax(x,y)
+#endif
+#ifdef fmin
+{double r = fmin(x,y);}
+#else
+#error no fmin(x,y)
+#endif
+#ifdef fmod
+{double r = fmod(x,y);}
+#else
+#error no fmod(x,y)
+#endif
+#ifdef frexp
+{double r = frexp(x,&i);}
+#else
+#error no frexp(x,y)
+#endif
+#ifdef hypot
+{double r = hypot(x,y);}
+#else
+#error no hypot(x,y)
+#endif
+#ifdef ilogb
+{double r = ilogb(x);}
+#else
+#error no ilogb(x)
+#endif
+#ifdef ldexp
+{double r = ldexp(x,y);}
+#else
+#error no ldexp(x,y)
+#endif
+#ifdef lgamma
+{double r = lgamma(x);}
+#else
+#error no lgamma(x)
+#endif
+#ifdef llrint
+{double r = llrint(x);}
+#else
+#error no llrint(x)
+#endif
+#ifdef llround
+{double r = llround(x);}
+#else
+#error no llround(x)
+#endif
+#ifdef log
+{double r = log(x);}
+#else
+#error no log(x)
+#endif
+#ifdef log10
+{double r = log10(x);}
+#else
+#error no log10(x)
+#endif
+#ifdef log1p
+{double r = log1p(x);}
+#else
+#error no log1p(x)
+#endif
+#ifdef log2
+{double r = log2(x);}
+#else
+#error no log2(x)
+#endif
+#ifdef logb
+{double r = logb(x);}
+#else
+#error no logb(x)
+#endif
+#ifdef lrint
+{double r = lrint(x);}
+#else
+#error no lrint(x)
+#endif
+#ifdef lround
+{double r = lround(x);}
+#else
+#error no lround(x)
+#endif
+#ifdef nearbyint
+{double r = nearbyint(x);}
+#else
+#error no nearbyint(x)
+#endif
+#ifdef nextafter
+{double r = nextafter(x,y);}
+#else
+#error no nextafter(x,y)
+#endif
+#ifdef nexttoward
+{double r = nexttoward(x,y);}
+#else
+#error no nexttoward(x,y)
+#endif
+#ifdef pow
+{double r = pow(x,y);}
+#else
+#error no pow(x,y)
+#endif
+#ifdef remainder
+{double r = remainder(x,y);}
+#else
+#error no remainder(x,y)
+#endif
+#ifdef remquo
+{double r = remquo(x,y,&i);}
+#else
+#error no remquo(x,y,z)
+#endif
+#ifdef rint
+{double r = rint(x);}
+#else
+#error no rint(x)
+#endif
+#ifdef round
+{double r = round(x);}
+#else
+#error no round(x)
+#endif
+#ifdef scalbln
+{double r = scalbln(x,y);}
+#else
+#error no scalbln(x,y)
+#endif
+#ifdef scalbn
+{double r = scalbn(x,y);}
+#else
+#error no scalbn(x,y)
+#endif
+#ifdef sin
+{double r = sin(x);}
+#else
+#error no sin(x)
+#endif
+#ifdef sinh
+{double r = sinh(x);}
+#else
+#error no sinh(x)
+#endif
+#ifdef sqrt
+{double r = sqrt(x);}
+#else
+#error no sqrt(x)
+#endif
+#ifdef tan
+{double r = tan(x);}
+#else
+#error no tan(x)
+#endif
+#ifdef tanh
+{double r = tanh(x);}
+#else
+#error no tanh(x)
+#endif
+#ifdef tgamma
+{double r = tgamma(x);}
+#else
+#error no tgamma(x)
+#endif
+#ifdef trunc
+{double r = trunc(x);}
+#else
+#error no trunc(x)
+#endif
+}
+
diff --git a/src/api/time.c b/src/api/time.c
new file mode 100644 (file)
index 0000000..d5d3d6e
--- /dev/null
@@ -0,0 +1,88 @@
+#include <time.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(clock_t)
+T(size_t)
+T(time_t)
+#ifdef _POSIX_C_SOURCE
+T(clockid_t)
+T(timer_t)
+T(locale_t)
+T(pid_t)
+T(struct sigevent)
+{
+struct timespec x;
+F(time_t,tv_sec)
+F(long,tv_nsec)
+}
+{
+struct itimerspec x;
+F(struct timespec,it_interval)
+F(struct timespec,it_value)
+}
+C(CLOCK_MONOTONIC)
+C(CLOCK_PROCESS_CPUTIME_ID)
+C(CLOCK_REALTIME)
+C(CLOCK_THREAD_CPUTIME_ID)
+#endif
+{
+struct tm x;
+F(int,tm_sec)
+F(int,tm_min)
+F(int,tm_hour)
+F(int,tm_mday)
+F(int,tm_mon)
+F(int,tm_year)
+F(int,tm_wday)
+F(int,tm_yday)
+F(int,tm_isdst)
+}
+{void *x = NULL;}
+{int x = CLOCKS_PER_SEC;}
+C(TIMER_ABSTIME)
+char*(*p_asctime)(const struct tm*) = asctime;
+clock_t(*p_clock)(void) = clock;
+char*(*p_ctime)(const time_t*) = ctime;
+{int i = daylight;}
+double(*p_difftime)(time_t,time_t) = difftime;
+struct tm*(*p_gmtime)(const time_t*) = gmtime;
+struct tm*(*p_localtime)(const time_t*) = localtime;
+time_t(*p_mktime)(struct tm*) = mktime;
+size_t(*p_strftime)(char*restrict,size_t,const char*restrict,const struct tm*restrict) = strftime;
+time_t(*p_time)(time_t*) = time;
+#ifdef _POSIX_C_SOURCE
+char*(*p_asctime_r)(const struct tm*restrict,char*restrict) = asctime_r;
+int(*p_clock_getcpuclockid)(pid_t,clockid_t*) = clock_getcpuclockid;
+int(*p_clock_getres)(clockid_t,struct timespec*) = clock_getres;
+int(*p_clock_gettime)(clockid_t,struct timespec*) = clock_gettime;
+int(*p_clock_nanosleep)(clockid_t,int,const struct timespec*,struct timespec*) = clock_nanosleep;
+int(*p_clock_settime)(clockid_t,const struct timespec*) = clock_settime;
+char*(*p_ctime_r)(const time_t*,char*) = ctime_r;
+struct tm*(*p_gmtime_r)(const time_t*restrict,struct tm*restrict) = gmtime_r;
+struct tm*(*p_localtime_r)(const time_t*restrict,struct tm*restrict) = localtime_r;
+int(*p_nanosleep)(const struct timespec*,struct timespec*) = nanosleep;
+size_t(*p_strftime_l)(char*restrict,size_t,const char*restrict,const struct tm*restrict,locale_t) = strftime_l;
+int(*p_timer_delete)(timer_t) = timer_delete;
+int(*p_timer_getoverrun)(timer_t) = timer_getoverrun;
+int(*p_timer_gettime)(timer_t,struct itimerspec*) = timer_gettime;
+int(*p_timer_settime)(timer_t,int,const struct itimerspec*restrict,struct itimerspec*restrict) = timer_settime;
+{char **x = tzname;}
+void(*p_tzset)(void) = tzset;
+#endif
+#ifdef _XOPEN_SOURCE
+struct tm*(*p_getdate)(const char*) = getdate;
+{int i = getdate_err;}
+char*(*p_strptime)(const char*restrict,const char*restrict,struct tm*restrict) = strptime;
+{long i = timezone;}
+#endif
+}
+#ifdef _POSIX_C_SOURCE
+#include <signal.h>
+static void g()
+{
+int(*p_timer_create)(clockid_t,struct sigevent*restrict,timer_t*restrict) = timer_create;
+}
+#endif
diff --git a/src/api/unistd.c b/src/api/unistd.c
new file mode 100644 (file)
index 0000000..10a94cd
--- /dev/null
@@ -0,0 +1,282 @@
+#include <unistd.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+C(_POSIX_VERSION)
+C(_POSIX2_VERSION)
+#ifdef _XOPEN_SOURCE)
+C(_XOPEN_VERSION)
+#endif
+C(F_OK)
+C(R_OK)
+C(W_OK)
+C(X_OK)
+C(_CS_PATH)
+C(_CS_POSIX_V7_ILP32_OFF32_CFLAGS)
+C(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS)
+C(_CS_POSIX_V7_ILP32_OFF32_LIBS)
+C(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS)
+C(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS)
+C(_CS_POSIX_V7_ILP32_OFFBIG_LIBS)
+C(_CS_POSIX_V7_LP64_OFF64_CFLAGS)
+C(_CS_POSIX_V7_LP64_OFF64_LDFLAGS)
+C(_CS_POSIX_V7_LP64_OFF64_LIBS)
+C(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS)
+C(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS)
+C(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS)
+C(_CS_POSIX_V7_THREADS_CFLAGS)
+C(_CS_POSIX_V7_THREADS_LDFLAGS)
+C(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS)
+C(_CS_V7_ENV)
+C(SEEK_CUR)
+C(SEEK_END)
+C(SEEK_SET)
+C(F_LOCK)
+C(F_TEST)
+C(F_TLOCK)
+C(F_ULOCK)
+C(_PC_2_SYMLINKS)
+C(_PC_ALLOC_SIZE_MIN)
+C(_PC_ASYNC_IO)
+C(_PC_CHOWN_RESTRICTED)
+C(_PC_FILESIZEBITS)
+C(_PC_LINK_MAX)
+C(_PC_MAX_CANON)
+C(_PC_MAX_INPUT)
+C(_PC_NAME_MAX)
+C(_PC_NO_TRUNC)
+C(_PC_PATH_MAX)
+C(_PC_PIPE_BUF)
+C(_PC_PRIO_IO)
+C(_PC_REC_INCR_XFER_SIZE)
+C(_PC_REC_MAX_XFER_SIZE)
+C(_PC_REC_MIN_XFER_SIZE)
+C(_PC_REC_XFER_ALIGN)
+C(_PC_SYMLINK_MAX)
+C(_PC_SYNC_IO)
+C(_PC_TIMESTAMP_RESOLUTION)
+C(_PC_VDISABLE)
+C(_SC_2_C_BIND)
+C(_SC_2_C_DEV)
+C(_SC_2_CHAR_TERM)
+C(_SC_2_FORT_DEV)
+C(_SC_2_FORT_RUN)
+C(_SC_2_LOCALEDEF)
+C(_SC_2_PBS)
+C(_SC_2_PBS_ACCOUNTING)
+C(_SC_2_PBS_CHECKPOINT)
+C(_SC_2_PBS_LOCATE)
+C(_SC_2_PBS_MESSAGE)
+C(_SC_2_PBS_TRACK)
+C(_SC_2_SW_DEV)
+C(_SC_2_UPE)
+C(_SC_2_VERSION)
+C(_SC_ADVISORY_INFO)
+C(_SC_AIO_LISTIO_MAX)
+C(_SC_AIO_MAX)
+C(_SC_AIO_PRIO_DELTA_MAX)
+C(_SC_ARG_MAX)
+C(_SC_ASYNCHRONOUS_IO)
+C(_SC_ATEXIT_MAX)
+C(_SC_BARRIERS)
+C(_SC_BC_BASE_MAX)
+C(_SC_BC_DIM_MAX)
+C(_SC_BC_SCALE_MAX)
+C(_SC_BC_STRING_MAX)
+C(_SC_CHILD_MAX)
+C(_SC_CLK_TCK)
+C(_SC_CLOCK_SELECTION)
+C(_SC_COLL_WEIGHTS_MAX)
+C(_SC_CPUTIME)
+C(_SC_DELAYTIMER_MAX)
+C(_SC_EXPR_NEST_MAX)
+C(_SC_FSYNC)
+C(_SC_GETGR_R_SIZE_MAX)
+C(_SC_GETPW_R_SIZE_MAX)
+C(_SC_HOST_NAME_MAX)
+C(_SC_IOV_MAX)
+C(_SC_IPV6)
+C(_SC_JOB_CONTROL)
+C(_SC_LINE_MAX)
+C(_SC_LOGIN_NAME_MAX)
+C(_SC_MAPPED_FILES)
+C(_SC_MEMLOCK)
+C(_SC_MEMLOCK_RANGE)
+C(_SC_MEMORY_PROTECTION)
+C(_SC_MESSAGE_PASSING)
+C(_SC_MONOTONIC_CLOCK)
+C(_SC_MQ_OPEN_MAX)
+C(_SC_MQ_PRIO_MAX)
+C(_SC_NGROUPS_MAX)
+C(_SC_OPEN_MAX)
+C(_SC_PAGE_SIZE)
+C(_SC_PAGESIZE)
+C(_SC_PRIORITIZED_IO)
+C(_SC_PRIORITY_SCHEDULING)
+C(_SC_RAW_SOCKETS)
+C(_SC_RE_DUP_MAX)
+C(_SC_READER_WRITER_LOCKS)
+C(_SC_REALTIME_SIGNALS)
+C(_SC_REGEXP)
+C(_SC_RTSIG_MAX)
+C(_SC_SAVED_IDS)
+C(_SC_SEM_NSEMS_MAX)
+C(_SC_SEM_VALUE_MAX)
+C(_SC_SEMAPHORES)
+C(_SC_SHARED_MEMORY_OBJECTS)
+C(_SC_SHELL)
+C(_SC_SIGQUEUE_MAX)
+C(_SC_SPAWN)
+C(_SC_SPIN_LOCKS)
+C(_SC_SPORADIC_SERVER)
+C(_SC_SS_REPL_MAX)
+C(_SC_STREAM_MAX)
+C(_SC_SYMLOOP_MAX)
+C(_SC_SYNCHRONIZED_IO)
+C(_SC_THREAD_ATTR_STACKADDR)
+C(_SC_THREAD_ATTR_STACKSIZE)
+C(_SC_THREAD_CPUTIME)
+C(_SC_THREAD_DESTRUCTOR_ITERATIONS)
+C(_SC_THREAD_KEYS_MAX)
+C(_SC_THREAD_PRIO_INHERIT)
+C(_SC_THREAD_PRIO_PROTECT)
+C(_SC_THREAD_PRIORITY_SCHEDULING)
+C(_SC_THREAD_PROCESS_SHARED)
+C(_SC_THREAD_ROBUST_PRIO_INHERIT)
+C(_SC_THREAD_ROBUST_PRIO_PROTECT)
+C(_SC_THREAD_SAFE_FUNCTIONS)
+C(_SC_THREAD_SPORADIC_SERVER)
+C(_SC_THREAD_STACK_MIN)
+C(_SC_THREAD_THREADS_MAX)
+C(_SC_THREADS)
+C(_SC_TIMEOUTS)
+C(_SC_TIMER_MAX)
+C(_SC_TIMERS)
+C(_SC_TRACE)
+C(_SC_TRACE_EVENT_FILTER)
+C(_SC_TRACE_EVENT_NAME_MAX)
+C(_SC_TRACE_INHERIT)
+C(_SC_TRACE_LOG)
+C(_SC_TRACE_NAME_MAX)
+C(_SC_TRACE_SYS_MAX)
+C(_SC_TRACE_USER_EVENT_MAX)
+C(_SC_TTY_NAME_MAX)
+C(_SC_TYPED_MEMORY_OBJECTS)
+C(_SC_TZNAME_MAX)
+C(_SC_V7_ILP32_OFF32)
+C(_SC_V7_ILP32_OFFBIG)
+C(_SC_V7_LP64_OFF64)
+C(_SC_V7_LPBIG_OFFBIG)
+C(_SC_VERSION)
+C(_SC_XOPEN_CRYPT)
+C(_SC_XOPEN_ENH_I18N)
+C(_SC_XOPEN_REALTIME)
+C(_SC_XOPEN_REALTIME_THREADS)
+C(_SC_XOPEN_SHM)
+C(_SC_XOPEN_STREAMS)
+C(_SC_XOPEN_UNIX)
+C(_SC_XOPEN_UUCP)
+C(_SC_XOPEN_VERSION)
+C(STDERR_FILENO)
+C(STDIN_FILENO)
+C(STDOUT_FILENO)
+C(_POSIX_VDISABLE)
+T(size_t)
+T(ssize_t)
+T(uid_t)
+T(gid_t)
+T(off_t)
+T(pid_t)
+T(intptr_t)
+void(*p__exit)(int) = _exit;
+int(*p_access)(const char*,int) = access;
+unsigned(*p_alarm)(unsigned) = alarm;
+int(*p_chdir)(const char*) = chdir;
+int(*p_chown)(const char*,uid_t,gid_t) = chown;
+int(*p_close)(int) = close;
+size_t(*p_confstr)(int,char*,size_t) = confstr;
+char*(*p_ctermid)(char*) = ctermid;
+int(*p_dup)(int) = dup;
+int(*p_dup2)(int,int) = dup2;
+{char **x = environ};
+int(*p_execl)(const char*,const char*,...) = execl;
+int(*p_execle)(const char*,const char*,...) = execle;
+int(*p_execlp)(const char*,const char*,...) = execlp;
+int(*p_execv)(const char*,char*const[]) = execv;
+int(*p_execve)(const char*,char*const[],char*const[]) = execve;
+int(*p_execvp)(const char*,char*const[]) = execvp;
+int(*p_faccessat)(int,const char*,int,int) = faccessat;
+int(*p_fchdir)(int) = fchdir;
+int(*p_fchown)(int,uid_t,gid_t) = fchown;
+int(*p_fchownat)(int,const char*,uid_t,gid_t,int) = fchownat;
+int(*p_fdatasync)(int) = fdatasync;
+int(*p_fexecve)(int,char*const[],char*const[]) = fexecve;
+pid_t(*p_fork)(void) = fork;
+long(*p_fpathconf)(int,int) = fpathconf;
+int(*p_fsync)(int) = fsync;
+int(*p_ftruncate)(int,off_t) = ftruncate;
+char*(*p_getcwd)(char*,size_t) = getcwd;
+gid_t(*p_getegid)(void) = getegid;
+uid_t(*p_geteuid)(void) = geteuid;
+gid_t(*p_getgid)(void) = getgid;
+int(*p_getgroups)(int,gid_t[]) = getgroups;
+int(*p_gethostname)(char*,size_t) = gethostname;
+char*(*p_getlogin)(void) = getlogin;
+int(*p_getlogin_r)(char*,size_t) = getlogin_r;
+int(*p_getopt)(int,char*const[],const char*) = getopt;
+pid_t(*p_getpgid)(pid_t) = getpgid;
+pid_t(*p_getpgrp)(void) = getpgrp;
+pid_t(*p_getpid)(void) = getpid;
+pid_t(*p_getppid)(void) = getppid;
+pid_t(*p_getsid)(pid_t) = getsid;
+uid_t(*p_getuid)(void) = getuid;
+int(*p_isatty)(int) = isatty;
+int(*p_lchown)(const char*,uid_t,gid_t) = lchown;
+int(*p_link)(const char*,const char*) = link;
+int(*p_linkat)(int,const char*,int,const char*,int) = linkat;
+off_t(*p_lseek)(int,off_t,int) = lseek;
+{char *x = optarg;}
+{int i = opterr;}
+{int i = optind;}
+{int i = optopt;}
+long(*p_pathconf)(const char*,int) = pathconf;
+int(*p_pause)(void) = pause;
+int(*p_pipe)(int[]) = pipe;
+ssize_t(*p_pread)(int,void*,size_t,off_t) = pread;
+ssize_t(*p_pwrite)(int,const void*,size_t,off_t) = pwrite;
+ssize_t(*p_read)(int,void*,size_t) = read;
+ssize_t(*p_readlink)(const char*restrict,char*restrict,size_t) = readlink;
+ssize_t(*p_readlinkat)(int,const char*restrict,char*restrict,size_t) = readlinkat;
+int(*p_rmdir)(const char*) = rmdir;
+int(*p_setegid)(gid_t) = setegid;
+int(*p_seteuid)(uid_t) = seteuid;
+int(*p_setgid)(gid_t) = setgid;
+int(*p_setpgid)(pid_t,pid_t) = setpgid;
+pid_t(*p_setsid)(void) = setsid;
+int(*p_setuid)(uid_t) = setuid;
+unsigned(*p_sleep)(unsigned) = sleep;
+int(*p_symlink)(const char*,const char*) = symlink;
+int(*p_symlinkat)(const char*,int,const char*) = symlinkat;
+long(*p_sysconf)(int) = sysconf;
+pid_t(*p_tcgetpgrp)(int) = tcgetpgrp;
+int(*p_tcsetpgrp)(int,pid_t) = tcsetpgrp;
+int(*p_truncate)(const char*,off_t) = truncate;
+char*(*p_ttyname)(int) = ttyname;
+int(*p_ttyname_r)(int,char*,size_t) = ttyname_r;
+int(*p_unlink)(const char*) = unlink;
+int(*p_unlinkat)(int,const char*,int) = unlinkat;
+ssize_t(*p_write)(int,const void*,size_t) = write;
+#ifdef _XOPEN_SOURCE
+char*(*p_crypt)(const char*,const char*) = crypt;
+void(*p_encrypt)(char[],int) = encrypt;
+long(*p_gethostid)(void) = gethostid;
+int(*p_lockf)(int,int,off_t) = lockf;
+int(*p_nice)(int) = nice;
+int(*p_setregid)(gid_t,gid_t) = setregid;
+int(*p_setreuid)(uid_t,uid_t) = setreuid;
+void(*p_swab)(const void*restrict,void*restrict,ssize_t) = swab;
+void(*p_sync)(void) = sync;
+#endif
+}
diff --git a/src/api/utmpx.c b/src/api/utmpx.c
new file mode 100644 (file)
index 0000000..a1bffdb
--- /dev/null
@@ -0,0 +1,32 @@
+#include <utmpx.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(pid_t)
+T(struct timeval)
+{
+struct utmpx x;
+F(char,ut_user[0])
+F(char,ut_id[0])
+F(char,ut_line[0])
+F(pid_t, ut_pid)
+F(short, ut_type)
+F(struct timeval,ut_tv)
+}
+C(EMPTY)
+C(BOOT_TIME)
+C(OLD_TIME)
+C(NEW_TIME)
+C(USER_PROCESS)
+C(INIT_PROCESS)
+C(LOGIN_PROCESS)
+C(DEAD_PROCESS)
+void(*p_endutxent)(void) = endutxent;
+struct utmpx*(*p_getutxent)(void) = getutxent;
+struct utmpx*(*p_getutxid)(const struct utmpx*) = getutxid;
+struct utmpx*(*p_getutxline)(const struct utmpx*) = getutxline;
+struct utmpx*(*p_pututxline)(const struct utmpx*) = pututxline;
+void(*p_setutxent)(void) = setutxent;
+}
diff --git a/src/api/wchar.c b/src/api/wchar.c
new file mode 100644 (file)
index 0000000..5aeab9d
--- /dev/null
@@ -0,0 +1,76 @@
+#include <wchar.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+#ifdef _POSIX_C_SOURCE
+T(FILE)
+T(locale_t)
+T(va_list)
+#endif
+T(mbstate_t)
+T(size_t)
+T(wchar_t)
+T(wint_t)
+C(WCHAR_MAX)
+C(WCHAR_MIN)
+C(WEOF)
+{void *x=NULL;}
+wint_t(*p_getwchar)(void) = getwchar;
+size_t(*p_mbrlen)(const char*restrict,size_t,mbstate_t*restrict) = mbrlen;
+size_t(*p_mbrtowc)(wchar_t*restrict,const char*restrict,size_t,mbstate_t*restrict) = mbrtowc;
+int(*p_mbsinit)(const mbstate_t*) = mbsinit;
+size_t(*p_mbsrtowcs)(wchar_t*restrict,const char**restrict,size_t,mbstate_t*restrict) = mbsrtowcs;
+wint_t(*p_putwchar)(wchar_t) = putwchar;
+size_t(*p_wcrtomb)(char*restrict,wchar_t,mbstate_t*restrict) = wcrtomb;
+wchar_t*(*p_wcscat)(wchar_t*restrict,const wchar_t*restrict) = wcscat;
+wchar_t*(*p_wcschr)(const wchar_t*,wchar_t) = wcschr;
+int(*p_wcscmp)(const wchar_t*,const wchar_t*) = wcscmp;
+int(*p_wcscoll)(const wchar_t*,const wchar_t*) = wcscoll;
+wchar_t*(*p_wcscpy)(wchar_t*restrict,const wchar_t*restrict) = wcscpy;
+size_t(*p_wcscspn)(const wchar_t*,const wchar_t*) = wcscspn;
+size_t(*p_wcsftime)(wchar_t*restrict,size_t,const wchar_t*restrict,const struct tm*restrict) = wcsftime;
+size_t(*p_wcslen)(const wchar_t*) = wcslen;
+wchar_t*(*p_wcsncat)(wchar_t*restrict,const wchar_t*restrict,size_t) = wcsncat;
+int(*p_wcsncmp)(const wchar_t*,const wchar_t*,size_t) = wcsncmp;
+wchar_t*(*p_wcsncpy)(wchar_t*restrict,const wchar_t*restrict,size_t) = wcsncpy;
+wchar_t*(*p_wcspbrk)(const wchar_t*,const wchar_t*) = wcspbrk;
+wchar_t*(*p_wcsrchr)(const wchar_t*,wchar_t) = wcsrchr;
+size_t(*p_wcsrtombs)(char*restrict,const wchar_t**restrict,size_t,mbstate_t*restrict) = wcsrtombs;
+size_t(*p_wcsspn)(const wchar_t*,const wchar_t*) = wcsspn;
+wchar_t*(*p_wcsstr)(const wchar_t*restrict,const wchar_t*restrict) = wcsstr;
+double(*p_wcstod)(const wchar_t*restrict,wchar_t**restrict) = wcstod;
+float(*p_wcstof)(const wchar_t*restrict,wchar_t**restrict) = wcstof;
+wchar_t*(*p_wcstok)(wchar_t*restrict,const wchar_t*restrict,wchar_t**restrict) = wcstok;
+long(*p_wcstol)(const wchar_t*restrict,wchar_t**restrict,int) = wcstol;
+long double(*p_wcstold)(const wchar_t*restrict,wchar_t**restrict) = wcstold;
+long long(*p_wcstoll)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoll;
+unsigned long(*p_wcstoul)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoul;
+unsigned long long(*p_wcstoull)(const wchar_t*restrict,wchar_t**restrict,int) = wcstoull;
+size_t(*p_wcsxfrm)(wchar_t*restrict,const wchar_t*restrict,size_t) = wcsxfrm;
+wchar_t*(*p_wmemchr)(const wchar_t*,wchar_t,size_t) = wmemchr;
+int(*p_wmemcmp)(const wchar_t*,const wchar_t*,size_t) = wmemcmp;
+wchar_t*(*p_wmemcpy)(wchar_t*restrict,const wchar_t*restrict,size_t) = wmemcpy;
+wchar_t*(*p_wmemmove)(wchar_t*,const wchar_t*,size_t) = wmemmove;
+wchar_t*(*p_wmemset)(wchar_t*,wchar_t,size_t) = wmemset;
+#ifdef _POSIX_C_SOURCE
+size_t(*p_mbsnrtowcs)(wchar_t*restrict,const char**restrict,size_t,size_t,mbstate_t*restrict) = mbsnrtowcs;
+FILE*(*p_open_wmemstream)(wchar_t**,size_t*) = open_wmemstream;
+wchar_t*(*p_wcpcpy)(wchar_t*restrict,const wchar_t*restrict) = wcpcpy;
+wchar_t*(*p_wcpncpy)(wchar_t*restrict,const wchar_t*restrict,size_t) = wcpncpy;
+int(*p_wcscasecmp)(const wchar_t*,const wchar_t*) = wcscasecmp;
+int(*p_wcscasecmp_l)(const wchar_t*,const wchar_t*,locale_t) = wcscasecmp_l;
+int(*p_wcscoll_l)(const wchar_t*,const wchar_t*,locale_t) = wcscoll_l;
+wchar_t*(*p_wcsdup)(const wchar_t*) = wcsdup;
+int(*p_wcsncasecmp)(const wchar_t*,const wchar_t*,size_t) = wcsncasecmp;
+int(*p_wcsncasecmp_l)(const wchar_t*,const wchar_t*,size_t,locale_t) = wcsncasecmp_l;
+size_t(*p_wcsnlen)(const wchar_t*,size_t) = wcsnlen;
+size_t(*p_wcsnrtombs)(char*restrict,const wchar_t**restrict,size_t,size_t,mbstate_t*restrict) = wcsnrtombs;
+size_t(*p_wcsxfrm_l)(wchar_t*restrict,const wchar_t*restrict,size_t,locale_t) = wcsxfrm_l;
+#endif
+#ifdef _XOPEN_SOURCE
+int(*p_wcswidth)(const wchar_t*,size_t) = wcswidth;
+int(*p_wcwidth)(wchar_t) = wcwidth;
+#endif
+}
diff --git a/src/api/wctype.c b/src/api/wctype.c
new file mode 100644 (file)
index 0000000..8326598
--- /dev/null
@@ -0,0 +1,52 @@
+#include <wctype.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(wint_t)
+T(wctrans_t)
+T(wctype_t)
+#ifdef _POSIX_C_SOURCE
+T(locale_t)
+#endif
+C(WEOF)
+int(*p_iswalnum)(wint_t) = iswalnum;
+int(*p_iswalpha)(wint_t) = iswalpha;
+int(*p_iswblank)(wint_t) = iswblank;
+int(*p_iswcntrl)(wint_t) = iswcntrl;
+int(*p_iswctype)(wint_t,wctype_t) = iswctype;
+int(*p_iswdigit)(wint_t) = iswdigit;
+int(*p_iswgraph)(wint_t) = iswgraph;
+int(*p_iswlower)(wint_t) = iswlower;
+int(*p_iswprint)(wint_t) = iswprint;
+int(*p_iswpunct)(wint_t) = iswpunct;
+int(*p_iswspace)(wint_t) = iswspace;
+int(*p_iswupper)(wint_t) = iswupper;
+int(*p_iswxdigit)(wint_t) = iswxdigit;
+wint_t(*p_towctrans)(wint_t,wctrans_t) = towctrans;
+wint_t(*p_towlower)(wint_t) = towlower;
+wint_t(*p_towupper)(wint_t) = towupper;
+wctrans_t(*p_wctrans)(const char*) = wctrans;
+wctype_t(*p_wctype)(const char*) = wctype;
+#ifdef _POSIX_C_SOURCE
+int(*p_iswalnum_l)(wint_t,locale_t) = iswalnum_l;
+int(*p_iswalpha_l)(wint_t,locale_t) = iswalpha_l;
+int(*p_iswblank_l)(wint_t,locale_t) = iswblank_l;
+int(*p_iswcntrl_l)(wint_t,locale_t) = iswcntrl_l;
+int(*p_iswctype_l)(wint_t,wctype_t,locale_t) = iswctype_l;
+int(*p_iswdigit_l)(wint_t,locale_t) = iswdigit_l;
+int(*p_iswgraph_l)(wint_t,locale_t) = iswgraph_l;
+int(*p_iswlower_l)(wint_t,locale_t) = iswlower_l;
+int(*p_iswprint_l)(wint_t,locale_t) = iswprint_l;
+int(*p_iswpunct_l)(wint_t,locale_t) = iswpunct_l;
+int(*p_iswspace_l)(wint_t,locale_t) = iswspace_l;
+int(*p_iswupper_l)(wint_t,locale_t) = iswupper_l;
+int(*p_iswxdigit_l)(wint_t,locale_t) = iswxdigit_l;
+wint_t(*p_towctrans_l)(wint_t,wctrans_t,locale_t) = towctrans_l;
+wint_t(*p_towlower_l)(wint_t,locale_t) = towlower_l;
+wint_t(*p_towupper_l)(wint_t,locale_t) = towupper_l;
+wctrans_t(*p_wctrans_l)(const char*,locale_t) = wctrans_l;
+wctype_t(*p_wctype_l)(const char*,locale_t) = wctype_l;
+#endif
+}
diff --git a/src/api/wordexp.c b/src/api/wordexp.c
new file mode 100644 (file)
index 0000000..5f89956
--- /dev/null
@@ -0,0 +1,27 @@
+#include <wordexp.h>
+#define T(t) (t*)0;
+#define F(t,n) {t *y = &x.n;}
+#define C(n) switch(n){case n:;}
+static void f()
+{
+T(size_t)
+{
+wordexp_t x;
+F(size_t, we_wordc)
+F(char **,we_wordv)
+F(size_t, we_offs)
+}
+C(WRDE_APPEND)
+C(WRDE_DOOFFS)
+C(WRDE_NOCMD)
+C(WRDE_REUSE)
+C(WRDE_SHOWERR)
+C(WRDE_UNDEF)
+C(WRDE_BADCHAR)
+C(WRDE_BADVAL)
+C(WRDE_CMDSUB)
+C(WRDE_NOSPACE)
+C(WRDE_SYNTAX)
+int(*p_wordexp)(const char*restrict,wordexp_t*restrict,int) = wordexp;
+void(*p_wordfree)(wordexp_t*) = wordfree;
+}