From 6f745bb1829160c3da8034b00ea4725faf7f4340 Mon Sep 17 00:00:00 2001 From: Mystery Man Date: Sat, 15 Mar 2003 15:26:37 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'V9_1_25mdk'. --- mdk-stage1/dietlibc/lib/__dtostr.c | 104 ----------- mdk-stage1/dietlibc/lib/__fstat64.c | 25 --- mdk-stage1/dietlibc/lib/__getcwd.c | 10 - mdk-stage1/dietlibc/lib/__isnan.c | 14 -- mdk-stage1/dietlibc/lib/__lltostr.c | 31 ---- mdk-stage1/dietlibc/lib/__lstat64.c | 25 --- mdk-stage1/dietlibc/lib/__ltostr.c | 31 ---- mdk-stage1/dietlibc/lib/__stat64.c | 25 --- mdk-stage1/dietlibc/lib/__stat64_cvt.c | 18 -- mdk-stage1/dietlibc/lib/__xmknod.c | 6 - mdk-stage1/dietlibc/lib/_brk.c | 14 -- mdk-stage1/dietlibc/lib/abort.c | 13 -- mdk-stage1/dietlibc/lib/abs.c | 6 - mdk-stage1/dietlibc/lib/accept.c | 14 -- mdk-stage1/dietlibc/lib/alarm.c | 47 ----- mdk-stage1/dietlibc/lib/alloc.c | 243 ------------------------ mdk-stage1/dietlibc/lib/assert_fail.c | 30 --- mdk-stage1/dietlibc/lib/atexit.c | 23 --- mdk-stage1/dietlibc/lib/atof.c | 10 - mdk-stage1/dietlibc/lib/atoi.c | 8 - mdk-stage1/dietlibc/lib/atol.c | 8 - mdk-stage1/dietlibc/lib/bind.c | 12 -- mdk-stage1/dietlibc/lib/bsearch.c | 20 -- mdk-stage1/dietlibc/lib/cfmakeraw.c | 14 -- mdk-stage1/dietlibc/lib/closedir.c | 10 - mdk-stage1/dietlibc/lib/connect.c | 14 -- mdk-stage1/dietlibc/lib/creat.c | 5 - mdk-stage1/dietlibc/lib/creat64.c | 9 - mdk-stage1/dietlibc/lib/errlist.c | 132 -------------- mdk-stage1/dietlibc/lib/errno_location.c | 5 - mdk-stage1/dietlibc/lib/exec_lib.c | 20 -- mdk-stage1/dietlibc/lib/exec_lib.h | 9 - mdk-stage1/dietlibc/lib/execl.c | 24 --- mdk-stage1/dietlibc/lib/execlp.c | 26 --- mdk-stage1/dietlibc/lib/execv.c | 13 -- mdk-stage1/dietlibc/lib/execvp.c | 38 ---- mdk-stage1/dietlibc/lib/ftw.c | 52 ------ mdk-stage1/dietlibc/lib/getdomainname.c | 17 -- mdk-stage1/dietlibc/lib/getenv.c | 17 -- mdk-stage1/dietlibc/lib/gethostname.c | 18 -- mdk-stage1/dietlibc/lib/getopt.c | 118 ------------ mdk-stage1/dietlibc/lib/getpeername.c | 13 -- mdk-stage1/dietlibc/lib/getpgrp.c | 6 - mdk-stage1/dietlibc/lib/getservent.c | 137 -------------- mdk-stage1/dietlibc/lib/getsockname.c | 13 -- mdk-stage1/dietlibc/lib/getsockopt.c | 13 -- mdk-stage1/dietlibc/lib/htonl.c | 12 -- mdk-stage1/dietlibc/lib/htons.c | 11 -- mdk-stage1/dietlibc/lib/if_indextoname.c | 29 --- mdk-stage1/dietlibc/lib/if_nametoindex.c | 27 --- mdk-stage1/dietlibc/lib/isalnum.c | 7 - mdk-stage1/dietlibc/lib/isalpha.c | 7 - mdk-stage1/dietlibc/lib/isascii.c | 6 - mdk-stage1/dietlibc/lib/isatty.c | 20 -- mdk-stage1/dietlibc/lib/isblank.c | 6 - mdk-stage1/dietlibc/lib/iscntrl.c | 7 - mdk-stage1/dietlibc/lib/isdigit.c | 7 - mdk-stage1/dietlibc/lib/isgraph.c | 5 - mdk-stage1/dietlibc/lib/islower.c | 7 - mdk-stage1/dietlibc/lib/isprint.c | 6 - mdk-stage1/dietlibc/lib/ispunct.c | 7 - mdk-stage1/dietlibc/lib/isspace.c | 8 - mdk-stage1/dietlibc/lib/isupper.c | 7 - mdk-stage1/dietlibc/lib/isxdigit.c | 5 - mdk-stage1/dietlibc/lib/listen.c | 13 -- mdk-stage1/dietlibc/lib/lockf.c | 37 ---- mdk-stage1/dietlibc/lib/longjmp.c | 51 ------ mdk-stage1/dietlibc/lib/lseek64.c | 22 --- mdk-stage1/dietlibc/lib/memccmp.c | 17 -- mdk-stage1/dietlibc/lib/memccpy.c | 19 -- mdk-stage1/dietlibc/lib/memchr.c | 9 - mdk-stage1/dietlibc/lib/memcmp.c | 16 -- mdk-stage1/dietlibc/lib/memcpy.c | 12 -- mdk-stage1/dietlibc/lib/memmove.c | 23 --- mdk-stage1/dietlibc/lib/memset.c | 9 - mdk-stage1/dietlibc/lib/mkfifo.c | 6 - mdk-stage1/dietlibc/lib/msgctl.c | 10 - mdk-stage1/dietlibc/lib/msgget.c | 10 - mdk-stage1/dietlibc/lib/msgrcv.c | 13 -- mdk-stage1/dietlibc/lib/msgsnd.c | 10 - mdk-stage1/dietlibc/lib/nop.c | 7 - mdk-stage1/dietlibc/lib/open64.c | 14 -- mdk-stage1/dietlibc/lib/opendir.c | 18 -- mdk-stage1/dietlibc/lib/perror.c | 22 --- mdk-stage1/dietlibc/lib/pread.c | 10 - mdk-stage1/dietlibc/lib/pread64.c | 13 -- mdk-stage1/dietlibc/lib/putenv.c | 37 ---- mdk-stage1/dietlibc/lib/puts.c | 12 -- mdk-stage1/dietlibc/lib/qsort.c | 125 ------------- mdk-stage1/dietlibc/lib/raise.c | 8 - mdk-stage1/dietlibc/lib/rand.c | 9 - mdk-stage1/dietlibc/lib/random.c | 9 - mdk-stage1/dietlibc/lib/readdir.c | 13 -- mdk-stage1/dietlibc/lib/reboot.c | 8 - mdk-stage1/dietlibc/lib/recv.c | 15 -- mdk-stage1/dietlibc/lib/recvfrom.c | 15 -- mdk-stage1/dietlibc/lib/recvmsg.c | 15 -- mdk-stage1/dietlibc/lib/remove.c | 11 -- mdk-stage1/dietlibc/lib/rewind.c | 6 - mdk-stage1/dietlibc/lib/rewinddir.c | 8 - mdk-stage1/dietlibc/lib/sbrk.c | 20 -- mdk-stage1/dietlibc/lib/seekdir.c | 8 - mdk-stage1/dietlibc/lib/semctl.c | 10 - mdk-stage1/dietlibc/lib/semget.c | 10 - mdk-stage1/dietlibc/lib/semop.c | 10 - mdk-stage1/dietlibc/lib/send.c | 15 -- mdk-stage1/dietlibc/lib/sendmsg.c | 15 -- mdk-stage1/dietlibc/lib/sendto.c | 15 -- mdk-stage1/dietlibc/lib/set_errno.c | 9 - mdk-stage1/dietlibc/lib/setpgrp.c | 6 - mdk-stage1/dietlibc/lib/setsockopt.c | 13 -- mdk-stage1/dietlibc/lib/shmat.c | 15 -- mdk-stage1/dietlibc/lib/shmctl.c | 10 - mdk-stage1/dietlibc/lib/shmdt.c | 10 - mdk-stage1/dietlibc/lib/shmget.c | 10 - mdk-stage1/dietlibc/lib/shutdown.c | 14 -- mdk-stage1/dietlibc/lib/sigaddset.c | 15 -- mdk-stage1/dietlibc/lib/sigdelset.c | 15 -- mdk-stage1/dietlibc/lib/sigemptyset.c | 14 -- mdk-stage1/dietlibc/lib/sigfillset.c | 11 -- mdk-stage1/dietlibc/lib/sigismember.c | 21 --- mdk-stage1/dietlibc/lib/sigjmp.c | 35 ---- mdk-stage1/dietlibc/lib/sleep.c | 11 -- mdk-stage1/dietlibc/lib/snprintf.c | 14 -- mdk-stage1/dietlibc/lib/socket.c | 12 -- mdk-stage1/dietlibc/lib/speed.c | 67 ------- mdk-stage1/dietlibc/lib/sprintf.c | 18 -- mdk-stage1/dietlibc/lib/sscanf.c | 13 -- mdk-stage1/dietlibc/lib/strcasecmp.c | 17 -- mdk-stage1/dietlibc/lib/strcat.c | 18 -- mdk-stage1/dietlibc/lib/strchr.c | 18 -- mdk-stage1/dietlibc/lib/strcmp.c | 16 -- mdk-stage1/dietlibc/lib/strcpy.c | 15 -- mdk-stage1/dietlibc/lib/strcspn.c | 17 -- mdk-stage1/dietlibc/lib/strdup.c | 9 - mdk-stage1/dietlibc/lib/strerror.c | 10 - mdk-stage1/dietlibc/lib/strlcat.c | 72 -------- mdk-stage1/dietlibc/lib/strlcpy.3 | 169 ----------------- mdk-stage1/dietlibc/lib/strlcpy.c | 68 ------- mdk-stage1/dietlibc/lib/strlen.c | 47 ----- mdk-stage1/dietlibc/lib/strncasecmp.c | 18 -- mdk-stage1/dietlibc/lib/strncat.c | 31 ---- mdk-stage1/dietlibc/lib/strncmp.c | 6 - mdk-stage1/dietlibc/lib/strncpy.c | 10 - mdk-stage1/dietlibc/lib/strpbrk.c | 11 -- mdk-stage1/dietlibc/lib/strrchr.c | 20 -- mdk-stage1/dietlibc/lib/strsep.c | 16 -- mdk-stage1/dietlibc/lib/strspn.c | 17 -- mdk-stage1/dietlibc/lib/strstr.c | 15 -- mdk-stage1/dietlibc/lib/strtod.c | 52 ------ mdk-stage1/dietlibc/lib/strtok.c | 8 - mdk-stage1/dietlibc/lib/strtok_r.c | 21 --- mdk-stage1/dietlibc/lib/strtol.c | 15 -- mdk-stage1/dietlibc/lib/strtoll.c | 15 -- mdk-stage1/dietlibc/lib/strtoul.c | 32 ---- mdk-stage1/dietlibc/lib/strtoull.c | 30 --- mdk-stage1/dietlibc/lib/sys_siglist.c | 37 ---- mdk-stage1/dietlibc/lib/tcdrain.c | 8 - mdk-stage1/dietlibc/lib/tcflush.c | 23 --- mdk-stage1/dietlibc/lib/tcgetattr.c | 7 - mdk-stage1/dietlibc/lib/tcgetpgrp.c | 7 - mdk-stage1/dietlibc/lib/tcsetattr.c | 27 --- mdk-stage1/dietlibc/lib/tcsetpgrp.c | 7 - mdk-stage1/dietlibc/lib/telldir.c | 7 - mdk-stage1/dietlibc/lib/tolower.c | 6 - mdk-stage1/dietlibc/lib/toupper.c | 6 - mdk-stage1/dietlibc/lib/ttyname.c | 59 ------ mdk-stage1/dietlibc/lib/usleep.c | 12 -- mdk-stage1/dietlibc/lib/vfork.c | 6 - mdk-stage1/dietlibc/lib/vfprintf.c | 19 -- mdk-stage1/dietlibc/lib/vprintf.c | 14 -- mdk-stage1/dietlibc/lib/vsnprintf.c | 238 ------------------------ mdk-stage1/dietlibc/lib/vsprintf.c | 10 - mdk-stage1/dietlibc/lib/vsscanf.c | 304 ------------------------------- mdk-stage1/dietlibc/lib/wait.c | 6 - mdk-stage1/dietlibc/lib/wait3.c | 5 - 176 files changed, 4333 deletions(-) delete mode 100644 mdk-stage1/dietlibc/lib/__dtostr.c delete mode 100644 mdk-stage1/dietlibc/lib/__fstat64.c delete mode 100644 mdk-stage1/dietlibc/lib/__getcwd.c delete mode 100644 mdk-stage1/dietlibc/lib/__isnan.c delete mode 100644 mdk-stage1/dietlibc/lib/__lltostr.c delete mode 100644 mdk-stage1/dietlibc/lib/__lstat64.c delete mode 100644 mdk-stage1/dietlibc/lib/__ltostr.c delete mode 100644 mdk-stage1/dietlibc/lib/__stat64.c delete mode 100644 mdk-stage1/dietlibc/lib/__stat64_cvt.c delete mode 100644 mdk-stage1/dietlibc/lib/__xmknod.c delete mode 100644 mdk-stage1/dietlibc/lib/_brk.c delete mode 100644 mdk-stage1/dietlibc/lib/abort.c delete mode 100644 mdk-stage1/dietlibc/lib/abs.c delete mode 100644 mdk-stage1/dietlibc/lib/accept.c delete mode 100644 mdk-stage1/dietlibc/lib/alarm.c delete mode 100644 mdk-stage1/dietlibc/lib/alloc.c delete mode 100644 mdk-stage1/dietlibc/lib/assert_fail.c delete mode 100644 mdk-stage1/dietlibc/lib/atexit.c delete mode 100644 mdk-stage1/dietlibc/lib/atof.c delete mode 100644 mdk-stage1/dietlibc/lib/atoi.c delete mode 100644 mdk-stage1/dietlibc/lib/atol.c delete mode 100644 mdk-stage1/dietlibc/lib/bind.c delete mode 100644 mdk-stage1/dietlibc/lib/bsearch.c delete mode 100644 mdk-stage1/dietlibc/lib/cfmakeraw.c delete mode 100644 mdk-stage1/dietlibc/lib/closedir.c delete mode 100644 mdk-stage1/dietlibc/lib/connect.c delete mode 100644 mdk-stage1/dietlibc/lib/creat.c delete mode 100644 mdk-stage1/dietlibc/lib/creat64.c delete mode 100644 mdk-stage1/dietlibc/lib/errlist.c delete mode 100644 mdk-stage1/dietlibc/lib/errno_location.c delete mode 100644 mdk-stage1/dietlibc/lib/exec_lib.c delete mode 100644 mdk-stage1/dietlibc/lib/exec_lib.h delete mode 100644 mdk-stage1/dietlibc/lib/execl.c delete mode 100644 mdk-stage1/dietlibc/lib/execlp.c delete mode 100644 mdk-stage1/dietlibc/lib/execv.c delete mode 100644 mdk-stage1/dietlibc/lib/execvp.c delete mode 100644 mdk-stage1/dietlibc/lib/ftw.c delete mode 100644 mdk-stage1/dietlibc/lib/getdomainname.c delete mode 100644 mdk-stage1/dietlibc/lib/getenv.c delete mode 100644 mdk-stage1/dietlibc/lib/gethostname.c delete mode 100644 mdk-stage1/dietlibc/lib/getopt.c delete mode 100644 mdk-stage1/dietlibc/lib/getpeername.c delete mode 100644 mdk-stage1/dietlibc/lib/getpgrp.c delete mode 100644 mdk-stage1/dietlibc/lib/getservent.c delete mode 100644 mdk-stage1/dietlibc/lib/getsockname.c delete mode 100644 mdk-stage1/dietlibc/lib/getsockopt.c delete mode 100644 mdk-stage1/dietlibc/lib/htonl.c delete mode 100644 mdk-stage1/dietlibc/lib/htons.c delete mode 100644 mdk-stage1/dietlibc/lib/if_indextoname.c delete mode 100644 mdk-stage1/dietlibc/lib/if_nametoindex.c delete mode 100644 mdk-stage1/dietlibc/lib/isalnum.c delete mode 100644 mdk-stage1/dietlibc/lib/isalpha.c delete mode 100644 mdk-stage1/dietlibc/lib/isascii.c delete mode 100644 mdk-stage1/dietlibc/lib/isatty.c delete mode 100644 mdk-stage1/dietlibc/lib/isblank.c delete mode 100644 mdk-stage1/dietlibc/lib/iscntrl.c delete mode 100644 mdk-stage1/dietlibc/lib/isdigit.c delete mode 100644 mdk-stage1/dietlibc/lib/isgraph.c delete mode 100644 mdk-stage1/dietlibc/lib/islower.c delete mode 100644 mdk-stage1/dietlibc/lib/isprint.c delete mode 100644 mdk-stage1/dietlibc/lib/ispunct.c delete mode 100644 mdk-stage1/dietlibc/lib/isspace.c delete mode 100644 mdk-stage1/dietlibc/lib/isupper.c delete mode 100644 mdk-stage1/dietlibc/lib/isxdigit.c delete mode 100644 mdk-stage1/dietlibc/lib/listen.c delete mode 100644 mdk-stage1/dietlibc/lib/lockf.c delete mode 100644 mdk-stage1/dietlibc/lib/longjmp.c delete mode 100644 mdk-stage1/dietlibc/lib/lseek64.c delete mode 100644 mdk-stage1/dietlibc/lib/memccmp.c delete mode 100644 mdk-stage1/dietlibc/lib/memccpy.c delete mode 100644 mdk-stage1/dietlibc/lib/memchr.c delete mode 100644 mdk-stage1/dietlibc/lib/memcmp.c delete mode 100644 mdk-stage1/dietlibc/lib/memcpy.c delete mode 100644 mdk-stage1/dietlibc/lib/memmove.c delete mode 100644 mdk-stage1/dietlibc/lib/memset.c delete mode 100644 mdk-stage1/dietlibc/lib/mkfifo.c delete mode 100644 mdk-stage1/dietlibc/lib/msgctl.c delete mode 100644 mdk-stage1/dietlibc/lib/msgget.c delete mode 100644 mdk-stage1/dietlibc/lib/msgrcv.c delete mode 100644 mdk-stage1/dietlibc/lib/msgsnd.c delete mode 100644 mdk-stage1/dietlibc/lib/nop.c delete mode 100644 mdk-stage1/dietlibc/lib/open64.c delete mode 100644 mdk-stage1/dietlibc/lib/opendir.c delete mode 100644 mdk-stage1/dietlibc/lib/perror.c delete mode 100644 mdk-stage1/dietlibc/lib/pread.c delete mode 100644 mdk-stage1/dietlibc/lib/pread64.c delete mode 100644 mdk-stage1/dietlibc/lib/putenv.c delete mode 100644 mdk-stage1/dietlibc/lib/puts.c delete mode 100644 mdk-stage1/dietlibc/lib/qsort.c delete mode 100644 mdk-stage1/dietlibc/lib/raise.c delete mode 100644 mdk-stage1/dietlibc/lib/rand.c delete mode 100644 mdk-stage1/dietlibc/lib/random.c delete mode 100644 mdk-stage1/dietlibc/lib/readdir.c delete mode 100644 mdk-stage1/dietlibc/lib/reboot.c delete mode 100644 mdk-stage1/dietlibc/lib/recv.c delete mode 100644 mdk-stage1/dietlibc/lib/recvfrom.c delete mode 100644 mdk-stage1/dietlibc/lib/recvmsg.c delete mode 100644 mdk-stage1/dietlibc/lib/remove.c delete mode 100644 mdk-stage1/dietlibc/lib/rewind.c delete mode 100644 mdk-stage1/dietlibc/lib/rewinddir.c delete mode 100644 mdk-stage1/dietlibc/lib/sbrk.c delete mode 100644 mdk-stage1/dietlibc/lib/seekdir.c delete mode 100644 mdk-stage1/dietlibc/lib/semctl.c delete mode 100644 mdk-stage1/dietlibc/lib/semget.c delete mode 100644 mdk-stage1/dietlibc/lib/semop.c delete mode 100644 mdk-stage1/dietlibc/lib/send.c delete mode 100644 mdk-stage1/dietlibc/lib/sendmsg.c delete mode 100644 mdk-stage1/dietlibc/lib/sendto.c delete mode 100644 mdk-stage1/dietlibc/lib/set_errno.c delete mode 100644 mdk-stage1/dietlibc/lib/setpgrp.c delete mode 100644 mdk-stage1/dietlibc/lib/setsockopt.c delete mode 100644 mdk-stage1/dietlibc/lib/shmat.c delete mode 100644 mdk-stage1/dietlibc/lib/shmctl.c delete mode 100644 mdk-stage1/dietlibc/lib/shmdt.c delete mode 100644 mdk-stage1/dietlibc/lib/shmget.c delete mode 100644 mdk-stage1/dietlibc/lib/shutdown.c delete mode 100644 mdk-stage1/dietlibc/lib/sigaddset.c delete mode 100644 mdk-stage1/dietlibc/lib/sigdelset.c delete mode 100644 mdk-stage1/dietlibc/lib/sigemptyset.c delete mode 100644 mdk-stage1/dietlibc/lib/sigfillset.c delete mode 100644 mdk-stage1/dietlibc/lib/sigismember.c delete mode 100644 mdk-stage1/dietlibc/lib/sigjmp.c delete mode 100644 mdk-stage1/dietlibc/lib/sleep.c delete mode 100644 mdk-stage1/dietlibc/lib/snprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/socket.c delete mode 100644 mdk-stage1/dietlibc/lib/speed.c delete mode 100644 mdk-stage1/dietlibc/lib/sprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/sscanf.c delete mode 100644 mdk-stage1/dietlibc/lib/strcasecmp.c delete mode 100644 mdk-stage1/dietlibc/lib/strcat.c delete mode 100644 mdk-stage1/dietlibc/lib/strchr.c delete mode 100644 mdk-stage1/dietlibc/lib/strcmp.c delete mode 100644 mdk-stage1/dietlibc/lib/strcpy.c delete mode 100644 mdk-stage1/dietlibc/lib/strcspn.c delete mode 100644 mdk-stage1/dietlibc/lib/strdup.c delete mode 100644 mdk-stage1/dietlibc/lib/strerror.c delete mode 100644 mdk-stage1/dietlibc/lib/strlcat.c delete mode 100644 mdk-stage1/dietlibc/lib/strlcpy.3 delete mode 100644 mdk-stage1/dietlibc/lib/strlcpy.c delete mode 100644 mdk-stage1/dietlibc/lib/strlen.c delete mode 100644 mdk-stage1/dietlibc/lib/strncasecmp.c delete mode 100644 mdk-stage1/dietlibc/lib/strncat.c delete mode 100644 mdk-stage1/dietlibc/lib/strncmp.c delete mode 100644 mdk-stage1/dietlibc/lib/strncpy.c delete mode 100644 mdk-stage1/dietlibc/lib/strpbrk.c delete mode 100644 mdk-stage1/dietlibc/lib/strrchr.c delete mode 100644 mdk-stage1/dietlibc/lib/strsep.c delete mode 100644 mdk-stage1/dietlibc/lib/strspn.c delete mode 100644 mdk-stage1/dietlibc/lib/strstr.c delete mode 100644 mdk-stage1/dietlibc/lib/strtod.c delete mode 100644 mdk-stage1/dietlibc/lib/strtok.c delete mode 100644 mdk-stage1/dietlibc/lib/strtok_r.c delete mode 100644 mdk-stage1/dietlibc/lib/strtol.c delete mode 100644 mdk-stage1/dietlibc/lib/strtoll.c delete mode 100644 mdk-stage1/dietlibc/lib/strtoul.c delete mode 100644 mdk-stage1/dietlibc/lib/strtoull.c delete mode 100644 mdk-stage1/dietlibc/lib/sys_siglist.c delete mode 100644 mdk-stage1/dietlibc/lib/tcdrain.c delete mode 100644 mdk-stage1/dietlibc/lib/tcflush.c delete mode 100644 mdk-stage1/dietlibc/lib/tcgetattr.c delete mode 100644 mdk-stage1/dietlibc/lib/tcgetpgrp.c delete mode 100644 mdk-stage1/dietlibc/lib/tcsetattr.c delete mode 100644 mdk-stage1/dietlibc/lib/tcsetpgrp.c delete mode 100644 mdk-stage1/dietlibc/lib/telldir.c delete mode 100644 mdk-stage1/dietlibc/lib/tolower.c delete mode 100644 mdk-stage1/dietlibc/lib/toupper.c delete mode 100644 mdk-stage1/dietlibc/lib/ttyname.c delete mode 100644 mdk-stage1/dietlibc/lib/usleep.c delete mode 100644 mdk-stage1/dietlibc/lib/vfork.c delete mode 100644 mdk-stage1/dietlibc/lib/vfprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/vprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/vsnprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/vsprintf.c delete mode 100644 mdk-stage1/dietlibc/lib/vsscanf.c delete mode 100644 mdk-stage1/dietlibc/lib/wait.c delete mode 100644 mdk-stage1/dietlibc/lib/wait3.c (limited to 'mdk-stage1/dietlibc/lib') diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c deleted file mode 100644 index e9a8a83d3..000000000 --- a/mdk-stage1/dietlibc/lib/__dtostr.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -/* convert double to string. Helper for sprintf. */ - -int __dtostr(double d,char *buf,int maxlen,int prec) { - unsigned long long *x=(unsigned long long *)&d; - /* step 1: extract sign, mantissa and exponent */ - signed int s=*x>>63; - signed long e=((*x>>52)&((1<<11)-1))-1023; -/* unsigned long long m=*x & ((1ull<<52)-1); */ - /* step 2: exponent is base 2, compute exponent for base 10 */ - signed long e10=1+(long)(e*0.30102999566398119802); /* log10(2) */ - /* step 3: calculate 10^e10 */ - int i; - double tmp=10.0; - char *oldbuf=buf; - int initial=1; - - if (d==0.0) { - *buf='0'; ++buf; - goto done; - } - if (s) { d=-d; *buf='-'; --maxlen; buf++; } -/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */ - if (e10>=0) { - i=e10; - while (i>10) { tmp=tmp*1e10; i-=10; } - while (i>1) { tmp=tmp*10; --i; } - } else { - i=(e10=-e10); - while (i>10) { tmp=tmp*1e-10; i-=10; } - while (i>1) { tmp=tmp/10; --i; } - } - while (d/tmp<1) { - --e10; - tmp/=10.0; - } - /* step 4: see if precision is sufficient to display all digits */ - if (e10>prec) { - /* use scientific notation */ - int len=__dtostr(d/tmp,buf,maxlen,prec); - if (len==0) return 0; - maxlen-=len; buf+=len; - if (--maxlen>=0) { - *buf='e'; - ++buf; - } - for (len=1000; len>0; len/=10) { - if (e10>=len || !initial) { - if (--maxlen>=0) { - *buf=(e10/len)+'0'; - ++buf; - } - initial=0; - e10=e10%len; - } - } - if (maxlen>=0) return buf-oldbuf; - return 0; - } - /* step 5: loop through the digits, inserting the decimal point when - * appropriate */ - if (d<1.0) { - double x=1.0; - int first=1; - do { - if (--maxlen<0) return buf-oldbuf; - *buf='0'; ++buf; - if (first) { - first=0; - *buf='.'; ++buf; - if (--maxlen<0) return buf-oldbuf; - } - x/=10.0; - } while (x>d); - } - for (; prec>0; ) { - double tmp2=d/tmp; - char c; - d-=((int)tmp2*tmp); - c=((int)tmp2); - if ((!initial)||c) { - if (--maxlen>=0) { - initial=0; - *buf=c+'0'; - ++buf; - } else - return 0; - --prec; - } - if (tmp>0.5 && tmp<1.5) { - tmp=1e-1; - initial=0; - if (--maxlen>=0) { - *buf='.'; - ++buf; - } else - return 0; - } else - tmp/=10.0; - } -done: - *buf=0; - return buf-oldbuf; -} diff --git a/mdk-stage1/dietlibc/lib/__fstat64.c b/mdk-stage1/dietlibc/lib/__fstat64.c deleted file mode 100644 index 6f9fcb2c5..000000000 --- a/mdk-stage1/dietlibc/lib/__fstat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include -#ifndef __NO_STAT64 -#include - -extern int __dietlibc_fstat64(int __fd, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int fstat64(int __fd, struct stat64 *__buf) { - if (__dietlibc_fstat64(__fd,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (fstat(__fd,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__getcwd.c b/mdk-stage1/dietlibc/lib/__getcwd.c deleted file mode 100644 index e97fc4520..000000000 --- a/mdk-stage1/dietlibc/lib/__getcwd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern int __syscall_getcwd(char* buf, size_t size); - -char *getcwd(char *buf, size_t size) { - int tmp; - if ((tmp=__syscall_getcwd(buf,size))<0) return 0; - buf[tmp]=0; - return buf; -} diff --git a/mdk-stage1/dietlibc/lib/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c deleted file mode 100644 index 9d21e9824..000000000 --- a/mdk-stage1/dietlibc/lib/__isnan.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -int __isnan(double d) { - unsigned long long *x=(unsigned long long *)&d; - return (*x==0x7FF8002000000000ll || *x==0x7FF0002000000000); -} - -#if 0 -TestFromIeeeExtended("7FFF0000000000000000"); /* +infinity */ -TestFromIeeeExtended("FFFF0000000000000000"); /* -infinity */ -TestFromIeeeExtended("7FFF8001000000000000"); /* Quiet NaN(1) */ -TestFromIeeeExtended("7FFF0001000000000000"); /* Signalling NaN(1) */ -TestFromIeeeExtended("3FFFFEDCBA9876543210"); /* accuracy test */ -#endif diff --git a/mdk-stage1/dietlibc/lib/__lltostr.c b/mdk-stage1/dietlibc/lib/__lltostr.c deleted file mode 100644 index eb4a27cef..000000000 --- a/mdk-stage1/dietlibc/lib/__lltostr.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase) -{ - char *tmp; - int j=0; - - s[--size]=0; - - tmp=s+size; - - if ((base==0)||(base>36)) base=10; - - j=0; - if (!i) - { - *(--tmp)='0'; - j=1; - } - - while((tmp>s)&&(i)) - { - tmp--; - if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1; - i=i/base; - j++; - } - memmove(s,tmp,j+1); - - return j; -} diff --git a/mdk-stage1/dietlibc/lib/__lstat64.c b/mdk-stage1/dietlibc/lib/__lstat64.c deleted file mode 100644 index a871f3917..000000000 --- a/mdk-stage1/dietlibc/lib/__lstat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include -#ifndef __NO_STAT64 -#include - -extern int __dietlibc_lstat64(const char *__file, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int lstat64(const char *__file, struct stat64 *__buf) { - if (__dietlibc_lstat64(__file,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (lstat(__file,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__ltostr.c b/mdk-stage1/dietlibc/lib/__ltostr.c deleted file mode 100644 index 57e0690d2..000000000 --- a/mdk-stage1/dietlibc/lib/__ltostr.c +++ /dev/null @@ -1,31 +0,0 @@ -#include - -int __ltostr(char *s, int size, unsigned long i, int base, char UpCase) -{ - char *tmp; - int j=0; - - s[--size]=0; - - tmp=s+size; - - if ((base==0)||(base>36)) base=10; - - j=0; - if (!i) - { - *(--tmp)='0'; - j=1; - } - - while((tmp>s)&&(i)) - { - tmp--; - if ((*tmp=i%base+'0')>'9') *tmp+=(UpCase?'A':'a')-'9'-1; - i=i/base; - j++; - } - memmove(s,tmp,j+1); - - return j; -} diff --git a/mdk-stage1/dietlibc/lib/__stat64.c b/mdk-stage1/dietlibc/lib/__stat64.c deleted file mode 100644 index dfb0d4315..000000000 --- a/mdk-stage1/dietlibc/lib/__stat64.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include -#ifndef __NO_STAT64 -#include - -extern int __dietlibc_stat64(const char *__file, struct stat64 *__buf); -extern void __stat64_cvt(const struct stat *src,struct stat64 *dest); - -int stat64(const char *__file, struct stat64 *__buf) { - if (__dietlibc_stat64(__file,__buf)) { - struct stat temp; -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - if (stat(__file,&temp)) return -1; - __stat64_cvt(&temp,__buf); - } - return 0; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/__stat64_cvt.c b/mdk-stage1/dietlibc/lib/__stat64_cvt.c deleted file mode 100644 index dced352a4..000000000 --- a/mdk-stage1/dietlibc/lib/__stat64_cvt.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#ifndef __NO_STAT64 - -void __stat64_cvt(const struct stat *src,struct stat64 *dest) { - dest->st_dev=src->st_dev; - dest->st_ino=src->st_ino; - dest->st_mode=src->st_mode; - dest->st_nlink=src->st_nlink; - dest->st_uid=src->st_gid; - dest->st_rdev=src->st_rdev; - dest->st_size=src->st_size; - dest->st_blksize=src->st_blksize; - dest->st_blocks=src->st_blocks; - dest->st_atime=src->st_atime; - dest->st_mtime=src->st_mtime; - dest->st_ctime=src->st_ctime; -} -#endif diff --git a/mdk-stage1/dietlibc/lib/__xmknod.c b/mdk-stage1/dietlibc/lib/__xmknod.c deleted file mode 100644 index 4739a1f5f..000000000 --- a/mdk-stage1/dietlibc/lib/__xmknod.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int __xmknod(int ver,char* filename,mode_t mode,dev_t *dev) { - return mknod(filename,mode,*dev); -} - diff --git a/mdk-stage1/dietlibc/lib/_brk.c b/mdk-stage1/dietlibc/lib/_brk.c deleted file mode 100644 index 6d0b29c03..000000000 --- a/mdk-stage1/dietlibc/lib/_brk.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -extern int __diet_brk(void *end_data_segment); - -void* __curbrk=0; - -int __brk(void *end_data_segment) { - int res; - if ((res=__diet_brk(end_data_segment))==0) - __curbrk=end_data_segment; - return res; -} - -int brk (void *end_data_segment) __attribute__((weak,alias("__brk"))); diff --git a/mdk-stage1/dietlibc/lib/abort.c b/mdk-stage1/dietlibc/lib/abort.c deleted file mode 100644 index 55bfb8f0f..000000000 --- a/mdk-stage1/dietlibc/lib/abort.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include -#include - -void abort() { - sigset_t t; - if (!sigemptyset(&t) && !sigaddset(&t, SIGABRT)) - sigprocmask(SIG_UNBLOCK, &t, 0); - while (1) - if (raise(SIGABRT)) - exit(127); -} diff --git a/mdk-stage1/dietlibc/lib/abs.c b/mdk-stage1/dietlibc/lib/abs.c deleted file mode 100644 index 9d7055358..000000000 --- a/mdk-stage1/dietlibc/lib/abs.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int abs(int j) -{ - return (j < 0) ? -j : j; -} diff --git a/mdk-stage1/dietlibc/lib/accept.c b/mdk-stage1/dietlibc/lib/accept.c deleted file mode 100644 index c7e8254ca..000000000 --- a/mdk-stage1/dietlibc/lib/accept.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_accept(int a, void * addr, void * addr2) { -#ifdef __i386__ - return socketcall(SYS_ACCEPT, (long*)&a); -#else - unsigned long args[] = { a, (long) addr, (long) addr2 }; - return socketcall(SYS_ACCEPT, args); -#endif -} - -int accept(int a, void * addr, void * addr2) __attribute__((weak,alias("__libc_accept"))); diff --git a/mdk-stage1/dietlibc/lib/alarm.c b/mdk-stage1/dietlibc/lib/alarm.c deleted file mode 100644 index fd35372f2..000000000 --- a/mdk-stage1/dietlibc/lib/alarm.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright (C) 1991, 1992, 1994, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include - -/* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. - If SECONDS is zero, any currently scheduled alarm will be cancelled. - The function returns the number of seconds remaining until the last - alarm scheduled would have signaled, or zero if there wasn't one. - There is no return value to indicate an error, but you can set `errno' - to 0 and check its value after calling `alarm', and this might tell you. - The signal may come late due to processor scheduling. */ -unsigned int -alarm (seconds) - unsigned int seconds; -{ - struct itimerval old, new; - unsigned int retval; - - new.it_interval.tv_usec = 0; - new.it_interval.tv_sec = 0; - new.it_value.tv_usec = 0; - new.it_value.tv_sec = (long int) seconds; - if (setitimer (ITIMER_REAL, &new, &old) < 0) - return 0; - - retval = old.it_value.tv_sec; - if (old.it_value.tv_usec) - ++retval; - return retval; -} diff --git a/mdk-stage1/dietlibc/lib/alloc.c b/mdk-stage1/dietlibc/lib/alloc.c deleted file mode 100644 index 8cb87a69b..000000000 --- a/mdk-stage1/dietlibc/lib/alloc.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * malloc/free by O.Dreesen - */ - -#include -#include -#include -#include "dietfeatures.h" - -#if 0 -#include -#define _LIBC -#include -#endif - -#include - -#if defined(MAP_ANONYMOUS) && !defined(MAP_ANON) -#define MAP_ANON MAP_ANONYMOUS -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void*)-1) -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -extern void * mmap(void *start, size_t length, int prot , int flags, int fd, off_t offset); -extern void *memset(void *s, int c, size_t n); -extern void *memcpy(void *dest, const void *src, size_t n); - -typedef struct t_alloc_head { - unsigned int magic1; - struct t_alloc_head *ptr; - unsigned long size; - unsigned int magic2; -} alloc_head; - -/* guess what ? the virtual block size */ -#define MEM_BLOCK_SIZE 4096 - -/* minimum allocated bytes */ -#define MEM_ALLOC_MIN 4 - -/* Initial start position in memory */ -#define MEM_ALLOC_START ((char*)0x18000000) - -/* Make every block align */ -#define MEM_ALIGN(s) (((s)+MEM_ALLOC_MIN-1)&(~(MEM_ALLOC_MIN-1))) -#define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(~(MEM_BLOCK_SIZE-1))) -#define PAGE_ALIGNP(p) ((char*)PAGE_ALIGN((size_t)(p))) - -#define END_OF_BLOCK(p) ((alloc_head*)(((char*)(p))+((p)->size))) -#define START_BLOCK(p) ((alloc_head*)(((char*)(p))-sizeof(alloc_head))) -#define START_DATA(p) (((char*)(p))+sizeof(alloc_head)) -#define MIN_ALLOC(s) (((((s)+sizeof(alloc_head)-1)/MEM_ALLOC_MIN)+1)*MEM_ALLOC_MIN) - -#define ALLOC_MAGIC1 0xbad2f7ee -#define ALLOC_MAGIC2 0xf7ee2bad - -/* freelist handler */ -static alloc_head base = {ALLOC_MAGIC1,&base,0,ALLOC_MAGIC2}; -static char *alloc_get_end = MEM_ALLOC_START; - -void __libc_free(void *ptr) -{ - alloc_head *prev,*p,*block; - - if (ptr==NULL) return; - - block=START_BLOCK(ptr); - if (block->magic1 != ALLOC_MAGIC1) return; - if (block->magic2 != ALLOC_MAGIC2) return; - - prev=&base; - for (p=prev->ptr ; ; prev=p, p=p->ptr) - { - if ((block>prev)&&(blockp)&&(blockp)&&(block>prev)) break; /* block after freelist */ - - /* emergency escape: freelist has ONLY one entry the freelist base */ - if (p->ptr==p) break; - } - prev->ptr = block; - - if (END_OF_BLOCK(block)==p) - { /* join right neighbor */ - block->ptr = p->ptr; - block->size += p->size; - } - else - block->ptr = p; - - if (END_OF_BLOCK(prev)==block) - { /* join left neighbor */ - prev->size += block->size; - prev->ptr = block->ptr; - } -} -void free(void *ptr) __attribute__((weak,alias("__libc_free"))); - -static void *alloc_get_mem(unsigned long size) -{ - char *tmp; - alloc_head *ah; - - size=PAGE_ALIGN(size); - - /* map free pages @ alloc_get_end */ - tmp=mmap(alloc_get_end, size, PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE|MAP_FIXED, -1, 0); - if (tmp==MAP_FAILED) - { - /* OK we can't map free pages @ alloc_get_end so try free position */ - tmp=mmap(0, size, PROT_READ|PROT_WRITE, - MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); - if (tmp==MAP_FAILED) - { - errno = ENOMEM; - return NULL; /* PANIC ! */ - } - alloc_get_end=tmp; - } - - alloc_get_end+=size; - - /* make a header */ - ah=(alloc_head*)tmp; - ah->magic1=ALLOC_MAGIC1; - ah->magic2=ALLOC_MAGIC2; - ah->ptr=ah; - ah->size=size; - - /* link new free maped pages in freelist */ - __libc_free(START_DATA(tmp)); - - return &base; -} - -void *__libc_malloc(size_t size) -{ - alloc_head *p, *prev; - size_t need; - - /* needed MEM_ALLOC_MIN */ - need=MIN_ALLOC(size); - - prev=&base; - for (p=prev->ptr;;prev=p,p=p->ptr) - { - if (p->size>=need) - { - if (p->size==need) - { /* fit PERFECT */ - prev->ptr=p->ptr; /* relink freelist */ - } - else - { - alloc_head *tmp=(alloc_head*)(((char*)p)+need); - if ((p->size-need)size; - prev->ptr=p->ptr; /* relink freelist */ - } - else - { - prev->ptr=tmp; - tmp->magic1=ALLOC_MAGIC1; - tmp->magic2=ALLOC_MAGIC2; - tmp->ptr=p->ptr; - tmp->size=p->size-need; /* remaining size */ - } - - p->size=need; /* set size */ - } - p->ptr=p; /* self-link */ - - return (void*)START_DATA(p); - } - else if (p==&base) - { - if ((p=alloc_get_mem(need))==NULL) goto err_out; - } - } -err_out: - return NULL; -} -void *malloc(size_t size) __attribute__((weak,alias("__libc_malloc"))); - -void *calloc(size_t nmemb,size_t size) -{ - size_t n=nmemb*size; - void *tmp=malloc(n); - if (tmp) memset(tmp,0,n); - return tmp; -} - -void *realloc(void *ptr,size_t size) -{ - alloc_head *tmp=0,*tf=0; - long need=0; - long diff=0; - - if (ptr) - { - if (size) - { - tmp=START_BLOCK(ptr); - need=MIN_ALLOC(size); /* only this size will survive */ - diff=tmp->size-need; - if (diff<0) - { - if ((tf=malloc(size))) - { - memcpy(tf,ptr,tmp->size-sizeof(alloc_head)); - free(ptr); - return tf; - } - return NULL; - } - if (diff>=sizeof(alloc_head)) - { - tmp->size=need; - tf=END_OF_BLOCK(tmp); - tf->magic1=ALLOC_MAGIC1; - tf->magic2=ALLOC_MAGIC2; - tf->ptr=tf; - tf->size=diff; - free(START_DATA(tf)); - } - return ptr; - } - else - free(ptr); - } - else if (size>0) - return malloc(size); - return NULL; -} diff --git a/mdk-stage1/dietlibc/lib/assert_fail.c b/mdk-stage1/dietlibc/lib/assert_fail.c deleted file mode 100644 index 3d6ba65c1..000000000 --- a/mdk-stage1/dietlibc/lib/assert_fail.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include "dietwarning.h" - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); - -void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function) -{ - int alen=strlen(assertion); - int flen=strlen(file); - int fulen=strlen(function); - char *buf=(char*)alloca(alen+flen+fulen+50); - if (buf) { - char *tmp; - *buf=0; - if (file) strcat(strcat(buf,file),":"); - tmp=buf+strlen(buf); - __ltostr(tmp,10,line,10,0); - strcat(buf,": "); - if (function) strcat(strcat(buf,function),": "); - strcat(buf,"Assertion `"); - strcat(buf,assertion); - strcat(buf,"' failed.\n"); - write(2,buf,strlen(buf)); - } - abort(); -} - -link_warning("__assert_fail","warning: your code still has assertions enabled!") diff --git a/mdk-stage1/dietlibc/lib/atexit.c b/mdk-stage1/dietlibc/lib/atexit.c deleted file mode 100644 index 8204af06c..000000000 --- a/mdk-stage1/dietlibc/lib/atexit.c +++ /dev/null @@ -1,23 +0,0 @@ -typedef void (*function)(void); - -static function __atexitlist[4]; - -int atexit(function t) { - int i; - for (i=0; i<4; i++) - if (__atexitlist[i]==0) { - __atexitlist[i]=t; - return 0; - } - return -1; -} - -extern void _exit(int code) __attribute__((noreturn)); - -void exit(int code) { - if (__atexitlist[3]) __atexitlist[3](); - if (__atexitlist[2]) __atexitlist[2](); - if (__atexitlist[1]) __atexitlist[1](); - if (__atexitlist[0]) __atexitlist[0](); - _exit(code); -} diff --git a/mdk-stage1/dietlibc/lib/atof.c b/mdk-stage1/dietlibc/lib/atof.c deleted file mode 100644 index 54221390e..000000000 --- a/mdk-stage1/dietlibc/lib/atof.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -double atof(const char *nptr) { -#if 0 - return strtod(nptr,0); -#else - double tmp=strtod(nptr,0); - return tmp; -#endif -} diff --git a/mdk-stage1/dietlibc/lib/atoi.c b/mdk-stage1/dietlibc/lib/atoi.c deleted file mode 100644 index fe952b8c4..000000000 --- a/mdk-stage1/dietlibc/lib/atoi.c +++ /dev/null @@ -1,8 +0,0 @@ -int atoi(const char* s) { - int v=0; - int sign=1; - if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s; - while (*s && (*s>='0') && (*s<='9')) - v=v*10+*s++-'0'; - return v*sign; -} diff --git a/mdk-stage1/dietlibc/lib/atol.c b/mdk-stage1/dietlibc/lib/atol.c deleted file mode 100644 index 558a004b9..000000000 --- a/mdk-stage1/dietlibc/lib/atol.c +++ /dev/null @@ -1,8 +0,0 @@ -long int atol(const char* s) { - long int v=0; - int sign=1; - if (*s=='-') { sign=-1; ++s; } else if (*s=='+') ++s; - while (*s && (*s>='0') && (*s<='9')) - v=v*10+*s++-'0'; - return v*sign; -} diff --git a/mdk-stage1/dietlibc/lib/bind.c b/mdk-stage1/dietlibc/lib/bind.c deleted file mode 100644 index ec1c93e1b..000000000 --- a/mdk-stage1/dietlibc/lib/bind.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int bind(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_BIND, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_BIND, args); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/bsearch.c b/mdk-stage1/dietlibc/lib/bsearch.c deleted file mode 100644 index d2f5c74b2..000000000 --- a/mdk-stage1/dietlibc/lib/bsearch.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { - const char *v, *r; - int res; - r=base+(nmemb-1)*size; - do { - register int num=nmemb/2; - v=base+num*size; - if ((res=compar(key,v))<0) { - r=v-size; - nmemb=num; - } else { - if (res==0) return (void*)v; - base=v+size; - nmemb-=num; - } - } while ((char*)base<=r); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/cfmakeraw.c b/mdk-stage1/dietlibc/lib/cfmakeraw.c deleted file mode 100644 index 7f6df9913..000000000 --- a/mdk-stage1/dietlibc/lib/cfmakeraw.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -void cfmakeraw(struct termios *t) -{ - t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); - t->c_cflag |= CS8; - t->c_cc[VMIN] = 1; - t->c_cc[VTIME] = 0; -} - diff --git a/mdk-stage1/dietlibc/lib/closedir.c b/mdk-stage1/dietlibc/lib/closedir.c deleted file mode 100644 index e73025eb1..000000000 --- a/mdk-stage1/dietlibc/lib/closedir.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "dietdirent.h" -#include -#include -#include - -int closedir (DIR* d) { - int res=close(d->fd); - free(d); - return res; -} diff --git a/mdk-stage1/dietlibc/lib/connect.c b/mdk-stage1/dietlibc/lib/connect.c deleted file mode 100644 index 01fd61a6c..000000000 --- a/mdk-stage1/dietlibc/lib/connect.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_connect(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_CONNECT, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_CONNECT, args); -#endif -} - -int connect(int a, void * b, int c) __attribute__((weak,alias("__libc_connect"))); diff --git a/mdk-stage1/dietlibc/lib/creat.c b/mdk-stage1/dietlibc/lib/creat.c deleted file mode 100644 index 82145b515..000000000 --- a/mdk-stage1/dietlibc/lib/creat.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int creat(const char *file,mode_t mode) { - return open(file,O_WRONLY|O_CREAT|O_TRUNC,mode); -} diff --git a/mdk-stage1/dietlibc/lib/creat64.c b/mdk-stage1/dietlibc/lib/creat64.c deleted file mode 100644 index 8cf897b57..000000000 --- a/mdk-stage1/dietlibc/lib/creat64.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -#ifndef O_LARGEFILE -#define O_LARGEFILE 0 -#endif - -int creat64(const char *file,mode_t mode) { - return open(file,O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE,mode); -} diff --git a/mdk-stage1/dietlibc/lib/errlist.c b/mdk-stage1/dietlibc/lib/errlist.c deleted file mode 100644 index d0e712190..000000000 --- a/mdk-stage1/dietlibc/lib/errlist.c +++ /dev/null @@ -1,132 +0,0 @@ - -const char *const sys_errlist[] = { - "Success", /* 0 */ - "Operation not permitted", /* EPERM */ - "No such file or directory", /* ENOENT */ - "No such process", /* ESRCH */ - "Interrupted system call", /* EINTR */ - "I/O error", /* EIO */ - "No such device or address", /* ENXIO */ - "Arg list too long", /* E2BIG */ - "Exec format error", /* ENOEXEC */ - "Bad file number", /* EBADF */ - "No child processes", /* ECHILD */ - "Try again", /* EAGAIN */ - "Out of memory", /* ENOMEM */ - "Permission denied", /* EACCES */ - "Bad address", /* EFAULT */ - "Block device required", /* ENOTBLK */ - "Device or resource busy", /* EBUSY */ - "File exists", /* EEXIST */ - "Cross-device link", /* EXDEV */ - "No such device", /* ENODEV */ - "Not a directory", /* ENOTDIR */ - "Is a directory", /* EISDIR */ - "Invalid argument", /* EINVAL */ - "File table overflow", /* ENFILE */ - "Too many open files", /* EMFILE */ - "Not a typewriter", /* ENOTTY */ - "Text file busy", /* ETXTBSY */ - "File too large", /* EFBIG */ - "No space left on device", /* ENOSPC */ - "Illegal seek", /* ESPIPE */ - "Read-only file system", /* EROFS */ - "Too many links", /* EMLINK */ - "Broken pipe", /* EPIPE */ - "Math argument out of domain of func", /* EDOM */ - "Math result not representable", /* ERANGE */ - "Resource deadlock would occur", /* EDEADLK */ - "File name too long", /* ENAMETOOLONG */ - "No record locks available", /* ENOLCK */ - "Function not implemented", /* ENOSYS */ - "Directory not empty", /* ENOTEMPTY */ - "Too many symbolic links encountered", /* ELOOP */ - "Operation would block", /* EWOULDBLOCK */ - "No message of desired type", /* ENOMSG */ - "Identifier removed", /* EIDRM */ - "Channel number out of range", /* ECHRNG */ - "Level 2 not synchronized", /* EL2NSYNC */ - "Level 3 halted", /* EL3HLT */ - "Level 3 reset", /* EL3RST */ - "Link number out of range", /* ELNRNG */ - "Protocol driver not attached", /* EUNATCH */ - "No CSI structure available", /* ENOCSI */ - "Level 2 halted", /* EL2HLT */ - "Invalid exchange", /* EBADE */ - "Invalid request descriptor", /* EBADR */ - "Exchange full", /* EXFULL */ - "No anode", /* ENOANO */ - "Invalid request code", /* EBADRQC */ - "Invalid slot", /* EBADSLT */ - "File locking deadlock error", /* EDEADLOCK */ - "Bad font file format", /* EBFONT */ - "Device not a stream", /* ENOSTR */ - "No data available", /* ENODATA */ - "Timer expired", /* ETIME */ - "Out of streams resources", /* ENOSR */ - "Machine is not on the network", /* ENONET */ - "Package not installed", /* ENOPKG */ - "Object is remote", /* EREMOTE */ - "Link has been severed", /* ENOLINK */ - "Advertise error", /* EADV */ - "Srmount error", /* ESRMNT */ - "Communication error on send", /* ECOMM */ - "Protocol error", /* EPROTO */ - "Multihop attempted", /* EMULTIHOP */ - "RFS specific error", /* EDOTDOT */ - "Not a data message", /* EBADMSG */ - "Value too large for defined data type", /* EOVERFLOW */ - "Name not unique on network", /* ENOTUNIQ */ - "File descriptor in bad state", /* EBADFD */ - "Remote address changed", /* EREMCHG */ - "Can not access a needed shared library", /* ELIBACC */ - "Accessing a corrupted shared library", /* ELIBBAD */ - ".lib section in a.out corrupted", /* ELIBSCN */ - "Attempting to link in too many shared libraries", /* ELIBMAX */ - "Cannot exec a shared library directly", /* ELIBEXEC */ - "Illegal byte sequence", /* EILSEQ */ - "Interrupted system call should be restarted", /* ERESTART */ - "Streams pipe error", /* ESTRPIPE */ - "Too many users", /* EUSERS */ - "Socket operation on non-socket", /* ENOTSOCK */ - "Destination address required", /* EDESTADDRREQ */ - "Message too long", /* EMSGSIZE */ - "Protocol wrong type for socket", /* EPROTOTYPE */ - "Protocol not available", /* ENOPROTOOPT */ - "Protocol not supported", /* EPROTONOSUPPORT */ - "Socket type not supported", /* ESOCKTNOSUPPORT */ - "Operation not supported on transport endpoint", /* EOPNOTSUPP */ - "Protocol family not supported", /* EPFNOSUPPORT */ - "Address family not supported by protocol", /* EAFNOSUPPORT */ - "Address already in use", /* EADDRINUSE */ - "Cannot assign requested address", /* EADDRNOTAVAIL */ - "Network is down", /* ENETDOWN */ - "Network is unreachable", /* ENETUNREACH */ - "Network dropped connection because of reset", /* ENETRESET */ - "Software caused connection abort", /* ECONNABORTED */ - "Connection reset by peer", /* ECONNRESET */ - "No buffer space available", /* ENOBUFS */ - "Transport endpoint is already connected", /* EISCONN */ - "Transport endpoint is not connected", /* ENOTCONN */ - "Cannot send after transport endpoint shutdown", /* ESHUTDOWN */ - "Too many references: cannot splice", /* ETOOMANYREFS */ - "Connection timed out", /* ETIMEDOUT */ - "Connection refused", /* ECONNREFUSED */ - "Host is down", /* EHOSTDOWN */ - "No route to host", /* EHOSTUNREACH */ - "Operation already in progress", /* EALREADY */ - "Operation now in progress", /* EINPROGRESS */ - "Stale NFS file handle", /* ESTALE */ - "Structure needs cleaning", /* EUCLEAN */ - "Not a XENIX named type file", /* ENOTNAM */ - "No XENIX semaphores available", /* ENAVAIL */ - "Is a named type file", /* EISNAM */ - "Remote I/O error", /* EREMOTEIO */ - "Quota exceeded", /* EDQUOT */ - "No medium found", /* ENOMEDIUM */ - "Wrong medium type", /* EMEDIUMTYPE */ - 0 -}; - - -const int sys_nerr = ((sizeof (sys_errlist))/(sizeof(char *))-1); diff --git a/mdk-stage1/dietlibc/lib/errno_location.c b/mdk-stage1/dietlibc/lib/errno_location.c deleted file mode 100644 index 286f833c9..000000000 --- a/mdk-stage1/dietlibc/lib/errno_location.c +++ /dev/null @@ -1,5 +0,0 @@ -extern int errno; - -int *__errno_location() { return &errno; } - -int *errno_location() __attribute__((weak,alias("__errno_location"))); diff --git a/mdk-stage1/dietlibc/lib/exec_lib.c b/mdk-stage1/dietlibc/lib/exec_lib.c deleted file mode 100644 index 3129224a0..000000000 --- a/mdk-stage1/dietlibc/lib/exec_lib.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -extern char **environ; - -int __exec_shell(const char *file, char *const argv[]) { - int i; - - for (i = 0; argv[i]; i++); - - { - char *shell_argv[i + 1]; - shell_argv[0] = _PATH_BSHELL; - shell_argv[1] = (char *) file; - for (; i > 1; i--) - shell_argv[i] = argv[i - 1]; - return execve(_PATH_BSHELL, shell_argv, environ); - } -} - diff --git a/mdk-stage1/dietlibc/lib/exec_lib.h b/mdk-stage1/dietlibc/lib/exec_lib.h deleted file mode 100644 index 0971bd1fb..000000000 --- a/mdk-stage1/dietlibc/lib/exec_lib.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef __EXEC_LIB_H -#define __EXEC_LIB_H - -#include - -extern int __exec_shell(const char *file, char *const argv[]); - -#endif /* __EXEC_LIB_H */ - diff --git a/mdk-stage1/dietlibc/lib/execl.c b/mdk-stage1/dietlibc/lib/execl.c deleted file mode 100644 index 71459e71f..000000000 --- a/mdk-stage1/dietlibc/lib/execl.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include -#include - -int execl( const char *path,...) { - va_list ap; - int n,i; - char **argv,*tmp; - va_start(ap, path); - n=1; - while ((tmp=va_arg(ap,char *))) - ++n; - va_end (ap); - if ((argv=(char **)alloca(n*sizeof(char*)))) { - va_start(ap, path); - for (i=0; i -#include -#include -#include -#include "dietstdarg.h" - -int execlp(const char* file, const char *arg,...) { - va_list ap,bak; - int n,i; - char **argv,*tmp; - va_start(ap, arg); - va_copy(bak,ap); - n=2; - while ((tmp=va_arg(ap,char *))) - ++n; - va_end (ap); - if ((argv=(char **)alloca(n*sizeof(char*)))) { - argv[0]=arg; - for (i=0; i -#include -#include -#include -#include -#include "exec_lib.h" - -int execv(const char *file, char *const argv[]) { - if (execve(file,argv,environ)==-1) { - if (errno==ENOEXEC) __exec_shell(file,argv); - } - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/execvp.c b/mdk-stage1/dietlibc/lib/execvp.c deleted file mode 100644 index 20521d69f..000000000 --- a/mdk-stage1/dietlibc/lib/execvp.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include -#include -#include -#include "exec_lib.h" - -int execvp(const char *file, char *const argv[]) { - char *path=getenv("PATH"); - char *cur,*next; - char buf[PATH_MAX]; - if (strchr((char*)file,'/')) { - if (execve(file,argv,environ)==-1) { - if (errno==ENOEXEC) __exec_shell(file,argv); - return -1; - } - } - if (!path) path=_PATH_DEFPATH; - for (cur=path; cur; cur=next) { - next=strchr(cur,':'); - if (!next) - next=cur+strlen(cur); - if (next==cur) { - buf[0]='.'; - cur--; - } else - memmove(buf,cur,next-cur); - buf[next-cur]='/'; - memmove(&buf[next-cur+1],file,strlen(file)+1); - if (execve(buf,argv,environ)==-1) { - if (errno==ENOEXEC) return __exec_shell(buf,argv); - if ((errno!=EACCES) && (errno!=ENOENT)) return -1; - } - if (*next==0) break; - next++; - } - return -1; -} diff --git a/mdk-stage1/dietlibc/lib/ftw.c b/mdk-stage1/dietlibc/lib/ftw.c deleted file mode 100644 index a3c04af9a..000000000 --- a/mdk-stage1/dietlibc/lib/ftw.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -int ftw(const char *dir,int (*fn)(const char *file, const struct stat *sb, int flag), int depth) { - char *cwd; - int cwdlen; - DIR *d; - struct dirent *de; - struct stat sb; - if (chdir(dir)) return -1; - cwd=alloca(PATH_MAX+1); - if (!getcwd(cwd,PATH_MAX)) return -1; - cwd[PATH_MAX]=0; - cwdlen=strlen(cwd); -/* write(1,"ftw in ",7); puts(cwd); */ - if (!(d=opendir("."))) return -1; - while ((de=readdir(d))) { - int res; - int flag; - int nlen; - char *filename; - if (de->d_name[0]=='.' && - (de->d_name[1]==0 || - (de->d_name[1]=='.' && de->d_name[2]==0))) continue; - nlen=strlen(de->d_name); - filename=alloca(nlen+cwdlen+3); - memmove(filename,cwd,cwdlen); - filename[cwdlen]='/'; - memmove(filename+cwdlen+1,de->d_name,nlen+1); - if (!lstat(de->d_name,&sb)) { - if (S_ISLNK(sb.st_mode)) flag=FTW_SL; else - if (S_ISDIR(sb.st_mode)) flag=FTW_D; else - flag=FTW_F; - } else - flag=FTW_NS; - res=fn(filename,&sb,flag); - if (res) return res; - if (flag==FTW_D && depth>0) { - res=ftw(filename,fn,depth-1); - chdir(dir); - if (res) return res; - } -/* puts(de->d_name); */ - } - closedir(d); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/getdomainname.c b/mdk-stage1/dietlibc/lib/getdomainname.c deleted file mode 100644 index 2554fe4c3..000000000 --- a/mdk-stage1/dietlibc/lib/getdomainname.c +++ /dev/null @@ -1,17 +0,0 @@ -#define _GNU_SOURCE - -#include -#include - -int getdomainname(char *name,size_t len) { - struct utsname u; - int res=uname(&u); - if (res==0) { - int i; - if (len>=_UTSNAME_DOMAIN_LENGTH) - len=_UTSNAME_DOMAIN_LENGTH; - for (i=0; i - -extern char **environ; - -extern char *getenv(const char *s) -{ - int i; - unsigned int len; - - if (!environ || !s) return 0; - len = strlen(s); - for (i = 0;environ[i];++i) - if ((memcmp(environ[i],s,len)==0) && (environ[i][len] == '=')) - return environ[i] + len + 1; - return 0; -} - diff --git a/mdk-stage1/dietlibc/lib/gethostname.c b/mdk-stage1/dietlibc/lib/gethostname.c deleted file mode 100644 index ccc0fbc8e..000000000 --- a/mdk-stage1/dietlibc/lib/gethostname.c +++ /dev/null @@ -1,18 +0,0 @@ -#define _GNU_SOURCE - -#include -#include - -int gethostname(char *name,size_t len) { - struct utsname u; - int res=uname(&u); - if (res==0) { - int i; - if (len>=_UTSNAME_NODENAME_LENGTH) - len=_UTSNAME_NODENAME_LENGTH; - for (i=0; i - -/* - * by Olaf Dreesen - */ - -int opterr; - -int optind=1; -char *optarg; - -static int opt_unknown=1,opt_unknown_len; - -static int getopt_check(int c,char*o,int ol) -{ - int i; - if (c==':') return 2; - for (i=0;iopt_unknown;i--) v[i+oi]=v[i-1]; - - v[opt_unknown++]=tmp; - if (oi) v[opt_unknown++]=tmp2; - } -} - -static char* nextchar; -int getopt(int c,char*v[],char*o) -{ - int ol=strlen(o); - int ret=0; - int oi=0; - - optarg=0; - - while (nextchar || (optind - -extern int socketcall(int callno,long* args); - -int getpeername(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_GETPEERNAME, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_GETPEERNAME, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/getpgrp.c b/mdk-stage1/dietlibc/lib/getpgrp.c deleted file mode 100644 index ee2ab0257..000000000 --- a/mdk-stage1/dietlibc/lib/getpgrp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int getpgrp() -{ - return getpgid(0); -} diff --git a/mdk-stage1/dietlibc/lib/getservent.c b/mdk-stage1/dietlibc/lib/getservent.c deleted file mode 100644 index bf25d046b..000000000 --- a/mdk-stage1/dietlibc/lib/getservent.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -static int servicesfd=-1; -static char* servicesmap; -static unsigned int serviceslen; - -static char* aliases[10]; - -static char *cur; - -/* nameserver 42/tcp name # IEN 116 */ -struct servent *getservent(void) { - static struct servent se; - char *last; - int aliasidx; - if (servicesfd<0) { - servicesfd=open(_PATH_SERVICES,O_RDONLY); - if (servicesfd<0) return 0; - serviceslen=lseek(servicesfd,0,SEEK_END); - servicesmap=mmap(0,serviceslen,PROT_READ|PROT_WRITE,MAP_PRIVATE,servicesfd,0); - if ((long)servicesmap==(-1)) goto error; - cur=servicesmap; - } - last=servicesmap+serviceslen; -again: - se.s_name=0; - se.s_aliases=aliases; aliases[0]=0; - se.s_port=0; - se.s_proto=0; - if (cur>=last) return 0; - if (*cur=='#' || *cur=='\n') goto parseerror; - /* first, the primary name */ - if (!isalpha(*cur)) goto parseerror; - se.s_name=cur; - se.s_aliases=aliases; - while (cur=last) return 0; - if (*cur=='\n') goto parseerror; - *cur=0; cur++; - /* second, the port */ - while (cur=last) return 0; - /* third, "/tcp" or "/udp" */ - if (*cur!='/') goto parseerror; - cur++; - se.s_proto=cur; - while (cur=last) return 0; - if (*cur=='\n') { *cur++=0; return &se; } - *cur=0; cur++; - /* now the aliases */ - for (aliasidx=0;aliasidx<10;++aliasidx) { - while (cur=last || !isblank(*cur)) break; - *cur++=0; - } - aliases[aliasidx]=0; - return &se; -parseerror: - while (curs_name,strlen(s->s_name)); - write(1,"/",1); - write(1,s->s_proto,strlen(s->s_proto)); - write(1,"\n",1); - if (!strcmp(name,"auth")) { - tmp=s->s_aliases; - write(1," aka ",5); - while (*tmp) { - write(1,*tmp,strlen(*tmp)); - write(1,", ",2); - ++tmp; - } - write(1,"\n",1); - } -#endif - if (!strcmp(name,s->s_name) && !strcmp(proto,s->s_proto)) - return s; - tmp=s->s_aliases; - while (*tmp) - if (!strcmp(name,*tmp++)) return s; - } - return 0; -} - -struct servent *getservbyport(int port, const char *proto) { - struct servent *s; - for (s=getservent(); s; s=getservent()) { - if (port==s->s_port && !strcmp(proto,s->s_proto)) - return s; - } - return 0; -} - -void endservent(void) { - if (servicesmap!=(char*)-1) munmap(servicesmap,serviceslen); - if (servicesfd!=-1) close(servicesfd); - servicesmap=(char*)-1; - servicesfd=-1; -} - diff --git a/mdk-stage1/dietlibc/lib/getsockname.c b/mdk-stage1/dietlibc/lib/getsockname.c deleted file mode 100644 index 61a3ea24a..000000000 --- a/mdk-stage1/dietlibc/lib/getsockname.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int getsockname(int a, void * b, int c) { -#ifdef __i386__ - return socketcall(SYS_GETSOCKNAME, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c }; - return socketcall(SYS_GETSOCKNAME, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/getsockopt.c b/mdk-stage1/dietlibc/lib/getsockopt.c deleted file mode 100644 index 8c0a57557..000000000 --- a/mdk-stage1/dietlibc/lib/getsockopt.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int getsockopt(int a, int b, int c, void *d, int e) { -#ifdef __i386__ - return socketcall(SYS_GETSOCKOPT, (long*)&a); -#else - unsigned long args[] = { a, b, c, (long)d, e }; - return socketcall(SYS_GETSOCKOPT, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/htonl.c b/mdk-stage1/dietlibc/lib/htonl.c deleted file mode 100644 index 490de42c4..000000000 --- a/mdk-stage1/dietlibc/lib/htonl.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -unsigned long int htonl(unsigned long int hostlong) { -#if __BYTE_ORDER==__LITTLE_ENDIAN - return (hostlong>>24) | ((hostlong&0xff0000)>>8) | - ((hostlong&0xff00)<<8) | (hostlong<<24); -#else - return hostlong; -#endif -} - -unsigned long int ntohl(unsigned long int hostlong) __attribute__((weak,alias("htonl"))); diff --git a/mdk-stage1/dietlibc/lib/htons.c b/mdk-stage1/dietlibc/lib/htons.c deleted file mode 100644 index 765d3bbc5..000000000 --- a/mdk-stage1/dietlibc/lib/htons.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -unsigned short int htons(unsigned short int hostshort) { -#if __BYTE_ORDER==__LITTLE_ENDIAN - return ((hostshort>>8)&0xff) | (hostshort<<8); -#else - return hostshort; -#endif -} - -unsigned short int ntohs(unsigned short int hostshort) __attribute__((weak,alias("htons"))); diff --git a/mdk-stage1/dietlibc/lib/if_indextoname.c b/mdk-stage1/dietlibc/lib/if_indextoname.c deleted file mode 100644 index e683755f6..000000000 --- a/mdk-stage1/dietlibc/lib/if_indextoname.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include -#include -#include - -#ifndef SOCK_DGRAM -#define SOCK_DGRAM 2 -#endif - -char* if_indextoname(unsigned int interface,char* blub) { - struct ifreq ifr; - int fd; - - fd=socket(AF_INET6,SOCK_DGRAM,0); - if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0); - ifr.ifr_ifindex=interface; - if (ioctl(fd,SIOCGIFNAME,&ifr)==0) { - int i; - close(fd); - for (i=0; i -#include -#include -#include -#include - -#ifndef SOCK_DGRAM -#define SOCK_DGRAM 2 -#endif - -int if_nametoindex(char* blub) { - struct ifreq ifr; - int fd; - char *tmp; - int len=sizeof(ifr.ifr_name); - fd=socket(AF_INET6,SOCK_DGRAM,0); - if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0); - for (tmp=ifr.ifr_name; len>0; --len) { - if ((*tmp++=*blub++)==0) break; - } - if (ioctl(fd,SIOCGIFINDEX,&ifr)==0) { - close(fd); - return ifr.ifr_ifindex; - } - close(fd); - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/isalnum.c b/mdk-stage1/dietlibc/lib/isalnum.c deleted file mode 100644 index 4d363fab9..000000000 --- a/mdk-stage1/dietlibc/lib/isalnum.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __isalnum_ascii(int c) { - return isalpha(c) || isdigit(c); -} - -int isalnum(int c) __attribute__((weak,alias("__isalnum_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isalpha.c b/mdk-stage1/dietlibc/lib/isalpha.c deleted file mode 100644 index 07ea69696..000000000 --- a/mdk-stage1/dietlibc/lib/isalpha.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __isalpha_ascii(int c) { - return (c>='a' && c<='z') || (c>='A' && c<='Z'); -} - -int isalpha(int c) __attribute__((weak,alias("__isalpha_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isascii.c b/mdk-stage1/dietlibc/lib/isascii.c deleted file mode 100644 index e06994783..000000000 --- a/mdk-stage1/dietlibc/lib/isascii.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int isascii(int c) { - return (c & 0x80) == 0; -} - diff --git a/mdk-stage1/dietlibc/lib/isatty.c b/mdk-stage1/dietlibc/lib/isatty.c deleted file mode 100644 index b31609720..000000000 --- a/mdk-stage1/dietlibc/lib/isatty.c +++ /dev/null @@ -1,20 +0,0 @@ -#define ioctl libc_ioctl -#include -#undef ioctl -#include - -extern int errno; - -int isatty(int fd) -{ - int save; - int is_tty; - struct termios term; - - save = errno; - is_tty = ioctl(fd, TCGETS, &term) == 0; - errno = save; - - return is_tty; -} - diff --git a/mdk-stage1/dietlibc/lib/isblank.c b/mdk-stage1/dietlibc/lib/isblank.c deleted file mode 100644 index 034e543b1..000000000 --- a/mdk-stage1/dietlibc/lib/isblank.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int isblank(int ch) -{ - return ((ch==' ')||(ch=='\t')); -} diff --git a/mdk-stage1/dietlibc/lib/iscntrl.c b/mdk-stage1/dietlibc/lib/iscntrl.c deleted file mode 100644 index a183a54f1..000000000 --- a/mdk-stage1/dietlibc/lib/iscntrl.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __iscntrl_ascii(int c) { - return (c<32) || (c==127); -} - -int iscntrl(int c) __attribute__((weak,alias("__iscntrl_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isdigit.c b/mdk-stage1/dietlibc/lib/isdigit.c deleted file mode 100644 index 8a7c3e801..000000000 --- a/mdk-stage1/dietlibc/lib/isdigit.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __isdigit_ascii(int c) { - return (c>='0' && c<='9'); -} - -int isdigit(int c) __attribute__((weak,alias("__isdigit_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isgraph.c b/mdk-stage1/dietlibc/lib/isgraph.c deleted file mode 100644 index 807f90ff0..000000000 --- a/mdk-stage1/dietlibc/lib/isgraph.c +++ /dev/null @@ -1,5 +0,0 @@ -int __isgraph_ascii(int c) { - return (c>=33 && c<=126); -} - -int isgraph(int c) __attribute__((weak,alias("__isgraph_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/islower.c b/mdk-stage1/dietlibc/lib/islower.c deleted file mode 100644 index 6a9afa519..000000000 --- a/mdk-stage1/dietlibc/lib/islower.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __islower_ascii(int c) { - return (c>='a' && c<='z'); -} - -int islower(int c) __attribute__((weak,alias("__islower_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isprint.c b/mdk-stage1/dietlibc/lib/isprint.c deleted file mode 100644 index e980658a5..000000000 --- a/mdk-stage1/dietlibc/lib/isprint.c +++ /dev/null @@ -1,6 +0,0 @@ - -int __isprint_ascii(int c) { - return (c>=32 && c<=126); -} - -int isprint(int c) __attribute__((weak,alias("__isprint_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/ispunct.c b/mdk-stage1/dietlibc/lib/ispunct.c deleted file mode 100644 index 2fd1183b1..000000000 --- a/mdk-stage1/dietlibc/lib/ispunct.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __ispunct_ascii(int c) { - return isprint(c) && !( isalnum(c) || isspace(c) ); -} - -int ispunct(int c) __attribute__((weak,alias("__ispunct_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isspace.c b/mdk-stage1/dietlibc/lib/isspace.c deleted file mode 100644 index 916f784ab..000000000 --- a/mdk-stage1/dietlibc/lib/isspace.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __isspace_ascii(int ch) -{ - return ((ch==' ')||(ch=='\f')||(ch=='\t')||(ch=='\v')||(ch=='\r')||(ch=='\n')); -} - -int isspace(int c) __attribute__((weak,alias("__isspace_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isupper.c b/mdk-stage1/dietlibc/lib/isupper.c deleted file mode 100644 index 933dfc169..000000000 --- a/mdk-stage1/dietlibc/lib/isupper.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int __isupper_ascii(int c) { - return (c>='A' && c<='Z'); -} - -int isupper(int c) __attribute__((weak,alias("__isupper_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/isxdigit.c b/mdk-stage1/dietlibc/lib/isxdigit.c deleted file mode 100644 index 22a711f2d..000000000 --- a/mdk-stage1/dietlibc/lib/isxdigit.c +++ /dev/null @@ -1,5 +0,0 @@ -int __isxdigit_ascii(int c) { - return ((c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f')); -} - -int isxdigit(int c) __attribute__((weak,alias("__isxdigit_ascii"))); diff --git a/mdk-stage1/dietlibc/lib/listen.c b/mdk-stage1/dietlibc/lib/listen.c deleted file mode 100644 index 56a51be06..000000000 --- a/mdk-stage1/dietlibc/lib/listen.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int listen(int a, int b) { -#ifdef __i386__ - return socketcall(SYS_LISTEN, (long*)&a); -#else - unsigned long args[] = { a, b, 0 }; - return socketcall(SYS_LISTEN, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/lockf.c b/mdk-stage1/dietlibc/lib/lockf.c deleted file mode 100644 index 2b1d004ef..000000000 --- a/mdk-stage1/dietlibc/lib/lockf.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -#include - -int lockf(int fd, int cmd, off_t len) { - struct flock fl; - fl.l_whence=SEEK_CUR; - fl.l_start=0; - fl.l_len=len; - fl.l_pid=0; - switch (cmd) { - case F_TEST: - if (fcntl(fd,F_GETLK,&fl)<0) - return -1; - if (fl.l_type == F_UNLCK || fl.l_pid == getpid ()) - return 0; - errno=EACCES; - return -1; - case F_ULOCK: - fl.l_type=F_UNLCK; - cmd=F_SETLK; - break; - case F_LOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLKW; - break; - case F_TLOCK: - fl.l_type = F_WRLCK; - cmd = F_SETLK; - break; - default: - errno=EINVAL; - return -1; - } - return fcntl(fd,cmd,&fl); -} diff --git a/mdk-stage1/dietlibc/lib/longjmp.c b/mdk-stage1/dietlibc/lib/longjmp.c deleted file mode 100644 index d0a5719c1..000000000 --- a/mdk-stage1/dietlibc/lib/longjmp.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 1991, 92, 94, 95, 97, 98 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* #include */ -#include -#include - -extern int __sigprocmask(int how,void* set,void* oldset); -extern void __longjmp(void* env, int val); - -/* -extern void _longjmp_unwind (jmp_buf env, int val); -*/ -/* Set the signal mask to the one specified in ENV, and jump - to the position specified in ENV, causing the setjmp - call there to return VAL, or 1 if VAL is 0. */ -void __siglongjmp (sigjmp_buf env, int val) -{ - /* Perform any cleanups needed by the frames being unwound. */ - /* - _longjmp_unwind (env, val); - */ - - if (env[0].__mask_was_saved) - /* Restore the saved signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &env[0].__saved_mask, - (sigset_t *) NULL); - - /* Call the machine-dependent function to restore machine state. */ - __longjmp (env[0].__jmpbuf, val ?: 1); -} - -void siglongjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void _longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); -void __libc_longjmp (sigjmp_buf env, int val) __attribute__((weak,alias("__siglongjmp"))); diff --git a/mdk-stage1/dietlibc/lib/lseek64.c b/mdk-stage1/dietlibc/lib/lseek64.c deleted file mode 100644 index f39e779f9..000000000 --- a/mdk-stage1/dietlibc/lib/lseek64.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "dietfeatures.h" - -#ifdef WANT_LARGEFILE_BACKCOMPAT -#include -#ifndef __NO_STAT64 -#include -#include - -loff_t lseek64(int fildes, loff_t offset, int whence) { - loff_t tmp; - if (llseek(fildes,offset>>32,offset&0xffffffff,&tmp,whence)) { -#ifdef WANT_THREAD_SAFE - if (*__errno_location()!=ENOSYS) return -1; -#else - if (errno!=ENOSYS) return -1; -#endif - return (loff_t)lseek(fildes,(off_t)offset,whence); - } - return tmp; -} -#endif -#endif diff --git a/mdk-stage1/dietlibc/lib/memccmp.c b/mdk-stage1/dietlibc/lib/memccmp.c deleted file mode 100644 index 3a8c14f60..000000000 --- a/mdk-stage1/dietlibc/lib/memccmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include - -int memccmp(const void *dst, const void *src, int c, size_t count) -{ - register const char *a = dst; - register const char *b = src; - while (count--) - { - register int res=(*a - *b); - if (res) return res; - if (*a==c) return 0; - ++a; ++b; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memccpy.c b/mdk-stage1/dietlibc/lib/memccpy.c deleted file mode 100644 index 6d6ac98ab..000000000 --- a/mdk-stage1/dietlibc/lib/memccpy.c +++ /dev/null @@ -1,19 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include - -void *memccpy(void *dst, const void *src, int c, size_t count) -{ - char *a = dst; - const char *b = src; - while (count--) - { - *a++ = *b; - if (*b==c) - { - return (void *)a; - } - b++; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memchr.c b/mdk-stage1/dietlibc/lib/memchr.c deleted file mode 100644 index 93d81328a..000000000 --- a/mdk-stage1/dietlibc/lib/memchr.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -char *memchr(const char *s, int c, size_t n) { - int i; - for (i=n; i; --i) - if (*s++==c) - return (char*)s; - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/memcmp.c b/mdk-stage1/dietlibc/lib/memcmp.c deleted file mode 100644 index c05a46863..000000000 --- a/mdk-stage1/dietlibc/lib/memcmp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -int memcmp(const void *dst, const void *src, size_t count) { - register int r; - register const char *d=dst; - register const char *s=src; - while (count--) { - if ((r=(*d - *s))) - return r; - ++d; - ++s; - } - return 0; -} - -int bcmp(const char *a,const char *b,size_t c) __attribute__((weak,alias("memcmp"))); diff --git a/mdk-stage1/dietlibc/lib/memcpy.c b/mdk-stage1/dietlibc/lib/memcpy.c deleted file mode 100644 index 0c688b509..000000000 --- a/mdk-stage1/dietlibc/lib/memcpy.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -void* memcpy(void* dst, const void* src, size_t count) { - register char *d=dst; - register const char *s=src; - ++count; /* this actually produces better code than using count-- */ - while (--count) { - *d = *s; - ++d; ++s; - } - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/memmove.c b/mdk-stage1/dietlibc/lib/memmove.c deleted file mode 100644 index 7adb2be91..000000000 --- a/mdk-stage1/dietlibc/lib/memmove.c +++ /dev/null @@ -1,23 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include - -void *memmove(void *dst, const void *src, size_t count) -{ - char *a = dst; - const char *b = src; - if (src!=dst) - { - if (src>dst) - { - while (count--) *a++ = *b++; - } - else - { - a+=count-1; - b+=count-1; - while (count--) *a-- = *b--; - } - } - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/memset.c b/mdk-stage1/dietlibc/lib/memset.c deleted file mode 100644 index 5f9ae49ee..000000000 --- a/mdk-stage1/dietlibc/lib/memset.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -void * memset(void * dst, int s, size_t count) { - register char * a = dst; - count++; /* this actually creates smaller code than using count-- */ - while (--count) - *a++ = s; - return dst; -} diff --git a/mdk-stage1/dietlibc/lib/mkfifo.c b/mdk-stage1/dietlibc/lib/mkfifo.c deleted file mode 100644 index 596efbe27..000000000 --- a/mdk-stage1/dietlibc/lib/mkfifo.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -int mkfifo(const char *fn,mode_t mode) { - return mknod(fn,S_IFIFO|mode,0); -} diff --git a/mdk-stage1/dietlibc/lib/msgctl.c b/mdk-stage1/dietlibc/lib/msgctl.c deleted file mode 100644 index 19ea6d8cf..000000000 --- a/mdk-stage1/dietlibc/lib/msgctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int msgctl(int msqid, int cmd, struct msqid_ds *buf) { - return __ipc(MSGCTL,msqid,cmd,0,buf); -} diff --git a/mdk-stage1/dietlibc/lib/msgget.c b/mdk-stage1/dietlibc/lib/msgget.c deleted file mode 100644 index 9bca09ebe..000000000 --- a/mdk-stage1/dietlibc/lib/msgget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int msgget(key_t key,int flag) { - return __ipc(MSGGET,key,flag,0,0); -} diff --git a/mdk-stage1/dietlibc/lib/msgrcv.c b/mdk-stage1/dietlibc/lib/msgrcv.c deleted file mode 100644 index b4ae9cc6c..000000000 --- a/mdk-stage1/dietlibc/lib/msgrcv.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int msgrcv(int msqid, void *msgp, size_t msgsz, long int msgtyp, int msgflg) { - struct ipc_kludge tmp; - tmp.msgp = msgp; - tmp.msgtyp = msgtyp; - return __ipc(MSGRCV,msqid, msgsz, msgflg, &tmp); -} diff --git a/mdk-stage1/dietlibc/lib/msgsnd.c b/mdk-stage1/dietlibc/lib/msgsnd.c deleted file mode 100644 index 6203053f0..000000000 --- a/mdk-stage1/dietlibc/lib/msgsnd.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg) { - return __ipc(MSGSND,msqid, msgsz, msgflg, msgp); -} diff --git a/mdk-stage1/dietlibc/lib/nop.c b/mdk-stage1/dietlibc/lib/nop.c deleted file mode 100644 index c05bea813..000000000 --- a/mdk-stage1/dietlibc/lib/nop.c +++ /dev/null @@ -1,7 +0,0 @@ - -int __fflush_stdin() __attribute__((weak,alias("__return0"))); -int __fflush_stdout() __attribute__((weak,alias("__return0"))); -int __fflush_stderr() __attribute__((weak,alias("__return0"))); - -/* used for weak aliases */ -int __return0() { return 0; } diff --git a/mdk-stage1/dietlibc/lib/open64.c b/mdk-stage1/dietlibc/lib/open64.c deleted file mode 100644 index f1499d017..000000000 --- a/mdk-stage1/dietlibc/lib/open64.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -#ifndef O_LARGEFILE -#define O_LARGEFILE 0 -#endif - -extern int open(const char* file,int oflag,int mode); - -int __libc_open64(const char* file,int oflag,int mode) { - return open(file,oflag|O_LARGEFILE,mode); -} - -int open64(const char* file,int oflag,int mode) __attribute__((weak,alias("__libc_open64"))); diff --git a/mdk-stage1/dietlibc/lib/opendir.c b/mdk-stage1/dietlibc/lib/opendir.c deleted file mode 100644 index 5c0c4a305..000000000 --- a/mdk-stage1/dietlibc/lib/opendir.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietdirent.h" -#include -#include -#include -#include - -DIR *opendir (const char *name) { - DIR *t=(DIR*)malloc(sizeof(DIR)); - if (t) { - if ((t->fd=open(name,O_RDONLY|O_DIRECTORY))>=0) { - t->num=t->cur=0; - } else { - free(t); - t=0; - } - } - return t; -} diff --git a/mdk-stage1/dietlibc/lib/perror.c b/mdk-stage1/dietlibc/lib/perror.c deleted file mode 100644 index ecab7250b..000000000 --- a/mdk-stage1/dietlibc/lib/perror.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "dietfeatures.h" -#include -#include -#include - -extern char *sys_errlist[]; -extern int sys_nerr; -extern int errno; - -void perror(const char *s) { - register char *message="[unknown error]"; - write(2,s,strlen(s)); - write(2,": ",2); - if (errno>=0 && errno -#include - -extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b); - -size_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { - return __pread(fd,buf,count,offset,0); -} - -int pread(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread"))); diff --git a/mdk-stage1/dietlibc/lib/pread64.c b/mdk-stage1/dietlibc/lib/pread64.c deleted file mode 100644 index e6ba4d103..000000000 --- a/mdk-stage1/dietlibc/lib/pread64.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include - -#ifndef __NO_STAT64 -extern size_t __pread(int fd, void *buf, size_t count, off_t a,off_t b); - -size_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { - return __pread(fd,buf,count,__LONG_LONG_PAIR (offset&0xffffffff,offset>>32)); -} - -int pread64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pread64"))); -#endif diff --git a/mdk-stage1/dietlibc/lib/putenv.c b/mdk-stage1/dietlibc/lib/putenv.c deleted file mode 100644 index 274b16b0e..000000000 --- a/mdk-stage1/dietlibc/lib/putenv.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -int putenv(const char *string) { - int len; - int envc; - char *tmp; - const char **ep; - char **newenv; - static char **origenv=0; - if (!origenv) origenv=environ; - if (!(tmp=strchr(string,'='))) - len=strlen(string); - else - len=tmp-string+1; - for (envc=0, ep=(const char**)environ; *ep; ++ep) { - if (!memcmp(string,*ep,len)) { /* found */ - if (!tmp) { - for (; ep[1]; ++ep) ep[0]=ep[1]; - ep[0]=0; - return 0; - } - *ep=string; - return 0; - } - ++envc; - } - if (tmp) { - newenv=(char**)malloc((envc+2)*sizeof(char*)); - if (!newenv) return -1; - newenv[0]=(char*)string; - memcpy(newenv+1,environ,(envc+1)*sizeof(char*)); - if (environ!=origenv) free(environ); - environ=newenv; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/puts.c b/mdk-stage1/dietlibc/lib/puts.c deleted file mode 100644 index 54415151d..000000000 --- a/mdk-stage1/dietlibc/lib/puts.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include "dietstdio.h" -#include "dietfeatures.h" - -int puts(const char *s) { -#ifdef WANT_BUFFERED_STDIO - return fwrite(s,1,strlen(s),stdout) && fputc('\n',stdout); -#else - return write(1,s,strlen(s)) && write(1,"\n",1); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/qsort.c b/mdk-stage1/dietlibc/lib/qsort.c deleted file mode 100644 index 2a8824bf3..000000000 --- a/mdk-stage1/dietlibc/lib/qsort.c +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include - -/* comments: - 1. insertion sort sofort, nicht nachträglich - 2. threshold = 16 - */ - -static inline void iswap(void *a,void *b,size_t size) { - register char *x=a; - register char *y=b; - register char *z=x+size; - while (x1) { - char *min=base; - char *tmp=min+size; - for (i=1; i=0 && right<=1000); -#endif - if (nmemb<=8) { - --level; - return isort(base,nmemb,size,compar); - } - { - mid=base+(nmemb/2)*size; - max=base+(nmemb-1)*size; - - if (compar(base,max)<0) /* a[left] < a[right] */ - if (compar(base,mid)<0) /* a[left] < a[med] */ - if (compar(max,mid)<0) /* a[left] < a[right] < a[med] */ - v=max; - else /* a[left] < a[med] < a[right] */ - v=mid; - else /* a[med] < a[left] < a[right] */ - v=base; - else /* a[right] < a[left] */ - if (compar(base,mid)<0) /* a[right] < a[left] < a[med] */ - v=base; - else /* a[right] < a[left] && a[med] < a[left] */ - if (compar(max,mid)<0) /* a[right] < a[med] < a[left] */ - v=mid; - else - v=max; -// printf("%d %d %d -> median %d\n",*(int*)base,*(int*)mid,*(int*)max,*(int*)v); - } - if (v != max) - iswap(v,max,size); - v=max; - min=base; lmemb=0; - for (;;) { - while (compar(min,v)<0) { min+=size; ++lmemb; } - while (compar(max-=size,v)>0) ; - if (min>=max) break; - iswap(min,max,size); - } - iswap(min,v,size); -#ifdef DEBUG -// { int i; for (i=0; i(char*)base+size) { -#ifdef DEBUG - assert(base==dbase); -#endif -// { int i; for (i=0; ilmemb+1) { -// { int i; for (i=0; i -#include -#include -#include "syscalls.h" - -int raise(int sig) { - return kill(getpid(),sig); -} diff --git a/mdk-stage1/dietlibc/lib/rand.c b/mdk-stage1/dietlibc/lib/rand.c deleted file mode 100644 index 10bfaf94d..000000000 --- a/mdk-stage1/dietlibc/lib/rand.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -static unsigned int seed=1; - -int rand() { - return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1)); -} - -void srand(unsigned int i) { seed=i; } diff --git a/mdk-stage1/dietlibc/lib/random.c b/mdk-stage1/dietlibc/lib/random.c deleted file mode 100644 index e7785c455..000000000 --- a/mdk-stage1/dietlibc/lib/random.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -static unsigned int seed=1; - -long int random() { - return ((seed = seed * 1103515245 + 12345) % ((unsigned int)RAND_MAX + 1)); -} - -void srandom(unsigned int i) { seed=i; } diff --git a/mdk-stage1/dietlibc/lib/readdir.c b/mdk-stage1/dietlibc/lib/readdir.c deleted file mode 100644 index 689f5d08b..000000000 --- a/mdk-stage1/dietlibc/lib/readdir.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "dietdirent.h" -#include -#include -#include - -struct dirent* readdir(DIR *d) { - if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) { - int res=getdents(d->fd,(struct dirent*)d->buf,1023); - if (res<=0) return 0; - d->num=res; d->cur=0; - } - return (struct dirent*)(d->buf+d->cur); -} diff --git a/mdk-stage1/dietlibc/lib/reboot.c b/mdk-stage1/dietlibc/lib/reboot.c deleted file mode 100644 index 7f47a95dd..000000000 --- a/mdk-stage1/dietlibc/lib/reboot.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __reboot(int magic1, int magic2, int cmd, void * arg); - -int reboot(int cmd, void *arg) -{ - return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg); -} diff --git a/mdk-stage1/dietlibc/lib/recv.c b/mdk-stage1/dietlibc/lib/recv.c deleted file mode 100644 index bc6b1e5d7..000000000 --- a/mdk-stage1/dietlibc/lib/recv.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_recv(int a, const void * b, size_t c, int flags) { -#ifdef __i386__ - return socketcall(SYS_RECV,(long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags }; - return socketcall(SYS_RECV, args); -#endif -} - -int recv(int a, const void * b, size_t c, int flags) - __attribute__ ((weak, alias("__libc_recv"))); diff --git a/mdk-stage1/dietlibc/lib/recvfrom.c b/mdk-stage1/dietlibc/lib/recvfrom.c deleted file mode 100644 index 802ad665f..000000000 --- a/mdk-stage1/dietlibc/lib/recvfrom.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) { -#ifdef __i386__ - return socketcall(SYS_RECVFROM, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags, (long) to, (long) tolen }; - return socketcall(SYS_RECVFROM, args); -#endif -} - -int recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) - __attribute__ ((weak,alias("__libc_recvfrom"))) ; diff --git a/mdk-stage1/dietlibc/lib/recvmsg.c b/mdk-stage1/dietlibc/lib/recvmsg.c deleted file mode 100644 index c14c58c78..000000000 --- a/mdk-stage1/dietlibc/lib/recvmsg.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_recvmsg(int a, struct msghdr* msg, int flags) { -#ifdef __i386__ - return socketcall(SYS_RECVMSG, (long*)&a); -#else - unsigned long args[] = { a, (long) msg, flags }; - return socketcall(SYS_RECVMSG, args); -#endif -} - -int recvmsg(int a, struct msghdr *msg, int flags) - __attribute__ ((weak,alias("__libc_recvmsg"))) ; diff --git a/mdk-stage1/dietlibc/lib/remove.c b/mdk-stage1/dietlibc/lib/remove.c deleted file mode 100644 index d5125bfed..000000000 --- a/mdk-stage1/dietlibc/lib/remove.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int remove(const char* filename) { - if (unlink(filename)) { - if (errno==EISDIR) - return rmdir(filename); - return -1; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/rewind.c b/mdk-stage1/dietlibc/lib/rewind.c deleted file mode 100644 index 48434a316..000000000 --- a/mdk-stage1/dietlibc/lib/rewind.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -void rewind( FILE *stream) { - fseek(stream, 0L, SEEK_SET); -} diff --git a/mdk-stage1/dietlibc/lib/rewinddir.c b/mdk-stage1/dietlibc/lib/rewinddir.c deleted file mode 100644 index addc7bde9..000000000 --- a/mdk-stage1/dietlibc/lib/rewinddir.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietdirent.h" -#include -#include - -void rewinddir(DIR *d) { - if (lseek(d->fd,0,SEEK_SET) != (off_t)-1) - d->num=d->cur=0; -} diff --git a/mdk-stage1/dietlibc/lib/sbrk.c b/mdk-stage1/dietlibc/lib/sbrk.c deleted file mode 100644 index 945ad5a16..000000000 --- a/mdk-stage1/dietlibc/lib/sbrk.c +++ /dev/null @@ -1,20 +0,0 @@ -#include - -extern int __brk(void *end_data_segment); - -extern void* __curbrk; - -void* __sbrk(ptrdiff_t increment) { - void* oldbrk; - if (__curbrk==0) - if (__brk(0) < 0) - return (void*)-1; - if (increment==0) - return __curbrk; - oldbrk=__curbrk; - if (__brk(oldbrk+increment)<0) - return (void*)-1; - return oldbrk; -} - -void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__sbrk"))); diff --git a/mdk-stage1/dietlibc/lib/seekdir.c b/mdk-stage1/dietlibc/lib/seekdir.c deleted file mode 100644 index cf111fbc8..000000000 --- a/mdk-stage1/dietlibc/lib/seekdir.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "dietdirent.h" -#include -#include - -void seekdir(DIR *d,off_t offset) { - if (lseek(d->fd,offset,SEEK_SET) != (off_t)-1) - d->num=d->cur=0; -} diff --git a/mdk-stage1/dietlibc/lib/semctl.c b/mdk-stage1/dietlibc/lib/semctl.c deleted file mode 100644 index ddc0aae95..000000000 --- a/mdk-stage1/dietlibc/lib/semctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int semctl(int semid, int semnum, int cmd, union semun arg) { - return __ipc(SEMCTL,semid,semnum,cmd,&arg); -} diff --git a/mdk-stage1/dietlibc/lib/semget.c b/mdk-stage1/dietlibc/lib/semget.c deleted file mode 100644 index 056aeae04..000000000 --- a/mdk-stage1/dietlibc/lib/semget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int semget(key_t key, int nsems, int semflg) { - return __ipc(SEMGET,key,nsems,semflg,0); -} diff --git a/mdk-stage1/dietlibc/lib/semop.c b/mdk-stage1/dietlibc/lib/semop.c deleted file mode 100644 index abfde73a7..000000000 --- a/mdk-stage1/dietlibc/lib/semop.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int semop(int semid,struct sembuf *sops,unsigned nsops) { - return __ipc(SEMOP,semid,nsops,0,sops); -} diff --git a/mdk-stage1/dietlibc/lib/send.c b/mdk-stage1/dietlibc/lib/send.c deleted file mode 100644 index c1adf1b5d..000000000 --- a/mdk-stage1/dietlibc/lib/send.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_send(int a, const void * b, size_t c, int flags) { -#ifdef __i386__ - return socketcall(SYS_SEND, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags }; - return socketcall(SYS_SEND, args); -#endif -} - -int send(int a, const void * b, size_t c, int flags) - __attribute__ ((weak, alias("__libc_send"))); diff --git a/mdk-stage1/dietlibc/lib/sendmsg.c b/mdk-stage1/dietlibc/lib/sendmsg.c deleted file mode 100644 index 277265985..000000000 --- a/mdk-stage1/dietlibc/lib/sendmsg.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_sendmsg(int a, const struct msghdr* msg, int flags) { -#ifdef __i386__ - return socketcall(SYS_SENDMSG, (long*)&a); -#else - unsigned long args[] = { a, (long) msg, flags }; - return socketcall(SYS_SENDMSG, args); -#endif -} - -int sendmsg(int a, const struct msghdr *msg, int flags) - __attribute__ ((weak,alias("__libc_sendmsg"))) ; diff --git a/mdk-stage1/dietlibc/lib/sendto.c b/mdk-stage1/dietlibc/lib/sendto.c deleted file mode 100644 index 078c010ea..000000000 --- a/mdk-stage1/dietlibc/lib/sendto.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) { -#ifdef __i386__ - return socketcall(SYS_SENDTO, (long*)&a); -#else - unsigned long args[] = { a, (long) b, c, flags, (long) to, tolen }; - return socketcall(SYS_SENDTO, args); -#endif -} - -int sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) - __attribute__ ((weak, alias("__libc_sendto"))); diff --git a/mdk-stage1/dietlibc/lib/set_errno.c b/mdk-stage1/dietlibc/lib/set_errno.c deleted file mode 100644 index 6553bc496..000000000 --- a/mdk-stage1/dietlibc/lib/set_errno.c +++ /dev/null @@ -1,9 +0,0 @@ -extern int errno; - -void __set_errno(int error) __attribute__ ((weak)); - -void __set_errno(int error) -{ - errno=error; -} - diff --git a/mdk-stage1/dietlibc/lib/setpgrp.c b/mdk-stage1/dietlibc/lib/setpgrp.c deleted file mode 100644 index 825ca3725..000000000 --- a/mdk-stage1/dietlibc/lib/setpgrp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int setpgrp() -{ - return setpgid(0,0); -} diff --git a/mdk-stage1/dietlibc/lib/setsockopt.c b/mdk-stage1/dietlibc/lib/setsockopt.c deleted file mode 100644 index 781e9c31c..000000000 --- a/mdk-stage1/dietlibc/lib/setsockopt.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int setsockopt(int a, int b, int c, void *d, void *e) { -#ifdef __i386__ - return socketcall(SYS_SETSOCKOPT, (long*)&a); -#else - unsigned long args[] = { a, b, c, (long)d, (long) e }; - return socketcall(SYS_SETSOCKOPT, args); -#endif -} - diff --git a/mdk-stage1/dietlibc/lib/shmat.c b/mdk-stage1/dietlibc/lib/shmat.c deleted file mode 100644 index 63284b1ea..000000000 --- a/mdk-stage1/dietlibc/lib/shmat.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include -#include - -extern void* __ipc(); - -void* shmat(int shmid,const void* shmaddr,int shmflg) { - void* raddr; - register void* result; - result=__ipc(SHMAT,shmid,shmflg,&raddr,shmaddr); - if ((unsigned long)result <= -(unsigned long)SHMLBA) - result=raddr; - return result; -} diff --git a/mdk-stage1/dietlibc/lib/shmctl.c b/mdk-stage1/dietlibc/lib/shmctl.c deleted file mode 100644 index 8f942f2a4..000000000 --- a/mdk-stage1/dietlibc/lib/shmctl.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int shmctl(int shmid, int cmd, struct shmid_ds *buf) { - return __ipc(SHMCTL,shmid,cmd,0,buf); -} diff --git a/mdk-stage1/dietlibc/lib/shmdt.c b/mdk-stage1/dietlibc/lib/shmdt.c deleted file mode 100644 index 36db10f08..000000000 --- a/mdk-stage1/dietlibc/lib/shmdt.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int shmdt(const void* shmaddr) { - return __ipc(SHMDT,0,0,0,shmaddr); -} diff --git a/mdk-stage1/dietlibc/lib/shmget.c b/mdk-stage1/dietlibc/lib/shmget.c deleted file mode 100644 index 9b03f5deb..000000000 --- a/mdk-stage1/dietlibc/lib/shmget.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include - -extern int __ipc(); - -int shmget(key_t key, int size, int shmflg) { - return __ipc(SHMGET,key,size,shmflg,0); -} diff --git a/mdk-stage1/dietlibc/lib/shutdown.c b/mdk-stage1/dietlibc/lib/shutdown.c deleted file mode 100644 index 0a6be6c37..000000000 --- a/mdk-stage1/dietlibc/lib/shutdown.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int __libc_shutdown(int s, int how) { -#ifdef __i386__ - return socketcall(SYS_SHUTDOWN, (long*)&s); -#else - unsigned long args[] = { s, (long) how, 0 }; - return socketcall(SYS_SHUTDOWN, args); -#endif -} - -int shutdown(int s, int how) __attribute__((weak,alias("__libc_shutdown"))); diff --git a/mdk-stage1/dietlibc/lib/sigaddset.c b/mdk-stage1/dietlibc/lib/sigaddset.c deleted file mode 100644 index 8ce69ea77..000000000 --- a/mdk-stage1/dietlibc/lib/sigaddset.c +++ /dev/null @@ -1,15 +0,0 @@ -#define __KERNEL__ -#define sigaddset foobar -#include -#undef sigaddset - -int __sigaddset(sigset_t *set, int signo) { - unsigned long sig = signo - 1; - if (_NSIG_WORDS == 1) - set->sig[0] |= 1UL << sig; - else - set->sig[sig / _NSIG_BPW] |= 1UL << (sig % _NSIG_BPW); - return 0; -} - -int sigaddset (sigset_t *env, int signo) __attribute__((weak,alias("__sigaddset"))); diff --git a/mdk-stage1/dietlibc/lib/sigdelset.c b/mdk-stage1/dietlibc/lib/sigdelset.c deleted file mode 100644 index 2c3385ea8..000000000 --- a/mdk-stage1/dietlibc/lib/sigdelset.c +++ /dev/null @@ -1,15 +0,0 @@ -#define __KERNEL__ -#define sigdelset foobar -#include -#undef sigdelset - -int __sigdelset(sigset_t *set, int signo) { - unsigned long sig = signo - 1; - if (_NSIG_WORDS == 1) - set->sig[0] &= ~(1UL << sig); - else - set->sig[sig / _NSIG_BPW] &= ~(1UL << (sig % _NSIG_BPW)); - return 0; -} - -int sigdelset (sigset_t *env, int signo) __attribute__((weak,alias("__sigdelset"))); diff --git a/mdk-stage1/dietlibc/lib/sigemptyset.c b/mdk-stage1/dietlibc/lib/sigemptyset.c deleted file mode 100644 index f4532f96e..000000000 --- a/mdk-stage1/dietlibc/lib/sigemptyset.c +++ /dev/null @@ -1,14 +0,0 @@ -#define __USE_EXTERN_INLINES 1 -#include -#include -#include - -int sigemptyset(sigset_t *set) { - if (set==NULL) { - __set_errno(EINVAL); - return -1; - } - memset(set,0,sizeof(*set)); - return 0; -} - diff --git a/mdk-stage1/dietlibc/lib/sigfillset.c b/mdk-stage1/dietlibc/lib/sigfillset.c deleted file mode 100644 index ddac6e391..000000000 --- a/mdk-stage1/dietlibc/lib/sigfillset.c +++ /dev/null @@ -1,11 +0,0 @@ -#define __KERNEL__ -#include - -int __sigfillset (sigset_t *set) { - int i; - for (i=0; i<_NSIG_WORDS; i++) - set->sig[i]=~0; - return 0; -} - -int sigfillset(sigset_t *env) __attribute__((weak,alias("__sigfillset"))); diff --git a/mdk-stage1/dietlibc/lib/sigismember.c b/mdk-stage1/dietlibc/lib/sigismember.c deleted file mode 100644 index 67a258884..000000000 --- a/mdk-stage1/dietlibc/lib/sigismember.c +++ /dev/null @@ -1,21 +0,0 @@ -#define __USE_EXTERN_INLINES 1 -#include - -# define __sigmask(sig) \ - (((unsigned long int) 1) << (((sig) - 1) % (8 * sizeof (unsigned long int)))) - -# define __sigword(sig) (((sig) - 1) / (8 * sizeof (unsigned long int))) - -# define _SIGSET_NWORDS (1024 / (8 * sizeof (unsigned long int))) -typedef struct - { - unsigned long int __val[_SIGSET_NWORDS]; - } __sigset_t; - -int __sigismember(const __sigset_t *set, int signo) { - unsigned long int __mask = __sigmask (signo); - unsigned long int __word = __sigword (signo); - return (set->__val[__word] & __mask); -} - -int sigismember(const sigset_t *env, int signo) __attribute__((weak,alias("__sigismember"))); diff --git a/mdk-stage1/dietlibc/lib/sigjmp.c b/mdk-stage1/dietlibc/lib/sigjmp.c deleted file mode 100644 index be97c62cc..000000000 --- a/mdk-stage1/dietlibc/lib/sigjmp.c +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#include -#include -#include - -/* This function is called by the `sigsetjmp' macro - before doing a `__setjmp' on ENV[0].__jmpbuf. - Always return zero. */ - -int -__sigjmp_save (sigjmp_buf env, int savemask) -{ - env[0].__mask_was_saved = (savemask && - sigprocmask (SIG_BLOCK, (sigset_t *) NULL, - (sigset_t*)&env[0].__saved_mask) == 0); - - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/sleep.c b/mdk-stage1/dietlibc/lib/sleep.c deleted file mode 100644 index ec5b99533..000000000 --- a/mdk-stage1/dietlibc/lib/sleep.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -unsigned int sleep(unsigned int secs) { - struct timespec t; - t.tv_sec=secs; - t.tv_nsec=0; - nanosleep(&t,&t); - return secs-t.tv_sec; -} - diff --git a/mdk-stage1/dietlibc/lib/snprintf.c b/mdk-stage1/dietlibc/lib/snprintf.c deleted file mode 100644 index 096c06115..000000000 --- a/mdk-stage1/dietlibc/lib/snprintf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int snprintf(char *str,size_t size,const char *format,...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(str,size,format,arg_ptr); - va_end (arg_ptr); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/socket.c b/mdk-stage1/dietlibc/lib/socket.c deleted file mode 100644 index 1684a6a2b..000000000 --- a/mdk-stage1/dietlibc/lib/socket.c +++ /dev/null @@ -1,12 +0,0 @@ -#include - -extern int socketcall(int callno,long* args); - -int socket(int a, int b, int c) { -#ifdef __i386__ - return socketcall(SYS_SOCKET, (long*)&a); -#else - unsigned long args[] = { a, b, c }; - return socketcall(SYS_SOCKET, args); -#endif -} diff --git a/mdk-stage1/dietlibc/lib/speed.c b/mdk-stage1/dietlibc/lib/speed.c deleted file mode 100644 index a7fcca7c9..000000000 --- a/mdk-stage1/dietlibc/lib/speed.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - -#include - -extern int errno; - -/* Hack around a kernel bug; value must correspond to the one used in tcsetattr.c */ -#define IBAUD0 020000000000 - - -/* Return the output baud rate stored in *TERMIOS_P. */ -speed_t cfgetospeed (struct termios *termios_p) -{ - return termios_p->c_cflag & (CBAUD | CBAUDEX); -} - - -/* Return the input baud rate stored in *TERMIOS_P. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -speed_t cfgetispeed (struct termios *termios_p) -{ - return ((termios_p->c_iflag & IBAUD0) - ? 0 : termios_p->c_cflag & (CBAUD | CBAUDEX)); -} - - -/* Set the output baud rate stored in *TERMIOS_P to SPEED. */ -int cfsetospeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - - return 0; -} - - -/* Set the input baud rate stored in *TERMIOS_P to SPEED. - Although for Linux there is no difference between input and output - speed, the numerical 0 is a special case for the input baud rate. It - should set the input baud rate to the output baud rate. */ -int cfsetispeed (struct termios *termios_p, speed_t speed) -{ - if ((speed & ~CBAUD) != 0 && (speed < B57600 || speed > B460800)) { - errno = EINVAL; - return -1; - } - - if (speed == 0) - termios_p->c_iflag |= IBAUD0; - else - { - termios_p->c_iflag &= ~IBAUD0; - termios_p->c_cflag &= ~(CBAUD | CBAUDEX); - termios_p->c_cflag |= speed; - } - - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/sprintf.c b/mdk-stage1/dietlibc/lib/sprintf.c deleted file mode 100644 index b355d01f9..000000000 --- a/mdk-stage1/dietlibc/lib/sprintf.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include -#include "dietwarning.h" - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int sprintf(char *dest,const char *format,...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsnprintf(dest,1000000,format,arg_ptr); - va_end (arg_ptr); - return n; -} - -link_warning("sprintf","warning: Avoid sprintf; use snprintf. It is more secure and faster.") diff --git a/mdk-stage1/dietlibc/lib/sscanf.c b/mdk-stage1/dietlibc/lib/sscanf.c deleted file mode 100644 index 341e74bba..000000000 --- a/mdk-stage1/dietlibc/lib/sscanf.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int vsscanf(const char *str, const char *format, va_list arg_ptr); - -int sscanf(const char *str, const char *format, ...) -{ - int n; - va_list arg_ptr; - va_start(arg_ptr, format); - n=vsscanf(str,format,arg_ptr); - va_end (arg_ptr); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/strcasecmp.c b/mdk-stage1/dietlibc/lib/strcasecmp.c deleted file mode 100644 index d978488a4..000000000 --- a/mdk-stage1/dietlibc/lib/strcasecmp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include "dietfeatures.h" - -int strcasecmp(register const char *s,register const char *t) { - register char x; - - for (;;) { - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; - x = tolower(*s); if (x != tolower(*t)) break; if (!x) break; ++s; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strcat.c b/mdk-stage1/dietlibc/lib/strcat.c deleted file mode 100644 index 8a755afea..000000000 --- a/mdk-stage1/dietlibc/lib/strcat.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietfeatures.h" -#include - -char* strcat(register char* s,register const char* t) -{ - char *dest=s; - s+=strlen(s); - for (;;) { - if (!(*s = *t)) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) break; ++s; ++t; - if (!(*s = *t)) break; ++s; ++t; - if (!(*s = *t)) break; ++s; ++t; -#endif - } - return dest; -} - diff --git a/mdk-stage1/dietlibc/lib/strchr.c b/mdk-stage1/dietlibc/lib/strchr.c deleted file mode 100644 index 0c2050da6..000000000 --- a/mdk-stage1/dietlibc/lib/strchr.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "dietfeatures.h" - -char *strchr(register const char *t, int c) { - register char ch; - - ch = c; - for (;;) { - if (*t == ch) break; if (!*t) return 0; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (*t == ch) break; if (!*t) return 0; ++t; - if (*t == ch) break; if (!*t) return 0; ++t; - if (*t == ch) break; if (!*t) return 0; ++t; -#endif - } - return (char*)t; -} - -char *index(char *t,int c) __attribute__((weak,alias("strchr"))); diff --git a/mdk-stage1/dietlibc/lib/strcmp.c b/mdk-stage1/dietlibc/lib/strcmp.c deleted file mode 100644 index 0db324e66..000000000 --- a/mdk-stage1/dietlibc/lib/strcmp.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "dietfeatures.h" - -int strcmp(register const char *s,register const char *t) { - register char x; - - for (;;) { - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; - x = *s; if (x != *t) break; if (!x) break; ++s; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strcpy.c b/mdk-stage1/dietlibc/lib/strcpy.c deleted file mode 100644 index 49693c30d..000000000 --- a/mdk-stage1/dietlibc/lib/strcpy.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "dietfeatures.h" - -char* strcpy(register char* s,register const char* t) -{ - char *dest=s; - for (;;) { - if (!(*s = *t)) return dest; ++s; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) return dest; ++s; ++t; - if (!(*s = *t)) return dest; ++s; ++t; - if (!(*s = *t)) return dest; ++s; ++t; -#endif - } -} - diff --git a/mdk-stage1/dietlibc/lib/strcspn.c b/mdk-stage1/dietlibc/lib/strcspn.c deleted file mode 100644 index 37053c72c..000000000 --- a/mdk-stage1/dietlibc/lib/strcspn.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -size_t strcspn(const char *s, const char *reject) -{ - size_t l=0; - int a=1,i,al=strlen(reject); - - while((a)&&(*s)) - { - for(i=0;(a)&&(i -#include - -char *strdup(const char *s) { - char *tmp=(char *)malloc(strlen(s)+1); - if (!tmp) return 0; - strcpy(tmp,s); - return tmp; -} diff --git a/mdk-stage1/dietlibc/lib/strerror.c b/mdk-stage1/dietlibc/lib/strerror.c deleted file mode 100644 index f15b86aae..000000000 --- a/mdk-stage1/dietlibc/lib/strerror.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern char *sys_errlist[]; -extern int sys_nerr; - -char *strerror(int errnum) { - if (errnum>=0 && errnum - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(initial dst) + strlen(src); if retval >= siz, - * truncation occurred. - */ -size_t strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - size_t dlen; - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (*d != '\0' && n-- != 0) - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -} diff --git a/mdk-stage1/dietlibc/lib/strlcpy.3 b/mdk-stage1/dietlibc/lib/strlcpy.3 deleted file mode 100644 index e00af8d6b..000000000 --- a/mdk-stage1/dietlibc/lib/strlcpy.3 +++ /dev/null @@ -1,169 +0,0 @@ -.\" $OpenBSD: strlcpy.3,v 1.10 2000/11/06 01:03:25 aaron Exp $ -.\" -.\" Copyright (c) 1998, 2000 Todd C. Miller -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd June 22, 1998 -.Dt STRLCPY 3 -.Os -.Sh NAME -.Nm strlcpy , -.Nm strlcat -.Nd size-bounded string copying and concatenation -.Sh SYNOPSIS -.Fd #include -.Ft size_t -.Fn strlcpy "char *dst" "const char *src" "size_t size" -.Ft size_t -.Fn strlcat "char *dst" "const char *src" "size_t size" -.Sh DESCRIPTION -The -.Fn strlcpy -and -.Fn strlcat -functions copy and concatenate strings respectively. -They are designed -to be safer, more consistent, and less error prone replacements for -.Xr strncpy 3 -and -.Xr strncat 3 . -Unlike those functions, -.Fn strlcpy -and -.Fn strlcat -take the full size of the buffer (not just the length) and guarantee to -NUL-terminate the result (as long as -.Fa size -is larger than 0 or, in the case of -.Fn strlcat , -as long as there is at least one byte free in -.Fa dst ) . -Note that you should include a byte for the NUL in -.Fa size . -Also note that -.Fn strlcpy -and -.Fn strlcat -only operate on true -.Dq C -strings. -This means that for -.Fn strlcpy -.Fa src -must be NUL-terminated and for -.Fn strlcat -both -.Fa src -and -.Fa dst -must be NUL-terminated. -.Pp -The -.Fn strlcpy -function copies up to -.Fa size -- 1 characters from the NUL-terminated string -.Fa src -to -.Fa dst , -NUL-terminating the result. -.Pp -The -.Fn strlcat -function appends the NUL-terminated string -.Fa src -to the end of -.Fa dst . -It will append at most -.Fa size -- strlen(dst) - 1 bytes, NUL-terminating the result. -.Sh RETURN VALUES -The -.Fn strlcpy -and -.Fn strlcat -functions return the total length of the string they tried to create. -For -.Fn strlcpy -that means the length of -.Fa src . -For -.Fn strlcat -that means the initial length of -.Fa dst -plus -the length of -.Fa src . -While this may seem somewhat confusing it was done to make -truncation detection simple. -.Sh EXAMPLES -The following code fragment illustrates the simple case: -.Bd -literal -offset indent -char *s, *p, buf[BUFSIZ]; - -\&... - -(void)strlcpy(buf, s, sizeof(buf)); -(void)strlcat(buf, p, sizeof(buf)); -.Ed -.Pp -To detect truncation, perhaps while building a pathname, something -like the following might be used: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHLEN]; - -\&... - -if (strlcpy(pname, dir, sizeof(pname)) >= sizeof(pname)) - goto toolong; -if (strlcat(pname, file, sizeof(pname)) >= sizeof(pname)) - goto toolong; -.Ed -.Pp -Since we know how many characters we copied the first time, we can -speed things up a bit by using a copy instead of an append: -.Bd -literal -offset indent -char *dir, *file, pname[MAXPATHLEN]; -size_t n; - -\&... - -n = strlcpy(pname, dir, sizeof(pname)); -if (n >= sizeof(pname)) - goto toolong; -if (strlcpy(pname + n, file, sizeof(pname) - n) >= sizeof(pname) - n) - goto toolong; -.Ed -.Pp -However, one may question the validity of such optimizations, as they -defeat the whole purpose of -.Fn strlcpy -and -.Fn strlcat . -As a matter of fact, the first version of this manual page got it wrong. -.Sh SEE ALSO -.Xr snprintf 3 , -.Xr strncat 3 , -.Xr strncpy 3 diff --git a/mdk-stage1/dietlibc/lib/strlcpy.c b/mdk-stage1/dietlibc/lib/strlcpy.c deleted file mode 100644 index b935b9527..000000000 --- a/mdk-stage1/dietlibc/lib/strlcpy.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t strlcpy(dst, src, siz) - char *dst; - const char *src; - size_t siz; -{ - register char *d = dst; - register const char *s = src; - register size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} diff --git a/mdk-stage1/dietlibc/lib/strlen.c b/mdk-stage1/dietlibc/lib/strlen.c deleted file mode 100644 index 56c085dac..000000000 --- a/mdk-stage1/dietlibc/lib/strlen.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include "dietfeatures.h" -#include - -#ifdef WANT_SMALL_STRING_ROUTINES -size_t strlen(const char *s) { - register int i; - if (!s) return 0; - for (i=0; *s; ++s) ++i; - return i; -} -#else -static const unsigned long magic = 0x01010101; - -size_t strlen(const char *s) -{ - const char *t = s; - unsigned long word; - - if (!s) return 0; - - /* Byte compare up until word boundary */ - for (; ((unsigned long) t & 3); t++) - if (!*t) return t - s; - - /* Word compare */ - do { - word = *((unsigned long *) t); t += 4; - word = (word - magic) &~ word; - word &= (magic << 7); - } while (word == 0); - -#if BYTE_ORDER == LITTLE_ENDIAN - /* word & 0x80808080 == word */ - word = (word - 1) & (magic << 10); - word += (word << 8) + (word << 16); - t += word >> 26; -#else - if ((word & 0x80800000) == 0) { - word <<= 16; - t += 2; - } - if ((word & 0x80000000) == 0) t += 1; -#endif - return ((const char *) t) - 4 - s; -} -#endif diff --git a/mdk-stage1/dietlibc/lib/strncasecmp.c b/mdk-stage1/dietlibc/lib/strncasecmp.c deleted file mode 100644 index 8a5445e53..000000000 --- a/mdk-stage1/dietlibc/lib/strncasecmp.c +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include -#include - -int strncasecmp(const char *s, const char *t, size_t n) { - register char x; - register const char* u=s+n; - for (;;) { - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; - x = tolower(*s); if (x!=tolower(*t)) break; if (!x) break; if (++s>=u) return 0; ++t; -#endif - } - return ((int)(unsigned int)(unsigned char) x) - - ((int)(unsigned int)(unsigned char) *t); -} diff --git a/mdk-stage1/dietlibc/lib/strncat.c b/mdk-stage1/dietlibc/lib/strncat.c deleted file mode 100644 index a08e97916..000000000 --- a/mdk-stage1/dietlibc/lib/strncat.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "dietfeatures.h" -#include - -#ifdef WANT_NON_COMPLIANT_STRNCAT -/* this implementation is not standards compliant. - * the standard says that strncat(dest,"foobar",3) should write 'f', 'o' - * and 'o'. The programmer is then expected to overwrite the last byte - * with '\0', which is often forgotten. This implementation makes sure - * the last written bytes is always '\0'. */ -#endif - -char *strncat(char *s, const char *t, size_t n) { - char *dest=s; - register char *max; - s+=strlen(s); -#ifdef WANT_NON_COMPLIANT_STRNCAT - max=s+n-1; -#else - max=s+n; -#endif - for (;;) { - if (!(*s = *t)) break; if (++s==max) break; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (!(*s = *t)) break; if (++s==max) break; ++t; - if (!(*s = *t)) break; if (++s==max) break; ++t; - if (!(*s = *t)) break; if (++s==max) break; ++t; -#endif - } - *s=0; - return dest; -} diff --git a/mdk-stage1/dietlibc/lib/strncmp.c b/mdk-stage1/dietlibc/lib/strncmp.c deleted file mode 100644 index 7c08c0fa7..000000000 --- a/mdk-stage1/dietlibc/lib/strncmp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -int strncmp(const char *s1, const char *s2, size_t n) { - return memccmp(s1,s2,0,n); -} diff --git a/mdk-stage1/dietlibc/lib/strncpy.c b/mdk-stage1/dietlibc/lib/strncpy.c deleted file mode 100644 index 531387b7f..000000000 --- a/mdk-stage1/dietlibc/lib/strncpy.c +++ /dev/null @@ -1,10 +0,0 @@ -#define _POSIX_SOURCE -#define _XOPEN_SOURCE -#include -#include - -char *strncpy(char *dest, const char *src, size_t n) -{ - memccpy(dest,src,0,n); - return dest; -} diff --git a/mdk-stage1/dietlibc/lib/strpbrk.c b/mdk-stage1/dietlibc/lib/strpbrk.c deleted file mode 100644 index e18fd2a2d..000000000 --- a/mdk-stage1/dietlibc/lib/strpbrk.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -char *strpbrk(const char *s, const char *accept) { - register int i,l=strlen(accept); - for (; *s; s++) - for (i=0; i -#include "dietfeatures.h" - -char *strrchr(const char *t, int c) { - register char ch; - register const char *l=0; - - ch = c; - for (;;) { - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; -#ifndef WANT_SMALL_STRING_ROUTINES - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; - if (*t == ch) l=t; if (!*t) return (char*)l; ++t; -#endif - } - return (char*)l; -} - -char *rindex(const char *t,int c) __attribute__((weak,alias("strrchr"))); diff --git a/mdk-stage1/dietlibc/lib/strsep.c b/mdk-stage1/dietlibc/lib/strsep.c deleted file mode 100644 index a1bf1872a..000000000 --- a/mdk-stage1/dietlibc/lib/strsep.c +++ /dev/null @@ -1,16 +0,0 @@ -#include - -char *strsep(char **stringp, const char *delim) { - register char *tmp=*stringp; - register char *tmp2=tmp; - register const char *tmp3; - for (tmp2=tmp; *tmp2; ++tmp2) { - for (tmp3=delim; *tmp3; ++tmp3) - if (*tmp2==*tmp3) { /* delimiter found */ - *tmp2=0; - *stringp=tmp2+1; - return tmp; - } - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/strspn.c b/mdk-stage1/dietlibc/lib/strspn.c deleted file mode 100644 index 2b3a4c116..000000000 --- a/mdk-stage1/dietlibc/lib/strspn.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include - -size_t strspn(const char *s, const char *accept) -{ - size_t l=0; - int a=1,i,al=strlen(accept); - - while((a)&&(*s)) - { - for(a=i=0;(!a)&&(i -#include - -char *strstr(const char *haystack, const char *needle) { - int nl=strlen(needle); - int hl=strlen(haystack); - int i; - if (nl>hl) return 0; - for (i=hl-nl+1; i; --i) { - if (!memcmp(haystack,needle,nl)) - return (char*)haystack; - ++haystack; - } - return 0; -} diff --git a/mdk-stage1/dietlibc/lib/strtod.c b/mdk-stage1/dietlibc/lib/strtod.c deleted file mode 100644 index cbe983d84..000000000 --- a/mdk-stage1/dietlibc/lib/strtod.c +++ /dev/null @@ -1,52 +0,0 @@ -#include - -extern char isspace(char c); - -#ifdef __GNUC__ -static inline char isdigit(char c) { return (c>='0' && c<='9'); } -#endif - -double strtod(const char *nptr, char **endptr) { - double d=0; - register const char *c=nptr; - char neg=0; - while (*c && isspace(*c)) ++c; - switch (*c) { - case '-': neg=1; - case '+': c++; break; - default: break; - } - while (isdigit(*c)) { - d=d*10+(*c-'0'); - ++c; - } - if (*c=='.') { - double factor=.1; - while (isdigit(*++c)) { - d=d+(factor*(*c-'0')); - factor/=10; - } - } - if ((*c|32)=='e') { - int exp=0; - double factor=10; - if (c[1]<'0') { - switch (c[1]) { - case '-': factor=0.1; - case '+': c++; break; - default: - d=0; - c=nptr; - goto done; - } - } - while (isdigit(*++c)) - exp=exp*10+(*c-'0'); - while (exp) { /* XXX: this introduces rounding errors */ - d*=factor; --exp; - } - } -done: - if (endptr) *endptr=(char*)c; - return d; -} diff --git a/mdk-stage1/dietlibc/lib/strtok.c b/mdk-stage1/dietlibc/lib/strtok.c deleted file mode 100644 index 86337da7b..000000000 --- a/mdk-stage1/dietlibc/lib/strtok.c +++ /dev/null @@ -1,8 +0,0 @@ -char *strtok_r(char *s, const char *delim, char **ptrptr); - -static char *strtok_pos; - -char *strtok(char *s, const char *delim) -{ - return strtok_r(s,delim,&strtok_pos); -} diff --git a/mdk-stage1/dietlibc/lib/strtok_r.c b/mdk-stage1/dietlibc/lib/strtok_r.c deleted file mode 100644 index 93f9401de..000000000 --- a/mdk-stage1/dietlibc/lib/strtok_r.c +++ /dev/null @@ -1,21 +0,0 @@ -#include - -char *strtok_r(char *s, const char *delim, char **ptrptr) -{ - int i; - char *tmp=0; - - if (s) (*ptrptr)=s; - - if (**ptrptr) - { - while(!(i=strcspn(*ptrptr,delim))) (*ptrptr)++; - if (**ptrptr) - { - tmp=(*ptrptr); - (*ptrptr)+=i; - if (**ptrptr) *(*ptrptr)++=0; - } - } - return tmp; -} diff --git a/mdk-stage1/dietlibc/lib/strtol.c b/mdk-stage1/dietlibc/lib/strtol.c deleted file mode 100644 index ead89f408..000000000 --- a/mdk-stage1/dietlibc/lib/strtol.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern unsigned long int strtoul(const char *nptr, char **endptr, int base); - -long int strtol(const char *nptr, char **endptr, int base) -{ - int neg=0; - unsigned long int v; - - while(isspace(*nptr)) nptr++; - - if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; } - v=strtoul(nptr,endptr,base); - return (neg?-v:v); -} diff --git a/mdk-stage1/dietlibc/lib/strtoll.c b/mdk-stage1/dietlibc/lib/strtoll.c deleted file mode 100644 index 7b8e28a1d..000000000 --- a/mdk-stage1/dietlibc/lib/strtoll.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -extern unsigned long int strtoull(const char *nptr, char **endptr, int base); - -long int strtoll(const char *nptr, char **endptr, int base) -{ - int neg=0; - unsigned long long int v; - - while(isspace(*nptr)) nptr++; - - if (*nptr == '-' && isdigit(nptr[1])) { neg=-1; nptr++; } - v=strtoull(nptr,endptr,base); - return (neg?-v:v); -} diff --git a/mdk-stage1/dietlibc/lib/strtoul.c b/mdk-stage1/dietlibc/lib/strtoul.c deleted file mode 100644 index 3f93962a9..000000000 --- a/mdk-stage1/dietlibc/lib/strtoul.c +++ /dev/null @@ -1,32 +0,0 @@ -#include - -/* static char *num="0123456789abcdefghijklmnopqrstuvwxyz"; */ - -unsigned long int strtoul(const char *nptr, char **endptr, int base) -{ - long int v=0; - - while(isspace(*nptr)) ++nptr; - - if (*nptr == '+') ++nptr; - if (!base) { - if (*nptr=='0') { - base=8; - if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) { - nptr+=2; - base=16; - } - } - else - base=10; - } - while(*nptr) { - register unsigned char c=*nptr; - c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0'); - if (c>=base) break; - v=v*base+c; - ++nptr; - } - if (endptr) *endptr=(char *)nptr; - return v; -} diff --git a/mdk-stage1/dietlibc/lib/strtoull.c b/mdk-stage1/dietlibc/lib/strtoull.c deleted file mode 100644 index 40818958d..000000000 --- a/mdk-stage1/dietlibc/lib/strtoull.c +++ /dev/null @@ -1,30 +0,0 @@ -#include - -unsigned long long int strtoull(const char *nptr, char **endptr, int base) -{ - long long int v=0; - - while(isspace(*nptr)) ++nptr; - - if (*nptr == '+') ++nptr; - if (!base) { - if (*nptr=='0') { - base=8; - if ((*(nptr+1)=='x')||(*(nptr+1)=='X')) { - nptr+=2; - base=16; - } - } - else - base=10; - } - while(*nptr) { - register unsigned char c=*nptr; - c=(c>='a'?c-'a'+10:c>='A'?c-'A'+10:c-'0'); - if (c>=base) break; - v=v*base+c; - ++nptr; - } - if (endptr) *endptr=(char *)nptr; - return v; -} diff --git a/mdk-stage1/dietlibc/lib/sys_siglist.c b/mdk-stage1/dietlibc/lib/sys_siglist.c deleted file mode 100644 index 80d7b3fb0..000000000 --- a/mdk-stage1/dietlibc/lib/sys_siglist.c +++ /dev/null @@ -1,37 +0,0 @@ -const char *const sys_siglist[] = - { - "Signal 0", - "Hangup", - "Interrupt", - "Quit", - "Illegal instruction", - "Trace/breakpoint trap", - "IOT trap", - "EMT trap", - "Floating point exception", - "Killed", - "Bus error", - "Segmentation fault", - "Bad system call", - "Broken pipe", - "Alarm clock", - "Terminated", - "Urgent I/O condition", - "Stopped (signal)", - "Stopped", - "Continued", - "Child exited", - "Stopped (tty input)", - "Stopped (tty output)", - "I/O possible", - "CPU time limit exceeded", - "File size limit exceeded", - "Virtual timer expired", - "Profiling timer expired", - "Window changed", - "Resource lost", - "User defined signal 1", - "User defined signal 2", - 0 - }; - diff --git a/mdk-stage1/dietlibc/lib/tcdrain.c b/mdk-stage1/dietlibc/lib/tcdrain.c deleted file mode 100644 index 7a760f643..000000000 --- a/mdk-stage1/dietlibc/lib/tcdrain.c +++ /dev/null @@ -1,8 +0,0 @@ -#include - -int __libc_tcdrain(int fd) -{ - return ioctl(fd, TCSBRK, 1); -} - -int tcdrain(int fd) __attribute__((weak,alias("__libc_tcdrain"))); diff --git a/mdk-stage1/dietlibc/lib/tcflush.c b/mdk-stage1/dietlibc/lib/tcflush.c deleted file mode 100644 index a19fe11d1..000000000 --- a/mdk-stage1/dietlibc/lib/tcflush.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -#include - -#include - -extern int errno; - -/* Flush pending data on FD. */ -int tcflush(int fd, int queue_selector) -{ - switch (queue_selector) { - case TCIFLUSH: - return ioctl(fd, TCFLSH, 0); - case TCOFLUSH: - return ioctl(fd, TCFLSH, 1); - case TCIOFLUSH: - return ioctl(fd, TCFLSH, 2); - default: - errno = EINVAL; - return -1; - } -} diff --git a/mdk-stage1/dietlibc/lib/tcgetattr.c b/mdk-stage1/dietlibc/lib/tcgetattr.c deleted file mode 100644 index f35d39442..000000000 --- a/mdk-stage1/dietlibc/lib/tcgetattr.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int tcgetattr(int fildes, struct termios *termios_p) -{ - return ioctl(fildes, TCGETS, termios_p); -} diff --git a/mdk-stage1/dietlibc/lib/tcgetpgrp.c b/mdk-stage1/dietlibc/lib/tcgetpgrp.c deleted file mode 100644 index f2a290651..000000000 --- a/mdk-stage1/dietlibc/lib/tcgetpgrp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int tcgetpgrp(int fildes) -{ - return ioctl(fildes, TIOCGPGRP); -} diff --git a/mdk-stage1/dietlibc/lib/tcsetattr.c b/mdk-stage1/dietlibc/lib/tcsetattr.c deleted file mode 100644 index cf70354d2..000000000 --- a/mdk-stage1/dietlibc/lib/tcsetattr.c +++ /dev/null @@ -1,27 +0,0 @@ -#define tcsetattr libc_tcsetattr -#include -#include -#undef tcsetattr - -#include - -extern int errno; - -/* Hack around a kernel bug; value must correspond to the one used in speed.c */ -#define IBAUD0 020000000000 - -int tcsetattr(int fildes, int optional_actions, struct termios *termios_p) -{ - termios_p->c_iflag &= ~IBAUD0; - switch (optional_actions) { - case TCSANOW: - return ioctl(fildes, TCSETS, termios_p); - case TCSADRAIN: - return ioctl(fildes, TCSETSW, termios_p); - case TCSAFLUSH: - return ioctl(fildes, TCSETSF, termios_p); - default: - errno = EINVAL; - return -1; - } -} diff --git a/mdk-stage1/dietlibc/lib/tcsetpgrp.c b/mdk-stage1/dietlibc/lib/tcsetpgrp.c deleted file mode 100644 index 6c40b5c79..000000000 --- a/mdk-stage1/dietlibc/lib/tcsetpgrp.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -int tcsetpgrp(int fildes, pid_t pgrpid) -{ - return ioctl(fildes, TIOCSPGRP, &pgrpid); -} diff --git a/mdk-stage1/dietlibc/lib/telldir.c b/mdk-stage1/dietlibc/lib/telldir.c deleted file mode 100644 index 58be5d034..000000000 --- a/mdk-stage1/dietlibc/lib/telldir.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "dietdirent.h" -#include -#include - -off_t telldir(DIR *d) { - return lseek(d->fd,0,SEEK_CUR)-d->num+d->cur; -} diff --git a/mdk-stage1/dietlibc/lib/tolower.c b/mdk-stage1/dietlibc/lib/tolower.c deleted file mode 100644 index 4b7c7cf2d..000000000 --- a/mdk-stage1/dietlibc/lib/tolower.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -inline int tolower(int c) { - return (c>='A' && c<='Z')?c-'A'+'a':c; -} - diff --git a/mdk-stage1/dietlibc/lib/toupper.c b/mdk-stage1/dietlibc/lib/toupper.c deleted file mode 100644 index c048e60bb..000000000 --- a/mdk-stage1/dietlibc/lib/toupper.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -inline int toupper(int c) { - return (c>='a' && c<='z')?c-'a'+'A':c; -} - diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c deleted file mode 100644 index a6b479088..000000000 --- a/mdk-stage1/dietlibc/lib/ttyname.c +++ /dev/null @@ -1,59 +0,0 @@ -#include "dietfeatures.h" -#include -#include - -#ifdef __linux__ - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); - -char *ttyname(int fd) { -#ifdef SLASH_PROC_OK - char ibuf[20]; - static char obuf[20]; - strcpy(ibuf,"/proc/self/fd/"); - ibuf[__ltostr(ibuf+14,6,fd,10,0)+14]=0; - if (readlink(ibuf,obuf,sizeof(obuf)-1)<0) return 0; - return obuf; -#else - static char buf[20]="/dev/tty"; - struct stat s; - char *c=buf+8; - int n; - if (fstat(fd,&s)) return 0; - if (S_ISCHR(s.st_mode)) { - n=minor(s.st_rdev); - switch (major(s.st_rdev)) { - case 4: - buf[5]='t'; buf[7]='y'; - if (n>63) { - n-=64; - *c='S'; - ++c; - } -num: - c[__ltostr(c,6,n,10,0)]=0; - break; - case 2: - buf[5]='p'; buf[7]='y'; - buf[8]='p'-(n>>4); - buf[9]=n%4+'0'; - if (buf[9]>'9') *c+='a'-'0'; - buf[10]=0; - case 136: - case 137: - case 138: - case 139: - buf[5]='p'; buf[7]='s'; - n+=(major(s.st_rdev)-136)<<8; - *c='/'; ++c; - goto num; - default: - return 0; - } - return buf; - } - return 0; -#endif -} - -#endif diff --git a/mdk-stage1/dietlibc/lib/usleep.c b/mdk-stage1/dietlibc/lib/usleep.c deleted file mode 100644 index 494f99233..000000000 --- a/mdk-stage1/dietlibc/lib/usleep.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -/* nano * 1000 == usecs - * usecs * 1000 == msecs - * msecs * 1000 = secs */ -void usleep(unsigned int usecs) { - struct timespec t; - t.tv_sec=usecs/1000000; - t.tv_nsec=(usecs%1000000)*1000; - nanosleep(&t,&t); -} diff --git a/mdk-stage1/dietlibc/lib/vfork.c b/mdk-stage1/dietlibc/lib/vfork.c deleted file mode 100644 index 795cddb05..000000000 --- a/mdk-stage1/dietlibc/lib/vfork.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -pid_t vfork(void) { - return fork(); -} diff --git a/mdk-stage1/dietlibc/lib/vfprintf.c b/mdk-stage1/dietlibc/lib/vfprintf.c deleted file mode 100644 index c33a2404b..000000000 --- a/mdk-stage1/dietlibc/lib/vfprintf.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include "dietstdarg.h" - -int vfprintf(FILE *fstream, const char *format, va_list ap) -{ - char *tmp; - va_list cp_ap; - size_t n = 0; - - va_copy(cp_ap, ap); - n=vsnprintf(0, 1000000, format, cp_ap); - tmp=alloca(n+2); - vsnprintf(tmp, n+1, format, ap); - fwrite(tmp, n,1, fstream); - return n; -} - diff --git a/mdk-stage1/dietlibc/lib/vprintf.c b/mdk-stage1/dietlibc/lib/vprintf.c deleted file mode 100644 index 46ecc47a4..000000000 --- a/mdk-stage1/dietlibc/lib/vprintf.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include -#include -#include - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int vprintf(const char *format, va_list ap) -{ - char tmp[1000000]; - size_t n = vsnprintf(tmp, sizeof(tmp), format, ap); - write(1, tmp, n); - return n; -} diff --git a/mdk-stage1/dietlibc/lib/vsnprintf.c b/mdk-stage1/dietlibc/lib/vsnprintf.c deleted file mode 100644 index f425066e3..000000000 --- a/mdk-stage1/dietlibc/lib/vsnprintf.c +++ /dev/null @@ -1,238 +0,0 @@ -#include "dietfeatures.h" -#include -#include -#include -#include -#include "dietwarning.h" - -extern int __ltostr(char *s, int size, unsigned long i, int base, char UpCase); -extern int __dtostr(double d,char *buf,int maxlen,int prec); - -int vsnprintf (char *str, size_t size, const char *format, va_list arg_ptr) -{ - size_t apos,i; - char ch,buf[1024]; - char *pb; - char flag_in_sign; - char flag_hash,flag_zero,flag_left,flag_space,flag_sign,flag_dot,flag_long; - long number,width,preci,buf_len,pad; - char padwith; - - size--; - - apos=0; - while (apos=size) continue; /* ARGL !!! */ - - ch=*format++; - switch (ch) - { -/* Format end ?!? */ - case 0: - return -1; - break; - -/* Format flag chars */ - case '#': - flag_hash=1; - goto inn_vsnprintf; - - case 'l': - ++flag_long; - goto inn_vsnprintf; - - case '0': - padwith='0'; - goto inn_vsnprintf; - - case '-': - flag_left=1; - goto inn_vsnprintf; - - case ' ': - flag_space=1; - goto inn_vsnprintf; - - case '+': - flag_sign=1; - goto inn_vsnprintf; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - if(flag_dot) return -1; - width=strtol(--format,&pb,10); - format=pb; - goto inn_vsnprintf; - - case '*': - width=va_arg(arg_ptr,int); - goto inn_vsnprintf; - - case '.': - flag_dot=1; - if (*format=='*') { - preci=va_arg(arg_ptr,int); - ++format; - } else { - preci=strtol(format,&pb,10); - format=pb; - } - goto inn_vsnprintf; - -/* Format conversion chars */ - case 'c': - ch=(char)va_arg(arg_ptr,int); - case '%': - if (str) str[apos]=ch; ++apos; - break; - - case 's': - pb=va_arg(arg_ptr,char *); -#ifdef WANT_NULL_PRINTF - if (!pb) pb="(null)"; -#endif - buf_len=strlen(pb); - if (flag_dot && buf_len>preci) buf_len=preci; - if (buf_len>size-apos) buf_len=size-apos; - -print_out: - if (str) { - if (width && (!flag_left)) - { - for (pad=width-buf_len; pad>0; --pad) str[apos++]=padwith; - } - for(i=0;i0; --pad) str[apos++]=padwith; - } - } else { - if (width) { - apos+=width>buf_len?width:buf_len; - } else { - apos+=size>buf_len?buf_len:size; - } - } - - break; - - /* Numbers */ - case 'b': - i=2; - goto num_vsnprintf; - case 'p': - flag_hash=1; - width=sizeof(void *)<<1; - padwith='0'; - ch='x'; - case 'X': - case 'x': - i=16; - if (flag_hash) - { - if (str) { - str[apos++]='0'; - str[apos++]=ch; - } else - apos+=2; - } - goto num_vsnprintf; - case 'd': - case 'i': - flag_in_sign=1; - case 'u': - i=10; - goto num_vsnprintf; - case 'o': - i=8; - if (flag_hash) { if (str) str[apos]='0'; ++apos; } - -num_vsnprintf: - if (apos>=size) continue; /* ARGL !!! */ - - if (flag_long) - number=va_arg(arg_ptr,long); - else - number=va_arg(arg_ptr,int); - - if (flag_in_sign && (number<0)) - { - number*=-1; - flag_in_sign=2; - } - - buf_len=__ltostr(buf+1,sizeof(buf)-1,(unsigned long) number,i,0); - pb=buf+1; - - if (flag_in_sign==2) - { - *(--pb)='-'; - buf_len++; - } - else if ((flag_in_sign)&&(flag_sign || flag_space)) - { - *(--pb)=(flag_sign)?'+':' '; - buf_len++; - } - goto print_out; - -#ifdef WANT_FLOATING_POINT_IN_PRINTF - case 'f': - case 'g': - { - double d=va_arg(arg_ptr,double); - buf_len=__dtostr(d,buf,sizeof(buf),width?width:6); - if (flag_dot) { - char *tmp; - if ((tmp=strchr(buf,'.'))) { - while (preci>-1 && *++tmp) --preci; - *tmp=0; - } - } - pb=buf; - goto print_out; - } -#endif - default: - break; - } - break; - case 0: - if (str) str[apos]=0; - return apos; - default: - if (str) str[apos]=ch; apos++; - break; - } - } - if (str) str[apos]=0; - return apos; -} - -link_warning("vsnprintf","warning: the printf functions add several kilobytes of bloat.") - diff --git a/mdk-stage1/dietlibc/lib/vsprintf.c b/mdk-stage1/dietlibc/lib/vsprintf.c deleted file mode 100644 index 10ff04bd7..000000000 --- a/mdk-stage1/dietlibc/lib/vsprintf.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -int vsnprintf (char *str,size_t size,const char *format, va_list arg_ptr); - -int vsprintf(char *dest,const char *format, va_list arg_ptr) -{ - return vsnprintf(dest,1000000,format,arg_ptr); -} diff --git a/mdk-stage1/dietlibc/lib/vsscanf.c b/mdk-stage1/dietlibc/lib/vsscanf.c deleted file mode 100644 index 1c4c9b787..000000000 --- a/mdk-stage1/dietlibc/lib/vsscanf.c +++ /dev/null @@ -1,304 +0,0 @@ -#include "dietfeatures.h" -#include -#include -#include -#include -#include - -const char *skip_ws(const char *str) -{ - while ((*str)&&(isspace(*str))) str++; - return str; -} - -extern double strtod(const char *s,char **f); - -int vsscanf(const char *str, const char *format, va_list arg_ptr) -{ - int n=0,div; - unsigned char ch; - - char flag_discard, flag_malloc, flag_half, flag_long, flag_longlong; - char flag_width; - - unsigned long width; - - /* arg_ptr tmps */ -#ifdef WANT_FLOATING_POINT_IN_SCANF - double d,*pd; - float *pf; -#endif - - long l=0,*pl; - short *ph; - int *pi; - char *s; - - while ((*str)&&(*format)) - { - const char *prevfmt=format; - format=skip_ws(format); - ch=*format++; - if (!ch) continue; - - switch (ch) - { - case '%': - div=0; - flag_discard=0; - flag_malloc=0; - flag_half=0; - flag_long=0; - flag_longlong=0; - - flag_width=0; - width=-1; - -inn_vsscanf: - ch=*format++; - - switch (ch) - { - case 0: - return 0; - - case '%': - if (*(str++)!=ch) return n; - break; - - /* flags */ - case '*': - flag_discard=1; - goto inn_vsscanf; - - case 'a': - flag_malloc=1; - goto inn_vsscanf; - - case 'h': - flag_half=1; - goto inn_vsscanf; - - case 'l': - if (flag_long) flag_longlong=1; - flag_long=1; - goto inn_vsscanf; - - /* longlong ? NOT YET ! */ - case 'q': - case 'L': - flag_longlong=1; - goto inn_vsscanf; - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - width=strtol(format-1,&s,10); - format=s; - flag_width=1; - goto inn_vsscanf; - - /* conversion */ - - case 'n': - while (width && *str) - { - *(s++)=*(str++); - --width; - l++; - } - if (!flag_discard) - { - pl=(long *)va_arg(arg_ptr,long*); - *pl=l; - ++n; - } - break; - - case 'p': - case 'X': - case 'x': - div+=6; - case 'd': - div+=2; - case 'o': - div+=8; - case 'u': - case 'i': - if (*(str=skip_ws(str))) - { - l=strtol(str,&s,div); - if (str!=s) - { - if (!flag_discard) - { - if (flag_long) - { - pl=(long *)va_arg(arg_ptr,long*); - *pl=l; - } - else if (flag_half) - { - ph=(short *)va_arg(arg_ptr,short*); - *ph=l; - } - else - { - pi=(int *)va_arg(arg_ptr,int*); - *pi=l; - } - ++n; - } - str=s; - } - else - return n; - } - break; - -#ifdef WANT_FLOATING_POINT_IN_SCANF - case 'e': - case 'E': - case 'f': - case 'g': - if (*(str=skip_ws(str))) - { - d=strtod(str,&s); - if (str!=s) - { - if (!flag_discard) - { - if (flag_long) - { - pd=(double *)va_arg(arg_ptr,double*); - *pd=d; - } - else - { - pf=(float *)va_arg(arg_ptr,float*); - *pf=d; - } - ++n; - } - str=s; - } - else - return n; - } - break; -#endif - - case 'c': - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - if (!flag_width) width=1; - while (width && *str) - { - if (!flag_discard) *(s++)=*(str); - ++str; - --width; - } - break; - - case 's': - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - if (*(str=skip_ws(str))) - { - while (width && (!isspace(*str))) - { - if (!flag_discard) *(s++)=*(str); - if (!*str) break; - ++str; - --width; - } - *s=0; - } - break; - -#ifdef WANT_CHARACTER_CLASSES_IN_SCANF - case '[': - { - char cset[256]; - int flag_not=0; - int flag_dash=0; - memset(cset,0,sizeof(cset)); - ch=*format++; - - /* first char specials */ - if (ch=='^') - { - flag_not=1; - ch=*format++; - } - if ((ch=='-')||(ch==']')) - { - cset[ch]=1; - ch=*format++; - } - - /* almost all non special chars */ - for (;(*format) && (*format!=']');++format) { - if (flag_dash) - { - register unsigned char tmp=*format; - for (;ch<=tmp;++ch) cset[ch]=1; - flag_dash=0; - ch=*(++format); - } - else if (*format=='-') flag_dash=1; - else - { - cset[ch]=1; - ch=*format; - } - } - - /* last char specials */ - if (flag_dash) cset['-']=1; - else cset[ch]=1; - - /* like %c or %s */ - if (!flag_discard) - { - s=(char *)va_arg(arg_ptr,char*); - ++n; - } - while (width && (cset[(unsigned char)(*str)]-flag_not)) - { - if (!flag_discard) *(s++)=*(str); - if (!*str) break; - ++str; - --width; - } - } - break; -#endif - } - break; - - default: - if (prevfmt -#include - -pid_t wait(int *status) { - return waitpid(-1,status,0); -} diff --git a/mdk-stage1/dietlibc/lib/wait3.c b/mdk-stage1/dietlibc/lib/wait3.c deleted file mode 100644 index 19e90740c..000000000 --- a/mdk-stage1/dietlibc/lib/wait3.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int wait3(int* status,int opts,struct rusage* rusage) { - return wait4(-1,status,opts,rusage); -} -- cgit v1.2.1