aboutsummaryrefslogtreecommitdiff
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 @@
16 * tail can now accept -<num> commands (e.g. -10) for better 16 * tail can now accept -<num> commands (e.g. -10) for better
17 compatibility with the standard tail command 17 compatibility with the standard tail command
18 * added a simple id implementation; doesn't support supp. groups yet 18 * added a simple id implementation; doesn't support supp. groups yet
19 * logname used getlogin(3), which uses utmp under the hood. Now it behaves. 19 * logname used getlogin(3) which uses utmp under the hood. Now it behaves.
20 * whoami used getpwuid(3) which uses libc NSS. Now it behaves.
20 * Due to the license change, I can now use minix code. Minux tr replaces 21 * Due to the license change, I can now use minix code. Minux tr replaces
21 the BSD derived tr, saving 4k and eliminating bsearch(3) from the 22 the BSD derived tr, saving 4k and eliminating bsearch(3) from the
22 list of used Libc symbols. 23 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)
68 STRIPTOOL = strip 68 STRIPTOOL = strip
69endif 69endif
70 70
71#also to try -- use --prefix=/usr/my-libc2.0.7-stuff 71# TODO: Try compiling vs other libcs. See what -nostdinc and -nostdlib do for that.
72# also try --prefix=/usr/my-libc-stuff
72 73
73# -D_GNU_SOURCE is needed because environ is used in init.c 74# -D_GNU_SOURCE is needed because environ is used in init.c
74ifeq ($(DODEBUG),true) 75ifeq ($(DODEBUG),true)
@@ -78,8 +79,6 @@ ifeq ($(DODEBUG),true)
78else 79else
79 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE 80 CFLAGS += -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
80 LDFLAGS = -s 81 LDFLAGS = -s
81 #CFLAGS += -nostdinc -I/home/andersen/apps/newlib/src/newlib/libc/include -Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
82 #LDFLAGS = -nostdlib -s -L/home/andersen/apps/newlib/src/newlib/libc.a
83 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG) 82 STRIP = $(STRIPTOOL) --remove-section=.note --remove-section=.comment $(PROG)
84 #Only staticly link when _not_ debugging 83 #Only staticly link when _not_ debugging
85 ifeq ($(DOSTATIC),true) 84 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.
47 47
48(BTW, this is more informative if BB_FEATURE_NFSMOUNT is turned off...) 48(BTW, this is more informative if BB_FEATURE_NFSMOUNT is turned off...)
49 49
50Most wanted list:
51
52 [andersen@slag busybox]$ grep -l getgroups *.[ch]
53 test.c
54
55Policy violation. getgroups uses libc nss, which is unlikely
56to be present in an embedded system.
57
58 [andersen@slag busybox]$ grep -l getopt *.[ch]
59 dmesg.c
60 gunzip.c
61 hostname.c
62 mkfs_minix.c
63 printf.c
64 sfdisk.c
65
66 This includes the symbols:
67 getopt_long
68 optarg
69 opterr
70 optind
71
72To be replaced with a non-getopt parser.
73
74 [andersen@slag busybox]$ grep -l glob *.[ch]
75 gunzip.c
76 gzip.c
77 sh.c
78 tar.c
79 telnet.c
80
81Can check_wildcard_match() from utility.c do this job?
82
50 83
51----------------------- 84-----------------------
52 85
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 @@
63#define BB_MNC 63#define BB_MNC
64#define BB_MORE 64#define BB_MORE
65#define BB_MOUNT 65#define BB_MOUNT
66#define BB_NFSMOUNT
67#define BB_MT 66#define BB_MT
68#define BB_NSLOOKUP 67#define BB_NSLOOKUP
69#define BB_PING 68#define BB_PING
@@ -185,6 +184,9 @@
185// Enable support for remounting filesystems 184// Enable support for remounting filesystems
186#define BB_FEATURE_REMOUNT 185#define BB_FEATURE_REMOUNT
187// 186//
187// Enable support for mounting remote NFS volumes
188//#define BB_FEATURE_NFSMOUNT
189//
188// Enable support for creation of tar files. 190// Enable support for creation of tar files.
189#define BB_FEATURE_TAR_CREATE 191#define BB_FEATURE_TAR_CREATE
190// 192//
@@ -253,3 +255,7 @@
253#endif 255#endif
254#endif 256#endif
255// 257//
258#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
259#define BB_NFSMOUNT
260#endif
261//
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 @@
2/* 2/*
3 * Mini tr implementation for busybox 3 * Mini tr implementation for busybox
4 * 4 *
5 * This version of tr is adapted from Minix tr 5 * Copyright (c) Michiel Huisjes
6 * Author: Michiel Huisjes 6 *
7 * This version of tr is adapted from Minix tr and was modified
8 * by Erik Andersen <andersee@debian.org> to be used in busybox.
7 * 9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * 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"
29 29
30extern int whoami_main(int argc, char **argv) 30extern int whoami_main(int argc, char **argv)
31{ 31{
32 struct passwd *pw; 32 char *user = xmalloc(9);
33 uid_t uid; 33 uid_t uid = geteuid();
34 34
35 if (argc > 1) 35 if (argc > 1)
36 usage(whoami_usage); 36 usage(whoami_usage);
37 37
38 uid = geteuid(); 38 my_getpwuid(user, uid);
39 pw = getpwuid(uid); 39 if (user) {
40 if (pw) { 40 puts(user);
41 puts(pw->pw_name);
42 exit(TRUE); 41 exit(TRUE);
43 } 42 }
44 fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0], 43 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 @@
25#define utmp new_utmp 25#define utmp new_utmp
26#endif 26#endif
27 27
28
28static const char dutmp_usage[] = "dutmp [FILE]\n\n" 29static const char dutmp_usage[] = "dutmp [FILE]\n\n"
29 "Dump utmp file format (pipe delimited) from FILE\n" 30 "Dump utmp file format (pipe delimited) from FILE\n"
30 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; 31 "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 @@
25#define utmp new_utmp 25#define utmp new_utmp
26#endif 26#endif
27 27
28
28static const char dutmp_usage[] = "dutmp [FILE]\n\n" 29static const char dutmp_usage[] = "dutmp [FILE]\n\n"
29 "Dump utmp file format (pipe delimited) from FILE\n" 30 "Dump utmp file format (pipe delimited) from FILE\n"
30 "or stdin to stdout. (i.e. 'dutmp /var/run/utmp')\n"; 31 "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)
135 fprintf(dst, "Name: %s\n", host->h_name); 135 fprintf(dst, "Name: %s\n", host->h_name);
136 addr_list_fprint(host->h_addr_list, dst); 136 addr_list_fprint(host->h_addr_list, dst);
137 } else { 137 } else {
138 fprintf(dst, "*** %s\n", hstrerror(h_errno)); 138 fprintf(dst, "*** Unknown host\n");
139 } 139 }
140 return host; 140 return host;
141} 141}
@@ -173,4 +173,4 @@ int nslookup_main(int argc, char **argv)
173 exit( TRUE); 173 exit( TRUE);
174} 174}
175 175
176/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */ 176/* $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)
135 fprintf(dst, "Name: %s\n", host->h_name); 135 fprintf(dst, "Name: %s\n", host->h_name);
136 addr_list_fprint(host->h_addr_list, dst); 136 addr_list_fprint(host->h_addr_list, dst);
137 } else { 137 } else {
138 fprintf(dst, "*** %s\n", hstrerror(h_errno)); 138 fprintf(dst, "*** Unknown host\n");
139 } 139 }
140 return host; 140 return host;
141} 141}
@@ -173,4 +173,4 @@ int nslookup_main(int argc, char **argv)
173 exit( TRUE); 173 exit( TRUE);
174} 174}
175 175
176/* $Id: nslookup.c,v 1.7 2000/04/15 16:34:54 erik Exp $ */ 176/* $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 @@
2/* 2/*
3 * Mini tr implementation for busybox 3 * Mini tr implementation for busybox
4 * 4 *
5 * This version of tr is adapted from Minix tr 5 * Copyright (c) Michiel Huisjes
6 * Author: Michiel Huisjes 6 *
7 * This version of tr is adapted from Minix tr and was modified
8 * by Erik Andersen <andersee@debian.org> to be used in busybox.
7 * 9 *
8 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 11 * 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,
1037 while (where != NULL) { 1037 while (where != NULL) {
1038 foundOne++; 1038 foundOne++;
1039 strcpy(oldhayStack, haystack); 1039 strcpy(oldhayStack, haystack);
1040#if 0
1041 if (strlen(newNeedle) > strlen(needle)) {
1042 haystack =
1043 (char *) realloc(haystack,
1044 (unsigned) (strlen(haystack) -
1045 strlen(needle) +
1046 strlen(newNeedle)));
1047 }
1048#endif
1049 for (slider = haystack, slider1 = oldhayStack; slider != where; 1040 for (slider = haystack, slider1 = oldhayStack; slider != where;
1050 slider++, slider1++); 1041 slider++, slider1++);
1051 *slider = 0; 1042 *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"
29 29
30extern int whoami_main(int argc, char **argv) 30extern int whoami_main(int argc, char **argv)
31{ 31{
32 struct passwd *pw; 32 char *user = xmalloc(9);
33 uid_t uid; 33 uid_t uid = geteuid();
34 34
35 if (argc > 1) 35 if (argc > 1)
36 usage(whoami_usage); 36 usage(whoami_usage);
37 37
38 uid = geteuid(); 38 my_getpwuid(user, uid);
39 pw = getpwuid(uid); 39 if (user) {
40 if (pw) { 40 puts(user);
41 puts(pw->pw_name);
42 exit(TRUE); 41 exit(TRUE);
43 } 42 }
44 fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0], 43 fprintf(stderr, "%s: cannot find username for UID %u\n", argv[0],