summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/libcruft
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1/dietlibc/libcruft')
-rw-r--r--mdk-stage1/dietlibc/libcruft/___div.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft.c115
-rw-r--r--mdk-stage1/dietlibc/libcruft/dnscruft2.c185
-rw-r--r--mdk-stage1/dietlibc/libcruft/entlib.c153
-rw-r--r--mdk-stage1/dietlibc/libcruft/entlib.h44
-rw-r--r--mdk-stage1/dietlibc/libcruft/getdtablesize.c6
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrgid.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getgrnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr.c38
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c51
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname.c39
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname2.c40
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c36
-rw-r--r--mdk-stage1/dietlibc/libcruft/gethostbyname_r.c30
-rw-r--r--mdk-stage1/dietlibc/libcruft/getlogin.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpagesize.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpass.c40
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getpwuid.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/getspnam.c14
-rw-r--r--mdk-stage1/dietlibc/libcruft/grent.c54
-rw-r--r--mdk-stage1/dietlibc/libcruft/h_errno.c1
-rw-r--r--mdk-stage1/dietlibc/libcruft/herrno_location.c5
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_addr.c11
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_aton.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntoa.c10
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c22
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_ntop.c75
-rw-r--r--mdk-stage1/dietlibc/libcruft/inet_pton.c97
-rw-r--r--mdk-stage1/dietlibc/libcruft/initgroups.c23
-rw-r--r--mdk-stage1/dietlibc/libcruft/mkstemp.c23
-rw-r--r--mdk-stage1/dietlibc/libcruft/pwent.c43
-rw-r--r--mdk-stage1/dietlibc/libcruft/res_init.c7
-rw-r--r--mdk-stage1/dietlibc/libcruft/spent.c45
34 files changed, 0 insertions, 1336 deletions
diff --git a/mdk-stage1/dietlibc/libcruft/___div.c b/mdk-stage1/dietlibc/libcruft/___div.c
deleted file mode 100644
index d359dc47b..000000000
--- a/mdk-stage1/dietlibc/libcruft/___div.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "dietwarning.h"
-#include <stdlib.h>
-
-div_t div(int numer, int denom) {
- div_t temp;
- temp.quot=numer/denom;
- temp.rem=numer%denom;
- return temp;
-}
-
-link_warning("div","warning: your code uses div(), which is completely superfluous!");
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft.c b/mdk-stage1/dietlibc/libcruft/dnscruft.c
deleted file mode 100644
index d7a0efa50..000000000
--- a/mdk-stage1/dietlibc/libcruft/dnscruft.c
+++ /dev/null
@@ -1,115 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <arpa/inet.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-
-int __dns_fd=-1;
-
-void __dns_make_fd() {
- int tmp;
- struct sockaddr_in si;
- if (__dns_fd>0) return;
- tmp=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP);
- if (tmp<0) {
- perror("__dns_make_fd!socket");
- return;
- }
- si.sin_family=AF_INET;
- si.sin_port=0;
- si.sin_addr.s_addr=INADDR_ANY;
- if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) {
- perror("__dns_make_fd!bind");
- return;
- }
- __dns_fd=tmp;
-}
-
-int __dns_servers=0;
-struct sockaddr __dns_server_ips[8];
-
-int __dns_search=0;
-char *__dns_domains[8];
-
-void __dns_readstartfiles() {
- int fd;
- char *buf=alloca(4096);
- int len;
- if (__dns_servers>0) return;
- {
- struct sockaddr_in to;
- char *cacheip=getenv("DNSCACHEIP");
- if (cacheip) {
- to.sin_port=htons(53);
- to.sin_family=AF_INET;
- if (inet_aton(cacheip,&to.sin_addr)) {
- memmove(__dns_server_ips,&to,sizeof(struct sockaddr));
- ++__dns_servers;
- }
- }
- }
- if ((fd=open("/etc/resolv.conf",O_RDONLY))<0) return;
- len=read(fd,buf,4096);
- close(fd);
- {
- char *last=buf+len;
- for (; buf<last;) {
- if (!strncmp(buf,"nameserver",10)) {
- buf+=10;
- while (buf<last && *buf!='\n') {
- while (buf<last && isblank(*buf)) ++buf;
- {
- char *tmp=buf;
- struct sockaddr_in i;
- while (buf<last && !isspace(*buf)) ++buf;
- if (buf>=last) break;
- *buf=0;
- if (inet_aton(tmp,&i.sin_addr)) {
- i.sin_family=AF_INET;
- i.sin_port=htons(53);
- memmove(&__dns_server_ips[__dns_servers],&i,sizeof(struct sockaddr));
- if (__dns_servers<8) ++__dns_servers;
- }
- }
- }
- }
- if (!strncmp(buf,"search",6) || !strncmp(buf,"domain",6)) {
- buf+=6;
- }
- while (buf<last && *buf!='\n') ++buf;
- while (buf<last && *buf=='\n') ++buf;
- }
- }
-}
-
-/* return length of decoded data or -1 */
-int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen) {
- unsigned char *tmp;
- unsigned char *max=dest+maxlen;
- unsigned char *after=packet+offset;
- int ok=0;
- for (tmp=after; maxlen>0&&*tmp; ) {
- if ((*tmp>>6)==3) { /* goofy DNS decompression */
- unsigned int ofs=((unsigned int)(*tmp&0x3f)<<8)|*(tmp+1);
- if (ofs>=offset) return -1; /* RFC1035: "pointer to a _prior_ occurrance" */
- if (after<tmp+2) after=tmp+2;
- tmp=packet+ofs;
- ok=0;
- } else {
- unsigned int duh;
- if (dest+*tmp+1>max) return -1;
- for (duh=*tmp; duh>0; --duh)
- *dest++=*++tmp;
- *dest++='.'; ok=1;
- ++tmp;
- if (tmp>after) { after=tmp; if (!*tmp) ++after; }
- }
- }
- if (ok) --dest;
- *dest=0;
- return after-packet;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft2.c b/mdk-stage1/dietlibc/libcruft/dnscruft2.c
deleted file mode 100644
index b59207072..000000000
--- a/mdk-stage1/dietlibc/libcruft/dnscruft2.c
+++ /dev/null
@@ -1,185 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int h_errno;
-
-static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000";
-
-extern void __dns_make_fd();
-extern int __dns_fd;
-
-extern int __dns_servers;
-extern struct sockaddr __dns_server_ips[];
-
-extern void __dns_readstartfiles();
-
-extern int __dns_decodename(unsigned char *packet,int offset,unsigned char *dest,int maxlen);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor) {
- int names,ips;
- unsigned char *cur;
- unsigned char *max;
- unsigned char packet[512];
- __dns_make_fd();
-
- if (lookfor==1) {
- result->h_aliases=(char**)(buf+8*4);
- result->h_addrtype=AF_INET;
- result->h_length=4;
- result->h_addr_list=(char**)buf;
- } else {
- result->h_aliases=(char**)(buf+8*16);
- result->h_addrtype=AF_INET6;
- result->h_length=16;
- result->h_addr_list=(char**)buf;
- }
- result->h_aliases[0]=0;
-
- cur=buf+16*sizeof(char*);
- max=buf+buflen;
- names=ips=0;
-
- memmove(packet,dnspacket,12);
- *(unsigned short*)packet=rand();
- {
- unsigned char* x;
- const char* y,* tmp;
- x=packet+12; y=name;
- while (*y) {
- while (*y=='.') ++y;
- for (tmp=y; *tmp && *tmp!='.'; ++tmp) ;
- *x=tmp-y;
- if (!(tmp-y)) break;
- ++x;
- if (x>=packet+510-(tmp-y)) { *h_errnop=ERANGE; return 1; }
- memmove(x,y,tmp-y);
- x+=tmp-y;
- if (!*tmp) {
- *x=0;
- break;
- }
- y=tmp;
- }
- *++x= 0; *++x= lookfor; /* A */
- *++x= 0; *++x= 1; /* IN */
- ++x;
- {
- int i; /* current server */
- int j; /* timeout count down */
- struct pollfd duh;
- i=0; j=30;
- __dns_readstartfiles();
- duh.fd=__dns_fd;
- duh.events=POLLIN;
- for (j=30; j>0; --j) {
- sendto(__dns_fd,packet,x-packet,0,(struct sockaddr*)&(__dns_server_ips[i]),sizeof(struct sockaddr));
- if (++i > __dns_servers) i=0;
- if (poll(&duh,1,1) == 1) {
- /* read and parse answer */
- unsigned char inpkg[1500];
- /*int len=*/ read(__dns_fd,inpkg,1500);
-#if 0
- {
- int tft=open("duh",0);
- read(tft,inpkg,1500);
- close(tft);
- }
-#endif
- /* header, question, answer, authority, additional */
- if (inpkg[0]!=packet[0] || inpkg[1]!=packet[1]) continue; /* wrong ID */
- if ((inpkg[2]&0xf9) != 0x81) continue; /* not answer */
- if ((inpkg[3]&0x0f) != 0) break; /* error */
- tmp=inpkg+12;
- {
- char name[257];
- unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5];
- while (q>0) {
- while (*tmp) tmp+=*tmp+1;
- tmp+=5;
- --q;
- }
- q=((unsigned short)inpkg[6]<<8)+inpkg[7];
- if (q<1) break;
- while (q>0) {
- int decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- --q;
- if (tmp[0]!=0 || tmp[1]!=lookfor || /* TYPE != A */
- tmp[2]!=0 || tmp[3]!=1) { /* CLASS != IN */
- if (tmp[1]==5) { /* CNAME */
- tmp+=10;
- decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- } else
- break;
- continue;
- }
- tmp+=10; /* skip type, class, TTL and length */
- {
- int slen;
- if (lookfor==1 || lookfor==28) /* A or AAAA*/ {
- slen=strlen(name);
- if (cur+slen+8+(lookfor==28?12:0)>=max) { *h_errnop=NO_RECOVERY; return 1; }
- } else if (lookfor==12) /* PTR */ {
- decofs=__dns_decodename(inpkg,tmp-(char*)inpkg,name,256);
- if (decofs<0) break;
- tmp=inpkg+decofs;
- slen=strlen(name);
- } else
- slen=strlen(name);
- strcpy(cur,name);
- if (names==0)
- result->h_name=cur;
- else
- result->h_aliases[names-1]=cur;
- result->h_aliases[names]=0;
- ++names;
-/* cur+=slen+1; */
- cur+=(slen|3)+1;
- result->h_addr_list[ips++] = cur;
- if (lookfor==1) /* A */ {
- *(int*)cur=*(int*)tmp;
- cur+=4;
- result->h_addr_list[ips]=0;
- } else if (lookfor==28) /* AAAA */ {
- {
- int i;
- for (i=0; i<16; ++i) cur[i]=tmp[i];
- }
- cur+=16;
- result->h_addr_list[ips]=0;
- }
- }
-/* puts(name); */
- }
- }
-/* printf("%d answers\n",((unsigned short)inpkg[6]<<8)+inpkg[7]);
- printf("ok\n");*/
- *h_errnop=0;
- *RESULT=result;
- return 0;
- }
-/*kaputt:*/
- }
- }
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/entlib.c b/mdk-stage1/dietlibc/libcruft/entlib.c
deleted file mode 100644
index f88b3f057..000000000
--- a/mdk-stage1/dietlibc/libcruft/entlib.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * dietlibc/lib/entlib.c - Generic delimited-line parsing library
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-
-/*
- * __ent_start
- *
- * Allocates and zeroes the module's state structure,
- * and open a handle to /etc/passwd.
- *
- * Returns -1 on failure and sets errno, or zero for success.
- */
-
-int __ent_start(const char *pathname, struct __ent_state **st_ref)
-{
- struct __ent_state *st;
-
- if (*st_ref)
- return 0;
-
- st = calloc(1, sizeof(*st));
- if (!st) {
- errno = ENOMEM;
- return -1;
- }
-
- st->fd = open(pathname, O_RDONLY);
- if (st->fd == -1) {
- /* errno should have been set by open(2) */
- free(st);
- st = NULL;
- return -1;
- }
-
- *st_ref = st;
- return 0;
-}
-
-
-/*
- * __ent_get_line
- *
- * Eliminates a previous line from the buffer, if any.
- * Then reads in a new line from /etc/passwd, if necessary.
- *
- * Returns -1 on failure, or zero for success.
- */
-
-int __ent_get_line(struct __ent_state *st)
-{
- int rc;
-
- /* overwrite previous line, by shifting the rest
- * of the rest to the front of the buffer
- */
- if (st->bufptr) {
- unsigned int slop = st->buflen - st->bufptr;
- memmove(st->ent_buf, &st->ent_buf[st->bufptr], slop);
- st->bufptr = 0;
- st->buflen = slop;
- st->ent_buf[st->buflen] = 0; /* null terminate */
- }
-
- if (st->buflen == __ENT_BUFSIZ || strchr(st->ent_buf, '\n'))
- return 0;
-
- rc = read(st->fd, &st->ent_buf[st->buflen], __ENT_BUFSIZ - st->buflen);
- if (rc < 0)
- return -1;
-
- st->buflen += rc;
- if (st->buflen == 0)
- return -1;
-
- return 0;
-}
-
-
-/*
- * __ent_split
- *
- * Splits a string into parts based on a delimiter.
- * Stops processing when \n is reached also.
- *
- * Returns -1 on failure, or zero on success.
- */
-
-int __ent_split(struct __ent_state *st, char **parts,
- int n_parts, int delimiter, int require_exact)
-{
- char *s = &st->ent_buf[st->bufptr];
- int idx = 0;
-
- /* empty list */
- if (!*s) {
- if (!require_exact)
- return 0;
- return -1;
- }
-
- /* scan through string, sticking string pointers
- * into parts[] as delimiters are found
- */
- parts[idx++] = s;
- while (*s) {
- st->bufptr++;
- if (*s == '\n') {
- *s = 0; /* null terminate */
- break;
- }
- if (*s == delimiter) {
- *s = 0; /* null terminate */
- /* boundary error: too many delimiters */
- if (idx == n_parts)
- return -1;
- s++;
- parts[idx++] = s;
- } else {
- s++;
- }
- }
-
- if (!require_exact)
- return 0;
- return (n_parts == idx) ? 0 : -1;
-}
-
-
-void __ent_set(struct __ent_state *st)
-{
- if (!st)
- return;
- st->buflen = st->bufptr = 0;
- lseek(st->fd, 0, SEEK_SET);
-}
-
-
-void __ent_end(struct __ent_state *st)
-{
- if (!st)
- return;
- close(st->fd);
- free(st);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/entlib.h b/mdk-stage1/dietlibc/libcruft/entlib.h
deleted file mode 100644
index 2659d542e..000000000
--- a/mdk-stage1/dietlibc/libcruft/entlib.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * dietlibc/lib/entlib.h - Generic delimited-line parsing library header
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-#ifndef __ENTLIB_H
-#define __ENTLIB_H
-
-#include <sys/types.h> /* for open(2), lseek(2) */
-#include <sys/stat.h> /* for open(2) */
-#include <fcntl.h> /* for open(2) */
-#include <unistd.h> /* for close(2), lseek(2) */
-#include <stdlib.h> /* for calloc(3), free(3) */
-#include <errno.h> /* for errno */
-#include <string.h> /* for memmove(3) */
-#include <stdlib.h> /* for atoi(3) */
-#include <paths.h> /* for the file locations */
-
-#include <pwd.h> /* for struct passwd */
-#include <grp.h> /* for struct group */
-#include <shadow.h> /* for struct spwd */
-
-/* should be a multiple of 64 to create decent alignment */
-#define __ENT_BUFSIZ (64 * 2)
-#define __ENT_RAW_BUFSIZ (__ENT_BUFSIZ + 2) /* some overlap required */
-
-struct __ent_state {
- char ent_buf[__ENT_RAW_BUFSIZ]; /* raw file data buffer */
- unsigned int buflen; /* amount of valid data in ent_buf */
- unsigned int bufptr; /* next valid position in ent_buf */
- int fd; /* /etc/passwd file descriptor */
-};
-
-extern int __ent_start(const char *pathname, struct __ent_state **st_ref);
-extern int __ent_get_line(struct __ent_state *st);
-extern int __ent_split(struct __ent_state *st, char **parts, int n_parts, int delimiter, int require_exact);
-extern void __ent_set(struct __ent_state *st);
-extern void __ent_end(struct __ent_state *st);
-
-#endif /* __ENTLIB_H */
diff --git a/mdk-stage1/dietlibc/libcruft/getdtablesize.c b/mdk-stage1/dietlibc/libcruft/getdtablesize.c
deleted file mode 100644
index 227354714..000000000
--- a/mdk-stage1/dietlibc/libcruft/getdtablesize.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <unistd.h>
-#include <limits.h>
-
-int getdtablesize(void) {
- return OPEN_MAX;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid.c b/mdk-stage1/dietlibc/libcruft/getgrgid.c
deleted file mode 100644
index 0c223056c..000000000
--- a/mdk-stage1/dietlibc/libcruft/getgrgid.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct group *getgrgid(gid_t gid) {
- struct group *tmp;
- setgrent();
- for (;;) {
- tmp=getgrent();
- if (!tmp) return 0;
- if (tmp->gr_gid == gid)
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam.c b/mdk-stage1/dietlibc/libcruft/getgrnam.c
deleted file mode 100644
index 1bdbb42a8..000000000
--- a/mdk-stage1/dietlibc/libcruft/getgrnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct group *getgrnam(const char* name) {
- struct group *tmp;
- setgrent();
- for (;;) {
- tmp=getgrent();
- if (!tmp) return 0;
- if (!strcmp(tmp->gr_name,name))
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
deleted file mode 100644
index a4207d44d..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type) {
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyaddr_r (addr, len, type, &hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
deleted file mode 100644
index 37174ab13..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-static int i2a(char* dest,unsigned int x) {
- register unsigned int tmp=x;
- register int len=0;
- if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; }
- if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; }
- *dest++=tmp+'0';
- return len+1;
-}
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyaddr_r(const char* addr, size_t length, int format,
- struct hostent* result, char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- if (format==AF_INET) {
- char tmpbuf[50];
- char *tmp;
- int res;
- tmp=tmpbuf+i2a(tmpbuf,(unsigned char)addr[3]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[2]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[1]); *tmp++='.';
- tmp+=i2a(tmp,(unsigned char)addr[0]); strcpy(tmp,".in-addr.arpa");
- res= __dns_gethostbyx_r(tmpbuf,result,buf+4,buflen-4,RESULT,h_errnop,12); /* 12 == ns_t_ptr */
- if (res==0) {
- result->h_addr_list[0]=buf;
- result->h_addr_list[1]=buf;
- *(int*)buf=*(int*)addr;
- }
- return res;
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname.c b/mdk-stage1/dietlibc/libcruft/gethostbyname.c
deleted file mode 100644
index 5db5bf3c5..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyname (const char *host)
-{
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyname_r (host, &hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
deleted file mode 100644
index 3d8296616..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c
+++ /dev/null
@@ -1,40 +0,0 @@
-
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-extern int h_errno;
-
-struct hostent* gethostbyname2(const char *host,int AF)
-{
- static struct hostent hostbuf;
- struct hostent *hp;
- size_t hstbuflen;
- char *tmphstbuf;
- int res;
- int herr;
-
- hstbuflen = 1024;
- /* Allocate buffer, remember to free it to avoid a memory leakage. */
- tmphstbuf = malloc (hstbuflen);
-
- while ((res = gethostbyname2_r (host, AF,&hostbuf, tmphstbuf, hstbuflen,
- &hp, &herr)) == ERANGE)
- {
- /* Enlarge the buffer. */
- hstbuflen *= 2;
- tmphstbuf = realloc (tmphstbuf, hstbuflen);
- }
- /* Check for errors. */
- if (res || hp == NULL)
- return NULL;
- return hp;
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
deleted file mode 100644
index b505ccfbc..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyname2_r(const char* name, int AF, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- int L=strlen(name);
- int lookfor=0;
- switch (AF) {
- case AF_INET: lookfor=1; break;
- case AF_INET6: lookfor=28; break;
- default: *h_errnop=EINVAL; return 1;
- }
- result->h_name=buf;
- if (buflen<L) { *h_errnop=ERANGE; return 1; }
- strcpy(buf,name);
- return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,lookfor);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
deleted file mode 100644
index d5a531f0f..000000000
--- a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <stdio.h>
-
-extern int __dns_gethostbyx_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop, int lookfor);
-
-/* Oh boy, this interface sucks so badly, there are no words for it.
- * Not one, not two, but _three_ error signalling methods! (*h_errnop
- * nonzero? return value nonzero? *RESULT zero?) The glibc goons
- * really outdid themselves with this one. */
-int gethostbyname_r(const char* name, struct hostent* result,
- char *buf, size_t buflen,
- struct hostent **RESULT, int *h_errnop) {
- int L=strlen(name);
- result->h_name=buf;
- if (buflen<L) { *h_errnop=ERANGE; return 1; }
- strcpy(buf,name);
- return __dns_gethostbyx_r(name,result,buf+L,buflen-L,RESULT,h_errnop,1);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getlogin.c b/mdk-stage1/dietlibc/libcruft/getlogin.c
deleted file mode 100644
index 359f44d9f..000000000
--- a/mdk-stage1/dietlibc/libcruft/getlogin.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include <stdlib.h>
-
-char* getlogin() {
- return getenv("LOGNAME");
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpagesize.c b/mdk-stage1/dietlibc/libcruft/getpagesize.c
deleted file mode 100644
index dea4a9693..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpagesize.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-#ifndef PAGE_SIZE
-#define PAGE_SIZE 4096
-#endif
-
-size_t __libc_getpagesize(void) {
- return PAGE_SIZE;
-}
-
-size_t getpagesize(void) __attribute__((weak,alias("__libc_getpagesize")));
-
diff --git a/mdk-stage1/dietlibc/libcruft/getpass.c b/mdk-stage1/dietlibc/libcruft/getpass.c
deleted file mode 100644
index 3da7cd2b3..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpass.c
+++ /dev/null
@@ -1,40 +0,0 @@
-#include <termios.h>
-#include <unistd.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <string.h>
-
-char *getpass(const char* prompt) {
- struct termios old,tmp;
- int out,in=open("/dev/tty",O_RDWR);
- int doclose=(in>=0);
- static char buf[PASS_MAX];
- if (doclose) { in=0; out=2; } else out=in;
- if (!tcgetattr(in,&old)) {
- tmp=old;
- tmp.c_lflag &= ~(ECHO|ISIG);
- tcsetattr(in,TCSAFLUSH,&tmp);
- }
- write(out,prompt,strlen(prompt));
- {
- int nread,ofs=0;
- for (;;) {
- nread=read(in,buf+ofs,PASS_MAX-ofs);
- if (nread<0) {
- buf[ofs]=0;
- break;
- } else if (ofs+nread>=PASS_MAX) {
- buf[PASS_MAX-1]=0;
- break;
- } else if (buf[ofs+nread-1]=='\n') {
- buf[ofs+nread-1]=0;
- break;
- }
- ofs+=nread;
- }
- write(out,"\n",1);
- }
- tcsetattr(in,TCSAFLUSH,&old);
- if (doclose) close(in);
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam.c b/mdk-stage1/dietlibc/libcruft/getpwnam.c
deleted file mode 100644
index 53aae74d1..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpwnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <pwd.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct passwd *getpwnam(const char * name) {
- struct passwd *tmp;
- setpwent();
- for (;;) {
- tmp=getpwent();
- if (!tmp) return 0;
- if (!strcmp(tmp->pw_name,name))
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid.c b/mdk-stage1/dietlibc/libcruft/getpwuid.c
deleted file mode 100644
index eef14e6e8..000000000
--- a/mdk-stage1/dietlibc/libcruft/getpwuid.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <pwd.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct passwd *getpwuid(uid_t uid) {
- struct passwd *tmp;
- setpwent();
- for (;;) {
- tmp=getpwent();
- if (!tmp) return 0;
- if (tmp->pw_uid==uid)
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/getspnam.c b/mdk-stage1/dietlibc/libcruft/getspnam.c
deleted file mode 100644
index e6573345d..000000000
--- a/mdk-stage1/dietlibc/libcruft/getspnam.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <shadow.h>
-#include <string.h>
-#include <stdlib.h>
-
-struct spwd *getspnam(const char * name) {
- struct spwd *tmp;
- setspent();
- for (;;) {
- tmp=getspent();
- if (!tmp) return 0;
- if (!strcmp(tmp->sp_namp,name))
- return tmp;
- }
-}
diff --git a/mdk-stage1/dietlibc/libcruft/grent.c b/mdk-stage1/dietlibc/libcruft/grent.c
deleted file mode 100644
index 0357657de..000000000
--- a/mdk-stage1/dietlibc/libcruft/grent.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * dietlibc/lib/grent.c - getgrent(3)/setgrent(3)/endgrent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-#define MAX_GROUP_MEMBERS 16 /* matches Linux kernel task struct */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static char *gr_mem[MAX_GROUP_MEMBERS+1];
-static struct group gr;
-
-struct group *getgrent(void)
-{
- char *parts[4], *grouplist;
- unsigned int bufptr;
-
- if (__ent_start(_PATH_GROUP, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 4, ':', 1) < 0)
- goto err_out;
-
- gr.gr_name = parts[0];
- gr.gr_passwd = parts[1];
- gr.gr_gid = (gid_t) atoi(parts[2]);
- grouplist = parts[3];
-
- memset(&gr_mem, 0, sizeof(gr_mem));
- gr.gr_mem = gr_mem;
-
- /* rewind bufptr to beginning of group list */
- bufptr = st->bufptr;
- st->bufptr = (int) (grouplist - st->ent_buf);
-
- __ent_split(st, gr_mem, MAX_GROUP_MEMBERS, ',', 0);
- st->bufptr = bufptr;
-
- return &gr;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setgrent(void) { __ent_set(st); }
-void endgrent(void) { __ent_end(st); st=NULL; }
diff --git a/mdk-stage1/dietlibc/libcruft/h_errno.c b/mdk-stage1/dietlibc/libcruft/h_errno.c
deleted file mode 100644
index 73ead0469..000000000
--- a/mdk-stage1/dietlibc/libcruft/h_errno.c
+++ /dev/null
@@ -1 +0,0 @@
-int h_errno;
diff --git a/mdk-stage1/dietlibc/libcruft/herrno_location.c b/mdk-stage1/dietlibc/libcruft/herrno_location.c
deleted file mode 100644
index 203f73d4b..000000000
--- a/mdk-stage1/dietlibc/libcruft/herrno_location.c
+++ /dev/null
@@ -1,5 +0,0 @@
-extern int h_errno;
-
-int *__h_errno_location() { return &h_errno; }
-
-int *h_errno_location() __attribute__((weak,alias("__h_errno_location")));
diff --git a/mdk-stage1/dietlibc/libcruft/inet_addr.c b/mdk-stage1/dietlibc/libcruft/inet_addr.c
deleted file mode 100644
index 0b8531ab1..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_addr.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-unsigned long int inet_addr(const char *cp) {
- struct in_addr foo;
- if (inet_aton(cp,&foo))
- return foo.s_addr;
- else
- return (unsigned long int)-1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_aton.c b/mdk-stage1/dietlibc/libcruft/inet_aton.c
deleted file mode 100644
index ac7d9d007..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_aton.c
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <stdlib.h>
-
-/* inet_aton() converts the Internet host address cp from the standard
- * numbers-and-dots notation into binary data and stores it in the
- * structure that inp points to. inet_aton returns nonzero if the
- * address is valid, zero if not. */
-
-/* problem is, inet_aton is historically quite, uh, lenient.
- * the following are all acceptable:
- * 0x7f000001 == 127.1 == 127.0.0.1.0 == 127.0.0.1
- * btw: 127.0.0.x.y == 127.0.0.(x|y)
- * and: 10.1.1 == 10.1.0.1 (huh?!)
- * and: 10 == 0.0.0.10 (?!?!?)
- * The Berkeley people must have been so stoned that they are still high.
- */
-
-/* I hereby disclaim that I wrote this code. */
-int inet_aton(const char *cp, struct in_addr *inp) {
- int i;
- unsigned int ip=0;
- char *tmp=(char*)cp;
- for (i=24; ;) {
- long j;
- j=strtol(tmp,&tmp,0);
- if (*tmp==0) {
- ip|=j;
- break;
- }
- if (*tmp=='.') {
- if (j>255) return 0;
- ip|=(j<<i);
- if (i>0) i-=8;
- ++tmp;
- continue;
- }
- return 0;
- }
- inp->s_addr=htonl(ip);
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
deleted file mode 100644
index f8c975f7a..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-extern char *inet_ntoa_r(struct in_addr in,char* buf);
-
-char *inet_ntoa(struct in_addr in) {
- static char buf[20];
- return inet_ntoa_r(in,buf);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c b/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c
deleted file mode 100644
index dcf0eab7b..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-static unsigned int i2a(char* dest,unsigned int x) {
- register unsigned int tmp=x;
- register unsigned int len=0;
- if (x>=100) { *dest++=tmp/100+'0'; tmp=tmp%100; ++len; }
- if (x>=10) { *dest++=tmp/10+'0'; tmp=tmp%10; ++len; }
- *dest++=tmp+'0';
- return len+1;
-}
-
-char *inet_ntoa_r(struct in_addr in,char* buf) {
- unsigned int len;
- unsigned char *ip=(unsigned char*)&in;
- len=i2a(buf,ip[0]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[1]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[2]); buf[len]='.'; ++len;
- len+=i2a(buf+ len,ip[3]); buf[len]=0;
- return buf;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_ntop.c b/mdk-stage1/dietlibc/libcruft/inet_ntop.c
deleted file mode 100644
index 77c47f239..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_ntop.c
+++ /dev/null
@@ -1,75 +0,0 @@
-#include <arpa/inet.h>
-
-extern char *inet_ntoa_r(struct in_addr in,char* buf);
-
-static const unsigned char V4mappedprefix[12]={0,0,0,0,0,0,0,0,0,0,0xff,0xff};
-
-static char tohex(char hexdigit) {
- return hexdigit>9?hexdigit+'a'-10:hexdigit+'0';
-}
-
-static int fmt_xlong(char* s,unsigned int i) {
- char* bak=s;
- *s=tohex((i>>12)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex((i>>8)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex((i>>4)&0xf); if (s!=bak || *s!='0') ++s;
- *s=tohex(i&0xf);
- return s-bak+1;
-}
-
-unsigned int fmt_ip6(char *s,const char ip[16])
-{
- unsigned int len;
- unsigned int i;
- unsigned int temp;
- unsigned int compressing;
- int j;
-
- len = 0; compressing = 0;
- for (j=0; j<16; j+=2) {
- if (j==12 && !memcmp(ip,V4mappedprefix,12)) {
- inet_ntoa_r(*(struct in_addr*)(ip+12),s);
- temp=strlen(s);
- return len+temp;
- }
- temp = ((unsigned long) (unsigned char) ip[j] << 8) +
- (unsigned long) (unsigned char) ip[j+1];
- if (temp == 0) {
- if (!compressing) {
- compressing=1;
- if (j==0) {
- *s++=':'; ++len;
- }
- }
- } else {
- if (compressing) {
- compressing=0;
- *s++=':'; ++len;
- }
- i = fmt_xlong(s,temp); len += i; s += i;
- if (j<14) {
- *s++ = ':';
- ++len;
- }
- }
- }
- *s=0;
- return len;
-}
-
-const char* inet_ntop(int AF, const void *CP, char *BUF, size_t LEN) {
- char buf[100];
- int len;
- if (AF==AF_INET) {
- inet_ntoa_r(*(struct in_addr*)CP,buf);
- len=strlen(buf);
- } else if (AF==AF_INET6) {
- len=fmt_ip6(buf,CP);
- } else
- return 0;
- if (len<LEN) {
- strcpy(BUF,buf);
- return BUF;
- }
- return 0;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/inet_pton.c b/mdk-stage1/dietlibc/libcruft/inet_pton.c
deleted file mode 100644
index d5c17509c..000000000
--- a/mdk-stage1/dietlibc/libcruft/inet_pton.c
+++ /dev/null
@@ -1,97 +0,0 @@
-#include <stdlib.h>
-#include <arpa/inet.h>
-#include <errno.h>
-
-static unsigned int scan_ip6(const char *s,char ip[16])
-{
- unsigned int i;
- unsigned int len=0;
- unsigned long u;
-
- char suffix[16];
- int prefixlen=0;
- int suffixlen=0;
-
- for (i=0; i<16; i++) ip[i]=0;
-
- for (;;) {
- if (*s == ':') {
- len++;
- if (s[1] == ':') { /* Found "::", skip to part 2 */
- s+=2;
- len++;
- break;
- }
- s++;
- }
- {
- char *tmp;
- u=strtol(s,&tmp,16);
- i=tmp-s;
- }
-
- if (!i) return 0;
- if (prefixlen==12 && s[i]=='.') {
- /* the last 4 bytes may be written as IPv4 address */
- if (inet_aton(s,(struct in_addr*)(ip+12)))
- return i+len;
- else
- return 0;
- }
- ip[prefixlen++] = (u >> 8);
- ip[prefixlen++] = (u & 255);
- s += i; len += i;
- if (prefixlen==16)
- return len;
- }
-
-/* part 2, after "::" */
- for (;;) {
- if (*s == ':') {
- if (suffixlen==0)
- break;
- s++;
- len++;
- } else if (suffixlen!=0)
- break;
- {
- char *tmp;
- u=strtol(s,&tmp,16);
- i=tmp-s;
- }
- if (!i) {
- len--;
- break;
- }
- if (suffixlen+prefixlen<=12 && s[i]=='.') {
- if (inet_aton(s,(struct in_addr*)(suffix+suffixlen))) {
- suffixlen+=4;
- len+=strlen(s);
- break;
- } else
- prefixlen=12-suffixlen; /* make end-of-loop test true */
- }
- suffix[suffixlen++] = (u >> 8);
- suffix[suffixlen++] = (u & 255);
- s += i; len += i;
- if (prefixlen+suffixlen==16)
- break;
- }
- for (i=0; i<suffixlen; i++)
- ip[16-suffixlen+i] = suffix[i];
- return len;
-}
-
-int inet_pton(int AF, const char *CP, void *BUF) {
- if (AF==AF_INET) {
- if (!inet_aton(CP,(struct in_addr*)BUF))
- return 0;
- } else if (AF==AF_INET6) {
- if (CP[scan_ip6(CP,BUF)])
- return 0;
- } else {
- errno=EAFNOSUPPORT;
- return -1;
- }
- return 1;
-}
diff --git a/mdk-stage1/dietlibc/libcruft/initgroups.c b/mdk-stage1/dietlibc/libcruft/initgroups.c
deleted file mode 100644
index 7d24866e9..000000000
--- a/mdk-stage1/dietlibc/libcruft/initgroups.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <grp.h>
-#include <sys/types.h>
-#include <string.h>
-
-int initgroups(const char *user, gid_t group) {
- int n=0;
- gid_t grouplist[32];
- struct group *g;
- setgrent();
- while ((g=getgrent())) {
- char **duh=g->gr_mem;
- while (*duh) {
- if (!strcmp(*duh,user)) {
- grouplist[n]=g->gr_gid;
- if (++n>=32)
- break;
- }
- duh++;
- }
- }
- return setgroups(n,grouplist);
-}
-
diff --git a/mdk-stage1/dietlibc/libcruft/mkstemp.c b/mdk-stage1/dietlibc/libcruft/mkstemp.c
deleted file mode 100644
index 3b24ecb54..000000000
--- a/mdk-stage1/dietlibc/libcruft/mkstemp.c
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
-int mkstemp(char* template) {
- char *tmp=template+strlen(template)-6;
- int randfd;
- int i,res;
- unsigned int random;
- for (i=0; i<6; ++i) if (tmp[i]!='X') { __set_errno(EINVAL); return -1; }
- randfd=open("/dev/urandom",O_RDONLY);
- for (;;) {
- read(randfd,&random,sizeof(random));
- for (i=0; i<6; ++i) {
- int hexdigit=(random>>(i*5))&0x1f;
- tmp[i]=hexdigit>9?hexdigit+'a'-10:hexdigit+'0';
- }
- res=open(template,O_CREAT|O_RDWR|O_EXCL,0600);
- if (res>=0) return res;
- }
- close(randfd);
-}
diff --git a/mdk-stage1/dietlibc/libcruft/pwent.c b/mdk-stage1/dietlibc/libcruft/pwent.c
deleted file mode 100644
index 30a8a0957..000000000
--- a/mdk-stage1/dietlibc/libcruft/pwent.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * dietlibc/lib/pwent.c - getpwent(3)/setpwent(3)/endpwent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static struct passwd pw;
-
-struct passwd *getpwent(void)
-{
- char *parts[7];
-
- if (__ent_start(_PATH_PASSWD, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 7, ':', 1) < 0)
- goto err_out;
-
- pw.pw_name = parts[0];
- pw.pw_passwd = parts[1];
- pw.pw_uid = (uid_t) atoi(parts[2]);
- pw.pw_gid = (gid_t) atoi(parts[3]);
- pw.pw_gecos = parts[4];
- pw.pw_dir = parts[5];
- pw.pw_shell = parts[6];
-
- return &pw;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setpwent(void) { __ent_set(st); }
-void endpwent(void) { __ent_end(st); st=NULL; }
diff --git a/mdk-stage1/dietlibc/libcruft/res_init.c b/mdk-stage1/dietlibc/libcruft/res_init.c
deleted file mode 100644
index 9322af298..000000000
--- a/mdk-stage1/dietlibc/libcruft/res_init.c
+++ /dev/null
@@ -1,7 +0,0 @@
-extern int __dns_servers;
-extern void __dns_readstartfiles(void);
-
-int res_init(void) {
- __dns_servers=0;
- __dns_readstartfiles();
-}
diff --git a/mdk-stage1/dietlibc/libcruft/spent.c b/mdk-stage1/dietlibc/libcruft/spent.c
deleted file mode 100644
index e4beb81e4..000000000
--- a/mdk-stage1/dietlibc/libcruft/spent.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * dietlibc/lib/spent.c - getspent(3)/setspent(3)/endspent(3) implementation
- *
- * Copyright 2001 Jeff Garzik <jgarzik@mandrakesoft.com>
- *
- * This is a brand new implementation, based on the interface
- * described in man-pages-1.34-1mdk man pages package.
- */
-
-
-#include "entlib.h" /* this is our only include */
-
-static struct __ent_state *st = NULL; /* state held across calls */
-static struct spwd sp;
-
-struct spwd *getspent(void)
-{
- char *parts[9];
-
- if (__ent_start(_PATH_SHADOW, &st))
- return NULL;
- if (__ent_get_line(st))
- goto err_out;
- if (__ent_split(st, parts, 9, ':', 1) < 0)
- goto err_out;
-
- sp.sp_namp = parts[0];
- sp.sp_pwdp = parts[1];
- sp.sp_lstchg = atoi(parts[2]); /* XXX: atol */
- sp.sp_min = atoi(parts[3]);
- sp.sp_max = atoi(parts[4]);
- sp.sp_warn = atoi(parts[5]);
- sp.sp_inact = atoi(parts[6]);
- sp.sp_expire = atoi(parts[7]);
- sp.sp_flag = atoi(parts[8]);
-
- return &sp;
-
-err_out:
- st->buflen = st->bufptr = 0; /* invalidate file data buffer */
- return NULL;
-}
-
-void setspent(void) { __ent_set(st); }
-void endspent(void) { __ent_end(st); st=NULL; }