* 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.
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)
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)
(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?
+
-----------------------
#define BB_MNC
#define BB_MORE
#define BB_MOUNT
-#define BB_NFSMOUNT
#define BB_MT
#define BB_NSLOOKUP
#define BB_PING
// 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
//
#endif
#endif
//
+#if defined BB_MOUNT && defined BB_FEATURE_NFSMOUNT
+#define BB_NFSMOUNT
+#endif
+//
/*
* 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
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],
#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";
#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";
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;
}
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 $ */
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;
}
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 $ */
/*
* 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
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;
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],