diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-05-02 00:07:56 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-05-02 00:07:56 +0000 |
commit | 5afc864422e8c572a13b3e48df47fd0e56cfbb74 (patch) | |
tree | 5a6ec9054284616133cdea4b62efdcbaddd061f9 | |
parent | 3c1217cfad0fb72f458223ae73e1ce612f5e9efd (diff) | |
download | busybox-5afc864422e8c572a13b3e48df47fd0e56cfbb74.tar.gz |
More stuff
-Erik
-rw-r--r-- | Changelog | 3 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | TODO | 33 | ||||
-rw-r--r-- | busybox.def.h | 8 | ||||
-rw-r--r-- | coreutils/tr.c | 6 | ||||
-rw-r--r-- | coreutils/whoami.c | 11 | ||||
-rw-r--r-- | dutmp.c | 1 | ||||
-rw-r--r-- | miscutils/dutmp.c | 1 | ||||
-rw-r--r-- | networking/nslookup.c | 4 | ||||
-rw-r--r-- | nslookup.c | 4 | ||||
-rw-r--r-- | tr.c | 6 | ||||
-rw-r--r-- | utility.c | 9 | ||||
-rw-r--r-- | whoami.c | 11 |
13 files changed, 68 insertions, 34 deletions
@@ -16,7 +16,8 @@ * tail can now accept -<num> commands (e.g. -10) for better compatibility with the standard tail command * added a simple id implementation; doesn't support supp. groups yet - * logname used getlogin(3), which uses utmp under the hood. Now it behaves. + * logname used getlogin(3) which uses utmp under the hood. Now it behaves. + * whoami used getpwuid(3) which uses libc NSS. Now it behaves. * Due to the license change, I can now use minix code. Minux tr replaces the BSD derived tr, saving 4k and eliminating bsearch(3) from the list of used Libc symbols. @@ -68,7 +68,8 @@ ifndef $(STRIPTOOL) STRIPTOOL = strip endif -#also to try -- use --prefix=/usr/my-libc2.0.7-stuff +# TODO: Try compiling vs other libcs. See what -nostdinc and -nostdlib do for that. +# also try --prefix=/usr/my-libc-stuff # -D_GNU_SOURCE is needed because environ is used in init.c ifeq ($(DODEBUG),true) @@ -78,8 +79,6 @@ ifeq ($(DODEBUG),true) else CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE LDFLAGS = -s - #CFLAGS += -nostdinc -I/home/andersen/apps/newlib/src/newlib/libc/include -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE - #LDFLAGS = -nostdlib -s -L/home/andersen/apps/newlib/src/newlib/libc.a STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) #Only staticly link when _not_ debugging ifeq ($(DOSTATIC),true) @@ -47,6 +47,39 @@ for GNU libc to be so big. I'm sure it can be a lot better. (BTW, this is more informative if BB_FEATURE_NFSMOUNT is turned off...) +Most wanted list: + + [andersen@slag busybox]$ grep -l getgroups *.[ch] + test.c + +Policy violation. getgroups uses libc nss, which is unlikely +to be present in an embedded system. + + [andersen@slag busybox]$ grep -l getopt *.[ch] + dmesg.c + gunzip.c + hostname.c + mkfs_minix.c + printf.c + sfdisk.c + + This includes the symbols: + getopt_long + optarg + opterr + optind + +To be replaced with a non-getopt parser. + + [andersen@slag busybox]$ grep -l glob *.[ch] + gunzip.c + gzip.c + sh.c + tar.c + telnet.c + +Can check_wildcard_match() from utility.c do this job? + ----------------------- diff --git a/busybox.def.h b/busybox.def.h index 86b8059cb..5187bc506 100644 --- a/busybox.def.h +++ b/busybox.def.h @@ -63,7 +63,6 @@ #define BB_MNC #define BB_MORE #define BB_MOUNT -#define BB_NFSMOUNT #define BB_MT #define BB_NSLOOKUP #define BB_PING @@ -185,6 +184,9 @@ // Enable support for remounting filesystems #define BB_FEATURE_REMOUNT // +// Enable support for mounting remote NFS volumes +//#define BB_FEATURE_NFSMOUNT +// // Enable support for creation of tar files. #define BB_FEATURE_TAR_CREATE // @@ -253,3 +255,7 @@ #endif #endif // +#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT +#define BB_NFSMOUNT +#endif +// diff --git a/coreutils/tr.c b/coreutils/tr.c index 079c252d3..ebb64799f 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c @@ -2,8 +2,10 @@ /* * Mini tr implementation for busybox * - * This version of tr is adapted from Minix tr - * Author: Michiel Huisjes + * Copyright (c) Michiel Huisjes + * + * This version of tr is adapted from Minix tr and was modified + * by Erik Andersen <andersee@debian.org> to be used in busybox. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 5c3fea13f..f9d3f286a 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c @@ -29,16 +29,15 @@ static const char whoami_usage[] = "whoami\n\n" extern int whoami_main(int argc, char **argv) { - struct passwd *pw; - uid_t uid; + char *user = xmalloc(9); + uid_t uid = geteuid(); if (argc > 1) usage(whoami_usage); - uid = geteuid(); - pw = getpwuid(uid); - if (pw) { - puts(pw->pw_name); + my_getpwuid(user, uid); + if (user) { + puts(user); exit(TRUE); } fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0], @@ -25,6 +25,7 @@ #define utmp new_utmp #endif + static const char dutmp_usage[] = "dutmp [FILE]\n\n" "Dump utmp file format (pipe delimited) from FILE\n" "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; diff --git a/miscutils/dutmp.c b/miscutils/dutmp.c index 886d7880d..192871f1e 100644 --- a/miscutils/dutmp.c +++ b/miscutils/dutmp.c @@ -25,6 +25,7 @@ #define utmp new_utmp #endif + static const char dutmp_usage[] = "dutmp [FILE]\n\n" "Dump utmp file format (pipe delimited) from FILE\n" "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; diff --git a/networking/nslookup.c b/networking/nslookup.c index 3223b3b63..e4bf52f80 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -135,7 +135,7 @@ static struct hostent *hostent_fprint(struct hostent *host, FILE * dst) fprintf(dst, "Name: %s\n", host->h_name); addr_list_fprint(host->h_addr_list, dst); } else { - fprintf(dst, "*** %s\n", hstrerror(h_errno)); + fprintf(dst, "*** Unknown host\n"); } return host; } @@ -173,4 +173,4 @@ int nslookup_main(int argc, char **argv) exit( TRUE); } -/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */ +/* $Id: nslookup.c,v 1.8 2000/05/02 00:07:56 erik Exp $ */ diff --git a/nslookup.c b/nslookup.c index 3223b3b63..e4bf52f80 100644 --- a/nslookup.c +++ b/nslookup.c @@ -135,7 +135,7 @@ static struct hostent *hostent_fprint(struct hostent *host, FILE * dst) fprintf(dst, "Name: %s\n", host->h_name); addr_list_fprint(host->h_addr_list, dst); } else { - fprintf(dst, "*** %s\n", hstrerror(h_errno)); + fprintf(dst, "*** Unknown host\n"); } return host; } @@ -173,4 +173,4 @@ int nslookup_main(int argc, char **argv) exit( TRUE); } -/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */ +/* $Id: nslookup.c,v 1.8 2000/05/02 00:07:56 erik Exp $ */ @@ -2,8 +2,10 @@ /* * Mini tr implementation for busybox * - * This version of tr is adapted from Minix tr - * Author: Michiel Huisjes + * Copyright (c) Michiel Huisjes + * + * This version of tr is adapted from Minix tr and was modified + * by Erik Andersen <andersee@debian.org> to be used in busybox. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1037,15 +1037,6 @@ extern int replace_match(char *haystack, char *needle, char *newNeedle, while (where != NULL) { foundOne++; strcpy(oldhayStack, haystack); -#if 0 - if (strlen(newNeedle) > strlen(needle)) { - haystack = - (char *) realloc(haystack, - (unsigned) (strlen(haystack) - - strlen(needle) + - strlen(newNeedle))); - } -#endif for (slider = haystack, slider1 = oldhayStack; slider != where; slider++, slider1++); *slider = 0; @@ -29,16 +29,15 @@ static const char whoami_usage[] = "whoami\n\n" extern int whoami_main(int argc, char **argv) { - struct passwd *pw; - uid_t uid; + char *user = xmalloc(9); + uid_t uid = geteuid(); if (argc > 1) usage(whoami_usage); - uid = geteuid(); - pw = getpwuid(uid); - if (pw) { - puts(pw->pw_name); + my_getpwuid(user, uid); + if (user) { + puts(user); exit(TRUE); } fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0], |