summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/lib')
-rw-r--r--mdk-stage1/dietlibc/lib/__dtostr.c140
-rw-r--r--mdk-stage1/dietlibc/lib/__fstat64.c20
-rw-r--r--mdk-stage1/dietlibc/lib/__ftruncate64.c23
-rw-r--r--mdk-stage1/dietlibc/lib/__getcwd.c11
-rw-r--r--mdk-stage1/dietlibc/lib/__isinf.c15
-rw-r--r--mdk-stage1/dietlibc/lib/__isnan.c15
-rw-r--r--mdk-stage1/dietlibc/lib/__lltostr.c33
-rw-r--r--mdk-stage1/dietlibc/lib/__lstat64.c20
-rw-r--r--mdk-stage1/dietlibc/lib/__ltostr.c32
-rw-r--r--mdk-stage1/dietlibc/lib/__ptrace.c27
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64.c20
-rw-r--r--mdk-stage1/dietlibc/lib/__stat64_cvt.c20
-rw-r--r--mdk-stage1/dietlibc/lib/__stime.c14
-rw-r--r--mdk-stage1/dietlibc/lib/__truncate64.c23
-rw-r--r--mdk-stage1/dietlibc/lib/__v_printf.c301
-rw-r--r--mdk-stage1/dietlibc/lib/__v_scanf.c391
-rw-r--r--mdk-stage1/dietlibc/lib/_brk.c13
-rw-r--r--mdk-stage1/dietlibc/lib/abort.c19
-rw-r--r--mdk-stage1/dietlibc/lib/abs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/accept.c12
-rw-r--r--mdk-stage1/dietlibc/lib/adjtime.c18
-rw-r--r--mdk-stage1/dietlibc/lib/alloc.c239
-rw-r--r--mdk-stage1/dietlibc/lib/assert_fail.c31
-rw-r--r--mdk-stage1/dietlibc/lib/atexit.c31
-rw-r--r--mdk-stage1/dietlibc/lib/atof.c10
-rw-r--r--mdk-stage1/dietlibc/lib/atoi.c19
-rw-r--r--mdk-stage1/dietlibc/lib/atol.c23
-rw-r--r--mdk-stage1/dietlibc/lib/atoll.c19
-rw-r--r--mdk-stage1/dietlibc/lib/bcd.c185
-rw-r--r--mdk-stage1/dietlibc/lib/bind.c11
-rw-r--r--mdk-stage1/dietlibc/lib/binshstr.c5
-rw-r--r--mdk-stage1/dietlibc/lib/bsearch.c20
-rw-r--r--mdk-stage1/dietlibc/lib/cfgetospeed.c8
-rw-r--r--mdk-stage1/dietlibc/lib/cfmakeraw.c13
-rw-r--r--mdk-stage1/dietlibc/lib/cfsetispeed.c22
-rw-r--r--mdk-stage1/dietlibc/lib/cfsetospeed.c14
-rw-r--r--mdk-stage1/dietlibc/lib/closedir.c11
-rw-r--r--mdk-stage1/dietlibc/lib/connect.c11
-rw-r--r--mdk-stage1/dietlibc/lib/creat.c7
-rw-r--r--mdk-stage1/dietlibc/lib/creat64.c9
-rw-r--r--mdk-stage1/dietlibc/lib/errlistu.c6
-rw-r--r--mdk-stage1/dietlibc/lib/errno_location.c5
-rw-r--r--mdk-stage1/dietlibc/lib/exec_lib.c21
-rw-r--r--mdk-stage1/dietlibc/lib/exec_lib.h9
-rw-r--r--mdk-stage1/dietlibc/lib/execl.c25
-rw-r--r--mdk-stage1/dietlibc/lib/execle.c26
-rw-r--r--mdk-stage1/dietlibc/lib/execlp.c26
-rw-r--r--mdk-stage1/dietlibc/lib/execv.c15
-rw-r--r--mdk-stage1/dietlibc/lib/execvp.c47
-rw-r--r--mdk-stage1/dietlibc/lib/ftw.c47
-rw-r--r--mdk-stage1/dietlibc/lib/getdomainname.c18
-rw-r--r--mdk-stage1/dietlibc/lib/getenv.c16
-rw-r--r--mdk-stage1/dietlibc/lib/gethostname.c19
-rw-r--r--mdk-stage1/dietlibc/lib/getopt.c63
-rw-r--r--mdk-stage1/dietlibc/lib/getpeername.c12
-rw-r--r--mdk-stage1/dietlibc/lib/getpgrp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/getsockname.c12
-rw-r--r--mdk-stage1/dietlibc/lib/getsockopt.c12
-rw-r--r--mdk-stage1/dietlibc/lib/htonl.c13
-rw-r--r--mdk-stage1/dietlibc/lib/htons.c12
-rw-r--r--mdk-stage1/dietlibc/lib/if_indextoname.c28
-rw-r--r--mdk-stage1/dietlibc/lib/if_nameindex.c40
-rw-r--r--mdk-stage1/dietlibc/lib/if_nametoindex.c26
-rw-r--r--mdk-stage1/dietlibc/lib/ipv6constants.c4
-rw-r--r--mdk-stage1/dietlibc/lib/isalnum.c9
-rw-r--r--mdk-stage1/dietlibc/lib/isalpha.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isascii.c6
-rw-r--r--mdk-stage1/dietlibc/lib/isatty.c20
-rw-r--r--mdk-stage1/dietlibc/lib/isblank.c6
-rw-r--r--mdk-stage1/dietlibc/lib/iscntrl.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isdigit.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isgraph.c6
-rw-r--r--mdk-stage1/dietlibc/lib/islower.c8
-rw-r--r--mdk-stage1/dietlibc/lib/isprint.c7
-rw-r--r--mdk-stage1/dietlibc/lib/ispunct.c9
-rw-r--r--mdk-stage1/dietlibc/lib/isspace.c9
-rw-r--r--mdk-stage1/dietlibc/lib/isupper.c9
-rw-r--r--mdk-stage1/dietlibc/lib/isxdigit.c8
-rw-r--r--mdk-stage1/dietlibc/lib/labs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/listen.c12
-rw-r--r--mdk-stage1/dietlibc/lib/llabs.c6
-rw-r--r--mdk-stage1/dietlibc/lib/lockf.c38
-rw-r--r--mdk-stage1/dietlibc/lib/longjmp.c16
-rw-r--r--mdk-stage1/dietlibc/lib/lseek64.c16
-rw-r--r--mdk-stage1/dietlibc/lib/memccpy.c20
-rw-r--r--mdk-stage1/dietlibc/lib/memchr.c13
-rw-r--r--mdk-stage1/dietlibc/lib/memcmp.c18
-rw-r--r--mdk-stage1/dietlibc/lib/memcpy.c14
-rw-r--r--mdk-stage1/dietlibc/lib/memmem.c14
-rw-r--r--mdk-stage1/dietlibc/lib/memmove.c24
-rw-r--r--mdk-stage1/dietlibc/lib/memrchr.c15
-rw-r--r--mdk-stage1/dietlibc/lib/memset.c11
-rw-r--r--mdk-stage1/dietlibc/lib/mkfifo.c6
-rw-r--r--mdk-stage1/dietlibc/lib/msgctl.c9
-rw-r--r--mdk-stage1/dietlibc/lib/msgget.c9
-rw-r--r--mdk-stage1/dietlibc/lib/msgrcv.c17
-rw-r--r--mdk-stage1/dietlibc/lib/msgsnd.c9
-rw-r--r--mdk-stage1/dietlibc/lib/open64.c13
-rw-r--r--mdk-stage1/dietlibc/lib/opendir.c26
-rw-r--r--mdk-stage1/dietlibc/lib/perror.c24
-rw-r--r--mdk-stage1/dietlibc/lib/pread.c11
-rw-r--r--mdk-stage1/dietlibc/lib/pread64.c14
-rw-r--r--mdk-stage1/dietlibc/lib/putenv.c40
-rw-r--r--mdk-stage1/dietlibc/lib/pwrite.c11
-rw-r--r--mdk-stage1/dietlibc/lib/pwrite64.c14
-rw-r--r--mdk-stage1/dietlibc/lib/qsort.c127
-rw-r--r--mdk-stage1/dietlibc/lib/raise.c7
-rw-r--r--mdk-stage1/dietlibc/lib/rand.c12
-rw-r--r--mdk-stage1/dietlibc/lib/rand48.c89
-rw-r--r--mdk-stage1/dietlibc/lib/rand_r.c30
-rw-r--r--mdk-stage1/dietlibc/lib/readdir.c13
-rw-r--r--mdk-stage1/dietlibc/lib/readdir64.c62
-rw-r--r--mdk-stage1/dietlibc/lib/reboot.c8
-rw-r--r--mdk-stage1/dietlibc/lib/recv.c13
-rw-r--r--mdk-stage1/dietlibc/lib/recvfrom.c13
-rw-r--r--mdk-stage1/dietlibc/lib/recvmsg.c13
-rw-r--r--mdk-stage1/dietlibc/lib/remove.c13
-rw-r--r--mdk-stage1/dietlibc/lib/rewind.c6
-rw-r--r--mdk-stage1/dietlibc/lib/rewinddir.c8
-rw-r--r--mdk-stage1/dietlibc/lib/sbrk.c21
-rw-r--r--mdk-stage1/dietlibc/lib/seekdir.c8
-rw-r--r--mdk-stage1/dietlibc/lib/semctl.c17
-rw-r--r--mdk-stage1/dietlibc/lib/semget.c9
-rw-r--r--mdk-stage1/dietlibc/lib/semop.c9
-rw-r--r--mdk-stage1/dietlibc/lib/send.c13
-rw-r--r--mdk-stage1/dietlibc/lib/sendmsg.c13
-rw-r--r--mdk-stage1/dietlibc/lib/sendto.c13
-rw-r--r--mdk-stage1/dietlibc/lib/setlinebuf.c12
-rw-r--r--mdk-stage1/dietlibc/lib/setpgrp.c6
-rw-r--r--mdk-stage1/dietlibc/lib/setsockopt.c12
-rw-r--r--mdk-stage1/dietlibc/lib/shmat.c14
-rw-r--r--mdk-stage1/dietlibc/lib/shmctl.c9
-rw-r--r--mdk-stage1/dietlibc/lib/shmdt.c9
-rw-r--r--mdk-stage1/dietlibc/lib/shmget.c9
-rw-r--r--mdk-stage1/dietlibc/lib/shutdown.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sigaction.c11
-rw-r--r--mdk-stage1/dietlibc/lib/sigaddset.c17
-rw-r--r--mdk-stage1/dietlibc/lib/sigdelset.c17
-rw-r--r--mdk-stage1/dietlibc/lib/sigemptyset.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sigfillset.c11
-rw-r--r--mdk-stage1/dietlibc/lib/siginterrupt.c17
-rw-r--r--mdk-stage1/dietlibc/lib/sigismember.c16
-rw-r--r--mdk-stage1/dietlibc/lib/sigjmp.c10
-rw-r--r--mdk-stage1/dietlibc/lib/signal.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sigpending.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigprocmask.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigqueueinfo.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sigsuspend.c10
-rw-r--r--mdk-stage1/dietlibc/lib/sigtimedwait.c7
-rw-r--r--mdk-stage1/dietlibc/lib/sleep.c11
-rw-r--r--mdk-stage1/dietlibc/lib/snprintf.c13
-rw-r--r--mdk-stage1/dietlibc/lib/socket.c11
-rw-r--r--mdk-stage1/dietlibc/lib/socketpair.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sprintf.c14
-rw-r--r--mdk-stage1/dietlibc/lib/sscanf.c12
-rw-r--r--mdk-stage1/dietlibc/lib/strcasecmp.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strcat.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strchr.c19
-rw-r--r--mdk-stage1/dietlibc/lib/strcmp.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strcpy.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strcspn.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strdup.c9
-rw-r--r--mdk-stage1/dietlibc/lib/strerror.c20
-rw-r--r--mdk-stage1/dietlibc/lib/strlcat.c72
-rw-r--r--mdk-stage1/dietlibc/lib/strlcpy.3169
-rw-r--r--mdk-stage1/dietlibc/lib/strlcpy.c68
-rw-r--r--mdk-stage1/dietlibc/lib/strlen.c47
-rw-r--r--mdk-stage1/dietlibc/lib/strncasecmp.c22
-rw-r--r--mdk-stage1/dietlibc/lib/strncat.c34
-rw-r--r--mdk-stage1/dietlibc/lib/strncmp.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strncpy.c15
-rw-r--r--mdk-stage1/dietlibc/lib/strpbrk.c11
-rw-r--r--mdk-stage1/dietlibc/lib/strrchr.c20
-rw-r--r--mdk-stage1/dietlibc/lib/strsep.c18
-rw-r--r--mdk-stage1/dietlibc/lib/strspn.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strstr.c17
-rw-r--r--mdk-stage1/dietlibc/lib/strtod.c66
-rw-r--r--mdk-stage1/dietlibc/lib/strtof.c66
-rw-r--r--mdk-stage1/dietlibc/lib/strtok.c8
-rw-r--r--mdk-stage1/dietlibc/lib/strtok_r.c21
-rw-r--r--mdk-stage1/dietlibc/lib/strtol.c26
-rw-r--r--mdk-stage1/dietlibc/lib/strtold.c66
-rw-r--r--mdk-stage1/dietlibc/lib/strtoll.c14
-rw-r--r--mdk-stage1/dietlibc/lib/strtoul.c44
-rw-r--r--mdk-stage1/dietlibc/lib/strtoull.c31
-rw-r--r--mdk-stage1/dietlibc/lib/strxfrm.c12
-rw-r--r--mdk-stage1/dietlibc/lib/sys_siglist.c174
-rw-r--r--mdk-stage1/dietlibc/lib/tcdrain.c9
-rw-r--r--mdk-stage1/dietlibc/lib/tcflow.c35
-rw-r--r--mdk-stage1/dietlibc/lib/tcflush.c9
-rw-r--r--mdk-stage1/dietlibc/lib/tcgetattr.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tcgetpgrp.c12
-rw-r--r--mdk-stage1/dietlibc/lib/tcsendbreak.c11
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetattr.c37
-rw-r--r--mdk-stage1/dietlibc/lib/tcsetpgrp.c8
-rw-r--r--mdk-stage1/dietlibc/lib/telldir.c7
-rw-r--r--mdk-stage1/dietlibc/lib/tolower.c8
-rw-r--r--mdk-stage1/dietlibc/lib/toupper.c8
-rw-r--r--mdk-stage1/dietlibc/lib/ttyname.c66
-rw-r--r--mdk-stage1/dietlibc/lib/usleep.c12
-rw-r--r--mdk-stage1/dietlibc/lib/vfork.c4
-rw-r--r--mdk-stage1/dietlibc/lib/vsnprintf.c33
-rw-r--r--mdk-stage1/dietlibc/lib/vsprintf.c12
-rw-r--r--mdk-stage1/dietlibc/lib/vsscanf.c25
-rw-r--r--mdk-stage1/dietlibc/lib/wait.c6
-rw-r--r--mdk-stage1/dietlibc/lib/wait3.c5
-rw-r--r--mdk-stage1/dietlibc/lib/write12.c11
207 files changed, 0 insertions, 5267 deletions
diff --git a/mdk-stage1/dietlibc/lib/__dtostr.c b/mdk-stage1/dietlibc/lib/__dtostr.c
deleted file mode 100644
index 580258936..000000000
--- a/mdk-stage1/dietlibc/lib/__dtostr.c
+++ /dev/null
@@ -1,140 +0,0 @@
-#include <stdlib.h>
-#include <endian.h>
-#include <math.h>
-/* convert double to string. Helper for sprintf. */
-
-static int copystring(char* buf,int maxlen, const char* s) {
- int i;
- for (i=0; i<3&&i<maxlen; ++i)
- buf[i]=s[i];
- if (i<maxlen) { buf[i]=0; ++i; }
- return i;
-}
-
-int __dtostr(double d,char *buf,unsigned int maxlen,unsigned int prec,unsigned int prec2) {
-#if 1
- unsigned long long *x=(unsigned long long *)&d;
- /* step 1: extract sign, mantissa and exponent */
- signed long e=((*x>>52)&((1<<11)-1))-1023;
-#else
-#if __BYTE_ORDER == __LITTLE_ENDIAN
- signed long e=(((((unsigned long*)&d)[1])>>20)&((1<<11)-1))-1023;
-#else
- signed long e=(((*((unsigned long*)&d))>>20)&((1<<11)-1))-1023;
-#endif
-#endif
-/* unsigned long long m=*x & ((1ull<<52)-1); */
- /* step 2: exponent is base 2, compute exponent for base 10 */
- signed long e10;
- /* step 3: calculate 10^e10 */
- unsigned int i;
- double backup=d;
- double tmp;
- char *oldbuf=buf;
-
- if (isnan(d)) return copystring(buf,maxlen,"nan");
- if ((i=isinf(d))) return copystring(buf,maxlen,i>0?"inf":"-inf");
- e10=1+(long)(e*0.30102999566398119802); /* log10(2) */
- /* Wir iterieren von Links bis wir bei 0 sind oder maxlen erreicht
- * ist. Wenn maxlen erreicht ist, machen wir das nochmal in
- * scientific notation. Wenn dann von prec noch was übrig ist, geben
- * wir einen Dezimalpunkt aus und geben prec2 Nachkommastellen aus.
- * Wenn prec2 Null ist, geben wir so viel Stellen aus, wie von prec
- * noch übrig ist. */
- if (d==0.0) {
- prec2=prec2==0?1:prec2+2;
- prec2=prec2>maxlen?8:prec2;
- for (i=0; i<prec2; ++i) buf[i]='0';
- buf[1]='.'; buf[i]=0;
- return i;
- }
-
- if (d < 0.0) { d=-d; *buf='-'; --maxlen; ++buf; }
-
- /*
- Perform rounding. It needs to be done before we generate any
- digits as the carry could propagate through the whole number.
- */
-
- tmp = 0.5;
- for (i = 0; i < prec2; i++) { tmp *= 0.1; }
- d += tmp;
-
- if (d < 1.0) { *buf='0'; --maxlen; ++buf; }
-/* printf("e=%d e10=%d prec=%d\n",e,e10,prec); */
- if (e10>0) {
- int first=1; /* are we about to write the first digit? */
- tmp = 10.0;
- i=e10;
- while (i>10) { tmp=tmp*1e10; i-=10; }
- while (i>1) { tmp=tmp*10; --i; }
- /* the number is greater than 1. Iterate through digits before the
- * decimal point until we reach the decimal point or maxlen is
- * reached (in which case we switch to scientific notation). */
- while (tmp>0.9) {
- char digit;
- double fraction=d/tmp;
- digit=(int)(fraction); /* floor() */
- if (!first || digit) {
- first=0;
- *buf=digit+'0'; ++buf;
- if (!maxlen) {
- /* use scientific notation */
- int len=__dtostr(backup/tmp,oldbuf,maxlen,prec,prec2);
- int initial=1;
- if (len==0) return 0;
- maxlen-=len; buf+=len;
- if (maxlen>0) {
- *buf='e';
- ++buf;
- }
- --maxlen;
- for (len=1000; len>0; len/=10) {
- if (e10>=len || !initial) {
- if (maxlen>0) {
- *buf=(e10/len)+'0';
- ++buf;
- }
- --maxlen;
- initial=0;
- e10=e10%len;
- }
- }
- if (maxlen>0) goto fini;
- return 0;
- }
- d-=digit*tmp;
- --maxlen;
- }
- tmp/=10.0;
- }
- }
- else
- {
- tmp = 0.1;
- }
-
- if (buf==oldbuf) {
- if (!maxlen) return 0; --maxlen;
- *buf='0'; ++buf;
- }
- if (prec2 || prec>(unsigned int)(buf-oldbuf)+1) { /* more digits wanted */
- if (!maxlen) return 0; --maxlen;
- *buf='.'; ++buf;
- prec-=buf-oldbuf-1;
- if (prec2) prec=prec2;
- if (prec>maxlen) return 0;
- while (prec>0) {
- char digit;
- double fraction=d/tmp;
- digit=(int)(fraction); /* floor() */
- *buf=digit+'0'; ++buf;
- d-=digit*tmp;
- tmp/=10.0;
- --prec;
- }
- }
-fini:
- *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 f2f9858ea..000000000
--- a/mdk-stage1/dietlibc/lib/__fstat64.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <errno.h>
-#include "dietfeatures.h"
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-
-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;
- if (errno!=ENOSYS) return -1;
- if (fstat(__fd,&temp)) return -1;
- __stat64_cvt(&temp,__buf);
- }
- return 0;
-}
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__ftruncate64.c b/mdk-stage1/dietlibc/lib/__ftruncate64.c
deleted file mode 100644
index e0ea8c98a..000000000
--- a/mdk-stage1/dietlibc/lib/__ftruncate64.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <errno.h>
-#include "dietfeatures.h"
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#include "syscalls.h"
-#include <unistd.h>
-#ifndef __NO_STAT64
-#ifdef __NR_ftruncate64
-
-extern int __dietlibc_ftruncate64(int fd, loff_t o);
-
-int ftruncate64(int fd, loff_t o) {
- int tmp;
- if ((tmp=__dietlibc_ftruncate64(fd,o))==-1) {
- if (errno!=ENOSYS) return -1;
- if (o>0x7fffffff) { errno=EOVERFLOW; return -1; }
- return ftruncate(fd,o);
- }
- return tmp;
-}
-#endif
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__getcwd.c b/mdk-stage1/dietlibc/lib/__getcwd.c
deleted file mode 100644
index 8616704ec..000000000
--- a/mdk-stage1/dietlibc/lib/__getcwd.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <unistd.h>
-#include <stdlib.h>
-
-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/__isinf.c b/mdk-stage1/dietlibc/lib/__isinf.c
deleted file mode 100644
index 359bd2709..000000000
--- a/mdk-stage1/dietlibc/lib/__isinf.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-
-int isinf(double d) {
- unsigned long long *x=(unsigned long long *)&d;
- return (*x==0x7FF0000000000000ll?1:*x==0xFFF0000000000000?-1:0);
-}
-int __isinf(double d) __attribute__((alias("isinf")));
-
-#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/__isnan.c b/mdk-stage1/dietlibc/lib/__isnan.c
deleted file mode 100644
index de74b8a9f..000000000
--- a/mdk-stage1/dietlibc/lib/__isnan.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <math.h>
-
-int isnan(double d) {
- unsigned long long *x=(unsigned long long *)&d;
- return (*x==0x7FF8000000000000ll || *x==0x7FF0000000000000 || *x==0xfff8000000000000);
-}
-int __isnan(double d) __attribute__((alias("isnan")));
-
-#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 fe4701f29..000000000
--- a/mdk-stage1/dietlibc/lib/__lltostr.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <string.h>
-
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase);
-
-int __lltostr(char *s, int size, unsigned long long i, int base, char UpCase)
-{
- char *tmp;
- unsigned 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 0eab6a94b..000000000
--- a/mdk-stage1/dietlibc/lib/__lstat64.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <errno.h>
-#include "dietfeatures.h"
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-
-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;
- if (errno!=ENOSYS) return -1;
- 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 fa71be9ab..000000000
--- a/mdk-stage1/dietlibc/lib/__ltostr.c
+++ /dev/null
@@ -1,32 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-
-int __ltostr(char *s, unsigned int size, unsigned long i, unsigned int base, int UpCase)
-{
- char *tmp;
- unsigned 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/__ptrace.c b/mdk-stage1/dietlibc/lib/__ptrace.c
deleted file mode 100644
index bd14a0351..000000000
--- a/mdk-stage1/dietlibc/lib/__ptrace.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* we need this because we need to use the glibc prototype which uses
- * varargs :-( */
-#define ptrace fnord
-#include <sys/ptrace.h>
-#undef ptrace
-#include <sys/types.h>
-#include <unistd.h>
-
-extern int __diet_ptrace(int request, pid_t pid, void *addr, void *data);
-int ptrace(int request, pid_t pid, void *addr, void *data);
-
-int ptrace(int request, pid_t pid, void *addr, void *data) {
- switch (request) {
- case PTRACE_TRACEME: case PTRACE_KILL: case PTRACE_ATTACH:
- case PTRACE_DETACH:
- return (__diet_ptrace (request, pid, NULL, NULL));
- case PTRACE_PEEKDATA: case PTRACE_PEEKUSER: case PTRACE_PEEKTEXT:
- {
- long result;
- if (__diet_ptrace (request, pid, addr, &result) == -1)
- return (-1);
- return (result);
- }
- default:
- return (__diet_ptrace (request, pid, addr, data));
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/__stat64.c b/mdk-stage1/dietlibc/lib/__stat64.c
deleted file mode 100644
index fcbdfef2d..000000000
--- a/mdk-stage1/dietlibc/lib/__stat64.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <errno.h>
-#include "dietfeatures.h"
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-
-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;
- if (errno!=ENOSYS) return -1;
- 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 c4ce8bea4..000000000
--- a/mdk-stage1/dietlibc/lib/__stat64_cvt.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-
-void __stat64_cvt(const struct stat *src,struct stat64 *dest);
-
-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/__stime.c b/mdk-stage1/dietlibc/lib/__stime.c
deleted file mode 100644
index 7b2c77729..000000000
--- a/mdk-stage1/dietlibc/lib/__stime.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <errno.h>
-#include <sys/time.h>
-#include <time.h>
-#include <syscalls.h>
-
-#ifndef __NR_stime
-int stime(time_t *when)
-{
- struct timeval tv;
- tv.tv_sec = *when;
- tv.tv_usec = 0;
- return settimeofday(&tv, (struct timezone *)0);
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__truncate64.c b/mdk-stage1/dietlibc/lib/__truncate64.c
deleted file mode 100644
index ccb3e7f64..000000000
--- a/mdk-stage1/dietlibc/lib/__truncate64.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include "dietfeatures.h"
-#include <errno.h>
-#ifdef WANT_LARGEFILE_BACKCOMPAT
-#include <sys/stat.h>
-#include "syscalls.h"
-#include <unistd.h>
-#ifndef __NO_STAT64
-#ifdef __NR_truncate64
-
-extern int __dietlibc_truncate64(const char* f, loff_t o);
-
-int truncate64(const char* f, loff_t o) {
- int tmp;
- if ((tmp=__dietlibc_truncate64(f,o))==-1) {
- if (errno!=ENOSYS) return -1;
- if (o>0x7fffffff) { errno=EOVERFLOW; return -1; }
- return truncate(f,o);
- }
- return tmp;
-}
-#endif
-#endif
-#endif
diff --git a/mdk-stage1/dietlibc/lib/__v_printf.c b/mdk-stage1/dietlibc/lib/__v_printf.c
deleted file mode 100644
index 1ff63bec1..000000000
--- a/mdk-stage1/dietlibc/lib/__v_printf.c
+++ /dev/null
@@ -1,301 +0,0 @@
-#include "dietfeatures.h"
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include "dietstdio.h"
-#include "dietwarning.h"
-
-static inline unsigned int skip_to(const unsigned char *format) {
- unsigned int nr;
- for (nr=0; format[nr] && (format[nr]!='%'); ++nr);
- return nr;
-}
-
-#define A_WRITE(fn,buf,sz) ((fn)->put((void*)(buf),(sz),(fn)->data))
-
-static const char pad_line[2][16]= { " ", "0000000000000000", };
-static inline int write_pad(struct arg_printf* fn, int len, int padwith) {
- int nr=0;
- for (;len>15;len-=16,nr+=16) {
- A_WRITE(fn,pad_line[(padwith=='0')?1:0],16);
- }
- if (len>0) {
- A_WRITE(fn,pad_line[(padwith=='0')?1:0],(unsigned int)len); nr+=len;
- }
- return nr;
-}
-
-int __v_printf(struct arg_printf* fn, const unsigned char *format, va_list arg_ptr)
-{
- int len=0;
-
- if (format)
- while (*format) {
- unsigned int sz = skip_to(format);
- if (sz) {
- A_WRITE(fn,format,sz); len+=sz;
- format+=sz;
- }
- if (*format=='%') {
- char buf[128];
-
- unsigned char ch, *s, padwith=' ';
-
- char flag_in_sign=0;
- char flag_upcase=0;
- char flag_hash=0;
- char flag_left=0;
- char flag_space=0;
- char flag_sign=0;
- char flag_dot=0;
- signed char flag_long=0;
-
- unsigned int base;
- unsigned int width=0, preci=0;
-
- long number=0;
-#ifdef WANT_LONGLONG_PRINTF
- long long llnumber=0;
-#endif
-
- ++format;
-inn_printf:
- switch(ch=*format++) {
- case 0:
- return -1;
- break;
-
- /* FLAGS */
- case '#':
- flag_hash=-1;
- case 'z':
- goto inn_printf;
-
- case 'h':
- --flag_long;
- goto inn_printf;
- case 'L':
- ++flag_long; /* fall through */
- case 'l':
- ++flag_long;
- goto inn_printf;
-
- case '0':
- padwith='0';
- goto inn_printf;
-
- case '-':
- flag_left=1;
- goto inn_printf;
-
- case ' ':
- flag_space=1;
- goto inn_printf;
-
- case '+':
- flag_sign=1;
- goto inn_printf;
-
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if(flag_dot) return -1;
- width=strtoul(format-1,(char**)&s,10);
- format=s;
- goto inn_printf;
-
- case '*':
- width=va_arg(arg_ptr,int);
- goto inn_printf;
-
- case '.':
- flag_dot=1;
- if (*format=='*') {
- preci=va_arg(arg_ptr,int);
- ++format;
- } else {
- long int tmp=strtol(format,(char**)&s,10);
- preci=tmp<0?0:tmp;
- format=s;
- }
- goto inn_printf;
-
- /* print a char or % */
- case 'c':
- ch=(char)va_arg(arg_ptr,int);
- case '%':
- A_WRITE(fn,&ch,1); ++len;
- break;
-
- /* print a string */
- case 's':
- s=va_arg(arg_ptr,char *);
-#ifdef WANT_NULL_PRINTF
- if (!s) s="(null)";
-#endif
- sz = strlen(s);
- if (flag_dot && sz>preci) sz=preci;
- flag_dot^=flag_dot;
-
-print_out:
- if (width && (!flag_left)) {
- if (flag_in_sign) {
- A_WRITE(fn,s,1); ++len;
- ++s; --sz;
- --width;
- }
- if (flag_hash>0) {
- A_WRITE(fn,s,flag_hash); len+=flag_hash;
- s+=flag_hash; sz-=flag_hash;
- width-=flag_hash;
- }
-// len+=write_pad(fn,(signed int)width-(signed int)sz,padwith);
- if (flag_dot) {
- len+=write_pad(fn,(signed int)width-(signed int)preci,padwith);
- len+=write_pad(fn,(signed int)preci-(signed int)sz,'0');
- } else
- len+=write_pad(fn,(signed int)width-(signed int)sz,padwith);
- }
- A_WRITE(fn,s,sz); len+=sz;
- if (width && (flag_left)) {
- len+=write_pad(fn,(signed int)width-(signed int)sz,' ');
- }
- break;
-
- /* print an integer value */
- case 'b':
- base=2;
- sz=0;
- goto num_printf;
- case 'p':
- flag_hash=2;
- flag_long=1;
- ch='x';
- case 'X':
- flag_upcase=(ch=='X');
- case 'x':
- base=16;
- sz=0;
- if (flag_dot) width=preci;
- if (flag_hash) {
- buf[1]='0';
- buf[2]=ch;
- flag_hash=2;
- sz=2;
- }
- goto num_printf;
- case 'd':
- case 'i':
- flag_in_sign=1;
- case 'u':
- base=10;
- sz=0;
- goto num_printf;
- case 'o':
- base=8;
- sz=0;
- if (flag_hash) {
- buf[1]='0';
- flag_hash=1;
- ++sz;
- }
-
-num_printf:
- s=buf+1;
-
- if (flag_long>0) {
-#ifdef WANT_LONGLONG_PRINTF
- if (flag_long>1)
- llnumber=va_arg(arg_ptr,long long);
- else
-#endif
- number=va_arg(arg_ptr,long);
- }
- else
- number=va_arg(arg_ptr,int);
-
- if (flag_in_sign) {
-#ifdef WANT_LONGLONG_PRINTF
- if ((flag_long>1)&&(llnumber<0)) {
- llnumber=-llnumber;
- flag_in_sign=2;
- } else
-#endif
- if (number<0) {
- number=-number;
- flag_in_sign=2;
- }
- }
- if (flag_long<0) number&=0xffff;
- if (flag_long<-1) number&=0xff;
-#ifdef WANT_LONGLONG_PRINTF
- if (flag_long>1)
- sz += __lltostr(s+sz,sizeof(buf)-5,(unsigned long long) llnumber,base,flag_upcase);
- else
-#endif
- sz += __ltostr(s+sz,sizeof(buf)-5,(unsigned long) number,base,flag_upcase);
-
- if (flag_in_sign==2) {
- *(--s)='-';
- ++sz;
- } else if ((flag_in_sign)&&(flag_sign || flag_space)) {
- *(--s)=(flag_sign)?'+':' ';
- ++sz;
- } else flag_in_sign=0;
-
- goto print_out;
-
-#ifdef WANT_FLOATING_POINT_IN_PRINTF
- /* print a floating point value */
- case 'f':
- case 'g':
- {
- int g=(ch=='g');
- double d=va_arg(arg_ptr,double);
- if (width==0) width=1;
- if (!flag_dot) preci=6;
- sz=__dtostr(d,buf,sizeof(buf),width,preci);
- if (flag_dot) {
- char *tmp;
- if ((tmp=strchr(buf,'.'))) {
- ++tmp;
- while (preci>0 && *++tmp) --preci;
- *tmp=0;
- }
- }
- if (g) {
- char *tmp,*tmp1; /* boy, is _this_ ugly! */
- if ((tmp=strchr(buf,'.'))) {
- tmp1=strchr(tmp,'e');
- while (*tmp) ++tmp;
- if (tmp1) tmp=tmp1;
- while (*--tmp=='0') ;
- if (*tmp!='.') ++tmp;
- *tmp=0;
- if (tmp1) strcpy(tmp,tmp1);
- }
- }
- preci=strlen(buf);
- s=buf;
-
- goto print_out;
- }
-#endif
-
- default:
- break;
- }
- }
- }
- return len;
-}
-
-link_warning("__v_printf","warning: the printf functions add several kilobytes of bloat.")
-
diff --git a/mdk-stage1/dietlibc/lib/__v_scanf.c b/mdk-stage1/dietlibc/lib/__v_scanf.c
deleted file mode 100644
index 6db51db59..000000000
--- a/mdk-stage1/dietlibc/lib/__v_scanf.c
+++ /dev/null
@@ -1,391 +0,0 @@
-#include "dietfeatures.h"
-#include <stdarg.h>
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-
-#include "dietstdio.h"
-#include "dietwarning.h"
-
-#define A_GETC(fn) (++consumed,(fn)->getch((fn)->data))
-#define A_PUTC(c,fn) (--consumed,(fn)->putch((c),(fn)->data))
-
-int __v_scanf(struct arg_scanf* fn, const unsigned char *format, va_list arg_ptr)
-{
- unsigned int ch; /* format act. char */
- int n=0;
-
- /* arg_ptr tmps */
-#ifdef WANT_FLOATING_POINT_IN_SCANF
- double *pd;
- float *pf;
-#endif
-#ifdef WANT_LONGLONG_SCANF
- long long *pll;
-#endif
- long *pl;
- short *ph;
- int *pi;
- char *s;
-
- unsigned int consumed=0;
-
- /* get one char */
- int tpch= A_GETC(fn);
-
- //while ((tpch!=-1)&&(*format))
- while (*format)
- {
-// const unsigned char *prev_fmt=format;
- ch=*format++;
- switch (ch) {
- /* end of format string ?!? */
- case 0: return 0;
-
- /* skip spaces ... */
- case ' ':
- case '\f':
- case '\t':
- case '\v':
- case '\n':
- case '\r':
- while((*format)&&(isspace(*format))) ++format;
- while(isspace(tpch)) tpch=A_GETC(fn);
- break;
-
- /* format string ... */
- case '%':
- {
- unsigned int _div=0;
- int width=-1;
- char flag_width=0;
- char flag_discard=0;
- char flag_half=0;
- char flag_long=0;
- char flag_longlong=0;
-
-in_scan:
- ch=*format++;
- if(ch!='n' && tpch==-1) goto err_out;
- switch (ch) {
- /* end of format string ?!? */
- case 0: return 0;
-
- /* check for % */
- case '%':
- if ((unsigned char)tpch != ch) goto err_out;
- tpch=A_GETC(fn);
- break;
-
- /* FLAGS */
- case '*':
- flag_discard=1;
- goto in_scan;
- case 'h':
- flag_half=1;
- goto in_scan;
- case 'l':
- if (flag_long) flag_longlong=1;
- flag_long=1;
- goto in_scan;
- case 'q':
- case 'L':
- flag_longlong=1;
- goto in_scan;
-
- /* WIDTH */
- case '0':
- 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 in_scan;
-
- /* scan for integer / strtol reimplementation ... */
- case 'p':
- case 'X':
- case 'x':
- _div+=6;
- case 'd':
- _div+=2;
- case 'o':
- _div+=8;
- case 'u':
- case 'i':
- {
-#ifdef WANT_LONGLONG_SCANF
- unsigned long long v=0;
-#else
- unsigned long v=0;
-#endif
- unsigned int consumedsofar=consumed;
- int neg=0;
- while(isspace(tpch)) tpch=A_GETC(fn);
- if (tpch=='-') {
- tpch=A_GETC(fn);
- neg=1;
- }
-
- if (tpch=='+') tpch=A_GETC(fn);
-
- if (!flag_width) {
- if ((_div==16) && (tpch=='0')) goto scan_hex;
- if (!_div) {
- _div=10;
- if (tpch=='0') {
- _div=8;
-scan_hex:
- tpch=A_GETC(fn);
- if ((tpch|32)=='x') {
- tpch=A_GETC(fn);
- _div=16;
- }
- }
- }
- }
- while ((width)&&(tpch!=-1)) {
- register unsigned long c=tpch&0xff;
-#ifdef WANT_LONGLONG_SCANF
- register unsigned long long d=c|0x20;
-#else
- register unsigned long d=c|0x20;
-#endif
- c=(d>='a'?d-'a'+10:c<='9'?c-'0':0xff);
- if (c>=_div) break;
- d=v*_div;
-#ifdef WANT_LONGLONG_SCANF
- v=(d<v)?ULLONG_MAX:d+c;
-#else
- v=(d<v)?ULONG_MAX:d+c;
-#endif
- --width;
- tpch=A_GETC(fn);
- }
- if ((ch|0x20)<'p') {
-#ifdef WANT_LONGLONG_SCANF
- register long long l=v;
- if (v>=-((unsigned long long)LLONG_MIN)) {
- l=(neg)?LLONG_MIN:LLONG_MAX;
- }
- else {
- if (neg) v*=-1;
- }
-#else
- register long l=v;
- if (v>=-((unsigned long)LONG_MIN)) {
- l=(neg)?LONG_MIN:LONG_MAX;
- }
- else {
- if (neg) v*=-1;
- }
-#endif
- }
- if (!flag_discard) {
-#ifdef WANT_LONGLONG_SCANF
- if (flag_longlong) {
- pll=(long long *)va_arg(arg_ptr,long long*);
- *pll=v;
- } else
-#endif
- if (flag_long) {
- pl=(long *)va_arg(arg_ptr,long*);
- *pl=v;
- } else if (flag_half) {
- ph=(short*)va_arg(arg_ptr,short*);
- *ph=v;
- } else {
- pi=(int *)va_arg(arg_ptr,int*);
- *pi=v;
- }
- if(consumedsofar<consumed)
- ++n;
- }
- }
- break;
-
-#ifdef WANT_FLOATING_POINT_IN_SCANF
- /* floating point numbers */
- case 'e':
- case 'E':
- case 'f':
- case 'g':
- {
- double d=0.0;
- int neg=0;
-
- while(isspace(tpch)) tpch=A_GETC(fn);
-
- if (tpch=='-') {
- tpch=A_GETC(fn);
- neg=1;
- }
- if (tpch=='+') tpch=A_GETC(fn);
-
- while (isdigit(tpch)) {
- d=d*10+(tpch-'0');
- tpch=A_GETC(fn);
- }
- if (tpch=='.') {
- double factor=.1;
- tpch=A_GETC(fn);
- while (isdigit(tpch)) {
- d=d+(factor*(tpch-'0'));
- factor/=10;
- tpch=A_GETC(fn);
- }
- }
- if ((tpch|0x20)=='e') {
- int exp=0, prec=tpch;
- double factor=10;
- tpch=A_GETC(fn);
- if (tpch=='-') {
- factor=0.1;
- tpch=A_GETC(fn);
- } else if (tpch=='+') {
- tpch=A_GETC(fn);
- } else {
- d=0;
- if (tpch!=-1) A_PUTC(tpch,fn);
- tpch=prec;
- goto exp_out;
- }
- while (isdigit(tpch)) {
- exp=exp*10+(tpch-'0');
- tpch=A_GETC(fn);
- }
- while (exp) { /* as in strtod: XXX: this introduces rounding errors */
- d*=factor; --exp;
- }
- }
-exp_out:
- 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;
- }
- break;
-#endif
-
- /* char-sequences */
- case 'c':
- if (!flag_discard) {
- s=(char *)va_arg(arg_ptr,char*);
- ++n;
- }
- if (!flag_width) width=1;
- while (width && (tpch!=-1)) {
- if (!flag_discard) *(s++)=tpch;
- --width;
- tpch=A_GETC(fn);
- }
- break;
-
- /* c-string */
- case 's':
- if (!flag_discard) s=(char *)va_arg(arg_ptr,char*);
- while(isspace(tpch)) tpch=A_GETC(fn);
- while (width && (tpch!=-1) && (!isspace(tpch))) {
- if (!flag_discard) *s=tpch;
- if (tpch) ++s; else break;
- --width;
- tpch=A_GETC(fn);
- }
- if (!flag_discard) { *s=0; n++; }
- break;
-
- /* consumed-count */
- case 'n':
- if (!flag_discard) {
- s=(char *)va_arg(arg_ptr,char*);
-// ++n; /* in accordance to ANSI C we don't count this conversion */
- }
- if (!flag_discard) *(s++)=consumed-1;
- 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 && (tpch>=0) && (cset[tpch]^flag_not)) {
- if (!flag_discard) *s=tpch;
- if (tpch) ++s; else break;
- --width;
- tpch=A_GETC(fn);
- }
- if (!flag_discard) *s=0;
- ++format;
- }
- break;
-#endif
- default:
- goto err_out;
- }
- }
- break;
-
- /* check if equal format string... */
- default:
- if ((unsigned char)tpch != ch) goto err_out;
- tpch=A_GETC(fn);
- break;
- }
- }
-err_out:
- if (tpch<0 && n==0) return EOF;
- A_PUTC(tpch,fn);
- return n;
-}
-
-link_warning("__v_scanf","warning: the scanf functions add several kilobytes of bloat.");
diff --git a/mdk-stage1/dietlibc/lib/_brk.c b/mdk-stage1/dietlibc/lib/_brk.c
deleted file mode 100644
index e73d7b621..000000000
--- a/mdk-stage1/dietlibc/lib/_brk.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-
-extern void* __diet_brk(void *end_data_segment);
-
-void* __curbrk=0;
-
-int __libc_brk(void *end_data_segment);
-
-int __libc_brk(void *end_data_segment) {
- return ((__curbrk=__diet_brk(end_data_segment))==(void*)-1?-1:0);
-}
-
-int brk(void *end_data_segment) __attribute__((weak,alias("__libc_brk")));
diff --git a/mdk-stage1/dietlibc/lib/abort.c b/mdk-stage1/dietlibc/lib/abort.c
deleted file mode 100644
index 7c49a32ef..000000000
--- a/mdk-stage1/dietlibc/lib/abort.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <sys/types.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#ifndef __PIC__
-void __stdio_flushall(void) __attribute__((weak));
-void __stdio_flushall(void) { }
-#endif
-
-void abort() {
- sigset_t t;
- __stdio_flushall();
- 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 d3b75f202..000000000
--- a/mdk-stage1/dietlibc/lib/abs.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <endian.h>
-
-int abs(int i) { return i>=0?i:-i; }
-#if __WORDSIZE == 32
-long labs(long i) __attribute__((alias("abs")));
-#endif
diff --git a/mdk-stage1/dietlibc/lib/accept.c b/mdk-stage1/dietlibc/lib/accept.c
deleted file mode 100644
index 08359b894..000000000
--- a/mdk-stage1/dietlibc/lib/accept.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_accept(int a, void * addr, void * addr2);
-
-int __libc_accept(int a, void * addr, void * addr2) {
- unsigned long args[] = { a, (long) addr, (long) addr2 };
- return socketcall(SYS_ACCEPT, args);
-}
-
-int accept(int a, void * addr, void * addr2) __attribute__((weak,alias("__libc_accept")));
diff --git a/mdk-stage1/dietlibc/lib/adjtime.c b/mdk-stage1/dietlibc/lib/adjtime.c
deleted file mode 100644
index b8986be57..000000000
--- a/mdk-stage1/dietlibc/lib/adjtime.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <time.h>
-#include <sys/timex.h>
-
-int adjtime (const struct timeval *itv, struct timeval *otv) {
- struct timex tmp;
- if (itv) {
- tmp.offset = (itv->tv_usec % 1000000L) + (itv->tv_sec + itv->tv_usec / 1000000L) * 1000000L;
- tmp.modes = ADJ_OFFSET_SINGLESHOT;
- } else
- tmp.modes = 0;
- if (adjtimex(&tmp)==-1)
- return -1;
- if (otv) {
- otv->tv_usec = tmp.offset % 1000000;
- otv->tv_sec = tmp.offset / 1000000;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/alloc.c b/mdk-stage1/dietlibc/lib/alloc.c
deleted file mode 100644
index 9643913a6..000000000
--- a/mdk-stage1/dietlibc/lib/alloc.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * malloc/free by O.Dreesen
- *
- * first TRY:
- * lists w/magics
- * and now the second TRY
- * let the kernel map all the stuff (if there is something to do)
- */
-
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include "dietfeatures.h"
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <sys/shm.h> /* for PAGE_SIZE */
-
-
-/* -- HELPER CODE --------------------------------------------------------- */
-
-#ifndef MAP_FAILED
-#define MAP_FAILED ((void*)-1)
-#endif
-
-#ifndef NULL
-#define NULL ((void*)0)
-#endif
-
-typedef union {
- void* next;
- size_t size;
-} __alloc_t;
-
-#define BLOCK_START(b) (((void*)(b))-sizeof(__alloc_t))
-#define BLOCK_RET(b) (((void*)(b))+sizeof(__alloc_t))
-
-#define MEM_BLOCK_SIZE PAGE_SIZE
-#define PAGE_ALIGN(s) (((s)+MEM_BLOCK_SIZE-1)&(unsigned long)(~(MEM_BLOCK_SIZE-1)))
-
-/* a simple mmap :) */
-
-/* regparm exists only on i386 */
-#ifdef __i386__
-#define REGPARM(n) __attribute__((regparm(n)))
-#else
-#define REGPARM(n)
-#endif
-static size_t REGPARM(1) get_index(size_t _size);
-static void* REGPARM(1) __small_malloc(size_t _size);
-
-
-static void REGPARM(1) *do_mmap(size_t size) {
- return mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (size_t)0);
-}
-
-/* -- SMALL MEM ----------------------------------------------------------- */
-
-static __alloc_t* __small_mem[8];
-
-#define __SMALL_NR(i) (MEM_BLOCK_SIZE/(i))
-
-#define __MIN_SMALL_SIZE __SMALL_NR(256) /* 16 / 32 */
-#define __MAX_SMALL_SIZE __SMALL_NR(2) /* 2048 / 4096 */
-
-#define GET_SIZE(s) (__MIN_SMALL_SIZE<<get_index((s)))
-
-#define FIRST_SMALL(p) (((unsigned long)(p))&(~(MEM_BLOCK_SIZE-1)))
-
-static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; }
-
-static size_t REGPARM(1) get_index(size_t _size) {
- register size_t idx=0;
- if (_size) {
- register size_t size=((_size-1)&(MEM_BLOCK_SIZE-1))>>__ind_shift();
- while(size) { size>>=1; ++idx; }
- }
- return idx;
-}
-
-/* small mem */
-
-static void REGPARM(2) __small_free(void*_ptr,size_t _size) {
- __alloc_t* ptr=BLOCK_START(_ptr);
- size_t size=_size;
- size_t idx=get_index(size);
-
- memset(ptr,0,size); /* allways zero out small mem */
-
- ptr->next=__small_mem[idx];
- __small_mem[idx]=ptr;
-}
-
-static void* REGPARM(1) __small_malloc(size_t _size) {
- __alloc_t *ptr;
- size_t size=_size;
- size_t idx;
-
- idx=get_index(size);
- ptr=__small_mem[idx];
-
- if (ptr==0) { /* no free blocks ? */
- register int i,nr;
- ptr=do_mmap(MEM_BLOCK_SIZE);
- if (ptr==MAP_FAILED) return MAP_FAILED;
-
- __small_mem[idx]=ptr;
-
- nr=__SMALL_NR(size)-1;
- for (i=0;i<nr;i++) {
- ptr->next=(((void*)ptr)+size);
- ptr=ptr->next;
- }
- ptr->next=0;
-
- ptr=__small_mem[idx];
- }
-
- /* get a free block */
- __small_mem[idx]=ptr->next;
- ptr->next=0;
-
- return ptr;
-}
-
-/* -- PUBLIC FUNCTIONS ---------------------------------------------------- */
-
-static void _alloc_libc_free(void *ptr) {
- register size_t size;
- if (ptr) {
- size=((__alloc_t*)BLOCK_START(ptr))->size;
- if (size) {
- if (size<=__MAX_SMALL_SIZE)
- __small_free(ptr,size);
- else
- munmap(BLOCK_START(ptr),size);
- }
- }
-}
-void __libc_free(void *ptr) __attribute__((alias("_alloc_libc_free")));
-void free(void *ptr) __attribute__((weak,alias("_alloc_libc_free")));
-void if_freenameindex(void* ptr) __attribute__((alias("free")));
-
-#ifdef WANT_MALLOC_ZERO
-static __alloc_t zeromem[2]={{0},{0}};
-#endif
-
-static void* _alloc_libc_malloc(size_t size) {
- __alloc_t* ptr;
- size_t need;
-#ifdef WANT_MALLOC_ZERO
- if (!size) return BLOCK_RET(zeromem);
-#else
- if (!size) goto retzero;
-#endif
- size+=sizeof(__alloc_t);
- if (size<sizeof(__alloc_t)) goto retzero;
- if (size<=__MAX_SMALL_SIZE) {
- need=GET_SIZE(size);
- ptr=__small_malloc(need);
- }
- else {
- need=PAGE_ALIGN(size);
- if (!need) ptr=MAP_FAILED; else ptr=do_mmap(need);
- }
- if (ptr==MAP_FAILED) goto err_out;
- ptr->size=need;
- return BLOCK_RET(ptr);
-err_out:
- (*__errno_location())=ENOMEM;
-retzero:
- return 0;
-}
-void* __libc_malloc(size_t size) __attribute__((alias("_alloc_libc_malloc")));
-void* malloc(size_t size) __attribute__((weak,alias("_alloc_libc_malloc")));
-
-void *calloc(size_t nmemb, size_t _size) {
- register size_t size=_size*nmemb;
- if (nmemb && size/nmemb!=_size) {
- (*__errno_location())=ENOMEM;
- return 0;
- }
- return malloc(size);
-}
-
-void* __libc_realloc(void* ptr, size_t _size);
-void* __libc_realloc(void* ptr, size_t _size) {
- register size_t size=_size;
- if (ptr) {
- if (size) {
- __alloc_t* tmp=BLOCK_START(ptr);
- size+=sizeof(__alloc_t);
- if (size<sizeof(__alloc_t)) goto retzero;
- size=(size<=__MAX_SMALL_SIZE)?GET_SIZE(size):PAGE_ALIGN(size);
- if (tmp->size!=size) {
- if ((tmp->size<=__MAX_SMALL_SIZE)) {
- void *new=_alloc_libc_malloc(_size);
- if (new) {
- register __alloc_t* foo=BLOCK_START(new);
- size=foo->size;
- if (size>tmp->size) size=tmp->size;
- if (size) memcpy(new,ptr,size-sizeof(__alloc_t));
- _alloc_libc_free(ptr);
- }
- ptr=new;
- }
- else {
- register __alloc_t* foo;
- size=PAGE_ALIGN(size);
- foo=mremap(tmp,tmp->size,size,MREMAP_MAYMOVE);
- if (foo==MAP_FAILED) {
-retzero:
- (*__errno_location())=ENOMEM;
- ptr=0;
- }
- else {
- foo->size=size;
- ptr=BLOCK_RET(foo);
- }
- }
- }
- }
- else { /* size==0 */
- _alloc_libc_free(ptr);
- }
- }
- else { /* ptr==0 */
- if (size) {
- ptr=_alloc_libc_malloc(size);
- }
- }
- return ptr;
-}
-void* realloc(void* ptr, size_t size) __attribute__((weak,alias("__libc_realloc")));
-
diff --git a/mdk-stage1/dietlibc/lib/assert_fail.c b/mdk-stage1/dietlibc/lib/assert_fail.c
deleted file mode 100644
index 35b8b186a..000000000
--- a/mdk-stage1/dietlibc/lib/assert_fail.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "dietwarning.h"
-#include <write12.h>
-
-void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function);
-
-void __assert_fail (const char *assertion, const char *file, unsigned int line, const char *function)
-{
- unsigned int alen=strlen(assertion);
- unsigned int flen=strlen(file);
- unsigned int fulen=function?strlen(function):0;
- 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");
- __write2(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 e0eef19c6..000000000
--- a/mdk-stage1/dietlibc/lib/atexit.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <stdlib.h>
-
-typedef void (*function)(void);
-
-#define NUM_ATEXIT 32
-
-static function __atexitlist[NUM_ATEXIT];
-static int atexit_counter = 0;
-
-int atexit(function t) {
- if (atexit_counter<NUM_ATEXIT) {
- __atexitlist[atexit_counter]=t;
- ++atexit_counter;
- return 0;
- }
- return -1;
-}
-
-extern void _exit(int code) __attribute__((noreturn));
-extern void __thread_doexit();
-
-void __libc_exit(int code);
-void __libc_exit(int code) {
- register int i=atexit_counter;
- __thread_doexit();
- while(i) {
- __atexitlist[--i]();
- }
- _exit(code);
-}
-void exit(int code) __attribute__((alias("__libc_exit")));
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 <stdlib.h>
-
-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 10b618950..000000000
--- a/mdk-stage1/dietlibc/lib/atoi.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <endian.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#if __WORDSIZE == 64
-int atoi(const char* s) {
- long int v=0;
- int sign=1;
- while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) s++;
- switch (*s) {
- case '-': sign=-1;
- case '+': ++s;
- }
- while ((unsigned int) (*s - '0') < 10u) {
- v=v*10+*s-'0'; ++s;
- }
- return sign==-1?-v:v;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/atol.c b/mdk-stage1/dietlibc/lib/atol.c
deleted file mode 100644
index 5961a1881..000000000
--- a/mdk-stage1/dietlibc/lib/atol.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <endian.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-long int atol(const char* s) {
- long int v=0;
- int sign=0;
- while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s;
- switch (*s) {
- case '-': sign=-1;
- case '+': ++s;
- }
- while ((unsigned int) (*s - '0') < 10u) {
- v=v*10+*s-'0'; ++s;
- }
- return sign?-v:v;
-}
-
-#if __WORDSIZE == 64
-long long int atoll(const char* s) __attribute__((alias("atol")));
-#else
-int atoi(const char* s) __attribute__((alias("atol")));
-#endif
diff --git a/mdk-stage1/dietlibc/lib/atoll.c b/mdk-stage1/dietlibc/lib/atoll.c
deleted file mode 100644
index 7bf2b2fd6..000000000
--- a/mdk-stage1/dietlibc/lib/atoll.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <endian.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-#if __WORDSIZE != 64
-long long int atoll(const char* s) {
- long long int v=0;
- int sign=1;
- while ( *s == ' ' || (unsigned int)(*s - 9) < 5u) ++s;
- switch (*s) {
- case '-': sign=-1;
- case '+': ++s;
- }
- while ((unsigned int) (*s - '0') < 10u) {
- v=v*10+*s-'0'; ++s;
- }
- return sign==-1?-v:v;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/bcd.c b/mdk-stage1/dietlibc/lib/bcd.c
deleted file mode 100644
index 1936b82f6..000000000
--- a/mdk-stage1/dietlibc/lib/bcd.c
+++ /dev/null
@@ -1,185 +0,0 @@
-
-static long double powers [] = {
- 1.e+1, 1.e+2, 1.e+4, 1.e+8, 1.e+16, 1.e+32, 1.e+64, 1.e+128, 1.e+256
-};
-
-/*
- * So, die ist zum Zerlegen von Gleitkommazahlen am besten geeignet.
- *
- * Die nichtnegative übergebende Gleitkommazahl number wird in einen
- * Exponenten e und eine Mantisse m zerlegt mit:
- *
- * 1 <= m < 10
- * number = m * 10^e
- *
- * Die Mantisse wird in precision Dezimalstellen zerlegt, die nach digits
- * geschrieben werden. digits[0] ist die Vorkommastelle, digits [1 ...
- * precision-1] die Nachkommastellen der Mantisse Zurückgeliefert wird der
- * Exponent.
- *
- * Für precision ist ein Wert von 0 erlaubt, Sinn machen allerdings erst
- * Werte ab 1.
- */
-
-int __decompose_floatp ( long double number,
- unsigned char* digits, unsigned int precision );
-
-int __decompose_floatp ( long double number,
- unsigned char* digits, unsigned int precision )
-{
- int ret = 0;
- int i;
- double tmp;
-
- if ( number > 0.L ) {
-
- // Exponent abtrennen
- if ( number >= 10.L ) {
- for ( i = sizeof(powers)/sizeof(*powers)-1; i >= 0; i--)
- if ( number >= powers [i] ) {
- number /= powers [i];
- ret += 1 << i;
- }
- } else if ( number < 1.L )
- for ( i = sizeof(powers)/sizeof(*powers)-1; i >= 0; i--)
- if ( number * powers [i] < 10.L ) {
- number *= powers [i];
- ret -= 1 << i;
- }
-
- // Runden (ohne Geradezahlregel => Bug)
- tmp = 5.;
- {
- unsigned int j;
- for ( j = 0; j < precision; j++ )
- tmp *= 0.1;
- }
-
- number += tmp;
-
- // Dabei kann die Zahl in die nächste Dekade reinrutschen ...
- if ( number >= 10.L ) {
- number = 1.L;
- ret++;
- }
- }
-
- // Mantisse in ASCII konvertieren
- while ( precision-- ) {
- i = (int) number;
- number = (number - i) * 10.L;
- *digits++ = '0' + i;
- }
-
- // Exponent zurück
- return ret;
-}
-
-
-/*
- * So, die ist zum Zerlegen von Festkommazahlen am besten geeignet.
- *
- * Die nichtnegative übergebende Festkomma wird in einen Integeranteil und
- * einen Bruchanteil zerlegt.
- *
- * Der Bruchanteil wird in digits_frac[0...precision_frac-1] gespeichert,
- * falls precision_frac != 0 ist.
- *
- * Der Integeranteil wird ab digits_int + precision_int - 1 rückwrts
- * geschrieben. Zurückgeliefert wird ein Zeiger auf das erste Zeichen, das
- * bei der Konvertierung != '0' ist (Ausnahme ist die 0.0 selbst). Zeichen
- * zwischen digits_int und diesem Zeiger (exklusive des Zeichens unter dem
- * Zeiger) sind unbestimmt. Wünscht man dort Nullen oder Leerzeichen,
- * sollte man mittels memset() dieses vorher initialsieren.
- */
-
-char* __decompose_fixp ( long double number,
- unsigned char* digits_int , unsigned int precision_int,
- unsigned char* digits_frac, unsigned int precision_frac );
-
-char* __decompose_fixp ( long double number,
- unsigned char* digits_int , unsigned int precision_int,
- unsigned char* digits_frac, unsigned int precision_frac )
-{
- long long int integer;
- double tmp;
- int i;
-
- // Runden (ohne Geradezahlregel => Bug)
- tmp = 0.5;
- {
- unsigned int j;
- for ( j = 0; j < precision_frac; j++ )
- tmp *= 0.1;
- }
-
- number += tmp;
-
- integer = number;
- number -= integer;
-
- // Nachkommastellen
- while ( precision_frac-- ) {
- number *= 10.L;
- i = (int) number;
- number -= i;
- *digits_frac++
- = '0' + i;
- }
-
- // Vorkommastellen
- while ( precision_int ) {
- i = (int) (integer % 10);
- integer /= 10;
- digits_int [--precision_int]
- = '0' + i;
- if ( integer == 0 )
- break;
- }
-
- return digits_int + precision_int;
-}
-
-
-#if 0
-
-#include <stdio.h>
-#include <math.h>
-
-long double test [] = {
- 1, M_PI, 123, 123456789, 12345678901234567, 1e300, 0.00123456789, 1.234567890123456e-300, 0
-};
-
-int main ( void )
-{
- int i;
- int j;
- int k;
- char buff1 [32];
- char buff2 [32];
- char* retp;
- int ret;
-
- for ( i = 0; i < sizeof(test)/sizeof(*test); i++ ) {
- printf ("\n*** %30.20Lf ***\n\n", test[i] );
-
- for ( j = 0; j <= 20; j++ ) {
- memset ( buff1, 0, sizeof(buff1) );
- ret = __decompose_floatp ( test[i], buff1, j );
- printf ( "floatp(%2u) = <%sE%+d>\n", j, buff1, ret );
- }
- for ( j = 0; j <= 20; j++ ) {
- for ( k = 0; k <= 20; k++ ) {
- memset ( buff1, 0, sizeof(buff1) );
- memset ( buff2, 0, sizeof(buff2) );
- retp = __decompose_fixp ( test[i], buff1, j, buff2, k );
- printf ( "fixp(%2u,%2u) = <%s.%s>\n", j, k, retp, buff2 );
- }
- }
-
- }
-
- return 0;
-}
-
-#endif
diff --git a/mdk-stage1/dietlibc/lib/bind.c b/mdk-stage1/dietlibc/lib/bind.c
deleted file mode 100644
index dae80f491..000000000
--- a/mdk-stage1/dietlibc/lib/bind.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_bind(int a, void * b, int c);
-int __libc_bind(int a, void * b, int c) {
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_BIND, args);
-}
-
-int bind(int a, void * b, int c) __attribute__((weak,alias("__libc_bind")));
diff --git a/mdk-stage1/dietlibc/lib/binshstr.c b/mdk-stage1/dietlibc/lib/binshstr.c
deleted file mode 100644
index 814297e3d..000000000
--- a/mdk-stage1/dietlibc/lib/binshstr.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "binshstr.h"
-
-const char __binsh [] = "/bin/sh";
-
-/* end of binshstr.c */
diff --git a/mdk-stage1/dietlibc/lib/bsearch.c b/mdk-stage1/dietlibc/lib/bsearch.c
deleted file mode 100644
index 14605f1f6..000000000
--- a/mdk-stage1/dietlibc/lib/bsearch.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <assert.h>
-#include <stdlib.h>
-
-void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- size_t m;
- while (nmemb) {
- int tmp;
- void *p;
- m=nmemb/2;
- p=(void *) (((const char *) base) + (m * size));
- if ((tmp=(*compar)(key,p))<0) {
- nmemb=m;
- } else if (tmp>0) {
- base=p+size;
- nmemb-=m+1;
- } else
- return p;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/cfgetospeed.c b/mdk-stage1/dietlibc/lib/cfgetospeed.c
deleted file mode 100644
index c330352b2..000000000
--- a/mdk-stage1/dietlibc/lib/cfgetospeed.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <termios.h>
-#include <sys/types.h>
-
-speed_t cfgetospeed(struct termios *termios_p) {
- return ((termios_p->c_cflag & (CBAUD|CBAUDEX)));
-}
-
-speed_t cfgetispeed(struct termios *termios_p) __attribute__((weak,alias("cfgetospeed")));
diff --git a/mdk-stage1/dietlibc/lib/cfmakeraw.c b/mdk-stage1/dietlibc/lib/cfmakeraw.c
deleted file mode 100644
index e33c783c9..000000000
--- a/mdk-stage1/dietlibc/lib/cfmakeraw.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-
-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/cfsetispeed.c b/mdk-stage1/dietlibc/lib/cfsetispeed.c
deleted file mode 100644
index ab0333853..000000000
--- a/mdk-stage1/dietlibc/lib/cfsetispeed.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <termios.h>
-#include <errno.h>
-#include "dietfeatures.h"
-
-#define IBAUD0 020000000000
-
-int cfsetispeed(struct termios *termios_p, speed_t speed)
-{
- if ((speed & (speed_t)~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/cfsetospeed.c b/mdk-stage1/dietlibc/lib/cfsetospeed.c
deleted file mode 100644
index d1aee3595..000000000
--- a/mdk-stage1/dietlibc/lib/cfsetospeed.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <termios.h>
-#include <errno.h>
-#include "dietfeatures.h"
-
-int cfsetospeed(struct termios *termios_p, speed_t speed) {
- if ((speed & (speed_t)~CBAUD) != 0 && (speed < B57600 || speed > B460800)) {
- errno=EINVAL;
- return -1;
- }
- termios_p->c_cflag &= ~(CBAUD | CBAUDEX);
- termios_p->c_cflag |= speed;
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/closedir.c b/mdk-stage1/dietlibc/lib/closedir.c
deleted file mode 100644
index 3aade81b3..000000000
--- a/mdk-stage1/dietlibc/lib/closedir.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "dietdirent.h"
-#include <sys/mman.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-
-int closedir (DIR* d) {
- int res=close(d->fd);
- munmap (d, PAGE_SIZE);
- return res;
-}
diff --git a/mdk-stage1/dietlibc/lib/connect.c b/mdk-stage1/dietlibc/lib/connect.c
deleted file mode 100644
index 642303ef3..000000000
--- a/mdk-stage1/dietlibc/lib/connect.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_connect(int a, void * b, int c);
-int __libc_connect(int a, void * b, int c) {
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_CONNECT, args);
-}
-
-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 41d8236aa..000000000
--- a/mdk-stage1/dietlibc/lib/creat.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <fcntl.h>
-
-int __libc_creat(const char *file,mode_t mode);
-int __libc_creat(const char *file,mode_t mode) {
- return open(file,O_WRONLY|O_CREAT|O_TRUNC,mode);
-}
-int creat(const char *file,mode_t mode) __attribute__((weak,alias("__libc_creat")));
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 <fcntl.h>
-
-#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/errlistu.c b/mdk-stage1/dietlibc/lib/errlistu.c
deleted file mode 100644
index 15e38807b..000000000
--- a/mdk-stage1/dietlibc/lib/errlistu.c
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * used by perror() and strerror()
- */
-
-const char __sys_err_unknown [] = "[unknown error]";
-
diff --git a/mdk-stage1/dietlibc/lib/errno_location.c b/mdk-stage1/dietlibc/lib/errno_location.c
deleted file mode 100644
index 298c9c3cf..000000000
--- a/mdk-stage1/dietlibc/lib/errno_location.c
+++ /dev/null
@@ -1,5 +0,0 @@
-extern int errno;
-
-int *__errno_location(void) __attribute__((weak));
-int *__errno_location() { return &errno; }
-
diff --git a/mdk-stage1/dietlibc/lib/exec_lib.c b/mdk-stage1/dietlibc/lib/exec_lib.c
deleted file mode 100644
index 575c03d6d..000000000
--- a/mdk-stage1/dietlibc/lib/exec_lib.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <unistd.h>
-#include <paths.h>
-
-extern char **environ;
-
-int __exec_shell(const char *file, char *const argv[]);
-int __exec_shell(const char *file, char *const argv[]) {
- int i;
-
- for (i = 0; argv[i]; i++);
-
- {
- const char *shell_argv[i + 1];
- shell_argv[0] = _PATH_BSHELL;
- shell_argv[1] = file;
- for (; i > 1; i--)
- shell_argv[i] = argv[i - 1];
- return execve(_PATH_BSHELL, (char*const*)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 <paths.h>
-
-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 360bd3908..000000000
--- a/mdk-stage1/dietlibc/lib/execl.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "dietfeatures.h"
-
-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<n; ++i)
- argv[i]=va_arg(ap,char *);
- va_end (ap);
- return execve(path,argv,environ);
- }
- errno=ENOMEM;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execle.c b/mdk-stage1/dietlibc/lib/execle.c
deleted file mode 100644
index 6d05c48a0..000000000
--- a/mdk-stage1/dietlibc/lib/execle.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "dietfeatures.h"
-
-int execle( const char *path,...) {
- va_list ap;
- int n,i;
- char **argv,*tmp, **env;
- 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<n; ++i)
- argv[i]=va_arg(ap,char *);
- env=va_arg(ap, char **);
- va_end (ap);
- return execve(path,argv,env);
- }
- errno=ENOMEM;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execlp.c b/mdk-stage1/dietlibc/lib/execlp.c
deleted file mode 100644
index 27dc0bb95..000000000
--- a/mdk-stage1/dietlibc/lib/execlp.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <stdarg.h>
-#include <unistd.h>
-#include <errno.h>
-#include <stdlib.h>
-#include "dietfeatures.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]=(char*)arg;
- for (i=0; i<n; ++i)
- argv[i+1]=va_arg(bak,char *);
- va_end (bak);
- return execvp(file,argv);
- }
- errno=ENOMEM;
- return -1;
-}
diff --git a/mdk-stage1/dietlibc/lib/execv.c b/mdk-stage1/dietlibc/lib/execv.c
deleted file mode 100644
index d7acfa29f..000000000
--- a/mdk-stage1/dietlibc/lib/execv.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include "exec_lib.h"
-#include "dietfeatures.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 72447af7a..000000000
--- a/mdk-stage1/dietlibc/lib/execvp.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include "exec_lib.h"
-#include "dietfeatures.h"
-
-int execvp(const char *file, char *const argv[]) {
- const 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=(char*)path; cur; cur=next) {
- next=strchr(cur,':');
- if (!next)
- next=cur+strlen(cur);
- if (next==cur) {
- buf[0]='.';
- cur--;
- } else {
- if (next-cur>=PATH_MAX-3) { error: errno=EINVAL; return -1; }
- memmove(buf,cur,(size_t)(next-cur));
- }
- buf[next-cur]='/';
- {
- int len=strlen(file);
- if (len+(next-cur)>=PATH_MAX-2) goto error;
- 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 af13a7f86..000000000
--- a/mdk-stage1/dietlibc/lib/ftw.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <sys/stat.h>
-#include <unistd.h>
-#include <limits.h>
-#include <ftw.h>
-#include <dirent.h>
-#include <string.h>
-#include <stdlib.h>
-#include "dietdirent.h"
-
-int ftw(const char*dir,int(*f)(const char*file,const struct stat*sb,int flag),int dpth){
- char* cd;
- size_t cdl;
- DIR* d;
- struct dirent* de;
- struct stat sb;
- int r;
- unsigned int oldlen=0;
- char* filename; /* the warning gcc issues here is bogus */
- if(chdir(dir))return-1;
- cd=alloca(PATH_MAX+1);
- if(!getcwd(cd,PATH_MAX))return-1;
- cd[PATH_MAX]='\0';
- cdl=strlen(cd);
- if(!(d=opendir(".")))return-1;
- while((de=readdir(d))){
- int flg;
- size_t nl;
- if(de->d_name[0]=='.'){if(!de->d_name[1])continue;if(de->d_name[1]=='.'&&!de->d_name[2])continue;}
- nl=strlen(de->d_name);
- if (nl+cdl+2>oldlen)
- filename=alloca(oldlen=nl+cdl+2);
- memmove(filename,cd,cdl);
- filename[cdl]='/';
- memmove(filename+cdl+1,de->d_name,nl+1);
- if(!lstat(de->d_name,&sb)){
- if(S_ISLNK(sb.st_mode))flg=FTW_SL;else if(S_ISDIR(sb.st_mode))flg=FTW_D;else flg=FTW_F;
- }else flg=FTW_NS;
- r=f(filename,&sb,flg);
- if(r){closedir(d);return r;}
- if(flg==FTW_D&&dpth){
- r=ftw(filename,f,dpth-1);
- fchdir(d->fd);
- if (r){closedir(d);return r;}
- }
- }
- return closedir(d);
-}
diff --git a/mdk-stage1/dietlibc/lib/getdomainname.c b/mdk-stage1/dietlibc/lib/getdomainname.c
deleted file mode 100644
index 75486b010..000000000
--- a/mdk-stage1/dietlibc/lib/getdomainname.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#define _GNU_SOURCE
-
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-
-int getdomainname(char *name,size_t len) {
- struct utsname u;
- int res=uname(&u);
- if (res==0) {
- size_t i;
- if (len>=_UTSNAME_DOMAIN_LENGTH)
- len=_UTSNAME_DOMAIN_LENGTH;
- for (i=0; i<len; i++)
- name[i]=u.domainname[i];
- }
- return res;
-}
diff --git a/mdk-stage1/dietlibc/lib/getenv.c b/mdk-stage1/dietlibc/lib/getenv.c
deleted file mode 100644
index 5b529c17f..000000000
--- a/mdk-stage1/dietlibc/lib/getenv.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-
-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 c3d2f3d5e..000000000
--- a/mdk-stage1/dietlibc/lib/gethostname.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#define _GNU_SOURCE
-
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <unistd.h>
-
-int gethostname(char *name,size_t len) {
- struct utsname u;
- int res=uname(&u);
- if (res==0) {
- size_t i;
- if (len>=_UTSNAME_NODENAME_LENGTH)
- len=_UTSNAME_NODENAME_LENGTH;
- for (i=0; i<len; i++)
- name[i]=u.nodename[i];
- }
- return res;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/getopt.c b/mdk-stage1/dietlibc/lib/getopt.c
deleted file mode 100644
index aa1988f8d..000000000
--- a/mdk-stage1/dietlibc/lib/getopt.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <string.h>
-#include <getopt.h>
-
-static void getopterror(int which) {
- static char error1[]="Unknown option `-x'.\n";
- static char error2[]="Missing argument for `-x'.\n";
- if (opterr) {
- if (which) {
- error2[23]=optopt;
- write(2,error2,28);
- } else {
- error1[17]=optopt;
- write(2,error1,22);
- }
- }
-}
-
-int getopt(int argc, char * const argv[], const char *optstring) {
- static int lastidx=0,lastofs=0;
- char *tmp;
- if (optind==0) optind=1; /* whoever started setting optind to 0 should be shot */
-again:
- if (optind>argc || !argv[optind] || *argv[optind]!='-' || argv[optind][1]==0)
- return -1;
- if (argv[optind][1]=='-' && argv[optind][2]==0) {
- ++optind;
- return -1;
- }
- if (lastidx!=optind) {
- lastidx=optind; lastofs=0;
- }
- optopt=argv[optind][lastofs+1];
- if ((tmp=strchr(optstring,optopt))) {
- if (*tmp==0) { /* apparently, we looked for \0, i.e. end of argument */
- ++optind;
- goto again;
- }
- if (tmp[1]==':') { /* argument expected */
- if (tmp[2]==':' || argv[optind][lastofs+2]) { /* "-foo", return "oo" as optarg */
- if (!*(optarg=argv[optind]+lastofs+2)) optarg=0;
- goto found;
- }
- optarg=argv[optind+1];
- if (!optarg) { /* missing argument */
- ++optind;
- if (*optstring==':') return ':';
- getopterror(1);
- return ':';
- }
- ++optind;
- } else {
- ++lastofs;
- return optopt;
- }
-found:
- ++optind;
- return optopt;
- } else { /* not found */
- getopterror(0);
- ++optind;
- return '?';
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/getpeername.c b/mdk-stage1/dietlibc/lib/getpeername.c
deleted file mode 100644
index c806c720d..000000000
--- a/mdk-stage1/dietlibc/lib/getpeername.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_getpeername(int a, void * b, int *c);
-int __libc_getpeername(int a, void * b, int *c) {
- unsigned long args[] = { a, (long) b, (long) c };
- return socketcall(SYS_GETPEERNAME, args);
-}
-
-int getpeername(int a, struct sockaddr* b, socklen_t *c) __attribute__((weak,alias("__libc_getpeername")));
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 <unistd.h>
-
-int getpgrp()
-{
- return getpgid(0);
-}
diff --git a/mdk-stage1/dietlibc/lib/getsockname.c b/mdk-stage1/dietlibc/lib/getsockname.c
deleted file mode 100644
index 6c81e317d..000000000
--- a/mdk-stage1/dietlibc/lib/getsockname.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_getsockname(int a, void * b, int c);
-int __libc_getsockname(int a, void * b, int c) {
- unsigned long args[] = { a, (long) b, c };
- return socketcall(SYS_GETSOCKNAME, args);
-}
-
-int getsockname(int a, struct sockaddr* b, socklen_t* c) __attribute__((weak,alias("__libc_getsockname")));
diff --git a/mdk-stage1/dietlibc/lib/getsockopt.c b/mdk-stage1/dietlibc/lib/getsockopt.c
deleted file mode 100644
index 05b71d77d..000000000
--- a/mdk-stage1/dietlibc/lib/getsockopt.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_getsockopt(int a, int b, int c, void *d, int e);
-int __libc_getsockopt(int a, int b, int c, void *d, int e) {
- unsigned long args[] = { a, b, c, (long)d, e };
- return socketcall(SYS_GETSOCKOPT, args);
-}
-
-int getsockopt(int s, int level, int optname, void * optval, socklen_t *optlen) __attribute__((weak,alias("__libc_getsockopt")));
diff --git a/mdk-stage1/dietlibc/lib/htonl.c b/mdk-stage1/dietlibc/lib/htonl.c
deleted file mode 100644
index 4096d04f5..000000000
--- a/mdk-stage1/dietlibc/lib/htonl.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <endian.h>
-#include <netinet/in.h>
-
-uint32_t htonl(uint32_t hostlong) {
-#if __BYTE_ORDER==__LITTLE_ENDIAN
- return (hostlong>>24) | ((hostlong&0xff0000)>>8) |
- ((hostlong&0xff00)<<8) | (hostlong<<24);
-#else
- return hostlong;
-#endif
-}
-
-uint32_t ntohl(uint32_t 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 a64483174..000000000
--- a/mdk-stage1/dietlibc/lib/htons.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <endian.h>
-#include <netinet/in.h>
-
-uint16_t htons(uint16_t hostshort) {
-#if __BYTE_ORDER==__LITTLE_ENDIAN
- return ((hostshort>>8)&0xff) | (hostshort<<8);
-#else
- return hostshort;
-#endif
-}
-
-uint16_t ntohs(uint16_t 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 cc3111ed8..000000000
--- a/mdk-stage1/dietlibc/lib/if_indextoname.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#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<IFNAMSIZ-1; i++)
- if (!(blub[i]=ifr.ifr_name[i]))
- return blub;
- blub[i]=0;
- return blub;
- }
- close(fd);
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/if_nameindex.c b/mdk-stage1/dietlibc/lib/if_nameindex.c
deleted file mode 100644
index fc0e1c0ff..000000000
--- a/mdk-stage1/dietlibc/lib/if_nameindex.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <net/if.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-
-struct if_nameindex* if_nameindex(void) {
- struct ifconf ic;
- int fd,len,i;
- struct if_nameindex* x,* y;
- char *dest;
- fd=socket(AF_INET6,SOCK_DGRAM,0);
- if (fd<0) fd=socket(AF_INET,SOCK_DGRAM,0);
- ic.ifc_buf=0;
- ic.ifc_len=0;
- if (ioctl(fd,SIOCGIFCONF,&ic)<0) {
-b0rken:
- close(fd);
- return 0;
- }
- ic.ifc_buf=alloca((size_t)ic.ifc_len);
- if (ioctl(fd,SIOCGIFCONF,&ic)<0) goto b0rken;
- len=(ic.ifc_len/sizeof(struct ifreq));
- x=(struct if_nameindex*)malloc((len+1)*sizeof(struct if_nameindex)+len*IFNAMSIZ);
- if (!x) goto b0rken;
- dest=(char*)(x+len+1);
- y=x;
- for (i=0; i<len; ++i) {
- struct ifreq* ir=(struct ifreq*)&ic.ifc_req[i];
- y->if_name=dest;
- memcpy(dest,ir->ifr_name,IFNAMSIZ);
- if (ioctl(fd,SIOCGIFINDEX,ir)==-1) continue;
- y->if_index=ir->ifr_ifindex;
- dest+=IFNAMSIZ;
- ++y;
- }
- y->if_name=0; y->if_index=0;
- return x;
-}
diff --git a/mdk-stage1/dietlibc/lib/if_nametoindex.c b/mdk-stage1/dietlibc/lib/if_nametoindex.c
deleted file mode 100644
index c9dd1b051..000000000
--- a/mdk-stage1/dietlibc/lib/if_nametoindex.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <net/if.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#ifndef SOCK_DGRAM
-#define SOCK_DGRAM 2
-#endif
-
-unsigned int if_nametoindex(const 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/ipv6constants.c b/mdk-stage1/dietlibc/lib/ipv6constants.c
deleted file mode 100644
index 1d5cb1f08..000000000
--- a/mdk-stage1/dietlibc/lib/ipv6constants.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "netinet/in.h"
-
-const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
-const struct in6_addr in6addr_loopback = IN6ADDR_LOOPBACK_INIT;
diff --git a/mdk-stage1/dietlibc/lib/isalnum.c b/mdk-stage1/dietlibc/lib/isalnum.c
deleted file mode 100644
index 3192cc20d..000000000
--- a/mdk-stage1/dietlibc/lib/isalnum.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <ctype.h>
-
-int __isalnum_ascii ( int ch );
-int __isalnum_ascii ( int ch ) {
- return (unsigned int)((ch | 0x20) - 'a') < 26u ||
- (unsigned int)( ch - '0') < 10u;
-}
-
-int isalnum ( int ch ) __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 efd8b1940..000000000
--- a/mdk-stage1/dietlibc/lib/isalpha.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int __isalpha_ascii ( int ch );
-int __isalpha_ascii ( int ch ) {
- return (unsigned int)((ch | 0x20) - 'a') < 26u;
-}
-
-int isalpha ( int ch ) __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 57a23ba44..000000000
--- a/mdk-stage1/dietlibc/lib/isascii.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-int isascii ( int ch )
-{
- return (unsigned int)ch < 128u;
-}
diff --git a/mdk-stage1/dietlibc/lib/isatty.c b/mdk-stage1/dietlibc/lib/isatty.c
deleted file mode 100644
index 4858a364d..000000000
--- a/mdk-stage1/dietlibc/lib/isatty.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#define ioctl libc_ioctl
-#include <termios.h>
-#undef ioctl
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <unistd.h>
-#include "dietfeatures.h"
-
-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 f13ca304a..000000000
--- a/mdk-stage1/dietlibc/lib/isblank.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <ctype.h>
-
-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 98dbae6f3..000000000
--- a/mdk-stage1/dietlibc/lib/iscntrl.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int __iscntrl_ascii ( int ch );
-int __iscntrl_ascii ( int ch ) {
- return (unsigned int)ch < 32u || ch == 127;
-}
-
-int iscntrl ( int ch ) __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 d04d281a8..000000000
--- a/mdk-stage1/dietlibc/lib/isdigit.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int __isdigit_ascii ( int ch );
-int __isdigit_ascii ( int ch ) {
- return (unsigned int)(ch - '0') < 10u;
-}
-
-int isdigit ( int ch ) __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 83419e788..000000000
--- a/mdk-stage1/dietlibc/lib/isgraph.c
+++ /dev/null
@@ -1,6 +0,0 @@
-int __isgraph_ascii ( int ch );
-int __isgraph_ascii ( int ch ) {
- return (unsigned int)(ch - '!') < 127u - '!';
-}
-
-int isgraph ( int ch ) __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 8d219c43a..000000000
--- a/mdk-stage1/dietlibc/lib/islower.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int __islower_ascii ( int ch );
-int __islower_ascii ( int ch ) {
- return (unsigned int) (ch - 'a') < 26u;
-}
-
-int islower ( int ch ) __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 51ff5b6ee..000000000
--- a/mdk-stage1/dietlibc/lib/isprint.c
+++ /dev/null
@@ -1,7 +0,0 @@
-
-int __isprint_ascii ( int ch );
-int __isprint_ascii ( int ch ) {
- return (unsigned int)(ch - ' ') < 127u - ' ';
-}
-
-int isprint ( int ch ) __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 8bbfcdb5a..000000000
--- a/mdk-stage1/dietlibc/lib/ispunct.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <ctype.h>
-
-int __ispunct_ascii ( int ch );
-int __ispunct_ascii ( int ch )
-{
- return isprint (ch) && !isalnum (ch) && !isspace (ch);
-}
-
-int ispunct ( int ch ) __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 bfa46648b..000000000
--- a/mdk-stage1/dietlibc/lib/isspace.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <ctype.h>
-
-int __isspace_ascii ( int ch );
-int __isspace_ascii ( int ch )
-{
- return (unsigned int)(ch - 9) < 5u || ch == ' ';
-}
-
-int isspace ( int ch ) __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 048d4fd6c..000000000
--- a/mdk-stage1/dietlibc/lib/isupper.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <ctype.h>
-
-int __isupper_ascii ( int ch );
-int __isupper_ascii ( int ch )
-{
- return (unsigned int)(ch - 'A') < 26u;
-}
-
-int isupper ( int ch ) __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 bca8e74ac..000000000
--- a/mdk-stage1/dietlibc/lib/isxdigit.c
+++ /dev/null
@@ -1,8 +0,0 @@
-int __isxdigit_ascii ( int ch );
-int __isxdigit_ascii ( int ch )
-{
- return (unsigned int)( ch - '0') < 10u ||
- (unsigned int)((ch | 0x20) - 'a') < 6u;
-}
-
-int isxdigit ( int ch ) __attribute__((weak,alias("__isxdigit_ascii")));
diff --git a/mdk-stage1/dietlibc/lib/labs.c b/mdk-stage1/dietlibc/lib/labs.c
deleted file mode 100644
index 364557f40..000000000
--- a/mdk-stage1/dietlibc/lib/labs.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <endian.h>
-
-#if __WORDSIZE == 64
-long int labs(long int i) { return i>=0?i:-i; }
-long long int llabs(long long int i) __attribute__((alias("labs")));
-#endif
diff --git a/mdk-stage1/dietlibc/lib/listen.c b/mdk-stage1/dietlibc/lib/listen.c
deleted file mode 100644
index 661b86a63..000000000
--- a/mdk-stage1/dietlibc/lib/listen.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_listen(int a, int b);
-int __libc_listen(int a, int b) {
- unsigned long args[] = { a, b, 0 };
- return socketcall(SYS_LISTEN, args);
-}
-
-int listen(int s, int backlog) __attribute__((weak,alias("__libc_listen")));
diff --git a/mdk-stage1/dietlibc/lib/llabs.c b/mdk-stage1/dietlibc/lib/llabs.c
deleted file mode 100644
index bcbd3dc78..000000000
--- a/mdk-stage1/dietlibc/lib/llabs.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <endian.h>
-#include <stdlib.h>
-
-#if __WORDSIZE != 64
-long long int llabs(long long int i) { if (i<0) i=-i; return i; }
-#endif
diff --git a/mdk-stage1/dietlibc/lib/lockf.c b/mdk-stage1/dietlibc/lib/lockf.c
deleted file mode 100644
index 1b6fcb80c..000000000
--- a/mdk-stage1/dietlibc/lib/lockf.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include "dietfeatures.h"
-
-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 6f1afb4b1..000000000
--- a/mdk-stage1/dietlibc/lib/longjmp.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <setjmp.h>
-#include <signal.h>
-
-void __longjmp(void*env,int val);
-
-void __libc_longjmp(sigjmp_buf env,int val);
-void __libc_longjmp(sigjmp_buf env,int val) {
- if (env[0].__mask_was_saved) {
- sigprocmask(SIG_SETMASK,(sigset_t*)&env[0].__saved_mask,0);
- }
- if (val==0) val=1;
- __longjmp(env[0].__jmpbuf,val);
-}
-void __siglongjmp(sigjmp_buf env,int val) __attribute__((alias("__libc_longjmp")));
-void longjmp(sigjmp_buf env,int val) __attribute__((weak,alias("__libc_longjmp")));
-void siglongjmp(sigjmp_buf env,int val) __attribute__((weak,alias("__libc_longjmp")));
diff --git a/mdk-stage1/dietlibc/lib/lseek64.c b/mdk-stage1/dietlibc/lib/lseek64.c
deleted file mode 100644
index 62acf4a2b..000000000
--- a/mdk-stage1/dietlibc/lib/lseek64.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <errno.h>
-#include "dietfeatures.h"
-
-#include <sys/stat.h>
-#ifndef __NO_STAT64
-#include <unistd.h>
-
-loff_t lseek64(int fildes, loff_t offset, int whence) {
- loff_t tmp;
- if (llseek(fildes,(unsigned long)(offset>>32),(unsigned long)offset&0xffffffff,&tmp,whence)) {
- if (errno!=ENOSYS) return -1;
- return (loff_t)lseek(fildes,(off_t)offset,whence);
- }
- return tmp;
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/memccpy.c b/mdk-stage1/dietlibc/lib/memccpy.c
deleted file mode 100644
index 3208cfabb..000000000
--- a/mdk-stage1/dietlibc/lib/memccpy.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-#include <string.h>
-
-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 ae76bb150..000000000
--- a/mdk-stage1/dietlibc/lib/memchr.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-void* memchr(const void *s, int c, size_t n) {
- register const char* t=s;
- int i;
- for (i=n; i; --i) {
- if (*t==c)
- return (char*)t;
- ++t;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/memcmp.c b/mdk-stage1/dietlibc/lib/memcmp.c
deleted file mode 100644
index 4c8f77142..000000000
--- a/mdk-stage1/dietlibc/lib/memcmp.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <sys/types.h>
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-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 ebfd1e60a..000000000
--- a/mdk-stage1/dietlibc/lib/memcpy.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/types.h>
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-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/memmem.c b/mdk-stage1/dietlibc/lib/memmem.c
deleted file mode 100644
index 5c88a29e7..000000000
--- a/mdk-stage1/dietlibc/lib/memmem.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#define _GNU_SOURCE 23
-#include <sys/types.h>
-#include <string.h>
-
-void *memmem(const void* haystack, size_t hl, const void* needle, size_t nl) {
- 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/memmove.c b/mdk-stage1/dietlibc/lib/memmove.c
deleted file mode 100644
index 58414d503..000000000
--- a/mdk-stage1/dietlibc/lib/memmove.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-#include <string.h>
-
-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/memrchr.c b/mdk-stage1/dietlibc/lib/memrchr.c
deleted file mode 100644
index f7750d2d7..000000000
--- a/mdk-stage1/dietlibc/lib/memrchr.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define _GNU_SOURCE
-#include <sys/types.h>
-#include <string.h>
-
-void* memrchr(const void *s, int c, size_t n) {
- register const char* t=s;
- register const char* last=0;
- int i;
- for (i=n; i; --i) {
- if (*t==c)
- last=t;
- ++t;
- }
- return (void*)last; /* man, what an utterly b0rken prototype */
-}
diff --git a/mdk-stage1/dietlibc/lib/memset.c b/mdk-stage1/dietlibc/lib/memset.c
deleted file mode 100644
index a019eca44..000000000
--- a/mdk-stage1/dietlibc/lib/memset.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/types.h>
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-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 1bd132e65..000000000
--- a/mdk-stage1/dietlibc/lib/mkfifo.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/stat.h>
-#include <unistd.h>
-
-int mkfifo(const char *fn,mode_t mode) {
- return mknod(fn,(mode_t)(mode|S_IFIFO),0);
-}
diff --git a/mdk-stage1/dietlibc/lib/msgctl.c b/mdk-stage1/dietlibc/lib/msgctl.c
deleted file mode 100644
index 51cffdef0..000000000
--- a/mdk-stage1/dietlibc/lib/msgctl.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-extern int __ipc(int,int,int,int,void*);
-
-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 6023c1786..000000000
--- a/mdk-stage1/dietlibc/lib/msgget.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-extern int __ipc(int,key_t,int,int,int);
-
-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 8168187a5..000000000
--- a/mdk-stage1/dietlibc/lib/msgrcv.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-extern int __ipc(int,int,size_t,int,void*);
-
-struct ipc_kludge {
- struct msgbuf *msgp;
- long msgtyp;
-};
-
-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 6e9ef445e..000000000
--- a/mdk-stage1/dietlibc/lib/msgsnd.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/msg.h>
-
-extern int __ipc(int,int,size_t,int,const void*);
-
-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/open64.c b/mdk-stage1/dietlibc/lib/open64.c
deleted file mode 100644
index 2599e2259..000000000
--- a/mdk-stage1/dietlibc/lib/open64.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <fcntl.h>
-
-#ifndef O_LARGEFILE
-#define O_LARGEFILE 0
-#endif
-
-int __libc_open64(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,...) __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 2530d1ac9..000000000
--- a/mdk-stage1/dietlibc/lib/opendir.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "dietdirent.h"
-#include <sys/mman.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-DIR* opendir ( const char* name ) {
- int fd = open (name, O_RDONLY | O_DIRECTORY);
- DIR* t = NULL;
-
- if ( fd >= 0 ) {
- if (fcntl (fd, F_SETFD, FD_CLOEXEC) < 0)
- goto lose;
- t = (DIR *) mmap (NULL, PAGE_SIZE, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
- if (t == MAP_FAILED)
-lose:
- close (fd);
- else
- t->fd = fd;
- }
-
-
- return t;
-}
diff --git a/mdk-stage1/dietlibc/lib/perror.c b/mdk-stage1/dietlibc/lib/perror.c
deleted file mode 100644
index 0a45fb9d6..000000000
--- a/mdk-stage1/dietlibc/lib/perror.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#define _BSD_SOURCE
-#include <errno.h>
-
-extern const char __sys_err_unknown [];
-
-void perror ( const char* prepend )
-{
- register const char* message = __sys_err_unknown;
-
- if ( (unsigned int) errno < (unsigned int) __SYS_NERR )
- message = sys_errlist [errno];
-
- if (prepend) {
- write ( 2, prepend, strlen(prepend) );
- write ( 2, ": ", 2 );
- }
- write ( 2, message, strlen(message) );
- write ( 2, "\n", 1 );
-}
diff --git a/mdk-stage1/dietlibc/lib/pread.c b/mdk-stage1/dietlibc/lib/pread.c
deleted file mode 100644
index fd6c49149..000000000
--- a/mdk-stage1/dietlibc/lib/pread.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-
-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);
-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 6dc93cefa..000000000
--- a/mdk-stage1/dietlibc/lib/pread64.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#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);
-size_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) {
- return __pread(fd,buf,count,__LONG_LONG_PAIR ((off_t)(offset&0xffffffff),(off_t)(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 448d59840..000000000
--- a/mdk-stage1/dietlibc/lib/putenv.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-int putenv(const char *string) {
- size_t len;
- int envc;
- int remove=0;
- char *tmp;
- const char **ep;
- char **newenv;
- static char **origenv;
- if (!origenv) origenv=environ;
- if (!(tmp=strchr(string,'='))) {
- len=strlen(string);
- remove=1;
- } else
- len=tmp-string+1;
- for (envc=0, ep=(const char**)environ; *ep; ++ep) {
- if (*string == **ep && !memcmp(string,*ep,len)) {
- if (remove) {
- for (; ep[1]; ++ep) ep[0]=ep[1];
- ep[0]=0;
- return 0;
- }
- *ep=string;
- return 0;
- }
- ++envc;
- }
- if (tmp) {
- newenv = (char**) realloc(environ==origenv?0:origenv,
- (envc+2)*sizeof(char*));
- if (!newenv) return -1;
- newenv[0]=(char*)string;
- memcpy(newenv+1,environ,(envc+1)*sizeof(char*));
- environ=newenv;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/pwrite.c b/mdk-stage1/dietlibc/lib/pwrite.c
deleted file mode 100644
index 1e9fde545..000000000
--- a/mdk-stage1/dietlibc/lib/pwrite.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-
-extern size_t __pwrite(int fd, void *buf, size_t count, off_t a,off_t b);
-
-size_t __libc_pwrite(int fd, void *buf, size_t count, off_t offset);
-size_t __libc_pwrite(int fd, void *buf, size_t count, off_t offset) {
- return __pwrite(fd,buf,count,offset,0);
-}
-
-int pwrite(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pwrite")));
diff --git a/mdk-stage1/dietlibc/lib/pwrite64.c b/mdk-stage1/dietlibc/lib/pwrite64.c
deleted file mode 100644
index cac46024a..000000000
--- a/mdk-stage1/dietlibc/lib/pwrite64.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <endian.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef __NO_STAT64
-extern size_t __pwrite(int fd, void *buf, size_t count, off_t a,off_t b);
-
-size_t __libc_pwrite64(int fd, void *buf, size_t count, off64_t offset);
-size_t __libc_pwrite64(int fd, void *buf, size_t count, off64_t offset) {
- return __pwrite(fd,buf,count,__LONG_LONG_PAIR ((off_t)(offset&0xffffffff),(off_t)(offset>>32)));
-}
-
-int pwrite64(int fd, void *buf, size_t count, off_t offset) __attribute__((weak,alias("__libc_pwrite64")));
-#endif
diff --git a/mdk-stage1/dietlibc/lib/qsort.c b/mdk-stage1/dietlibc/lib/qsort.c
deleted file mode 100644
index 62217e142..000000000
--- a/mdk-stage1/dietlibc/lib/qsort.c
+++ /dev/null
@@ -1,127 +0,0 @@
-#include <sys/cdefs.h>
-#include <stdlib.h>
-#include <assert.h>
-
-/* 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 (x<z) {
- register char tmp=*x;
- *x=*y;
- *y=tmp;
- ++x; ++y;
- }
-}
-
-static inline void swap(void *base,size_t size,size_t a,size_t b) {
- iswap((char*)base+a*size,(char*)base+b*size,size);
-}
-
-#if 0
-extern int array[];
-
-void dumparray() {
- printf("array now {%d,%d,%d,%d,%d}\n",array[0],array[1],array[2],array[3],array[4]);
-}
-#endif
-
-void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
-void isort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
- size_t i;
- while (expect(nmemb>1,1)) {
- char *min=base;
- char *tmp=min+size;
- for (i=1; i<nmemb; ++i) {
- if (expect(compar(tmp,min)<0,0))
- min=tmp;
- tmp+=size;
- }
- iswap(min,base,size);
- (char*)base+=size;
- nmemb-=1;
- }
-}
-
-void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) {
-#ifdef DEBUG
- char *dbase=base;
- char *dmax=base+(nmemb-1)*size;
- char dmemb=nmemb;
-#endif
- static int level=0;
- char* v; /* pivot */
- char* mid, *max, *min;
- size_t lmemb;
-
-#if 0
- int left,right;
- left=(int*)base-array;
- right=left+nmemb-1;
- ++level;
- { int i; for (i=0; i<level; ++i) printf(" "); }
- printf("qsort: level %d; base=%p, %dx%d; array[%d..%d]\n",level,base,nmemb,size,left,right);
- assert(left>=0 && right<=1000);
-#endif
- if (nmemb<=8) {
- --level;
- return isort(base,nmemb,size,compar);
- }
- {
- mid=(char*)base+(nmemb/2)*size;
- max=(char*)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 (expect(compar(min,v)<0,1)) { min+=size; ++lmemb; }
- while (expect(compar(max-=size,v)>0,1)) ;
- if (min>=max) break;
- iswap(min,max,size);
- }
- iswap(min,v,size);
-#ifdef DEBUG
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("-=< base=%p, min=%p, nmemb=%d, lmemb=%d (%d)\n",base,min,nmemb,lmemb,(min-(char*)base)/size);
- assert(lmemb==((min-(char*)base)/size));
-#endif
- if (min>(char*)base+size) {
-#ifdef DEBUG
- assert(base==dbase);
-#endif
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("+-left %d [%d..%d] of [%d..%d]\n",level+1,left,left+lmemb,left,right);
- qsort(base,lmemb,size,compar);
- }
- if (nmemb>lmemb+1) {
-// { int i; for (i=0; i<level; ++i) printf(" "); }
-// printf("+-right %d [%d..%d] of [%d..%d]\n",level+1,left+lmemb,right,left,right);
- qsort(min+size,nmemb-lmemb-1,size,compar);
- }
- --level;
-}
diff --git a/mdk-stage1/dietlibc/lib/raise.c b/mdk-stage1/dietlibc/lib/raise.c
deleted file mode 100644
index 0f548fc3b..000000000
--- a/mdk-stage1/dietlibc/lib/raise.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.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 beb2d2717..000000000
--- a/mdk-stage1/dietlibc/lib/rand.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdlib.h>
-
-static unsigned int seed=1;
-
-int rand(void) {
- return rand_r(&seed);
-}
-
-void srand(unsigned int i) { seed=i; }
-
-int random(void) __attribute__((alias("rand")));
-void srandom(unsigned int i) __attribute__((alias("srand")));
diff --git a/mdk-stage1/dietlibc/lib/rand48.c b/mdk-stage1/dietlibc/lib/rand48.c
deleted file mode 100644
index 9c6cfcda2..000000000
--- a/mdk-stage1/dietlibc/lib/rand48.c
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <stdlib.h>
-
-static randbuf rand48buf;
-#define A_0 0xE66D
-#define A_1 0xDEEC
-#define A_2 0x5
-#define C 0xB
-static randbuf a = { A_0, A_1, A_2 };
-static unsigned short c = C;
-
-static void calc_next(randbuf buf) {
- randbuf tmp;
- long t;
- t = buf[0] * a[0] + c;
- tmp[0] = t & 0xffff;
- tmp[1] = (t >> 16) & 0xffff;
- t = buf[1] * a[0] + buf[0] * a[1] + tmp[1];
- tmp[1] = t & 0xffff;
- tmp[2] = (t >> 16) & 0xffff;
- t = buf[2] * a[0] + buf[1] * a[1] + buf[0] * a[2] + tmp[2];
- tmp[2] = t & 0xffff;
- buf[0] = tmp[0];
- buf[1] = tmp[1];
- buf[2] = tmp[2];
-}
-
-double drand48(void) {
- return erand48(rand48buf);
-}
-
-long lrand48(void) {
- return nrand48(rand48buf);
-}
-
-long mrand48(void) {
- return jrand48(rand48buf);
-}
-
-void srand48(long seed) {
- rand48buf[1] = (seed >> 16) & 0xffff;
- rand48buf[2] = seed & 0xffff;
- rand48buf[0] = 0x330e;
- a[0] = A_0;
- a[1] = A_1;
- a[2] = A_2;
- c = C;
-}
-
-unsigned short *seed48(randbuf buf) {
- static randbuf oldx;
- int i;
- for (i = 0; i < 3; i++) {
- oldx[i] = rand48buf[i];
- rand48buf[i] = buf[i];
- }
- a[0] = A_0;
- a[1] = A_1;
- a[2] = A_2;
- c = C;
- return (unsigned short *)&oldx;
-}
-
-void lcong48(unsigned short param[7]) {
- int i;
- for (i = 0; i < 3; i++) {
- rand48buf[i] = param[i];
- a[i] = param[i + 3];
- }
- c = param[6];
-}
-
-long jrand48(randbuf buf) {
- long ret;
- ret = buf[2] << 16 | buf[1];
- calc_next(buf);
- return ret;
-}
-
-long nrand48(randbuf buf) {
- return jrand48(buf) & 0x7FFFFFFFL;
-}
-
-double erand48(randbuf buf) {
- double ret;
- ret = ((buf[0] / 65536.0 + buf[1]) / 65536.0 + buf[2]) / 65536.0;
- calc_next(buf);
- return ret;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/rand_r.c b/mdk-stage1/dietlibc/lib/rand_r.c
deleted file mode 100644
index 55f8303bc..000000000
--- a/mdk-stage1/dietlibc/lib/rand_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- Copyright (C) 2002 Luc Van Oostenryck
-
- This is free software. You can redistribute and
- modify it under the terms of the GNU General Public
- Public License.
-*/
-
-#include <stdlib.h>
-#include <stdint.h>
-
-/* Knuth's TAOCP section 3.6 */
-#define M ((1U<<31) -1)
-#define A 48271
-#define Q 44488 // M/A
-#define R 3399 // M%A; R < Q !!!
-
-// FIXME: ISO C/SuS want a longer period
-
-int rand_r(unsigned int* seed)
-{ int32_t X;
-
- X = *seed;
- X = A*(X%Q) - R * (int32_t) (X/Q);
- if (X < 0)
- X += M;
-
- *seed = X;
- return X;
-}
diff --git a/mdk-stage1/dietlibc/lib/readdir.c b/mdk-stage1/dietlibc/lib/readdir.c
deleted file mode 100644
index ed885a5f0..000000000
--- a/mdk-stage1/dietlibc/lib/readdir.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-
-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,sizeof (d->buf)-1);
- 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/readdir64.c b/mdk-stage1/dietlibc/lib/readdir64.c
deleted file mode 100644
index b9b0aafcc..000000000
--- a/mdk-stage1/dietlibc/lib/readdir64.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include "dietfeatures.h"
-#include "dietdirent.h"
-#include <unistd.h>
-#include <dirent.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include "syscalls.h"
-
-#ifndef __NR_getdents64
-#define WANT_LARGEFILE_BACKCOMPAT
-#endif
-
-#ifndef WANT_LARGEFILE_BACKCOMPAT
-struct dirent64* readdir64(DIR *d) {
- if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
- int res=getdents64(d->fd,(struct dirent64*)d->buf, sizeof (d->buf)-1);
- if (res<=0) return 0;
- d->num=res; d->cur=0;
- }
- return (struct dirent64*)(d->buf+d->cur);
-}
-#else
-struct dirent64* readdir64(DIR *d) {
-#ifdef __NR_getdents64
- static int trygetdents64=1;
-#endif
- struct dirent* o;
- static struct dirent64 d64;
-again:
-#ifdef __NR_getdents64
- if (!trygetdents64) {
-#endif
- if (!d->num || (d->cur += ((struct dirent*)(d->buf+d->cur))->d_reclen)>=d->num) {
- int res=getdents(d->fd,(struct dirent*)d->buf, sizeof (d->buf)-1);
- if (res<=0) return 0;
- d->num=res; d->cur=0;
- }
- o=(struct dirent*)(d->buf+d->cur);
- d64.d_ino=o->d_ino;
- d64.d_off=o->d_off;
- d64.d_reclen=o->d_reclen;
- strcpy(d64.d_name,o->d_name);
- d64.d_type=0; /* is this correct? */
- return &d64;
-#ifdef __NR_getdents64
- }
- if (!d->num || (d->cur += ((struct dirent64*)(d->buf+d->cur))->d_reclen)>=d->num) {
- int res=getdents64(d->fd,(struct dirent64*)d->buf,sizeof (d->buf));
- if (res<=0) {
- if (errno==ENOSYS) {
- trygetdents64=0;
- goto again;
- }
- return 0;
- }
- d->num=res; d->cur=0;
- }
- return (struct dirent64*)(d->buf+d->cur);
-#endif
-}
-#endif
diff --git a/mdk-stage1/dietlibc/lib/reboot.c b/mdk-stage1/dietlibc/lib/reboot.c
deleted file mode 100644
index 421068504..000000000
--- a/mdk-stage1/dietlibc/lib/reboot.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <sys/reboot.h>
-
-int __reboot(unsigned int magic1, unsigned int magic2, int cmd);
-
-int reboot(int cmd)
-{
- return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd);
-}
diff --git a/mdk-stage1/dietlibc/lib/recv.c b/mdk-stage1/dietlibc/lib/recv.c
deleted file mode 100644
index c6bab4fb1..000000000
--- a/mdk-stage1/dietlibc/lib/recv.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recv(int a, const void * b, size_t c, int flags);
-int __libc_recv(int a, const void * b, size_t c, int flags) {
- unsigned long args[] = { a, (long) b, c, flags };
- return socketcall(SYS_RECV, args);
-}
-
-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 b66ce3813..000000000
--- a/mdk-stage1/dietlibc/lib/recvfrom.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen);
-int __libc_recvfrom(int a, const void * b, size_t c, int flags, void *to, void *tolen) {
- unsigned long args[] = { a, (long) b, c, flags, (long) to, (long) tolen };
- return socketcall(SYS_RECVFROM, args);
-}
-
-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 d843ce9c0..000000000
--- a/mdk-stage1/dietlibc/lib/recvmsg.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/socket.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_recvmsg(int a, struct msghdr* msg, int flags);
-int __libc_recvmsg(int a, struct msghdr* msg, int flags) {
- unsigned long args[] = { a, (long) msg, flags };
- return socketcall(SYS_RECVMSG, args);
-}
-
-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 06f686356..000000000
--- a/mdk-stage1/dietlibc/lib/remove.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <unistd.h>
-#include <errno.h>
-#include "dietfeatures.h"
-#include <stdio.h>
-
-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 <dietstdio.h>
-#include <unistd.h>
-
-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 <unistd.h>
-#include <dirent.h>
-
-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 799ce7428..000000000
--- a/mdk-stage1/dietlibc/lib/sbrk.c
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <unistd.h>
-
-extern int __libc_brk(void *end_data_segment);
-
-extern void* __curbrk;
-
-void* __libc_sbrk(ptrdiff_t increment);
-void* __libc_sbrk(ptrdiff_t increment) {
- void* oldbrk;
- if (__curbrk==0)
- if (__libc_brk(0) < 0)
- return (void*)-1;
- if (increment==0)
- return __curbrk;
- oldbrk=__curbrk;
- if (__libc_brk((char*)oldbrk+increment)<0)
- return (void*)-1;
- return oldbrk;
-}
-
-void* sbrk (ptrdiff_t increment) __attribute__((weak,alias("__libc_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 <unistd.h>
-#include <dirent.h>
-
-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 cec0b7535..000000000
--- a/mdk-stage1/dietlibc/lib/semctl.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-
-extern int __ipc(int,int,int,int,void*);
-
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- unsigned short *array; /* array for GETALL & SETALL */
- struct seminfo *__buf; /* buffer for IPC_INFO */
- void *__pad;
-};
-
-int semctl(int semid, int semnum, int cmd, union semun arg);
-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 c3649eea1..000000000
--- a/mdk-stage1/dietlibc/lib/semget.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-
-extern int __ipc(int,key_t,int,int,int);
-
-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 4d2e748cc..000000000
--- a/mdk-stage1/dietlibc/lib/semop.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-
-extern int __ipc(int,int,unsigned,int,void*);
-
-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 783ecaf89..000000000
--- a/mdk-stage1/dietlibc/lib/send.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/types.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_send(int a, const void * b, size_t c, int flags);
-int __libc_send(int a, const void * b, size_t c, int flags) {
- unsigned long args[] = { a, (long) b, c, flags };
- return socketcall(SYS_SEND, args);
-}
-
-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 bb5d1711a..000000000
--- a/mdk-stage1/dietlibc/lib/sendmsg.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/socket.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_sendmsg(int a, const struct msghdr* msg, int flags);
-int __libc_sendmsg(int a, const struct msghdr* msg, int flags) {
- unsigned long args[] = { a, (long) msg, flags };
- return socketcall(SYS_SENDMSG, args);
-}
-
-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 d3239932b..000000000
--- a/mdk-stage1/dietlibc/lib/sendto.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <sys/socket.h>
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen);
-int __libc_sendto(int a, const void * b, size_t c, int flags, void *to, int tolen) {
- unsigned long args[] = { a, (long) b, c, flags, (long) to, tolen };
- return socketcall(SYS_SENDTO, args);
-}
-
-int sendto(int a, const void * b, size_t c, int flags, const struct sockaddr* to, socklen_t tolen)
- __attribute__ ((weak, alias("__libc_sendto")));
diff --git a/mdk-stage1/dietlibc/lib/setlinebuf.c b/mdk-stage1/dietlibc/lib/setlinebuf.c
deleted file mode 100644
index 1f30e183a..000000000
--- a/mdk-stage1/dietlibc/lib/setlinebuf.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdio.h>
-#include "dietwarning.h"
-#undef setlinebuf
-
-/* there is no previous prototype because it is a #define */
-void setlinebuf(FILE* stream);
-
-void setlinebuf(FILE* stream) {
- setvbuf(stream,0,_IOLBF,BUFSIZ);
-}
-
-link_warning("setlinebuf","warning: you used setlinebuf without including <stdio.h>")
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 <unistd.h>
-
-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 e4bab349f..000000000
--- a/mdk-stage1/dietlibc/lib/setsockopt.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_setsockopt(int a, int b, int c, void *d, void *e);
-int __libc_setsockopt(int a, int b, int c, void *d, void *e) {
- unsigned long args[] = { a, b, c, (long)d, (long) e };
- return socketcall(SYS_SETSOCKOPT, args);
-}
-
-int setsockopt(int s, int level, int optname, const void* optval, socklen_t optlen) __attribute__((weak,alias("__libc_setsockopt")));
diff --git a/mdk-stage1/dietlibc/lib/shmat.c b/mdk-stage1/dietlibc/lib/shmat.c
deleted file mode 100644
index d4b34c120..000000000
--- a/mdk-stage1/dietlibc/lib/shmat.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-extern void* __ipc(int,int,int,void*,const void*);
-
-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)8196)
- 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 92b9d1fbb..000000000
--- a/mdk-stage1/dietlibc/lib/shmctl.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-extern int __ipc(int,int,int,int,void*);
-
-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 54dc6f41b..000000000
--- a/mdk-stage1/dietlibc/lib/shmdt.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-extern int __ipc(int,int,int,int,const void*);
-
-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 bf1dc2030..000000000
--- a/mdk-stage1/dietlibc/lib/shmget.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-extern int __ipc(int,key_t,int,int,int);
-
-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 0e7b8755c..000000000
--- a/mdk-stage1/dietlibc/lib/shutdown.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-#include <sys/socket.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_shutdown(int s, int how);
-int __libc_shutdown(int s, int how) {
- unsigned long args[] = { s, (long) how, 0 };
- return socketcall(SYS_SHUTDOWN, args);
-}
-
-int shutdown(int s, int how) __attribute__((weak,alias("__libc_shutdown")));
diff --git a/mdk-stage1/dietlibc/lib/sigaction.c b/mdk-stage1/dietlibc/lib/sigaction.c
deleted file mode 100644
index fe1351f0f..000000000
--- a/mdk-stage1/dietlibc/lib/sigaction.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <signal.h>
-
-int __rt_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact, long nr);
-
-int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
-int __libc_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {
- return __rt_sigaction(signum, act, oldact, _NSIG/8);
-}
-
-int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact)
-__attribute__((weak,alias("__libc_sigaction")));
diff --git a/mdk-stage1/dietlibc/lib/sigaddset.c b/mdk-stage1/dietlibc/lib/sigaddset.c
deleted file mode 100644
index 1c2632e67..000000000
--- a/mdk-stage1/dietlibc/lib/sigaddset.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <signal.h>
-#include <errno.h>
-
-#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
-#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-
-int sigaddset(sigset_t *set, int signo) {
- if ((signo<1)||(signo>SIGRTMAX)) {
- (*__errno_location())=EINVAL;
- return -1;
- } else {
- unsigned long __mask = __sigmask (signo);
- unsigned long __word = __sigword (signo);
- set->sig[__word]|=__mask;
- return 0;
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/sigdelset.c b/mdk-stage1/dietlibc/lib/sigdelset.c
deleted file mode 100644
index 0c47ce348..000000000
--- a/mdk-stage1/dietlibc/lib/sigdelset.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <signal.h>
-#include <errno.h>
-
-#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
-#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-
-int sigdelset(sigset_t *set, int signo) {
- if ((signo<1)||(signo>SIGRTMAX)) {
- (*__errno_location())=EINVAL;
- return -1;
- } else {
- unsigned long __mask = __sigmask (signo);
- unsigned long __word = __sigword (signo);
- set->sig[__word]&=~__mask;
- return 0;
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/sigemptyset.c b/mdk-stage1/dietlibc/lib/sigemptyset.c
deleted file mode 100644
index 4efee2550..000000000
--- a/mdk-stage1/dietlibc/lib/sigemptyset.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <signal.h>
-
-int sigemptyset(sigset_t *set) {
- set->sig[0]=0;
- if (_NSIG_WORDS>1) set->sig[1]=0;
- if (_NSIG_WORDS>2) {
- set->sig[2]=0;
- set->sig[3]=0;
- }
- return 0;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/sigfillset.c b/mdk-stage1/dietlibc/lib/sigfillset.c
deleted file mode 100644
index b4e369fe4..000000000
--- a/mdk-stage1/dietlibc/lib/sigfillset.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <signal.h>
-
-int sigfillset(sigset_t *set) {
- set->sig[0]=(unsigned long)-1;
- if (_NSIG_WORDS>1) set->sig[1]=(unsigned long)-1;
- if (_NSIG_WORDS>2) {
- set->sig[2]=(unsigned long)-1;
- set->sig[3]=(unsigned long)-1;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/siginterrupt.c b/mdk-stage1/dietlibc/lib/siginterrupt.c
deleted file mode 100644
index 8926f09ed..000000000
--- a/mdk-stage1/dietlibc/lib/siginterrupt.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <signal.h>
-
-int siginterrupt(int sig, int flag) {
- int ret;
- struct sigaction act;
-
- sigaction(sig, 0, &act);
-
- if (flag)
- act.sa_flags &= ~SA_RESTART;
- else
- act.sa_flags |= SA_RESTART;
-
- ret = sigaction(sig, &act, 0);
-
- return ret;
-}
diff --git a/mdk-stage1/dietlibc/lib/sigismember.c b/mdk-stage1/dietlibc/lib/sigismember.c
deleted file mode 100644
index 8ffe9762a..000000000
--- a/mdk-stage1/dietlibc/lib/sigismember.c
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <signal.h>
-#include <errno.h>
-
-#define __sigmask(sig) ( ((unsigned long)1) << (((sig)-1) % (8*sizeof(unsigned long))) )
-#define __sigword(sig) ( ((sig)-1) / (8*sizeof(unsigned long)) )
-
-int sigismember(const sigset_t *set, int signo) {
- if ((signo<1)||(signo>SIGRTMAX)) {
- (*__errno_location())=EINVAL;
- return -1;
- } else {
- unsigned long __mask = __sigmask (signo);
- unsigned long __word = __sigword (signo);
- return (set->sig[__word] & __mask)?1:0;
- }
-}
diff --git a/mdk-stage1/dietlibc/lib/sigjmp.c b/mdk-stage1/dietlibc/lib/sigjmp.c
deleted file mode 100644
index 73c8baa8e..000000000
--- a/mdk-stage1/dietlibc/lib/sigjmp.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <setjmp.h>
-#include <signal.h>
-
-int __sigjmp_save(sigjmp_buf env,int savemask);
-int __sigjmp_save(sigjmp_buf env,int savemask) {
- if (savemask) {
- env[0].__mask_was_saved=(sigprocmask(SIG_BLOCK,(sigset_t*)0,(sigset_t*)&env[0].__saved_mask)==0);
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/signal.c b/mdk-stage1/dietlibc/lib/signal.c
deleted file mode 100644
index 51441558e..000000000
--- a/mdk-stage1/dietlibc/lib/signal.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <signal.h>
-
-sighandler_t signal(int signum, sighandler_t action) {
- struct sigaction sa,oa;
- sa.sa_handler=action;
- sigemptyset(&sa.sa_mask);
- sigaddset(&sa.sa_mask,signum);
- sa.sa_flags=SA_NODEFER;
- if (sigaction(signum,&sa,&oa))
- return SIG_ERR;
- return oa.sa_handler;
-}
diff --git a/mdk-stage1/dietlibc/lib/sigpending.c b/mdk-stage1/dietlibc/lib/sigpending.c
deleted file mode 100644
index 62a4761c6..000000000
--- a/mdk-stage1/dietlibc/lib/sigpending.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <signal.h>
-
-int __rt_sigpending(sigset_t *set, long nr);
-
-int sigpending(sigset_t *set) {
- return __rt_sigpending(set, _NSIG/8);
-}
diff --git a/mdk-stage1/dietlibc/lib/sigprocmask.c b/mdk-stage1/dietlibc/lib/sigprocmask.c
deleted file mode 100644
index 6d770c3d3..000000000
--- a/mdk-stage1/dietlibc/lib/sigprocmask.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <signal.h>
-
-int __rt_sigprocmask(int how, const sigset_t *set, sigset_t *oldsetm, long nr);
-
-int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) {
- return __rt_sigprocmask(how, set, oldset, _NSIG/8);
-}
diff --git a/mdk-stage1/dietlibc/lib/sigqueueinfo.c b/mdk-stage1/dietlibc/lib/sigqueueinfo.c
deleted file mode 100644
index adb7349f4..000000000
--- a/mdk-stage1/dietlibc/lib/sigqueueinfo.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <signal.h>
-
-int __rt_sigqueueinfo(int pid, int sig, siginfo_t *info);
-
-int sigqueueinfo(int pid, int sig, siginfo_t *info) {
- return __rt_sigqueueinfo(pid, sig, info);
-}
diff --git a/mdk-stage1/dietlibc/lib/sigsuspend.c b/mdk-stage1/dietlibc/lib/sigsuspend.c
deleted file mode 100644
index a020789e9..000000000
--- a/mdk-stage1/dietlibc/lib/sigsuspend.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <signal.h>
-
-int __rt_sigsuspend(const sigset_t *mask, long nr);
-
-int __libc_sigsuspend(const sigset_t *mask);
-int __libc_sigsuspend(const sigset_t *mask) {
- return __rt_sigsuspend(mask, _NSIG/8);
-}
-
-int sigsuspend(const sigset_t *mask) __attribute__((weak,alias("__libc_sigsuspend")));
diff --git a/mdk-stage1/dietlibc/lib/sigtimedwait.c b/mdk-stage1/dietlibc/lib/sigtimedwait.c
deleted file mode 100644
index 864e433c3..000000000
--- a/mdk-stage1/dietlibc/lib/sigtimedwait.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <signal.h>
-
-int __rt_sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts, long nr);
-
-int sigtimedwait(const sigset_t *set, siginfo_t *info, const struct timespec *ts) {
- return __rt_sigtimedwait(set,info,ts,_NSIG/8);
-}
diff --git a/mdk-stage1/dietlibc/lib/sleep.c b/mdk-stage1/dietlibc/lib/sleep.c
deleted file mode 100644
index 45c51f1b6..000000000
--- a/mdk-stage1/dietlibc/lib/sleep.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <unistd.h>
-#include <time.h>
-
-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 141b4ec13..000000000
--- a/mdk-stage1/dietlibc/lib/snprintf.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdio.h>
-
-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 c18df5123..000000000
--- a/mdk-stage1/dietlibc/lib/socket.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_socket(int a, int b, int c);
-int __libc_socket(int a, int b, int c) {
- unsigned long args[] = { a, b, c };
- return socketcall(SYS_SOCKET, args);
-}
-
-int socket(int a,int b,int c) __attribute__((weak,alias("__libc_socket")));
diff --git a/mdk-stage1/dietlibc/lib/socketpair.c b/mdk-stage1/dietlibc/lib/socketpair.c
deleted file mode 100644
index e6f1fd822..000000000
--- a/mdk-stage1/dietlibc/lib/socketpair.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <linuxnet.h>
-
-extern int socketcall(int callno,long* args);
-
-int __libc_socketpair(int a, int type, int protocol, int sv[2]);
-int __libc_socketpair(int a, int type, int protocol, int sv[2]) {
- unsigned long args[] = { a, type, protocol, (long)sv };
- return socketcall(SYS_SOCKETPAIR, args);
-}
-
-int socketpair(int d, int type, int protocol, int sv[2])
- __attribute__((weak,alias("__libc_socketpair")));
diff --git a/mdk-stage1/dietlibc/lib/sprintf.c b/mdk-stage1/dietlibc/lib/sprintf.c
deleted file mode 100644
index 37fd831d9..000000000
--- a/mdk-stage1/dietlibc/lib/sprintf.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-int sprintf(char *dest,const char *format,...)
-{
- int n;
- va_list arg_ptr;
- va_start(arg_ptr, format);
- n=vsprintf(dest,format,arg_ptr);
- va_end (arg_ptr);
- return n;
-}
diff --git a/mdk-stage1/dietlibc/lib/sscanf.c b/mdk-stage1/dietlibc/lib/sscanf.c
deleted file mode 100644
index e608878ef..000000000
--- a/mdk-stage1/dietlibc/lib/sscanf.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-
-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 cf1592567..000000000
--- a/mdk-stage1/dietlibc/lib/strcasecmp.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <strings.h>
-
-int strcasecmp ( const char* s1, const char* s2 )
-{
- register unsigned int x2;
- register unsigned int x1;
-
- while (1) {
- x2 = *s2++ - 'A'; if (x2 < 26u) x2 += 32;
- x1 = *s1++ - 'A'; if (x1 < 26u) x1 += 32;
- if ( x2 != x1 )
- break;
- if ( x1 == (unsigned int)-'A' )
- break;
- }
-
- return x1 - x2;
-}
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 <string.h>
-
-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 3a4c9b5b4..000000000
--- a/mdk-stage1/dietlibc/lib/strchr.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "dietfeatures.h"
-#include <string.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 3892379e5..000000000
--- a/mdk-stage1/dietlibc/lib/strcmp.c
+++ /dev/null
@@ -1,18 +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);
-}
-
-int strcoll(const char *s,const char* t) __attribute__((weak,alias("strcmp")));
diff --git a/mdk-stage1/dietlibc/lib/strcpy.c b/mdk-stage1/dietlibc/lib/strcpy.c
deleted file mode 100644
index 444054e71..000000000
--- a/mdk-stage1/dietlibc/lib/strcpy.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include "dietfeatures.h"
-
-char* strcpy(register char* s,register const char* t)
-{
- char *dest=s;
-#ifndef WANT_SMALL_STRING_ROUTINES
- for (;;) {
- if (!(*s = *t)) return dest; ++s; ++t;
- if (!(*s = *t)) return dest; ++s; ++t;
- if (!(*s = *t)) return dest; ++s; ++t;
- if (!(*s = *t)) return dest; ++s; ++t;
- }
-#else
- while ((*dest++=*t++));
- return s;
-#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 <sys/types.h>
-#include <string.h>
-
-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<al);i++)
- if (*s==reject[i]) a=0;
- if (a) l++;
- s++;
- }
- return l;
-}
diff --git a/mdk-stage1/dietlibc/lib/strdup.c b/mdk-stage1/dietlibc/lib/strdup.c
deleted file mode 100644
index 6a2ea5f95..000000000
--- a/mdk-stage1/dietlibc/lib/strdup.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-
-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 7cb79d988..000000000
--- a/mdk-stage1/dietlibc/lib/strerror.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <string.h>
-
-#define _BSD_SOURCE
-#include <errno.h>
-
-extern const char __sys_err_unknown[];
-
-char*strerror(int errnum) {
- register const char*message=__sys_err_unknown;
-
- if ( (unsigned int)errnum < (unsigned int)__SYS_NERR )
- message=sys_errlist[errnum];
-#if defined(__mips__)
- if ( errnum == 1133 )
- message="Quota exceeded";
-#endif
- return (char*)message;
-}
diff --git a/mdk-stage1/dietlibc/lib/strlcat.c b/mdk-stage1/dietlibc/lib/strlcat.c
deleted file mode 100644
index fd35ec8af..000000000
--- a/mdk-stage1/dietlibc/lib/strlcat.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $ */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left). At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 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 <Todd.Miller@courtesan.com>
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
-.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\"
-.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 <string.h>
-.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 <Todd.Miller@courtesan.com>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
- * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.3 1999/04/24 01:17:37 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz. At most siz-1 characters
- * will be copied. Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t strlcpy(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 96da5a540..000000000
--- a/mdk-stage1/dietlibc/lib/strlen.c
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <endian.h>
-#include "dietfeatures.h"
-#include <string.h>
-
-#ifdef WANT_SMALL_STRING_ROUTINES
-size_t strlen(const char *s) {
- register size_t 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 543fe56ba..000000000
--- a/mdk-stage1/dietlibc/lib/strncasecmp.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <sys/types.h>
-#include <strings.h>
-
-int strncasecmp ( const char* s1, const char* s2, size_t len )
-{
- register unsigned int x2;
- register unsigned int x1;
- register const char* end = s1 + len;
-
- while (1) {
- if ( s1 >= end )
- return 0;
- x2 = *s2++ - 'A'; if (x2 < 26u) x2 += 32;
- x1 = *s1++ - 'A'; if (x1 < 26u) x1 += 32;
- if ( x2 != x1 )
- break;
- if ( x1 == (unsigned int)-'A' )
- break;
- }
-
- return x1 - x2;
-}
diff --git a/mdk-stage1/dietlibc/lib/strncat.c b/mdk-stage1/dietlibc/lib/strncat.c
deleted file mode 100644
index 9802d5678..000000000
--- a/mdk-stage1/dietlibc/lib/strncat.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "dietfeatures.h"
-#include <string.h>
-
-#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
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-char *strncat(char *s, const char *t, size_t n) {
- char *dest=s;
- register char *max;
- s+=strlen(s);
-#ifdef WANT_NON_COMPLIANT_STRNCAT
- if ((max=s+n-1)<=s) goto fini;
-#else
- if ((max=s+n)==s) goto fini;
-#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;
-fini:
- return dest;
-}
diff --git a/mdk-stage1/dietlibc/lib/strncmp.c b/mdk-stage1/dietlibc/lib/strncmp.c
deleted file mode 100644
index b3b56cfbb..000000000
--- a/mdk-stage1/dietlibc/lib/strncmp.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-int strncmp(const char *s1, const char *s2, size_t n) {
- register const char* a=s1;
- register const char* b=s2;
- register const char* fini=a+n;
- while (a<fini) {
- register int res=*a-*b;
- if (res) return res;
- if (!*a) return 0;
- ++a; ++b;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/strncpy.c b/mdk-stage1/dietlibc/lib/strncpy.c
deleted file mode 100644
index 31b682a1e..000000000
--- a/mdk-stage1/dietlibc/lib/strncpy.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#define _POSIX_SOURCE
-#define _XOPEN_SOURCE
-#include <sys/types.h>
-#include <string.h>
-#include "dietfeatures.h"
-
-/* gcc is broken and has a non-SUSv2 compliant internal prototype.
- * This causes it to warn about a type mismatch here. Ignore it. */
-char *strncpy(char *dest, const char *src, size_t n) {
-#ifdef WANT_FULL_POSIX_COMPAT
- memset(dest,0,n);
-#endif
- 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 <sys/types.h>
-#include <string.h>
-
-char *strpbrk(const char *s, const char *accept) {
- register int i,l=strlen(accept);
- for (; *s; s++)
- for (i=0; i<l; i++)
- if (*s == accept[i])
- return (char*)s;
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/lib/strrchr.c b/mdk-stage1/dietlibc/lib/strrchr.c
deleted file mode 100644
index 1abb655e2..000000000
--- a/mdk-stage1/dietlibc/lib/strrchr.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <string.h>
-#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 db76f89b5..000000000
--- a/mdk-stage1/dietlibc/lib/strsep.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <string.h>
-
-char *strsep(char **stringp, const char *delim) {
- register char *tmp=*stringp;
- register char *tmp2=tmp;
- register const char *tmp3;
- if (!*stringp) return 0;
- for (tmp2=tmp; *tmp2; ++tmp2) {
- for (tmp3=delim; *tmp3; ++tmp3)
- if (*tmp2==*tmp3) { /* delimiter found */
- *tmp2=0;
- *stringp=tmp2+1;
- return tmp;
- }
- }
- *stringp=0;
- return tmp;
-}
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 <sys/types.h>
-#include <string.h>
-
-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<al);i++)
- if (*s==accept[i]) a=1;
- if (a) l++;
- s++;
- }
- return l;
-}
diff --git a/mdk-stage1/dietlibc/lib/strstr.c b/mdk-stage1/dietlibc/lib/strstr.c
deleted file mode 100644
index 0632cc28a..000000000
--- a/mdk-stage1/dietlibc/lib/strstr.c
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-
-char *strstr(const char *haystack, const char *needle) {
- size_t nl=strlen(needle);
- size_t hl=strlen(haystack);
- int i;
- if (!nl) goto found;
- if (nl>hl) return 0;
- for (i=hl-nl+1; i; --i) {
- if (*haystack==*needle && !memcmp(haystack,needle,nl))
-found:
- 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 5d50cc535..000000000
--- a/mdk-stage1/dietlibc/lib/strtod.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-double strtod(const char* s, char** endptr) {
- register const char* p = s;
- register long double value = 0.L;
- int sign = +1;
- long double factor;
- unsigned int expo;
-
- while ( isspace(*p) )
- p++;
-
- switch (*p) {
- case '-': sign = -1;
- case '+': p++;
- default : break;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- value = value*10 + (*p++ - '0');
-
- if ( *p == '.' ) {
- factor = 1.;
-
- p++;
- while ( (unsigned int)(*p - '0') < 10u ) {
- factor *= 0.1;
- value += (*p++ - '0') * factor;
- }
- }
-
- if ( (*p | 32) == 'e' ) {
- expo = 0;
- factor = 10.L;
-
- switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
- case '-': factor = 0.1;
- case '+': p++;
- break;
- case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
- break;
- default : value = 0.L;
- p = s;
- goto done;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- expo = 10 * expo + (*p++ - '0');
-
- while ( 1 ) {
- if ( expo & 1 )
- value *= factor;
- if ( (expo >>= 1) == 0 )
- break;
- factor *= factor;
- }
- }
-
-done:
- if ( endptr != NULL )
- *endptr = (char*)p;
-
- return value * sign;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtof.c b/mdk-stage1/dietlibc/lib/strtof.c
deleted file mode 100644
index acb081e51..000000000
--- a/mdk-stage1/dietlibc/lib/strtof.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-float strtof(const char* s, char** endptr) {
- register const char* p = s;
- register float value = 0.;
- int sign = +1;
- float factor;
- unsigned int expo;
-
- while ( isspace(*p) )
- p++;
-
- switch (*p) {
- case '-': sign = -1;
- case '+': p++;
- default : break;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- value = value*10 + (*p++ - '0');
-
- if ( *p == '.' ) {
- factor = 1.;
-
- p++;
- while ( (unsigned int)(*p - '0') < 10u ) {
- factor *= 0.1;
- value += (*p++ - '0') * factor;
- }
- }
-
- if ( (*p | 32) == 'e' ) {
- expo = 0;
- factor = 10.L;
-
- switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
- case '-': factor = 0.1;
- case '+': p++;
- break;
- case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
- break;
- default : value = 0.L;
- p = s;
- goto done;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- expo = 10 * expo + (*p++ - '0');
-
- while ( 1 ) {
- if ( expo & 1 )
- value *= factor;
- if ( (expo >>= 1) == 0 )
- break;
- factor *= factor;
- }
- }
-
-done:
- if ( endptr != NULL )
- *endptr = (char*)p;
-
- return value * sign;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtok.c b/mdk-stage1/dietlibc/lib/strtok.c
deleted file mode 100644
index e041703e3..000000000
--- a/mdk-stage1/dietlibc/lib/strtok.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <string.h>
-
-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 <string.h>
-
-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 2624aca0e..000000000
--- a/mdk-stage1/dietlibc/lib/strtol.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include <ctype.h>
-#include "dietfeatures.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#define ABS_LONG_MIN 2147483648UL
-long int strtol(const char *nptr, char **endptr, int base)
-{
- int neg=0;
- unsigned long int v;
-
- while(isspace(*nptr)) nptr++;
-
- if (*nptr == '-') { neg=-1; ++nptr; }
- v=strtoul(nptr,endptr,base);
- if (v>=ABS_LONG_MIN) {
- if (v==ABS_LONG_MIN && neg) {
- errno=0;
- return v;
- }
- errno=ERANGE;
- return (neg?LONG_MIN:LONG_MAX);
- }
- return (neg?-v:v);
-}
diff --git a/mdk-stage1/dietlibc/lib/strtold.c b/mdk-stage1/dietlibc/lib/strtold.c
deleted file mode 100644
index ae5f0fa48..000000000
--- a/mdk-stage1/dietlibc/lib/strtold.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-long double strtold(const char* s, char** endptr) {
- register const char* p = s;
- register long double value = 0.L;
- int sign = +1;
- long double factor;
- unsigned int expo;
-
- while ( isspace(*p) )
- p++;
-
- switch (*p) {
- case '-': sign = -1;
- case '+': p++;
- default : break;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- value = value*10 + (*p++ - '0');
-
- if ( *p == '.' ) {
- factor = 1.;
-
- p++;
- while ( (unsigned int)(*p - '0') < 10u ) {
- factor *= 0.1;
- value += (*p++ - '0') * factor;
- }
- }
-
- if ( (*p | 32) == 'e' ) {
- expo = 0;
- factor = 10.L;
-
- switch (*++p) { // ja hier weiß ich nicht, was mindestens nach einem 'E' folgenden MUSS.
- case '-': factor = 0.1;
- case '+': p++;
- break;
- case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
- break;
- default : value = 0.L;
- p = s;
- goto done;
- }
-
- while ( (unsigned int)(*p - '0') < 10u )
- expo = 10 * expo + (*p++ - '0');
-
- while ( 1 ) {
- if ( expo & 1 )
- value *= factor;
- if ( (expo >>= 1) == 0 )
- break;
- factor *= factor;
- }
- }
-
-done:
- if ( endptr != NULL )
- *endptr = (char*)p;
-
- return value * sign;
-}
diff --git a/mdk-stage1/dietlibc/lib/strtoll.c b/mdk-stage1/dietlibc/lib/strtoll.c
deleted file mode 100644
index 9e05e740e..000000000
--- a/mdk-stage1/dietlibc/lib/strtoll.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <ctype.h>
-#include <stdlib.h>
-
-long 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 e9c09fb59..000000000
--- a/mdk-stage1/dietlibc/lib/strtoul.c
+++ /dev/null
@@ -1,44 +0,0 @@
-#include <ctype.h>
-#include "dietfeatures.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-
-unsigned long int strtoul(const char *nptr, char **endptr, int base)
-{
- int neg = 0;
- unsigned long int v=0;
-
- while(isspace(*nptr)) ++nptr;
- if (*nptr == '-') { neg=1; nptr++; }
- if (*nptr == '+') ++nptr;
- if (base==16 && nptr[0]=='0') goto skip0x;
- if (!base) {
- if (*nptr=='0') {
- base=8;
-skip0x:
- 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<='9'?c-'0':0xff);
- if (c>=base) break;
- {
- register unsigned long int w=v*base;
- if (w<v) {
- errno=ERANGE;
- return ULONG_MAX;
- }
- v=w+c;
- }
- ++nptr;
- }
- if (endptr) *endptr=(char *)nptr;
- errno=0; /* in case v==ULONG_MAX, ugh! */
- return (neg?-v:v);
-}
diff --git a/mdk-stage1/dietlibc/lib/strtoull.c b/mdk-stage1/dietlibc/lib/strtoull.c
deleted file mode 100644
index d6073e32a..000000000
--- a/mdk-stage1/dietlibc/lib/strtoull.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <ctype.h>
-#include <stdlib.h>
-
-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/strxfrm.c b/mdk-stage1/dietlibc/lib/strxfrm.c
deleted file mode 100644
index 5075ff0b5..000000000
--- a/mdk-stage1/dietlibc/lib/strxfrm.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-#include "dietfeatures.h"
-
-size_t strxfrm(char *dest, const char *src, size_t n) {
-#ifdef WANT_FULL_POSIX_COMPAT
- memset(dest,0,n);
-#endif
- memccpy(dest,src,0,n);
- return strlen(dest);
-}
-
diff --git a/mdk-stage1/dietlibc/lib/sys_siglist.c b/mdk-stage1/dietlibc/lib/sys_siglist.c
deleted file mode 100644
index a753848d9..000000000
--- a/mdk-stage1/dietlibc/lib/sys_siglist.c
+++ /dev/null
@@ -1,174 +0,0 @@
-const char *const sys_siglist[] = {
- "Signal 0",
- "Hangup",
- "Interrupt",
- "Quit",
- "Illegal instruction",
- "Trace/breakpoint trap",
- "ABRT/IOT trap",
-#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
- "EMT trap",
-#else
- "Bus error",
-#endif
- "Floating point exception",
- "Killed",
-#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
- "Bus error",
-#else
- "User defined signal 1",
-#endif
- "Segmentation fault",
-#if defined(__alpha__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
- "Bad system call",
-#else
- "User defined signal 2",
-#endif
- "Broken pipe",
- "Alarm clock",
- "Terminated",
-#if defined(__hppa__)
- "User defined signal 1",
- "User defined signal 2",
- "Child exited",
- "Power lost",
- "Virtual timer expired",
- "Profiling timer expired",
- "I/O possible",
- "Window changed",
- "Stopped (signal)",
- "Stopped",
- "Continued",
- "Stopped (tty input)",
- "Stopped (tty output)",
- "Urgent I/O condition",
- "Power lost",
- "Unknown",
- "Unknown",
- "CPU time limit exceeded",
- "File size limit exceeded",
- "Unknown",
- "Stack fault",
-#elif defined(__mips__)
- "User defined signal 1",
- "User defined signal 2",
- "Child exited",
- "Power lost",
- "Window changed",
- "Urgent I/O condition",
- "I/O possible",
- "Stopped (signal)",
- "Stopped",
- "Continued",
- "Stopped (tty input)",
- "Stopped (tty output)",
- "Virtual timer expired",
- "Profiling timer expired",
- "CPU time limit exceeded",
- "File size limit exceeded",
-#elif defined(__alpha__) || defined(__sparc__)
- "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",
- "Power/Resource lost",
- "User defined signal 1",
- "User defined signal 2",
-#else
- "Stack fault",
- "Child exited",
- "Continued",
- "Stopped (signal)",
- "Stopped",
- "Stopped (tty input)",
- "Stopped (tty output)",
- "Urgent I/O condition",
- "CPU time limit exceeded",
- "File size limit exceeded",
- "Virtual timer expired",
- "Profiling timer expired",
- "Window changed",
- "I/O possible",
- "Power lost",
- "Bad system call",
-#endif
-#ifndef __hppa__
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
-#endif
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
-#ifdef __mips__
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
- "Real time signal",
-#endif
- 0
-};
-
diff --git a/mdk-stage1/dietlibc/lib/tcdrain.c b/mdk-stage1/dietlibc/lib/tcdrain.c
deleted file mode 100644
index bb2018fb4..000000000
--- a/mdk-stage1/dietlibc/lib/tcdrain.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/ioctl.h>
-
-int __libc_tcdrain(int fd);
-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/tcflow.c b/mdk-stage1/dietlibc/lib/tcflow.c
deleted file mode 100644
index ea460f362..000000000
--- a/mdk-stage1/dietlibc/lib/tcflow.c
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "dietfeatures.h"
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcflow ( int fd, int action )
-{
-#if TCOOFF==0 && TCOON==1 && TCIOFF==2 && TCION==3
-
- if ( (unsigned int)action < 4u )
- return ioctl ( fd, TCXONC, action );
-
- errno = EINVAL;
- return -1;
-
-#else
-
- int arg = 0;
-
- switch (action) {
- case TCION:
- arg++;
- case TCIOFF:
- arg++;
- case TCOON:
- arg++;
- case TCOOFF:
- return ioctl ( fd, TCXONC, arg );
- default:
- errno = EINVAL;
- return -1;
- }
-
-#endif
-}
diff --git a/mdk-stage1/dietlibc/lib/tcflush.c b/mdk-stage1/dietlibc/lib/tcflush.c
deleted file mode 100644
index 2e5447728..000000000
--- a/mdk-stage1/dietlibc/lib/tcflush.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <sys/ioctl.h>
-
-int __libc_tcflush(int fd, int queue_selector);
-int __libc_tcflush(int fd, int queue_selector)
-{
- return ioctl(fd, TCFLSH, queue_selector);
-}
-
-int tcflush(int fd) __attribute__((weak,alias("__libc_tcflush")));
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 <termios.h>
-#include <sys/ioctl.h>
-
-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 8d5d4614a..000000000
--- a/mdk-stage1/dietlibc/lib/tcgetpgrp.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-int tcgetpgrp(int fildes)
-{
- int foo;
- if (ioctl(fildes, TIOCGPGRP, &foo)==-1)
- return -1;
- else
- return foo;
-}
diff --git a/mdk-stage1/dietlibc/lib/tcsendbreak.c b/mdk-stage1/dietlibc/lib/tcsendbreak.c
deleted file mode 100644
index b026340cf..000000000
--- a/mdk-stage1/dietlibc/lib/tcsendbreak.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "dietfeatures.h"
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcsendbreak (int fd,int duration)
-{
- if (duration <= 0) return (ioctl (fd,TCSBRKP,0));
- errno = EINVAL;
- return (-1);
-}
diff --git a/mdk-stage1/dietlibc/lib/tcsetattr.c b/mdk-stage1/dietlibc/lib/tcsetattr.c
deleted file mode 100644
index 03fe8adee..000000000
--- a/mdk-stage1/dietlibc/lib/tcsetattr.c
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <errno.h>
-#include "dietfeatures.h"
-
-#if !defined(__powerpc__) && !defined(__sparc__) && !defined(__alpha__) && !defined(__hppa__)
-#if TCSANOW==0 && TCSADRAIN==1 && TCSAFLUSH==2 && TCSETSW-TCSETS==1 && TCSETSF-TCSETS==2
-#define shortcut
-#endif
-#endif
-
-int tcsetattr ( int fildes, int optional_actions, struct termios* termios_p )
-{
-#ifdef shortcut
-
- if ( (unsigned int)optional_actions < 3u )
- return ioctl ( fildes, TCSETS+optional_actions, termios_p );
-
- errno = EINVAL;
- return -1;
-
-#else
-
- 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;
- }
-
-#endif
-}
diff --git a/mdk-stage1/dietlibc/lib/tcsetpgrp.c b/mdk-stage1/dietlibc/lib/tcsetpgrp.c
deleted file mode 100644
index 8cf3165c2..000000000
--- a/mdk-stage1/dietlibc/lib/tcsetpgrp.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <termios.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-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 <unistd.h>
-#include <dirent.h>
-
-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 c24932ef4..000000000
--- a/mdk-stage1/dietlibc/lib/tolower.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-int tolower(int ch) {
- if ( (unsigned int)(ch - 'A') < 26u )
- ch += 'a' - 'A';
- return ch;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/toupper.c b/mdk-stage1/dietlibc/lib/toupper.c
deleted file mode 100644
index f7d415e95..000000000
--- a/mdk-stage1/dietlibc/lib/toupper.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <ctype.h>
-
-inline int toupper(int ch) {
- if ( (unsigned int)(ch - 'a') < 26u )
- ch += 'A' - 'a';
- return ch;
-}
-
diff --git a/mdk-stage1/dietlibc/lib/ttyname.c b/mdk-stage1/dietlibc/lib/ttyname.c
deleted file mode 100644
index 2bbc7f2a9..000000000
--- a/mdk-stage1/dietlibc/lib/ttyname.c
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "dietfeatures.h"
-#include <unistd.h>
-#include <sys/stat.h>
-#include <string.h>
-
-#ifdef __linux__
-
-#include <stdlib.h>
-
-char *ttyname(int fd) {
-#ifdef SLASH_PROC_OK
- char ibuf[20];
- static char obuf[20];
- int len;
- if (!isatty(fd)) return 0;
- strcpy(ibuf,"/proc/self/fd/");
- ibuf[__ltostr(ibuf+14,6,(unsigned long)fd,10,0)+14]=0;
- if ((len=readlink(ibuf,obuf,sizeof(obuf)-1))<0) return 0;
- obuf[len]=0;
- return obuf;
-#else
- static char buf[20];
- struct stat s;
- char *c=buf+8;
- int n;
- if (!isatty(fd)) return 0;
- if (fstat(fd,&s)) return 0;
- strcpy(buf,"/dev/tty");
- if (S_ISCHR(s.st_mode)) {
- n=minor(s.st_rdev);
- switch (major(s.st_rdev)) {
- case 4:
- if (n>63) {
- n-=64;
- *c='S';
- ++c;
- }
-num:
- c[__ltostr(c,6,n,10,0)]=0;
- break;
- case 2:
- buf[8]='p'-(n>>4);
- buf[9]=n%4+'0';
- if (buf[9]>'9') *c+='a'-'0';
- buf[10]=0;
- goto duh;
- case 136:
- case 137:
- case 138:
- case 139:
- buf[7]='s';
-duh:
- buf[5]='p';
- 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 8f07416a8..000000000
--- a/mdk-stage1/dietlibc/lib/usleep.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <time.h>
-#include <unistd.h>
-
-/* nano * 1000 == usecs
- * usecs * 1000 == msecs
- * msecs * 1000 = secs */
-int usleep(unsigned long usecs) {
- struct timespec t;
- t.tv_sec=usecs/1000000;
- t.tv_nsec=(usecs%1000000)*1000;
- return nanosleep(&t,&t);
-}
diff --git a/mdk-stage1/dietlibc/lib/vfork.c b/mdk-stage1/dietlibc/lib/vfork.c
deleted file mode 100644
index d54416d5d..000000000
--- a/mdk-stage1/dietlibc/lib/vfork.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <unistd.h>
-
-pid_t vfork() { return fork(); }
-
diff --git a/mdk-stage1/dietlibc/lib/vsnprintf.c b/mdk-stage1/dietlibc/lib/vsnprintf.c
deleted file mode 100644
index dd06d6483..000000000
--- a/mdk-stage1/dietlibc/lib/vsnprintf.c
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
-#include "dietstdio.h"
-
-struct str_data {
- unsigned char* str;
- size_t len;
- size_t size;
-};
-
-static int swrite(void*ptr, size_t nmemb, struct str_data* sd) {
- size_t tmp=sd->size-sd->len;
- if (tmp>0) {
- size_t len=nmemb;
- if (len>tmp) len=tmp;
- if (sd->str) {
- memcpy(sd->str+sd->len,ptr,len);
- sd->str[sd->len+len]=0;
- }
- sd->len+=len;
- }
- return nmemb;
-}
-
-int vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr) {
- struct str_data sd = { str, 0, size };
- struct arg_printf ap = { &sd, (int(*)(void*,size_t,void*)) swrite };
- if (size) --sd.size;
- return __v_printf(&ap,format,arg_ptr);
-}
diff --git a/mdk-stage1/dietlibc/lib/vsprintf.c b/mdk-stage1/dietlibc/lib/vsprintf.c
deleted file mode 100644
index 6cd5a40b1..000000000
--- a/mdk-stage1/dietlibc/lib/vsprintf.c
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include "dietwarning.h"
-
-int vsprintf(char *dest,const char *format, va_list arg_ptr)
-{
- return vsnprintf(dest,(size_t)-1,format,arg_ptr);
-}
-
-link_warning("vsprintf","warning: Avoid *sprintf; use *snprintf. It is more secure.")
diff --git a/mdk-stage1/dietlibc/lib/vsscanf.c b/mdk-stage1/dietlibc/lib/vsscanf.c
deleted file mode 100644
index 329cfd02a..000000000
--- a/mdk-stage1/dietlibc/lib/vsscanf.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include "dietstdio.h"
-#include <unistd.h>
-
-struct str_data {
- unsigned char* str;
-};
-
-static int sgetc(struct str_data* sd) {
- register unsigned int ret = *(sd->str++);
- return (ret)?(int)ret:-1;
-}
-
-static int sputc(int c, struct str_data* sd) {
- return (*(--sd->str)==c)?c:-1;
-}
-
-int vsscanf(const char* str, const char* format, va_list arg_ptr)
-{
- struct str_data fdat = { (unsigned char*)str };
- struct arg_scanf farg = { (void*)&fdat, (int(*)(void*))sgetc, (int(*)(int,void*))sputc };
- return __v_scanf(&farg,format,arg_ptr);
-}
diff --git a/mdk-stage1/dietlibc/lib/wait.c b/mdk-stage1/dietlibc/lib/wait.c
deleted file mode 100644
index 8459af18c..000000000
--- a/mdk-stage1/dietlibc/lib/wait.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <sys/types.h>
-#include <sys/wait.h>
-
-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 <sys/wait.h>
-
-int wait3(int* status,int opts,struct rusage* rusage) {
- return wait4(-1,status,opts,rusage);
-}
diff --git a/mdk-stage1/dietlibc/lib/write12.c b/mdk-stage1/dietlibc/lib/write12.c
deleted file mode 100644
index 8e0130bfb..000000000
--- a/mdk-stage1/dietlibc/lib/write12.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <unistd.h>
-#include <string.h>
-#include <write12.h>
-
-int __write1 (const char* s) {
- return write(1, s, strlen(s));
-}
-
-int __write2 (const char* s) {
- return write(2, s, strlen(s));
-}