aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog14
-rw-r--r--Makefile4
-rw-r--r--TODO38
-rw-r--r--applets/busybox.c3
-rw-r--r--archival/tar.c6
-rw-r--r--busybox.c3
-rw-r--r--busybox.def.h2
-rw-r--r--busybox.spec2
-rw-r--r--coreutils/tail.c2
-rw-r--r--examples/busybox.spec2
-rw-r--r--init.c10
-rw-r--r--init/init.c10
-rw-r--r--internal.h1
-rw-r--r--networking/nslookup.c16
-rw-r--r--nslookup.c16
-rw-r--r--sysklogd/syslogd.c22
-rw-r--r--syslogd.c22
-rw-r--r--tail.c2
-rw-r--r--tar.c6
19 files changed, 128 insertions, 53 deletions
diff --git a/Changelog b/Changelog
index 68a11015b..98e82df5c 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,17 @@
+0.43
+ * Wrote basename
+ * tar wouldn't create directory entries that don't end in '/',
+ now it does (fix thanks to Avery Pennarun <apenwarr@worldvisions.ca>)
+ * Several fixes from Pavel Roskin <pavel_roskin@geocities.com>:
+ - When `tail' fails to open a file it now exits.
+ - When `syslogd' is given the `-n' option it should still use
+ fork() for running klogd.
+ * nslookup types are now changed to u_int32_t (instead of uint32_t)
+ changed per a patch from Pascal Bellard <pascal.bellard@ascend.com>
+
+ -Erik Andersen
+
+
0.42
* Fairly massive restructuring of umount.c to deal with remounting
diff --git a/Makefile b/Makefile
index 10b76ee43..8a71beb94 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@
#
# PROG := busybox
-VERSION := 0.42
+VERSION := 0.43
BUILDTIME := $(shell TZ=GMT date "+%Y%m%d-%H%M")
# Set the following to `true' to make a debuggable build.
@@ -89,7 +89,7 @@ ifndef $(PREFIX)
endif
LIBRARIES =
-OBJECTS = $(shell ./busybox.sh) messages.o utility.o
+OBJECTS = $(shell ./busybox.sh) busybox.o messages.o utility.o
CFLAGS += -DBB_VER='"$(VERSION)"'
CFLAGS += -DBB_BT='"$(BUILDTIME)"'
ifdef BB_INIT_SCRIPT
diff --git a/TODO b/TODO
index b6f565f09..bcba2948c 100644
--- a/TODO
+++ b/TODO
@@ -24,10 +24,29 @@ around to it some time. If you have any good ideas, please let me know.
* killall
* stty
* tr
+* cut
* expr (maybe?) (ash builtin?)
+-----------------------
+
+
+busybox.defs.h is too big and hard to follow.
+
+I either need to add a better build system (like the Linux kernel?)
+or I need to split up busybox.defs.h into coherent chunks (i.e.
+busybox.defs.h just has a bunch of:
+
+#include "fileutils.h"
+#include "shellutils.h"
+
+which would then have smaller sets of #defines...
+Hmm. Needs to be carefully thought out.
+
+-----------------------
+
+
Some known bugs, todo items, etc...
@@ -67,3 +86,22 @@ think???)
There is no exclude file(s) option to tar. LRP's packaging system can not
function without this. Will you have the time to add this soon?
+
+-----------------------
+
+
+/bin/busybox --install -s which makes all links to commands that it
+ can support (an optionnal -s should be used for symbolic links instead
+ of hard links).
+
+-----------------------
+
+cd /mnt
+mkdir BACKUP
+mv * BACKUP
+
+Today, "mv" behaved as a cp -a and my disk becomed full. It does not
+work properly either when renaming a directory into something else
+(it produces a lot of disk activity when doing this).
+
+
diff --git a/applets/busybox.c b/applets/busybox.c
index 8bbe6a22e..a013f8ca1 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -37,6 +37,9 @@ void *__libc_stack_end;
static const struct Applet applets[] = {
+#ifdef BB_BASENAME //usr/bin/basename
+ {"basename", basename_main},
+#endif
#ifdef BB_BUSYBOX //bin
{"busybox", busybox_main},
#endif
diff --git a/archival/tar.c b/archival/tar.c
index 87b5d2176..8f802de64 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -596,6 +596,12 @@ readHeader(const TarHeader * hp, int fileCount, char **fileTable)
*/
if (S_ISDIR(mode)) {
if (createPath(outName, mode) == TRUE) {
+ /* make the final component, just in case it was
+ * omitted by createPath() (which will skip the
+ * directory if it doesn't have a terminating '/')
+ */
+ mkdir(outName, mode);
+
/* Set the file time */
utb.actime = mtime;
utb.modtime = mtime;
diff --git a/busybox.c b/busybox.c
index 8bbe6a22e..a013f8ca1 100644
--- a/busybox.c
+++ b/busybox.c
@@ -37,6 +37,9 @@ void *__libc_stack_end;
static const struct Applet applets[] = {
+#ifdef BB_BASENAME //usr/bin/basename
+ {"basename", basename_main},
+#endif
#ifdef BB_BUSYBOX //bin
{"busybox", busybox_main},
#endif
diff --git a/busybox.def.h b/busybox.def.h
index e2f5dd391..e531f1fed 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -7,7 +7,7 @@
//
//
// BusyBox Applications
-#define BB_BUSYBOX
+//#define BB_BASENAME
#define BB_CAT
#define BB_CHMOD_CHOWN_CHGRP
#define BB_CHROOT
diff --git a/busybox.spec b/busybox.spec
index 03e4feb36..dc03da004 100644
--- a/busybox.spec
+++ b/busybox.spec
@@ -1,5 +1,5 @@
Name: busybox
-Version: 0.42
+Version: 0.43
Release: 1
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 821244f9e..5e05fe8e7 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -330,7 +330,7 @@ static int tail_file(const char *filename, off_t n_units)
/* Not standard input. */
fd = open(filename, O_RDONLY);
if (fd == -1)
- errorMsg("open error");
+ fatalError("open error");
errors = tail_lines(filename, fd, (long) n_units);
close(fd);
diff --git a/examples/busybox.spec b/examples/busybox.spec
index 03e4feb36..dc03da004 100644
--- a/examples/busybox.spec
+++ b/examples/busybox.spec
@@ -1,5 +1,5 @@
Name: busybox
-Version: 0.42
+Version: 0.43
Release: 1
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
diff --git a/init.c b/init.c
index b59e9a147..a3e165ecc 100644
--- a/init.c
+++ b/init.c
@@ -118,7 +118,7 @@ initAction *initActionList = NULL;
static char *secondConsole = VT_SECONDARY;
static char *log = VT_LOG;
static int kernelVersion = 0;
-static char termType[32] = "TERM=ansi";
+static char termType[32] = "TERM=linux";
static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action);
@@ -314,6 +314,8 @@ static void console_init()
if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
log = NULL;
secondConsole = NULL;
+ /* Force the TERM setting to vt102 for serial console */
+ snprintf(termType, sizeof(termType) - 1, "TERM=vt102");
message(LOG | CONSOLE,
"serial console detected. Disabling virtual terminals.\r\n");
}
@@ -839,11 +841,11 @@ extern int init_main(int argc, char **argv)
/* Hello world */
#ifndef DEBUG_INIT
- message(LOG | CONSOLE,
+ message(LOG,
"init started: BusyBox v%s (%s) multi-call binary\r\n",
BB_VER, BB_BT);
#else
- message(LOG | CONSOLE,
+ message(LOG,
"init(%d) started: BusyBox v%s (%s) multi-call binary\r\n",
getpid(), BB_VER, BB_BT);
#endif
@@ -851,7 +853,7 @@ extern int init_main(int argc, char **argv)
/* Mount /proc */
if (mount("proc", "/proc", "proc", 0, 0) == 0) {
- message(LOG | CONSOLE, "Mounting /proc: done.\n");
+ message(LOG, "Mounting /proc: done.\n");
kernelVersion = get_kernel_revision();
} else
message(LOG | CONSOLE, "Mounting /proc: failed!\n");
diff --git a/init/init.c b/init/init.c
index b59e9a147..a3e165ecc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -118,7 +118,7 @@ initAction *initActionList = NULL;
static char *secondConsole = VT_SECONDARY;
static char *log = VT_LOG;
static int kernelVersion = 0;
-static char termType[32] = "TERM=ansi";
+static char termType[32] = "TERM=linux";
static char console[32] = _PATH_CONSOLE;
static void delete_initAction(initAction * action);
@@ -314,6 +314,8 @@ static void console_init()
if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
log = NULL;
secondConsole = NULL;
+ /* Force the TERM setting to vt102 for serial console */
+ snprintf(termType, sizeof(termType) - 1, "TERM=vt102");
message(LOG | CONSOLE,
"serial console detected. Disabling virtual terminals.\r\n");
}
@@ -839,11 +841,11 @@ extern int init_main(int argc, char **argv)
/* Hello world */
#ifndef DEBUG_INIT
- message(LOG | CONSOLE,
+ message(LOG,
"init started: BusyBox v%s (%s) multi-call binary\r\n",
BB_VER, BB_BT);
#else
- message(LOG | CONSOLE,
+ message(LOG,
"init(%d) started: BusyBox v%s (%s) multi-call binary\r\n",
getpid(), BB_VER, BB_BT);
#endif
@@ -851,7 +853,7 @@ extern int init_main(int argc, char **argv)
/* Mount /proc */
if (mount("proc", "/proc", "proc", 0, 0) == 0) {
- message(LOG | CONSOLE, "Mounting /proc: done.\n");
+ message(LOG, "Mounting /proc: done.\n");
kernelVersion = get_kernel_revision();
} else
message(LOG | CONSOLE, "Mounting /proc: failed!\n");
diff --git a/internal.h b/internal.h
index c2e77d4ab..5b71560c5 100644
--- a/internal.h
+++ b/internal.h
@@ -57,6 +57,7 @@ struct Applet {
int (*main)(int argc, char** argv);
};
+extern int basename_main(int argc, char **argv);
extern int busybox_main(int argc, char** argv);
extern int block_device_main(int argc, char** argv);
extern int cat_main(int argc, char** argv);
diff --git a/networking/nslookup.c b/networking/nslookup.c
index ffa720174..e2d8cea1f 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -58,9 +58,9 @@ static void server_fprint(FILE * dst)
/* only works for IPv4 */
static int addr_fprint(char *addr, FILE * dst)
{
- uint8_t split[4];
- uint32_t ip;
- uint32_t *x = (uint32_t *) addr;
+ u_int8_t split[4];
+ u_int32_t ip;
+ u_int32_t *x = (u_int32_t *) addr;
ip = ntohl(*x);
split[0] = (ip & 0xff000000) >> 24;
@@ -73,12 +73,12 @@ static int addr_fprint(char *addr, FILE * dst)
}
/* changes a c-string matching the perl regex \d+\.\d+\.\d+\.\d+
- * into a uint32_t
+ * into a u_int32_t
*/
-static uint32_t str_to_addr(const char *addr)
+static u_int32_t str_to_addr(const char *addr)
{
- uint32_t split[4];
- uint32_t ip;
+ u_int32_t split[4];
+ u_int32_t ip;
sscanf(addr, "%d.%d.%d.%d",
&split[0], &split[1], &split[2], &split[3]);
@@ -174,4 +174,4 @@ int nslookup_main(int argc, char **argv)
return 0;
}
-/* $Id: nslookup.c,v 1.4 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */
diff --git a/nslookup.c b/nslookup.c
index ffa720174..e2d8cea1f 100644
--- a/nslookup.c
+++ b/nslookup.c
@@ -58,9 +58,9 @@ static void server_fprint(FILE * dst)
/* only works for IPv4 */
static int addr_fprint(char *addr, FILE * dst)
{
- uint8_t split[4];
- uint32_t ip;
- uint32_t *x = (uint32_t *) addr;
+ u_int8_t split[4];
+ u_int32_t ip;
+ u_int32_t *x = (u_int32_t *) addr;
ip = ntohl(*x);
split[0] = (ip & 0xff000000) >> 24;
@@ -73,12 +73,12 @@ static int addr_fprint(char *addr, FILE * dst)
}
/* changes a c-string matching the perl regex \d+\.\d+\.\d+\.\d+
- * into a uint32_t
+ * into a u_int32_t
*/
-static uint32_t str_to_addr(const char *addr)
+static u_int32_t str_to_addr(const char *addr)
{
- uint32_t split[4];
- uint32_t ip;
+ u_int32_t split[4];
+ u_int32_t ip;
sscanf(addr, "%d.%d.%d.%d",
&split[0], &split[1], &split[2], &split[3]);
@@ -174,4 +174,4 @@ int nslookup_main(int argc, char **argv)
return 0;
}
-/* $Id: nslookup.c,v 1.4 2000/02/08 19:58:47 erik Exp $ */
+/* $Id: nslookup.c,v 1.5 2000/02/18 21:34:17 erik Exp $ */
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
index d39cd6a0d..3e35df15d 100644
--- a/sysklogd/syslogd.c
+++ b/sysklogd/syslogd.c
@@ -365,6 +365,17 @@ extern int syslogd_main(int argc, char **argv)
*p++ = '\0';
}
+#ifdef BB_KLOGD
+ /* Start up the klogd process */
+ if (startKlogd == TRUE) {
+ klogd_pid = fork();
+ if (klogd_pid == 0) {
+ strncpy(argv[0], "klogd", strlen(argv[0]));
+ doKlogd();
+ }
+ }
+#endif
+
if (doFork == TRUE) {
pid = fork();
if (pid < 0)
@@ -377,16 +388,5 @@ extern int syslogd_main(int argc, char **argv)
doSyslogd();
}
-#ifdef BB_KLOGD
- /* Start up the klogd process */
- if (startKlogd == TRUE) {
- klogd_pid = fork();
- if (klogd_pid == 0) {
- strncpy(argv[0], "klogd", strlen(argv[0]));
- doKlogd();
- }
- }
-#endif
-
exit(TRUE);
}
diff --git a/syslogd.c b/syslogd.c
index d39cd6a0d..3e35df15d 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -365,6 +365,17 @@ extern int syslogd_main(int argc, char **argv)
*p++ = '\0';
}
+#ifdef BB_KLOGD
+ /* Start up the klogd process */
+ if (startKlogd == TRUE) {
+ klogd_pid = fork();
+ if (klogd_pid == 0) {
+ strncpy(argv[0], "klogd", strlen(argv[0]));
+ doKlogd();
+ }
+ }
+#endif
+
if (doFork == TRUE) {
pid = fork();
if (pid < 0)
@@ -377,16 +388,5 @@ extern int syslogd_main(int argc, char **argv)
doSyslogd();
}
-#ifdef BB_KLOGD
- /* Start up the klogd process */
- if (startKlogd == TRUE) {
- klogd_pid = fork();
- if (klogd_pid == 0) {
- strncpy(argv[0], "klogd", strlen(argv[0]));
- doKlogd();
- }
- }
-#endif
-
exit(TRUE);
}
diff --git a/tail.c b/tail.c
index 821244f9e..5e05fe8e7 100644
--- a/tail.c
+++ b/tail.c
@@ -330,7 +330,7 @@ static int tail_file(const char *filename, off_t n_units)
/* Not standard input. */
fd = open(filename, O_RDONLY);
if (fd == -1)
- errorMsg("open error");
+ fatalError("open error");
errors = tail_lines(filename, fd, (long) n_units);
close(fd);
diff --git a/tar.c b/tar.c
index 87b5d2176..8f802de64 100644
--- a/tar.c
+++ b/tar.c
@@ -596,6 +596,12 @@ readHeader(const TarHeader * hp, int fileCount, char **fileTable)
*/
if (S_ISDIR(mode)) {
if (createPath(outName, mode) == TRUE) {
+ /* make the final component, just in case it was
+ * omitted by createPath() (which will skip the
+ * directory if it doesn't have a terminating '/')
+ */
+ mkdir(outName, mode);
+
/* Set the file time */
utb.actime = mtime;
utb.modtime = mtime;