summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Changelog3
-rw-r--r--Makefile5
-rw-r--r--TODO33
-rw-r--r--busybox.def.h8
-rw-r--r--coreutils/tr.c6
-rw-r--r--coreutils/whoami.c11
-rw-r--r--dutmp.c1
-rw-r--r--miscutils/dutmp.c1
-rw-r--r--networking/nslookup.c4
-rw-r--r--nslookup.c4
-rw-r--r--tr.c6
-rw-r--r--utility.c9
-rw-r--r--whoami.c11
13 files changed, 68 insertions, 34 deletions
diff --git a/Changelog b/Changelog
index 4580efc2b..aed8c14d7 100644
--- a/Changelog
+++ b/Changelog
@@ -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.
diff --git a/Makefile b/Makefile
index 7a0752e58..bf42e585c 100644
--- a/Makefile
+++ b/Makefile
@@ -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)
diff --git a/TODO b/TODO
index 15e9b30ad..909f8c51c 100644
--- a/TODO
+++ b/TODO
@@ -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],
diff --git a/dutmp.c b/dutmp.c
index 886d7880d..192871f1e 100644
--- a/dutmp.c
+++ b/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/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 $ */
diff --git a/tr.c b/tr.c
index 079c252d3..ebb64799f 100644
--- a/tr.c
+++ b/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/utility.c b/utility.c
index 51c51333c..b33b3c0b4 100644
--- a/utility.c
+++ b/utility.c
@@ -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;
diff --git a/whoami.c b/whoami.c
index 5c3fea13f..f9d3f286a 100644
--- a/whoami.c
+++ b/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],