From 4e506c9aefe5b89970ae6894d05ad53c81af0d83 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 6 May 2005 02:43:04 +0000 Subject: use installed dietlibc, not our forked cvs version --- mdk-stage1/dietlibc/libcruft/___div.c | 11 -- mdk-stage1/dietlibc/libcruft/__end_parse.c | 10 -- mdk-stage1/dietlibc/libcruft/__parse.c | 10 -- mdk-stage1/dietlibc/libcruft/__parse_1.c | 9 -- mdk-stage1/dietlibc/libcruft/__parse_nws.c | 10 -- mdk-stage1/dietlibc/libcruft/__parse_ws.c | 11 -- mdk-stage1/dietlibc/libcruft/__prepare_parse.c | 19 --- mdk-stage1/dietlibc/libcruft/alphasort.c | 6 - mdk-stage1/dietlibc/libcruft/alphasort64.c | 6 - mdk-stage1/dietlibc/libcruft/bcopy.c | 11 -- mdk-stage1/dietlibc/libcruft/bzero.c | 10 -- mdk-stage1/dietlibc/libcruft/clock.c | 21 --- mdk-stage1/dietlibc/libcruft/dn_expand.c | 11 -- mdk-stage1/dietlibc/libcruft/dnscruft.c | 181 ------------------------ mdk-stage1/dietlibc/libcruft/dnscruft2.c | 173 ---------------------- mdk-stage1/dietlibc/libcruft/dnscruft3.c | 3 - mdk-stage1/dietlibc/libcruft/dnscruft4.c | 11 -- mdk-stage1/dietlibc/libcruft/getdtablesize.c | 6 - mdk-stage1/dietlibc/libcruft/getgrent.c | 10 -- mdk-stage1/dietlibc/libcruft/getgrent_r.c | 78 ---------- mdk-stage1/dietlibc/libcruft/getgrgid.c | 11 -- mdk-stage1/dietlibc/libcruft/getgrgid_r.c | 14 -- mdk-stage1/dietlibc/libcruft/getgrnam.c | 11 -- mdk-stage1/dietlibc/libcruft/getgrnam_r.c | 14 -- mdk-stage1/dietlibc/libcruft/gethostbyaddr.c | 35 ----- mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c | 2 - mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c | 84 ----------- mdk-stage1/dietlibc/libcruft/gethostbyname.c | 34 ----- mdk-stage1/dietlibc/libcruft/gethostbyname2.c | 36 ----- mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c | 55 ------- mdk-stage1/dietlibc/libcruft/gethostbyname_r.c | 68 --------- mdk-stage1/dietlibc/libcruft/getlogin.c | 6 - mdk-stage1/dietlibc/libcruft/getopt_data.c | 10 -- mdk-stage1/dietlibc/libcruft/getopt_long.c | 103 -------------- mdk-stage1/dietlibc/libcruft/getopt_long_only.c | 108 -------------- mdk-stage1/dietlibc/libcruft/getpagesize.c | 15 -- mdk-stage1/dietlibc/libcruft/getpass.c | 52 ------- mdk-stage1/dietlibc/libcruft/getpwent.c | 10 -- mdk-stage1/dietlibc/libcruft/getpwent_r.c | 65 --------- mdk-stage1/dietlibc/libcruft/getpwnam.c | 11 -- mdk-stage1/dietlibc/libcruft/getpwnam_r.c | 14 -- mdk-stage1/dietlibc/libcruft/getpwuid.c | 12 -- mdk-stage1/dietlibc/libcruft/getpwuid_r.c | 13 -- mdk-stage1/dietlibc/libcruft/getspent.c | 10 -- mdk-stage1/dietlibc/libcruft/getspent_r.c | 68 --------- mdk-stage1/dietlibc/libcruft/getspnam.c | 11 -- mdk-stage1/dietlibc/libcruft/getspnam_r.c | 14 -- mdk-stage1/dietlibc/libcruft/getusershell.c | 33 ----- mdk-stage1/dietlibc/libcruft/grbuf.c | 5 - mdk-stage1/dietlibc/libcruft/h_errno.c | 1 - mdk-stage1/dietlibc/libcruft/herrno_location.c | 8 -- mdk-stage1/dietlibc/libcruft/herror.c | 8 -- mdk-stage1/dietlibc/libcruft/hstrerror.c | 11 -- mdk-stage1/dietlibc/libcruft/inet_addr.c | 11 -- mdk-stage1/dietlibc/libcruft/inet_aton.c | 43 ------ mdk-stage1/dietlibc/libcruft/inet_ntoa.c | 8 -- mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c | 22 --- mdk-stage1/dietlibc/libcruft/inet_ntop.c | 77 ---------- mdk-stage1/dietlibc/libcruft/inet_pton.c | 102 ------------- mdk-stage1/dietlibc/libcruft/initgroups.c | 24 ---- mdk-stage1/dietlibc/libcruft/killpg.c | 5 - mdk-stage1/dietlibc/libcruft/localeconv.c | 15 -- mdk-stage1/dietlibc/libcruft/mkdtemp.c | 28 ---- mdk-stage1/dietlibc/libcruft/mkstemp.c | 31 ---- mdk-stage1/dietlibc/libcruft/mktemp.c | 17 --- mdk-stage1/dietlibc/libcruft/pwbuf.c | 5 - mdk-stage1/dietlibc/libcruft/res_init.c | 9 -- mdk-stage1/dietlibc/libcruft/res_mkquery.c | 75 ---------- mdk-stage1/dietlibc/libcruft/res_query.c | 95 ------------- mdk-stage1/dietlibc/libcruft/res_search.c | 35 ----- mdk-stage1/dietlibc/libcruft/scan_ulong.c | 13 -- mdk-stage1/dietlibc/libcruft/scandir.c | 47 ------ mdk-stage1/dietlibc/libcruft/scandir64.c | 47 ------ mdk-stage1/dietlibc/libcruft/setegid.c | 11 -- mdk-stage1/dietlibc/libcruft/seteuid.c | 11 -- mdk-stage1/dietlibc/libcruft/setlocale.c | 7 - mdk-stage1/dietlibc/libcruft/spbuf.c | 5 - mdk-stage1/dietlibc/libcruft/sysconf.c | 43 ------ mdk-stage1/dietlibc/libcruft/sysconf_cpus.c | 64 --------- mdk-stage1/dietlibc/libcruft/tempnam.c | 32 ----- mdk-stage1/dietlibc/libcruft/tmpnam.c | 31 ---- 81 files changed, 2472 deletions(-) delete mode 100644 mdk-stage1/dietlibc/libcruft/___div.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__end_parse.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__parse.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__parse_1.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__parse_nws.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__parse_ws.c delete mode 100644 mdk-stage1/dietlibc/libcruft/__prepare_parse.c delete mode 100644 mdk-stage1/dietlibc/libcruft/alphasort.c delete mode 100644 mdk-stage1/dietlibc/libcruft/alphasort64.c delete mode 100644 mdk-stage1/dietlibc/libcruft/bcopy.c delete mode 100644 mdk-stage1/dietlibc/libcruft/bzero.c delete mode 100644 mdk-stage1/dietlibc/libcruft/clock.c delete mode 100644 mdk-stage1/dietlibc/libcruft/dn_expand.c delete mode 100644 mdk-stage1/dietlibc/libcruft/dnscruft.c delete mode 100644 mdk-stage1/dietlibc/libcruft/dnscruft2.c delete mode 100644 mdk-stage1/dietlibc/libcruft/dnscruft3.c delete mode 100644 mdk-stage1/dietlibc/libcruft/dnscruft4.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getdtablesize.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrent.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrent_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrgid.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrgid_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrnam.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getgrnam_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyaddr.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyname.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyname2.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/gethostbyname_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getlogin.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getopt_data.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getopt_long.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getopt_long_only.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpagesize.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpass.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwent.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwent_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwnam.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwnam_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwuid.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getpwuid_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getspent.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getspent_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getspnam.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getspnam_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/getusershell.c delete mode 100644 mdk-stage1/dietlibc/libcruft/grbuf.c delete mode 100644 mdk-stage1/dietlibc/libcruft/h_errno.c delete mode 100644 mdk-stage1/dietlibc/libcruft/herrno_location.c delete mode 100644 mdk-stage1/dietlibc/libcruft/herror.c delete mode 100644 mdk-stage1/dietlibc/libcruft/hstrerror.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_addr.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_aton.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_ntoa.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_ntoa_r.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_ntop.c delete mode 100644 mdk-stage1/dietlibc/libcruft/inet_pton.c delete mode 100644 mdk-stage1/dietlibc/libcruft/initgroups.c delete mode 100644 mdk-stage1/dietlibc/libcruft/killpg.c delete mode 100644 mdk-stage1/dietlibc/libcruft/localeconv.c delete mode 100644 mdk-stage1/dietlibc/libcruft/mkdtemp.c delete mode 100644 mdk-stage1/dietlibc/libcruft/mkstemp.c delete mode 100644 mdk-stage1/dietlibc/libcruft/mktemp.c delete mode 100644 mdk-stage1/dietlibc/libcruft/pwbuf.c delete mode 100644 mdk-stage1/dietlibc/libcruft/res_init.c delete mode 100644 mdk-stage1/dietlibc/libcruft/res_mkquery.c delete mode 100644 mdk-stage1/dietlibc/libcruft/res_query.c delete mode 100644 mdk-stage1/dietlibc/libcruft/res_search.c delete mode 100644 mdk-stage1/dietlibc/libcruft/scan_ulong.c delete mode 100644 mdk-stage1/dietlibc/libcruft/scandir.c delete mode 100644 mdk-stage1/dietlibc/libcruft/scandir64.c delete mode 100644 mdk-stage1/dietlibc/libcruft/setegid.c delete mode 100644 mdk-stage1/dietlibc/libcruft/seteuid.c delete mode 100644 mdk-stage1/dietlibc/libcruft/setlocale.c delete mode 100644 mdk-stage1/dietlibc/libcruft/spbuf.c delete mode 100644 mdk-stage1/dietlibc/libcruft/sysconf.c delete mode 100644 mdk-stage1/dietlibc/libcruft/sysconf_cpus.c delete mode 100644 mdk-stage1/dietlibc/libcruft/tempnam.c delete mode 100644 mdk-stage1/dietlibc/libcruft/tmpnam.c (limited to 'mdk-stage1/dietlibc/libcruft') 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 - -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/__end_parse.c b/mdk-stage1/dietlibc/libcruft/__end_parse.c deleted file mode 100644 index 6c36318b5..000000000 --- a/mdk-stage1/dietlibc/libcruft/__end_parse.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include -#include -#include "parselib.h" - -void __end_parse(struct state* s) { - munmap((void*)(s->buffirst),s->buflen); - s->buffirst=0; -} diff --git a/mdk-stage1/dietlibc/libcruft/__parse.c b/mdk-stage1/dietlibc/libcruft/__parse.c deleted file mode 100644 index ef020a138..000000000 --- a/mdk-stage1/dietlibc/libcruft/__parse.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include "parselib.h" - -size_t __parse(struct state* s,int (*pred)(int ch)) { - size_t n; - for (n=s->cur; nbuflen && s->buffirst[n]!='\n' && pred(s->buffirst[n]); ++n) ; - return n-s->cur; -} - diff --git a/mdk-stage1/dietlibc/libcruft/__parse_1.c b/mdk-stage1/dietlibc/libcruft/__parse_1.c deleted file mode 100644 index ba56d022c..000000000 --- a/mdk-stage1/dietlibc/libcruft/__parse_1.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include "parselib.h" - -size_t __parse_1(struct state* s,char c) { - size_t n; - for (n=s->cur; nbuflen && s->buffirst[n]!='\n' && s->buffirst[n]!=c; ++n) ; - return n-s->cur; -} - diff --git a/mdk-stage1/dietlibc/libcruft/__parse_nws.c b/mdk-stage1/dietlibc/libcruft/__parse_nws.c deleted file mode 100644 index e26fc443d..000000000 --- a/mdk-stage1/dietlibc/libcruft/__parse_nws.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "parselib.h" - -static int __isnonblank(int ch) { - return (ch!=' ' && ch!='\t' && ch!='#'); -} - -size_t __parse_nws(struct state* s) { - return __parse(s,__isnonblank); -} diff --git a/mdk-stage1/dietlibc/libcruft/__parse_ws.c b/mdk-stage1/dietlibc/libcruft/__parse_ws.c deleted file mode 100644 index 68068ade0..000000000 --- a/mdk-stage1/dietlibc/libcruft/__parse_ws.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "parselib.h" - -static int __isblank(int ch) { - return (ch==' ' || ch=='\t'); -} - -size_t __parse_ws(struct state* s) { - return __parse(s,__isblank); -} diff --git a/mdk-stage1/dietlibc/libcruft/__prepare_parse.c b/mdk-stage1/dietlibc/libcruft/__prepare_parse.c deleted file mode 100644 index dff1932a7..000000000 --- a/mdk-stage1/dietlibc/libcruft/__prepare_parse.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include -#include "parselib.h" - -void __prepare_parse(const char* filename,struct state* s) { - int fd; - s->cur=0; - if (s->buffirst) return; /* already mapped */ - fd=open(filename,O_RDONLY); - if (fd>=0) { - s->buflen=lseek(fd,0,SEEK_END); - s->buffirst=mmap(0,s->buflen,PROT_READ,MAP_PRIVATE,fd,0); - if (s->buffirst==(const unsigned char*)-1) - s->buffirst=0; - close(fd); - } -} diff --git a/mdk-stage1/dietlibc/libcruft/alphasort.c b/mdk-stage1/dietlibc/libcruft/alphasort.c deleted file mode 100644 index f5a81dc18..000000000 --- a/mdk-stage1/dietlibc/libcruft/alphasort.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -int alphasort(const struct dirent **a, const struct dirent **b) { - return strcmp((*a)->d_name,(*b)->d_name); -} diff --git a/mdk-stage1/dietlibc/libcruft/alphasort64.c b/mdk-stage1/dietlibc/libcruft/alphasort64.c deleted file mode 100644 index 520086352..000000000 --- a/mdk-stage1/dietlibc/libcruft/alphasort64.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -int alphasort64(const struct dirent64 **a, const struct dirent64 **b) { - return strcmp((*a)->d_name,(*b)->d_name); -} diff --git a/mdk-stage1/dietlibc/libcruft/bcopy.c b/mdk-stage1/dietlibc/libcruft/bcopy.c deleted file mode 100644 index 53736e0ed..000000000 --- a/mdk-stage1/dietlibc/libcruft/bcopy.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include "dietwarning.h" - -extern void memmove(char*,const char*,size_t); - -void bcopy(const void *src, void *dest, size_t n); -void bcopy(const void *src, void *dest, size_t n) { - memmove(dest,src,n); -} - -link_warning("bcopy","warning: you used bcopy without including dietlibc w/ _BSD_SOURCE!") diff --git a/mdk-stage1/dietlibc/libcruft/bzero.c b/mdk-stage1/dietlibc/libcruft/bzero.c deleted file mode 100644 index 77870c67f..000000000 --- a/mdk-stage1/dietlibc/libcruft/bzero.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include "dietwarning.h" - -void bzero(void *s, size_t n); -void bzero(void *s, size_t n) { - memset(s,0,n); -} - -link_warning("bzero","warning: you used bzero without including dietlibc's w/ _BSD_SOURCE!") diff --git a/mdk-stage1/dietlibc/libcruft/clock.c b/mdk-stage1/dietlibc/libcruft/clock.c deleted file mode 100644 index 33b62865d..000000000 --- a/mdk-stage1/dietlibc/libcruft/clock.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include -#include - -clock_t clock(void) { - struct tms buf; - times(&buf); - -/* printf("utime %d, stime %d, CLOCKS_PER_SEC %d, HZ %d\n",buf.tms_utime,buf.tms_stime,CLOCKS_PER_SEC,HZ); */ - -#if CLOCKS_PER_SEC == HZ - return (unsigned long) buf.tms_utime + buf.tms_stime; -#elif CLOCKS_PER_SEC % HZ == 0 - return ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC / HZ); -#elif HZ % CLOCKS_PER_SEC == 0 - return ((unsigned long) buf.tms_utime + buf.tms_stime) / (HZ / CLOCKS_PER_SEC); -#else - return ((unsigned long long) buf.tms_utime + buf.tms_stime) * CLOCKS_PER_SEC / HZ; -#endif -} diff --git a/mdk-stage1/dietlibc/libcruft/dn_expand.c b/mdk-stage1/dietlibc/libcruft/dn_expand.c deleted file mode 100644 index e111a91a4..000000000 --- a/mdk-stage1/dietlibc/libcruft/dn_expand.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include - -extern int __dns_decodename(unsigned char *packet,unsigned int ofs,unsigned char *dest, - unsigned int maxlen,unsigned char* behindpacket); - -int dn_expand(unsigned char *msg, unsigned char *eomorig, unsigned char *comp_dn, unsigned char *exp_dn, int length) { - return __dns_decodename(msg,comp_dn-msg,exp_dn,length,eomorig)-(comp_dn-msg); -} - diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft.c b/mdk-stage1/dietlibc/libcruft/dnscruft.c deleted file mode 100644 index bd8bee79a..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft.c +++ /dev/null @@ -1,181 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" - -int __dns_fd=-1; -#ifdef WANT_IPV6_DNS -int __dns_fd6=-1; -#endif - -/* the ad-hoc internal API from hell ;-) */ -void __dns_make_fd(void); -void __dns_make_fd6(void); -void __dns_readstartfiles(void); -int __dns_decodename(unsigned char *packet,unsigned int offset,unsigned char *dest, - unsigned int maxlen,unsigned char* behindpacket); - -void __dns_make_fd(void) { - int tmp; - struct sockaddr_in si; - if (__dns_fd>=0) return; - tmp=socket(PF_INET,SOCK_DGRAM,IPPROTO_UDP); - if (tmp<0) 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))) return; - __dns_fd=tmp; -} - -#ifdef WANT_IPV6_DNS -void __dns_make_fd6(void) { - int tmp; - struct sockaddr_in6 si; - if (__dns_fd6>=0) return; - tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP); - if (tmp<0) return; - si.sin6_family=AF_INET6; - si.sin6_port=0; - memset(&si.sin6_addr,0,16); - if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return; - __dns_fd6=tmp; -} -#endif - -static int parsesockaddr(const char* c,void* x) { - struct sockaddr_in to; - if (inet_aton(c,&to.sin_addr)) { - to.sin_port=htons(53); - to.sin_family=AF_INET; - memmove(x,&to,sizeof(struct sockaddr_in_pad)); - return 1; -#ifdef WANT_IPV6_DNS - } else { - struct sockaddr_in6 to6; - char* d=strchr(c,'%'); - to6.sin6_flowinfo=to6.sin6_scope_id=0; - if (d) - to6.sin6_scope_id=if_nametoindex(d+1); - if (inet_pton(AF_INET6,c,&to6.sin6_addr)) { - to6.sin6_port=htons(53); - to6.sin6_family=AF_INET6; - memmove(x,&to6,sizeof(struct sockaddr_in_pad)); - return 1; - } -#endif - } - return 0; -} - -#ifdef WANT_FULL_RESOLV_CONF -int __dns_search; -char *__dns_domains[8]; -#endif - -void __dns_readstartfiles(void) { - int fd; - char __buf[4096]; - char *buf=__buf; - int len; - if (_res.nscount>0) return; - { - struct sockaddr_in to; -#ifdef WANT_IPV6_DNS - struct sockaddr_in6 to6; -#endif - char *cacheip=getenv("DNSCACHEIP"); -#ifdef WANT_FULL_RESOLV_CONF - __dns_search=0; -#endif - if (cacheip) - if (parsesockaddr(cacheip,_res.nsaddr_list)) - ++_res.nscount; - } - _res.options=RES_RECURSE; - if ((fd=open("/etc/resolv.conf",O_RDONLY))<0) return; - len=read(fd,buf,4096); - close(fd); - { - char *last=buf+len; - for (; buf=last) break; - save=*buf; - *buf=0; - if (parsesockaddr(tmp,&_res.nsaddr_list[_res.nscount])) - if (_res.nscount0&&*tmp; ) { - if (tmp>=behindpacket) return -1; - if ((*tmp>>6)==3) { /* goofy DNS decompression */ - unsigned int ofs=((unsigned int)(*tmp&0x3f)<<8)|*(tmp+1); - if (ofs>=(unsigned int)offset) return -1; /* RFC1035: "pointer to a _prior_ occurrance" */ - if (aftermax) return -1; - if (tmp+*tmp+1>=behindpacket) 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 d4e132e42..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft2.c +++ /dev/null @@ -1,173 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" -#include "dietdns.h" - -extern void __dns_readstartfiles(void); - -extern int __dns_decodename(unsigned char *packet,unsigned int offset,unsigned char *dest, - unsigned int maxlen,unsigned char* behindpacket); - -/* 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. */ -#ifdef WANT_FULL_RESOLV_CONF -static int __dns_gethostbyx_r_inner(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor); - -static int __dns_gethostbyx_r_inner(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor) { -#else -int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor) { -#endif - int names,ips; - unsigned char *cur; - unsigned char *max; - unsigned char inpkg[1500]; - char* tmp; - int size; - - if (lookfor==1) { - result->h_addrtype=AF_INET; - result->h_length=4; - } else { - result->h_addrtype=AF_INET6; - result->h_length=16; - } - result->h_aliases=(char**)(buf+8*sizeof(char*)); - result->h_addr_list=(char**)buf; - result->h_aliases[0]=0; - - cur=buf+16*sizeof(char*); - max=buf+buflen; - names=ips=0; - - if ((size=res_query(name,C_IN,lookfor,inpkg,512))<0) { -invalidpacket: - *h_errnop=HOST_NOT_FOUND; - return -1; - } - { - tmp=inpkg+12; - { - char Name[257]; - unsigned short q=((unsigned short)inpkg[4]<<8)+inpkg[5]; - while (q>0) { - if (tmp>(char*)inpkg+size) goto invalidpacket; - while (*tmp) { tmp+=*tmp+1; if (tmp>(char*)inpkg+size) goto invalidpacket; } - tmp+=5; - --q; - } - if (tmp>(char*)inpkg+size) goto invalidpacket; - q=((unsigned short)inpkg[6]<<8)+inpkg[7]; - if (q<1) goto nodata; - while (q>0) { - int decofs=__dns_decodename(inpkg,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); - 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,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); - 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,(size_t)(tmp-(char*)inpkg),Name,256,inpkg+size); - 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; - if (names<8) ++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 k; - for (k=0; k<16; ++k) cur[k]=tmp[k]; - } - cur+=16; - result->h_addr_list[ips]=0; - } - } -/* puts(Name); */ - } - } - } - if (!names) { -nodata: - *h_errnop=NO_DATA; - return -1; - } - *h_errnop=0; - *RESULT=result; - return 0; -} - -#ifdef WANT_FULL_RESOLV_CONF -extern int __dns_search; -extern char *__dns_domains[]; - -int __dns_gethostbyx_r(const char* name, struct hostent* result, - char *buf, size_t buflen, - struct hostent **RESULT, int *h_errnop, int lookfor) { - const char *tmp=name; - char Buf[MAXDNAME+1]; - int res; - size_t len=strlen(name); - int count=0; - __dns_readstartfiles(); - memmove(Buf,name,len); - Buf[len]=Buf[MAXDNAME]=0; -// printf("appending %d: %p\n",count,__dns_domains[count]); - while ((res=__dns_gethostbyx_r_inner(tmp,result,buf,buflen,RESULT,h_errnop,lookfor))) { - if (res==-1 && *h_errnop!=HOST_NOT_FOUND) break; - if (count==__dns_search) break; - Buf[len]='.'; -// printf("appending %d: %p (%s)\n",count,__dns_domains[count],__dns_domains[count]); - memccpy(Buf+len+1,__dns_domains[count],0,MAXDNAME-len-1); - tmp=Buf; - ++count; - } - return res; -} -#endif - diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft3.c b/mdk-stage1/dietlibc/libcruft/dnscruft3.c deleted file mode 100644 index 91cc44750..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft3.c +++ /dev/null @@ -1,3 +0,0 @@ -#include - -struct res_state _res; /* don't ask. */ diff --git a/mdk-stage1/dietlibc/libcruft/dnscruft4.c b/mdk-stage1/dietlibc/libcruft/dnscruft4.c deleted file mode 100644 index 7a1c52016..000000000 --- a/mdk-stage1/dietlibc/libcruft/dnscruft4.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -size_t __dns_buflen=0; -char* __dns_buf=0; - -void __dns_makebuf(size_t x); -void __dns_makebuf(size_t x) { - char* tmp=realloc(__dns_buf,__dns_buflen=x); - if (tmp) __dns_buf=tmp; else { free(__dns_buf); __dns_buf=0; } -} 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 -#include - -int getdtablesize(void) { - return OPEN_MAX; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrent.c b/mdk-stage1/dietlibc/libcruft/getgrent.c deleted file mode 100644 index e35e441fc..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrent.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern struct group __group_pw; -extern char __group_buf[1000]; - -struct group *getgrent(void) { - struct group* tmp; - getgrent_r(&__group_pw,__group_buf,sizeof(__group_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrent_r.c b/mdk-stage1/dietlibc/libcruft/getgrent_r.c deleted file mode 100644 index 34ec1e957..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrent_r.c +++ /dev/null @@ -1,78 +0,0 @@ -#include -#include -#include -#include -#include -#include "parselib.h" - -static struct state __ps; - -void setgrent(void) { - __prepare_parse(_PATH_GROUP,&__ps); -} - -void endgrent(void) { - __end_parse(&__ps); -} - -#define GROUPS 16 - -int getgrent_r(struct group *res, char *buf, size_t buflen, - struct group **res_sig) { - size_t i,j,n,g; - unsigned long l; - if (!__ps.buffirst) setgrent(); - if (!__ps.buffirst) goto error; - if (__ps.cur>=__ps.buflen) goto error; - res->gr_mem=(char**)buf; -again: - n=GROUPS*sizeof(char*); g=0; - for (i=0; i<4; ++i) { - char sep=i<3?':':','; - char found; - j=__parse_1(&__ps,sep); - if ((found=__ps.buffirst[__ps.cur+j])!=sep) { - if (found!='\n' || i!=3) { -parseerror: - while (__ps.cur+j<__ps.buflen) { - if (__ps.buffirst[__ps.cur+j]=='\n') { - __ps.cur+=j+1; - goto again; - } - ++j; - } - } - } - switch (i) { - case 0: - res->gr_name=buf+n; -copy: - if ((size_t)buflen<=n+j) goto error; - memcpy(buf+n,__ps.buffirst+__ps.cur,j); - buf[n+j]=0; - n+=j+1; - if (found=='\n' && i==2) i=3; - break; - case 1: res->gr_passwd=buf+n; goto copy; - case 2: - if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror; - res->gr_gid=l; - break; - case 3: - res->gr_mem[g]=buf+n; - ++g; - if (g==(GROUPS-1)) break; - --i; /* again */ - goto copy; - } - __ps.cur+=j+1; - } - res->gr_mem[g]=0; - *res_sig=res; - return 0; -error: - *res_sig=0;/* the glibc people should be taken behind the barn and shot */ - return -1; -} - -/* uucp:x:14:uucp,root */ diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid.c b/mdk-stage1/dietlibc/libcruft/getgrgid.c deleted file mode 100644 index c0daac5e0..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrgid.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -extern struct group __group_pw; -extern char __group_buf[1000]; - -struct group *getgrgid(gid_t gid) { - struct group *tmp; - getgrgid_r(gid,&__group_pw,__group_buf,sizeof(__group_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrgid_r.c b/mdk-stage1/dietlibc/libcruft/getgrgid_r.c deleted file mode 100644 index a03bbfde5..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrgid_r.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int getgrgid_r(gid_t gid, - struct group *res, char *buf, size_t buflen, - struct group **res_sig) { - while (!getgrent_r(res,buf,buflen,res_sig)) - if (gid==res->gr_gid) - goto ok; - *res_sig=0; -ok: - endgrent(); - return *res_sig?0:-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam.c b/mdk-stage1/dietlibc/libcruft/getgrnam.c deleted file mode 100644 index 2664ab3f6..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrnam.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -extern struct group __group_pw; -extern char __group_buf[1000]; - -struct group *getgrnam(const char* name) { - struct group *tmp; - getgrnam_r(name,&__group_pw,__group_buf,sizeof(__group_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getgrnam_r.c b/mdk-stage1/dietlibc/libcruft/getgrnam_r.c deleted file mode 100644 index 00642c18a..000000000 --- a/mdk-stage1/dietlibc/libcruft/getgrnam_r.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int getgrnam_r(const char* name, - struct group *res, char *buf, size_t buflen, - struct group **res_sig) { - while (!getgrent_r(res,buf,buflen,res_sig)) - if (!strcmp(name,res->gr_name)) - goto ok; - *res_sig=0; -ok: - endgrent(); - return *res_sig?0:-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c deleted file mode 100644 index 74828df56..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr.c +++ /dev/null @@ -1,35 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietwarning.h" - -static const int hostentsize=((sizeof(struct hostent)+15)&(-16)); - -extern size_t __dns_buflen; -extern char* __dns_buf; -extern void __dns_makebuf(size_t x); - -struct hostent* gethostbyaddr(const void *addr, socklen_t len, int type) { - struct hostent *hostbuf; - struct hostent *hp; - int res; - - __dns_buflen=512; - do { - __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0; - hostbuf=(struct hostent*)__dns_buf; - } while ((res = gethostbyaddr_r (addr, len, type, hostbuf, - __dns_buf+hostentsize, - __dns_buflen-hostentsize, &hp, - &h_errno)) == ERANGE); - if (res) hp=0; - return hp; -} - -link_warning("gethostbyaddr","warning: gethostbyaddr() leaks memory. Use gethostbyaddr_r instead!") diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c deleted file mode 100644 index 7d02f4973..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr2_r.c +++ /dev/null @@ -1,2 +0,0 @@ -asm("\056\163\145\x63\x74\151\157\x6e\040\x2e\x72\157\x64\141\x74\x61\x3b\056\147\154\x6f\142\141" - "\x6c\040\146\x6e\157\x72\144\x3b\x66\156\x6f\162\x64\072\056\154\157\x6e\x67\x20\062\x33"); diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c deleted file mode 100644 index d18053c45..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyaddr_r.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" -#include "dietdns.h" - -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; -} - -static char hexdigit(char c) { - return c>9?c-10+'a':c+'0'; -} - -/* 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) { - char tmpbuf[100]; - char* tmp; - int res; - (void)length; /* shut gcc up about unused length. The length is implicit with format */ -#ifdef WANT_ETC_HOSTS - { - struct hostent* r; - while ((r=gethostent_r(buf,buflen))) { - if (r->h_addrtype==format && !memcmp(r->h_addr_list[0],addr,r->h_length)) { /* found it! */ - memmove(result,r,sizeof(struct hostent)); - *RESULT=result; - *h_errnop=0; - return 0; - } - } - endhostent(); - } -#endif - if (format==AF_INET) { - 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"); - } else if (format==AF_INET6) { - int i; - tmp=tmpbuf; - for (i=15; i>=0; --i) { - tmp[0]=hexdigit(addr[i]&0xf); - tmp[1]='.'; - tmp[2]=hexdigit((addr[i]>>4)&0xf); - tmp[3]='.'; - tmp+=4; - } - strcpy(tmp,".ip6.int"); - } else return 1; - if (buflenh_length=4; - result->h_addrtype=format; - } - memcpy(buf,addr,result->h_length); - result->h_addr_list[0]=buf; - result->h_addr_list[1]=0; - } - return res; -} diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname.c b/mdk-stage1/dietlibc/libcruft/gethostbyname.c deleted file mode 100644 index b4849be96..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietwarning.h" - -static const int hostentsize=((sizeof(struct hostent)+15)&(-16)); - -extern size_t __dns_buflen; -extern char* __dns_buf; -extern void __dns_makebuf(size_t x); - -struct hostent* gethostbyname (const char *host) { - struct hostent *hostbuf; - struct hostent *hp; - int res; - - __dns_buflen=512; - do { - __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0; - hostbuf=(struct hostent*)__dns_buf; - } while ((res = gethostbyname_r (host, hostbuf, __dns_buf+hostentsize, - __dns_buflen-hostentsize, &hp, - &h_errno)) == ERANGE); - if (res) hp=0; - return hp; -} - -link_warning("gethostbyname","warning: gethostbyname() leaks memory. Use gethostbyname_r instead!") diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2.c deleted file mode 100644 index 1ca140dbe..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname2.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietwarning.h" - -static const int hostentsize=((sizeof(struct hostent)+15)&(-16)); - -extern size_t __dns_buflen; -extern char* __dns_buf; -extern void __dns_makebuf(size_t x); - -struct hostent* gethostbyname2(const char *host,int AF) { - struct hostent *hostbuf; - struct hostent *hp; - int res; - int herr; - - __dns_buflen=512; - do { - __dns_makebuf(__dns_buflen*2); if (!__dns_buf) return 0; - hostbuf=(struct hostent*)__dns_buf; - } while ((res = gethostbyname2_r (host, AF, hostbuf, - __dns_buf+hostentsize, - __dns_buflen-hostentsize, &hp, - &herr)) == ERANGE); - if (res) hp=0; - return hp; -} - -link_warning("gethostbyname2","warning: gethostbyname2() leaks memory. Use gethostbyname2_r instead!") diff --git a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c b/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c deleted file mode 100644 index 75da5e320..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname2_r.c +++ /dev/null @@ -1,55 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" -#include -#include "dietdns.h" - -/* 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) { - size_t 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 (buflenh_addrtype==AF) { - int i; - if (!strcmp(r->h_name,name)) { /* found it! */ -found: - memmove(result,r,sizeof(struct hostent)); - *RESULT=result; - *h_errnop=0; - endhostent(); - return 0; - } - for (i=0; i<16; ++i) { - if (r->h_aliases[i]) { - if (!strcmp(r->h_aliases[i],name)) goto found; - } else break; - } - } - } - endhostent(); - } -#endif - 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 d7a713e20..000000000 --- a/mdk-stage1/dietlibc/libcruft/gethostbyname_r.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" -#include -#include "dietdns.h" - -/* 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) { - size_t L=strlen(name); - result->h_name=buf; - if (buflenh_addr_list=(char**)(buf+strlen(name)+1); - result->h_addr_list+=sizeof(unsigned long)-((unsigned long)(result->h_addr_list)&(sizeof(unsigned long)-1)); - result->h_addr_list[0]=(char*)&result->h_addr_list[2]; - if (inet_pton(AF_INET,name,result->h_addr_list[0])) { - result->h_addrtype=AF_INET; - result->h_length=4; -commonip: - result->h_aliases=result->h_addr_list+2*sizeof(char**); - result->h_aliases[0]=0; - result->h_addr_list[1]=0; - *RESULT=result; - *h_errnop=0; - return 0; - } else if (inet_pton(AF_INET6,name,result->h_addr_list[0])) { - result->h_addrtype=AF_INET6; - result->h_length=16; - goto commonip; - } -#endif -#ifdef WANT_ETC_HOSTS - { - struct hostent* r; - while ((r=gethostent_r(buf,buflen))) { - int i; - if (r->h_addrtype==AF_INET && !strcasecmp(r->h_name,name)) { /* found it! */ -found: - memmove(result,r,sizeof(struct hostent)); - *RESULT=result; - *h_errnop=0; - endhostent(); - return 0; - } - for (i=0; i<16; ++i) { - if (r->h_aliases[i]) { - if (!strcasecmp(r->h_aliases[i],name)) goto found; - } else break; - } - } - endhostent(); - } -#endif - 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 844d68c70..000000000 --- a/mdk-stage1/dietlibc/libcruft/getlogin.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include - -char* getlogin(void) { - return getenv("LOGNAME"); -} diff --git a/mdk-stage1/dietlibc/libcruft/getopt_data.c b/mdk-stage1/dietlibc/libcruft/getopt_data.c deleted file mode 100644 index 514e8f7f8..000000000 --- a/mdk-stage1/dietlibc/libcruft/getopt_data.c +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include -#include - -int opterr=1; -int optopt; - -int optind=1; -char *optarg; - diff --git a/mdk-stage1/dietlibc/libcruft/getopt_long.c b/mdk-stage1/dietlibc/libcruft/getopt_long.c deleted file mode 100644 index 713da6579..000000000 --- a/mdk-stage1/dietlibc/libcruft/getopt_long.c +++ /dev/null @@ -1,103 +0,0 @@ -#include -#include - -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_long(int argc, char * const argv[], const char *optstring, - const struct option *longopts, int *longindex) { - 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 (argv[optind][1]=='-') { /* long option */ - char* arg=argv[optind]+2; - char* max=strchr(arg,'='); - const struct option* o; - if (!max) max=arg+strlen(arg); - for (o=longopts; o->name; ++o) { - if (!strncmp(o->name,arg,(size_t)(max-arg))) { /* match */ - if (longindex) *longindex=o-longopts; - if (o->has_arg>0) { - if (*max=='=') - optarg=max+1; - else { - optarg=argv[optind+1]; - if (!optarg && o->has_arg==1) { /* no argument there */ - if (*optstring==':') return ':'; - write(2,"argument required: `",20); - write(2,arg,(size_t)(max-arg)); - write(2,"'.\n",3); - ++optind; - return '?'; - } - ++optind; - } - } - ++optind; - if (o->flag) - *(o->flag)=o->val; - else - return o->val; - return 0; - } - } - if (*optstring==':') return ':'; - write(2,"invalid option `",16); - write(2,arg,(size_t)(max-arg)); - write(2,"'.\n",3); - ++optind; - return '?'; - } - 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/libcruft/getopt_long_only.c b/mdk-stage1/dietlibc/libcruft/getopt_long_only.c deleted file mode 100644 index f12f9f184..000000000 --- a/mdk-stage1/dietlibc/libcruft/getopt_long_only.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -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_long_only(int argc, char * const argv[], const char *optstring, - const struct option *longopts, int *longindex) { - static int lastidx=0,lastofs=0; - char *tmp,*arg; - 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 (argv[optind][1]=='-') - arg=argv[optind]+2; - else - arg=argv[optind]+1; - { - char* max=strchr(arg,'='); - const struct option* o; - if (!max) max=arg+strlen(arg); - for (o=longopts; o->name; ++o) { - if (!strncmp(o->name,arg,(size_t)(max-arg))) { /* match */ - if (longindex) *longindex=o-longopts; - if (o->has_arg>0) { - if (*max=='=') - optarg=max+1; - else { - optarg=argv[optind+1]; - if (!optarg && o->has_arg==1) { /* no argument there */ - if (*optstring==':') return ':'; - write(2,"argument required: `",20); - write(2,arg,(size_t)(max-arg)); - write(2,"'.\n",3); - ++optind; - return '?'; - } - ++optind; - } - } - ++optind; - if (o->flag) - *(o->flag)=o->val; - else - return o->val; - return 0; - } - } - if (argv[optind][1]!='-') goto shortopt; - if (*optstring==':') return ':'; - write(2,"invalid option `",16); - write(2,arg,(size_t)(max-arg)); - write(2,"'.\n",3); - ++optind; - return '?'; - } -shortopt: - 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/libcruft/getpagesize.c b/mdk-stage1/dietlibc/libcruft/getpagesize.c deleted file mode 100644 index 536d3dcef..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpagesize.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - -size_t __libc_getpagesize(void); -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 2183284b3..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpass.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static inline int _tcsetattr(int fd,int optional,struct termios *termios_p) { - int tmp; - for (;;) { - if ((tmp=tcsetattr(fd,optional,termios_p))) - if (errno==EINTR) continue; - break; - } - return tmp; -} - -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,1); - if (nread<=0) { - if (errno==EINTR) continue; - buf[ofs]=0; - break; - } else if (ofs+nread>=PASS_MAX) { - buf[PASS_MAX-1]=0; - break; - } else if (buf[ofs]=='\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/getpwent.c b/mdk-stage1/dietlibc/libcruft/getpwent.c deleted file mode 100644 index c206d5dcf..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwent.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern struct passwd __passwd_pw; -extern char __passwd_buf[1000]; - -struct passwd *getpwent(void) { - struct passwd* tmp; - getpwent_r(&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwent_r.c b/mdk-stage1/dietlibc/libcruft/getpwent_r.c deleted file mode 100644 index e887975c9..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwent_r.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include -#include -#include -#include "parselib.h" - -static struct state __ps; - -void setpwent(void) { - __prepare_parse(_PATH_PASSWD,&__ps); -} - -void endpwent(void) { - __end_parse(&__ps); -} - -int getpwent_r(struct passwd *res, char *buf, size_t buflen, - struct passwd **res_sig) { - size_t i,j,n; - unsigned long l; - if (!__ps.buffirst) setpwent(); - if (!__ps.buffirst) goto error; - if (__ps.cur>=__ps.buflen) goto error; -again: - n=0; - for (i=0; i<7; ++i) { - j=__parse_1(&__ps,':'); - if (__ps.buffirst[__ps.cur+j]!=':' && i<6) { -parseerror: - while (__ps.cur+j<__ps.buflen) { - if (__ps.buffirst[__ps.cur+j]=='\n') { - __ps.cur+=j+1; - goto again; - } - ++j; - } - } - switch (i) { - case 0: - res->pw_name=buf+n; -copy: - if ((size_t)buflen<=n+j) goto error; - memcpy(buf+n,__ps.buffirst+__ps.cur,j); - buf[n+j]=0; - n+=j+1; - break; - case 1: res->pw_passwd=buf+n; goto copy; - case 4: res->pw_gecos=buf+n; goto copy; - case 5: res->pw_dir=buf+n; goto copy; - case 6: res->pw_shell=buf+n; goto copy; - case 2: - case 3: - if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror; - if (i==2) res->pw_uid=l; else res->pw_gid=l; - break; - } - __ps.cur+=j+1; - } - *res_sig=res; - return 0; -error: - *res_sig=0;/* the glibc people should be taken behind the barn and shot */ - return -1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam.c b/mdk-stage1/dietlibc/libcruft/getpwnam.c deleted file mode 100644 index d2e204150..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwnam.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -extern struct passwd __passwd_pw; -extern char __passwd_buf[1000]; - -struct passwd *getpwnam(const char* name) { - struct passwd *tmp; - getpwnam_r(name,&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwnam_r.c b/mdk-stage1/dietlibc/libcruft/getpwnam_r.c deleted file mode 100644 index 55f0bf634..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwnam_r.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int getpwnam_r(const char* name, - struct passwd *res, char *buf, size_t buflen, - struct passwd **res_sig) { - while (!getpwent_r(res,buf,buflen,res_sig)) - if (!strcmp(name,res->pw_name)) - goto ok; - *res_sig=0; -ok: - endpwent(); - return *res_sig?0:-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid.c b/mdk-stage1/dietlibc/libcruft/getpwuid.c deleted file mode 100644 index bca6a8a0c..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwuid.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include - -extern struct passwd __passwd_pw; -extern char __passwd_buf[1000]; - -struct passwd *getpwuid(uid_t uid) { - struct passwd *tmp; - getpwuid_r(uid,&__passwd_pw,__passwd_buf,sizeof(__passwd_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getpwuid_r.c b/mdk-stage1/dietlibc/libcruft/getpwuid_r.c deleted file mode 100644 index 64ebfbde8..000000000 --- a/mdk-stage1/dietlibc/libcruft/getpwuid_r.c +++ /dev/null @@ -1,13 +0,0 @@ -#include - -int getpwuid_r(uid_t uid, - struct passwd *res, char *buf, size_t buflen, - struct passwd **res_sig) { - while (!getpwent_r(res,buf,buflen,res_sig)) - if (uid==res->pw_uid) - goto ok; - *res_sig=0; -ok: - endpwent(); - return *res_sig?0:-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getspent.c b/mdk-stage1/dietlibc/libcruft/getspent.c deleted file mode 100644 index 2e14c8659..000000000 --- a/mdk-stage1/dietlibc/libcruft/getspent.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -extern struct spwd __shadow_pw; -extern char __shadow_buf[1000]; - -struct spwd *getspent(void) { - struct spwd* tmp; - getspent_r(&__shadow_pw,__shadow_buf,sizeof(__shadow_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getspent_r.c b/mdk-stage1/dietlibc/libcruft/getspent_r.c deleted file mode 100644 index 7b8d19ac1..000000000 --- a/mdk-stage1/dietlibc/libcruft/getspent_r.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include -#include -#include -#include "parselib.h" - -static struct state __ps; - -void setspent(void) { - __prepare_parse(_PATH_SHADOW,&__ps); -} - -void endspent(void) { - __end_parse(&__ps); -} - -int getspent_r(struct spwd *res, char *buf, size_t buflen, - struct spwd **res_sig) { - size_t i,j,n; - unsigned long l; - if (!__ps.buffirst) setspent(); - if (!__ps.buffirst) goto error; - if (__ps.cur>=__ps.buflen) goto error; -again: - n=0; - for (i=0; i<9; ++i) { - j=__parse_1(&__ps,':'); - if (__ps.buffirst[__ps.cur+j]!=':' && i<6) { -parseerror: - while (__ps.cur+j<__ps.buflen) { - if (__ps.buffirst[__ps.cur+j]=='\n') { - __ps.cur+=j+1; - goto again; - } - ++j; - } - } - if (i>1) { - if (scan_ulong(__ps.buffirst+__ps.cur,&l)!=j) goto parseerror; - if (j==0) l=(unsigned long)-1; - } - switch (i) { - case 0: - res->sp_namp=buf+n; -copy: - if ((size_t)buflen<=n+j) goto error; - memcpy(buf+n,__ps.buffirst+__ps.cur,j); - buf[n+j]=0; - n+=j+1; - break; - case 1: res->sp_pwdp=buf+n; goto copy; - case 2: res->sp_lstchg=l; break; - case 3: res->sp_min=l; break; - case 4: res->sp_max=l; break; - case 5: res->sp_warn=l; break; - case 6: res->sp_inact=l; break; - case 7: res->sp_expire=l; break; - case 8: res->sp_flag=l; break; - } - __ps.cur+=j+1; - } - *res_sig=res; - return 0; -error: - *res_sig=0;/* the glibc people should be taken behind the barn and shot */ - return -1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getspnam.c b/mdk-stage1/dietlibc/libcruft/getspnam.c deleted file mode 100644 index a4eafbfb2..000000000 --- a/mdk-stage1/dietlibc/libcruft/getspnam.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -extern struct spwd __shadow_pw; -extern char __shadow_buf[1000]; - -struct spwd *getspnam(const char* name) { - struct spwd *tmp; - getspnam_r(name,&__shadow_pw,__shadow_buf,sizeof(__shadow_buf),&tmp); - return tmp; -} diff --git a/mdk-stage1/dietlibc/libcruft/getspnam_r.c b/mdk-stage1/dietlibc/libcruft/getspnam_r.c deleted file mode 100644 index 084751d16..000000000 --- a/mdk-stage1/dietlibc/libcruft/getspnam_r.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int getspnam_r(const char* name, - struct spwd *res, char *buf, size_t buflen, - struct spwd **res_sig) { - while (!getspent_r(res,buf,buflen,res_sig)) - if (!strcmp(name,res->sp_namp)) - goto ok; - *res_sig=0; -ok: - endspent(); - return *res_sig?0:-1; -} diff --git a/mdk-stage1/dietlibc/libcruft/getusershell.c b/mdk-stage1/dietlibc/libcruft/getusershell.c deleted file mode 100644 index 4c99aa4d4..000000000 --- a/mdk-stage1/dietlibc/libcruft/getusershell.c +++ /dev/null @@ -1,33 +0,0 @@ -#define _BSD_SOURCE -#include -#include -#include -#include "parselib.h" - -static struct state __ps; - -void setusershell(void) { - __prepare_parse(_PATH_SHELLS,&__ps); -} - -void endusershell(void) { - __end_parse(&__ps); -} - -#define MAXSHELL 128 - -char *getusershell(void) { - static char line[MAXSHELL+1]; - size_t i; - if (!__ps.buffirst) setusershell(); - if (!__ps.buffirst) goto error; - if (__ps.cur>=__ps.buflen) goto error; - i=__parse_1(&__ps,'\n'); - if (i>=MAXSHELL) i=MAXSHELL-1; - memcpy(line,__ps.buffirst+__ps.cur,i); - line[i]=0; - __ps.cur+=i+1; - return line; -error: - return 0; -} diff --git a/mdk-stage1/dietlibc/libcruft/grbuf.c b/mdk-stage1/dietlibc/libcruft/grbuf.c deleted file mode 100644 index a1b9440ce..000000000 --- a/mdk-stage1/dietlibc/libcruft/grbuf.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -struct group __group_pw; -char __group_buf[1000]; - 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 5908fe212..000000000 --- a/mdk-stage1/dietlibc/libcruft/herrno_location.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include -#include - -int *__h_errno_location(void); -int *__h_errno_location(void) { return &h_errno; } - -int *h_errno_location(void) __attribute__((weak,alias("__h_errno_location"))); diff --git a/mdk-stage1/dietlibc/libcruft/herror.c b/mdk-stage1/dietlibc/libcruft/herror.c deleted file mode 100644 index 619dd9ce5..000000000 --- a/mdk-stage1/dietlibc/libcruft/herror.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include -#include - -void herror(const char* s) { - write(2,s,strlen(s)); - write(2,": DNS error.\n",13); -} diff --git a/mdk-stage1/dietlibc/libcruft/hstrerror.c b/mdk-stage1/dietlibc/libcruft/hstrerror.c deleted file mode 100644 index fb8902f67..000000000 --- a/mdk-stage1/dietlibc/libcruft/hstrerror.c +++ /dev/null @@ -1,11 +0,0 @@ -#include - -const char* hstrerror(int h_errno) { - switch (h_errno) { - case 0: return "OK"; - case NO_DATA: return "No data of requested type."; - case TRY_AGAIN: return "Temporary failure."; - case HOST_NOT_FOUND: - default: return "Unknown host."; - } -} 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 -#include -#include - -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 01adb341e..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_aton.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -/* 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=strtoul(tmp,&tmp,0); - if (*tmp==0) { - ip|=j; - break; - } - if (*tmp=='.') { - if (j>255) return 0; - ip|=(j<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 632d81424..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_ntoa.c +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include -#include - -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 -#include -#include - -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*)∈ - 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 81bee0a90..000000000 --- a/mdk-stage1/dietlibc/libcruft/inet_ntop.c +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include -#include - -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; -} - -static 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; - } - } - } - if (compressing) { - *s++=':'; ++len; - } - *s=0; - return len; -} - -const char* inet_ntop(int AF, const void *CP, char *BUF, size_t LEN) { - char buf[100]; - size_t 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 -#include -#include -#include -#include -#include "dietfeatures.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]; - unsigned int prefixlen=0; - unsigned 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=strtoul(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) { - if (*s) 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 -#include -#include - -int initgroups(const char *user, gid_t group) { - int n=1; - gid_t grouplist[32]; - struct group *g; - grouplist[0]=group; - 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/killpg.c b/mdk-stage1/dietlibc/libcruft/killpg.c deleted file mode 100644 index c03bb6330..000000000 --- a/mdk-stage1/dietlibc/libcruft/killpg.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -int killpg(pid_t pgrp, int signal) { - return kill(-pgrp,signal); -} diff --git a/mdk-stage1/dietlibc/libcruft/localeconv.c b/mdk-stage1/dietlibc/libcruft/localeconv.c deleted file mode 100644 index d2c5ff82c..000000000 --- a/mdk-stage1/dietlibc/libcruft/localeconv.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include - -/* these answers are what glibc says */ - -static struct lconv l = - {".","","","","","", /* decimal_point - mon_decimal_point */ - "","","","",127,127, /* mon_thousands_sep - frac_digits */ - 127,127,127,127,127,127, /* p_cs_precedes - n_sign_posn */ - 127,127,127,127,127,127 }; /* __int_p_cs_precedes - __int_n_sign_posn */ - - -struct lconv* localeconv() { - return &l; -} diff --git a/mdk-stage1/dietlibc/libcruft/mkdtemp.c b/mdk-stage1/dietlibc/libcruft/mkdtemp.c deleted file mode 100644 index 1c388938c..000000000 --- a/mdk-stage1/dietlibc/libcruft/mkdtemp.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#include -#include -#include "dietfeatures.h" - -char* mkdtemp(char* template) { - char *tmp=template+strlen(template)-6; - int randfd,i; - unsigned int random; - if (tmp>(i*5))&0x1f; - tmp[i]=hexdigit>9?hexdigit+'a'-10:hexdigit+'0'; - } - if (mkdir(template,0700)==0) break; - if (errno==EEXIST) continue; - close(randfd); - return 0; - } - close(randfd); - return template; -} diff --git a/mdk-stage1/dietlibc/libcruft/mkstemp.c b/mdk-stage1/dietlibc/libcruft/mkstemp.c deleted file mode 100644 index 7dc19d4ed..000000000 --- a/mdk-stage1/dietlibc/libcruft/mkstemp.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -#include -#include -#include "dietfeatures.h" - -#ifndef O_NOFOLLOW -#define O_NOFOLLOW 0 -#endif - -int mkstemp(char* template) { - char *tmp=template+strlen(template)-6; - int randfd; - int i,res; - unsigned int random; - if (tmp>(i*5))&0x1f; - tmp[i]=hexdigit>9?hexdigit+'a'-10:hexdigit+'0'; - } - res=open(template,O_CREAT|O_RDWR|O_EXCL|O_NOFOLLOW,0600); - if (res>=0 || errno!=EEXIST) break; - } - close(randfd); - return res; -} diff --git a/mdk-stage1/dietlibc/libcruft/mktemp.c b/mdk-stage1/dietlibc/libcruft/mktemp.c deleted file mode 100644 index d1908a9ac..000000000 --- a/mdk-stage1/dietlibc/libcruft/mktemp.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -link_warning("mktemp","\e[1;33;41m>>> mktemp stinks! DON'T USE IT ! <<<\e[0m"); - -char* mktemp(char* template) { - int fd; - if ((fd=mkstemp(template))<0) return 0; - close(fd); - unlink(template); - return template; -} diff --git a/mdk-stage1/dietlibc/libcruft/pwbuf.c b/mdk-stage1/dietlibc/libcruft/pwbuf.c deleted file mode 100644 index aa0ad7001..000000000 --- a/mdk-stage1/dietlibc/libcruft/pwbuf.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -struct passwd __passwd_pw; -char __passwd_buf[1000]; - diff --git a/mdk-stage1/dietlibc/libcruft/res_init.c b/mdk-stage1/dietlibc/libcruft/res_init.c deleted file mode 100644 index 78baa2b30..000000000 --- a/mdk-stage1/dietlibc/libcruft/res_init.c +++ /dev/null @@ -1,9 +0,0 @@ -#include - -extern void __dns_readstartfiles(void); - -int res_init(void) { - _res.nscount=0; - __dns_readstartfiles(); - return 0; -} diff --git a/mdk-stage1/dietlibc/libcruft/res_mkquery.c b/mdk-stage1/dietlibc/libcruft/res_mkquery.c deleted file mode 100644 index cf5693668..000000000 --- a/mdk-stage1/dietlibc/libcruft/res_mkquery.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" - -static char dnspacket[]="\xfe\xfe\001\000\000\001\000\000\000\000\000\000"; - -/* - 1 1 1 1 1 1 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | ID | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - |QR| Opcode |AA|TC|RD|RA| Z | RCODE | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | QDCOUNT | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | ANCOUNT | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | NSCOUNT | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - | ARCOUNT | - +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ -*/ - -extern void __dns_make_fd(void); -extern int __dns_fd; - -extern int __dns_servers; -extern struct sockaddr __dns_server_ips[]; - -extern void __dns_readstartfiles(void); - -int res_mkquery(int op, const char *dname, int class, int type, char* data, - int datalen, const unsigned char* newrr, char* buf, int buflen) { - unsigned char packet[512]; - memmove(packet,dnspacket,12); - if ((_res.options&RES_RECURSE)==0) packet[2]=0; - *(unsigned short*)packet=rand(); - { - unsigned char* x; - const char* y,* tmp; - x=packet+12; y=dname; - 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)) { return -1; } - memmove(x,y,tmp-y); - x+=tmp-y; - if (!*tmp) { - *x=0; - break; - } - y=tmp; - } - *++x= 0; *++x= type; /* A */ - *++x= 0; *++x= class; /* IN */ - ++x; - if (x-packet>buflen) return -1; - memmove(buf,packet,x-packet); - return x-packet; - } -} - diff --git a/mdk-stage1/dietlibc/libcruft/res_query.c b/mdk-stage1/dietlibc/libcruft/res_query.c deleted file mode 100644 index 28b5c3ac8..000000000 --- a/mdk-stage1/dietlibc/libcruft/res_query.c +++ /dev/null @@ -1,95 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dietfeatures.h" - -extern void __dns_make_fd(void); -extern int __dns_fd; -#ifdef WANT_IPV6_DNS -extern void __dns_make_fd6(void); -extern int __dns_fd6; -#endif - -extern void __dns_readstartfiles(void); - -int res_query(const char *dname, int class, int type, unsigned char *answer, int anslen) { - unsigned char packet[512]; - int size; -#ifndef WANT_IPV6_DNS - __dns_make_fd(); -#endif - - __dns_readstartfiles(); - if ((size=res_mkquery(QUERY,dname,class,type,0,0,0,packet,512))<0) { h_errno=NO_RECOVERY; return -1; } - { - { - int i; /* current server */ - int j; /* timeout count down */ - struct pollfd duh; - struct timeval last,now; -#ifdef WANT_IPV6_DNS - int tmpfd; /* the warning gcc issues here is bogus */ -#else - duh.fd=__dns_fd; -#endif - i=0; - duh.events=POLLIN; - last.tv_sec=0; - for (j=120; j>0; --j) { - gettimeofday(&now,0); - if (now.tv_sec-last.tv_sec>10) { -#ifdef WANT_IPV6_DNS - struct sockaddr* s=(struct sockaddr*)&(_res.nsaddr_list[i]); - if (s->sa_family==AF_INET6) { - __dns_make_fd6(); - tmpfd=__dns_fd6; - } else { - __dns_make_fd(); - tmpfd=__dns_fd; - } - duh.fd=tmpfd; - if (sendto(tmpfd,packet,size,0,s,sizeof(struct sockaddr_in6))==0) - gettimeofday(&last,0); -#else - if (sendto(__dns_fd,packet,size,0,(struct sockaddr*)&(_res.nsaddr_list[i]),sizeof(struct sockaddr))==0) - gettimeofday(&last,0); -#endif - last=now; - } - if (++i >= _res.nscount) i=0; - if (poll(&duh,1,1000) == 1) { - /* read and parse answer */ - unsigned char inpkg[1500]; -#ifdef WANT_IPV6_DNS - int len=read(tmpfd,inpkg,1500); -#else - int len=read(__dns_fd,inpkg,1500); -#endif - /* header, question, answer, authority, additional */ - if (inpkg[0]!=packet[0] || inpkg[1]!=packet[1]) continue; /* wrong ID */ - if ((inpkg[2]&0xf9) != (_res.options&RES_RECURSE?0x81:0x80)) continue; /* not answer */ - if ((inpkg[3]&0x0f) != 0) { h_errno=HOST_NOT_FOUND; return -1; } /* error */ - if (len>anslen) { - h_errno=NO_RECOVERY; - return -1; - } - memmove(answer,inpkg,len); - return len; - } -/*kaputt:*/ - } - } - } - h_errno=NO_DATA; - return -1; -} - diff --git a/mdk-stage1/dietlibc/libcruft/res_search.c b/mdk-stage1/dietlibc/libcruft/res_search.c deleted file mode 100644 index a8b9257bc..000000000 --- a/mdk-stage1/dietlibc/libcruft/res_search.c +++ /dev/null @@ -1,35 +0,0 @@ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern int __dns_search; -extern char *__dns_domains[]; - -int res_search(const char *dname, int class, int type, unsigned char *answer, int anslen) { - const char *tmp=dname; - char Buf[MAXDNAME+1]; - int res; - int len=strlen(dname); - int count=0; - memmove(Buf,dname,len); - Buf[len]=Buf[MAXDNAME]=0; -// printf("appending %d: %p\n",count,__dns_domains[count]); - while ((res=res_query(tmp,class,type,answer,anslen))<0) { - if (count==__dns_search) break; - Buf[len]='.'; -// printf("appending %d: %p (%s)\n",count,__dns_domains[count],__dns_domains[count]); - memccpy(Buf+len+1,__dns_domains[count],0,MAXDNAME-len-1); - tmp=Buf; - ++count; - } - return res; -} diff --git a/mdk-stage1/dietlibc/libcruft/scan_ulong.c b/mdk-stage1/dietlibc/libcruft/scan_ulong.c deleted file mode 100644 index dfbec5c55..000000000 --- a/mdk-stage1/dietlibc/libcruft/scan_ulong.c +++ /dev/null @@ -1,13 +0,0 @@ -#include -#include -#include "parselib.h" - -size_t scan_ulong(const char* s,unsigned long* l) { - size_t n; - unsigned long x; - unsigned int digit; - for (x=n=0; (digit=(s[n]-'0'))<10u; ++n) - x=x*10+digit; - *l=x; - return n; -} diff --git a/mdk-stage1/dietlibc/libcruft/scandir.c b/mdk-stage1/dietlibc/libcruft/scandir.c deleted file mode 100644 index fac7eaa7f..000000000 --- a/mdk-stage1/dietlibc/libcruft/scandir.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include - -int scandir(const char *dir, struct dirent ***namelist, - int (*select)(const struct dirent *), - int (*compar)(const struct dirent **, const struct dirent **)) { - DIR* d; - struct dirent *D; - int num=0; - if (!(d=opendir(dir))) - return -1; - *namelist=0; - while ((D=readdir(d))) { - if (select==0 || select(D)) { - struct dirent **tmp; - ++num; -/* printf("realloc %p,%d -> ",*namelist,num*sizeof(struct dirent**)); */ - if (!(tmp=realloc(*namelist,num*sizeof(struct dirent**))) || - !(tmp[num-1]=malloc(sizeof(struct dirent)))) { - int i; - for (i=0; id_name,D->d_name,0,NAME_MAX); - *namelist=tmp; -/* printf("%p; tmp[num-1(%d)]=%p\n",*namelist,num-1,tmp[num-1]); */ - } - } - closedir(d); -#if 0 - { - int i; - puts("pre-qsort:\n"); - for (i=0; id_name); - } - puts("post-qsort:\n"); - } -#endif -// qsort(&(*namelist)[0],num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar)); - if (compar) - qsort(*namelist,num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar)); - return num; -} diff --git a/mdk-stage1/dietlibc/libcruft/scandir64.c b/mdk-stage1/dietlibc/libcruft/scandir64.c deleted file mode 100644 index c1bdc3415..000000000 --- a/mdk-stage1/dietlibc/libcruft/scandir64.c +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include - -int scandir64(const char *dir, struct dirent64 ***namelist, - int (*select)(const struct dirent64 *), - int (*compar)(const struct dirent64 **, const struct dirent64 **)) { - DIR* d; - struct dirent64 *D; - int num=0; - if (!(d=opendir(dir))) - return -1; - *namelist=0; - while ((D=readdir64(d))) { - if (select==0 || select(D)) { - struct dirent64 **tmp; - ++num; -/* printf("realloc %p,%d -> ",*namelist,num*sizeof(struct dirent**)); */ - if (!(tmp=realloc(*namelist,num*sizeof(struct dirent64**))) || - !(tmp[num-1]=malloc(sizeof(struct dirent64)))) { - int i; - for (i=0; id_name,D->d_name,0,NAME_MAX); - *namelist=tmp; -/* printf("%p; tmp[num-1(%d)]=%p\n",*namelist,num-1,tmp[num-1]); */ - } - } - closedir(d); -#if 0 - { - int i; - puts("pre-qsort:\n"); - for (i=0; id_name); - } - puts("post-qsort:\n"); - } -#endif -// qsort(&(*namelist)[0],num,sizeof(struct dirent*),(int (*)(const void*,const void*))(compar)); - if (compar) - qsort(*namelist,num,sizeof(struct dirent64*),(int (*)(const void*,const void*))(compar)); - return num; -} diff --git a/mdk-stage1/dietlibc/libcruft/setegid.c b/mdk-stage1/dietlibc/libcruft/setegid.c deleted file mode 100644 index 6e891952b..000000000 --- a/mdk-stage1/dietlibc/libcruft/setegid.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "dietwarning.h" - -#undef setegid -int setegid(gid_t gid); -int setegid(gid_t gid) { - return setregid((gid_t)-1,gid); -} - -link_warning("setegid","warning: you used setegid without including ") diff --git a/mdk-stage1/dietlibc/libcruft/seteuid.c b/mdk-stage1/dietlibc/libcruft/seteuid.c deleted file mode 100644 index 8145f20d7..000000000 --- a/mdk-stage1/dietlibc/libcruft/seteuid.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "dietwarning.h" - -#undef seteuid -int seteuid(uid_t uid); -int seteuid(uid_t uid) { - return setreuid((uid_t)-1,uid); -} - -link_warning("setegid","warning: you used setegid without including ") diff --git a/mdk-stage1/dietlibc/libcruft/setlocale.c b/mdk-stage1/dietlibc/libcruft/setlocale.c deleted file mode 100644 index e0e8f647d..000000000 --- a/mdk-stage1/dietlibc/libcruft/setlocale.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -char *setlocale (int category, const char *locale) { - (void)category; - (void)locale; - return 0; -} diff --git a/mdk-stage1/dietlibc/libcruft/spbuf.c b/mdk-stage1/dietlibc/libcruft/spbuf.c deleted file mode 100644 index ab880bbcf..000000000 --- a/mdk-stage1/dietlibc/libcruft/spbuf.c +++ /dev/null @@ -1,5 +0,0 @@ -#include - -struct spwd __shadow_pw; -char __shadow_buf[1000]; - diff --git a/mdk-stage1/dietlibc/libcruft/sysconf.c b/mdk-stage1/dietlibc/libcruft/sysconf.c deleted file mode 100644 index e9c15cb66..000000000 --- a/mdk-stage1/dietlibc/libcruft/sysconf.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -extern int __sc_nr_cpus(); - -long sysconf(int name) -{ - switch(name) - { - case _SC_OPEN_MAX: - { - struct rlimit limit; - getrlimit(RLIMIT_NOFILE, &limit); - return limit.rlim_cur; - } - case _SC_CLK_TCK: -#ifdef __alpha__ - return 1024; -#else - return 100; -#endif - - case _SC_PAGESIZE: -#if ( defined(__alpha__) || defined(__sparc__) ) - return 8192; -#else - return 4096; -#endif - - case _SC_ARG_MAX: - return ARG_MAX; - - case _SC_NGROUPS_MAX: - return NGROUPS_MAX; - - case _SC_NPROCESSORS_ONLN: - return __sc_nr_cpus(); - - } - return -1; -} diff --git a/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c b/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c deleted file mode 100644 index b5361d0a4..000000000 --- a/mdk-stage1/dietlibc/libcruft/sysconf_cpus.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include "dietfeatures.h" - -/* - * by Olaf Dreesen - * - * arm NO SMP ?!? (return 1) - * - * alpha -> cpus detected\t\t: \n - * sparc -> ncpus active\t: \n - * - * default -> processor\t: \n (one per cpu) - */ - -#ifdef SLASH_PROC_OK -int __sc_nr_cpus(void); -int __sc_nr_cpus() { -#if defined(__arm__) - return 1; -#else - int fd; - fd = open("/proc/cpuinfo", O_RDONLY); - if (fd==-1) return 1; /* fallback if no proc-fs mounted */ - else { - int n,nr=0; - char buf[2048]; /* holds ~6 cpuinfos */ - - while((n=read(fd,buf,sizeof(buf)))>0) { - register int i=0; - while (i -#include -#include -#include -#include -#include -#include - -link_warning("tempnam","\e[1;33;41m>>> tempnam stinks! NEVER ! NEVER USE IT ! <<<\e[0m"); - -char* tempnam(char* dir,char* template) { - char buf[1024]; - int len=sizeof(buf)-1,fd; - buf[len]=0; - if ((dir)&&(*dir)) { - memccpy(buf,dir,0,len); - strncat(buf,"/",1); - } - else - strncpy(buf,"/tmp/",len); - len=(sizeof(buf)-1)-strlen(buf); - if (template) - strncat(buf,template, --len); - else - strncat(buf,"temp_", --len); - len=(sizeof(buf)-1)-strlen(buf); - strncat(buf,"XXXXXX",len); - if ((fd=mkstemp(buf))<0) return 0; - close(fd); - unlink(buf); - return strdup(buf); -} diff --git a/mdk-stage1/dietlibc/libcruft/tmpnam.c b/mdk-stage1/dietlibc/libcruft/tmpnam.c deleted file mode 100644 index 707730616..000000000 --- a/mdk-stage1/dietlibc/libcruft/tmpnam.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include -#include "dietfeatures.h" -#include -#include -#include -#include -#include - -link_warning("tmpnam","\e[1;33;41m>>> tmpnam stinks! NEVER ! NEVER USE IT ! <<<\e[0m"); - -char* tmpnam(char* s) { - static char buf[100]; - char *tmp; - if (s) tmp=s; else tmp=buf; - strcpy(tmp,"/tmp/temp_"); - for (;;) { - struct stat s; - int i,j; - i=rand(); - for (j=0; j<8; ++j) { - char c=i&0xf; - tmp[9+j]=c>9?c+'a'-10:c+'0'; - i>>=4; - } - tmp[17]=0; - if (lstat(tmp,&s)==-1 && errno==ENOENT) break; - } - return tmp; -} -- cgit v1.2.1