summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen1999-11-13 04:47:09 +0000
committerEric Andersen1999-11-13 04:47:09 +0000
commitb6a44b8d39b7834ab9f6c43938f4b58f135e846e (patch)
treed9bd903d4e30ea4faf1977a514853c5aac83690c
parenteded54bd96ed0394844f9ba23c5ab54dff8a917f (diff)
downloadbusybox-b6a44b8d39b7834ab9f6c43938f4b58f135e846e.zip
busybox-b6a44b8d39b7834ab9f6c43938f4b58f135e846e.tar.gz
updates for the day
-rw-r--r--Changelog12
-rw-r--r--archival/tar.c1
-rw-r--r--busybox.def.h6
-rw-r--r--coreutils/dd.c2
-rw-r--r--dd.c2
-rw-r--r--init.c30
-rw-r--r--init/init.c30
-rw-r--r--mnc.c14
-rw-r--r--regexp.c2
-rw-r--r--tar.c1
-rw-r--r--umount.c2
-rw-r--r--util-linux/umount.c2
-rw-r--r--utility.c6
13 files changed, 65 insertions, 45 deletions
diff --git a/Changelog b/Changelog
index f94855e..0f8cec9 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,15 @@
+0.36
+ * fixed dd so it properly defaults to stdin and stdout when no
+ if= and of= are set (fix thanks to Eric Delaunay).
+ * Don't try to close the file descriptor of a pipe. (fix also from
+ Eric Delaunay).
+ * Made createPath be quiet (again thanks to Eric Delaunay).
+ * If BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS is defined, then whatever
+ command you define it as will be run if the init script exits.
+ * Made createPath be quiet (again thanks to Eric Delaunay).
+
+ -Erik Andersen
+
0.35
* gzip now obeys the principle of least surprise and acts like god intended
(i.e. it accepts a file name, answers --help, and obeys the '-c' flag
diff --git a/archival/tar.c b/archival/tar.c
index 5478af8..1fdbf8c 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -559,6 +559,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
outFd = mknod (name, mode, makedev(major, minor) );
}
else if (S_ISFIFO(mode) ) {
+ devFileFlag = TRUE;
outFd = mkfifo(name, mode);
} else {
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
diff --git a/busybox.def.h b/busybox.def.h
index 5896861..6e2b818 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -17,7 +17,7 @@
//#define BB_FDFLUSH
#define BB_FIND
#define BB_FSCK_MINIX
-//#define BB_MKFS_MINIX
+#define BB_MKFS_MINIX
#define BB_CHVT
#define BB_DEALLOCVT
#define BB_GREP
@@ -34,7 +34,7 @@
#define BB_MKDIR
#define BB_MKNOD
#define BB_MKSWAP
-//#define BB_MNC
+#define BB_MNC
#define BB_MORE
#define BB_MOUNT
//#define BB_MT
@@ -54,7 +54,7 @@
#define BB_SYNC
#define BB_TAR
#define BB_TOUCH
-//#define BB_TRUE_FALSE // Supplied by ash
+#define BB_TRUE_FALSE
#define BB_UMOUNT
#define BB_UPDATE
#define BB_UNAME
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 800ed59..9468cdd 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -152,8 +152,6 @@ extern int dd_main (int argc, char **argv)
argc--;
argv++;
}
- if ( inFile == NULL || outFile == NULL)
- goto usage;
buf = malloc (blockSize);
if (buf == NULL) {
diff --git a/dd.c b/dd.c
index 800ed59..9468cdd 100644
--- a/dd.c
+++ b/dd.c
@@ -152,8 +152,6 @@ extern int dd_main (int argc, char **argv)
argc--;
argv++;
}
- if ( inFile == NULL || outFile == NULL)
- goto usage;
buf = malloc (blockSize);
if (buf == NULL) {
diff --git a/init.c b/init.c
index e70d5a1..a3e8d67 100644
--- a/init.c
+++ b/init.c
@@ -417,10 +417,14 @@ extern int init_main(int argc, char **argv)
pid_t pid1 = 0;
pid_t pid2 = 0;
struct stat statbuf;
- const char* const init_commands[] = { INITSCRIPT, INITSCRIPT, 0};
- const char* const shell_commands[] = { SHELL, "-" SHELL, 0};
- const char* const* tty0_commands = shell_commands;
- const char* const* tty1_commands = shell_commands;
+ const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0};
+ const char* const shell_command[] = { SHELL, "-" SHELL, 0};
+ const char* const* tty0_command = shell_command;
+ const char* const* tty1_command = shell_command;
+#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
+ const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS;
+#endif
+
#ifdef DEBUG_INIT
char *hello_msg_format =
"init(%d) started: BusyBox v%s (%s) multi-call binary\r\n";
@@ -493,7 +497,7 @@ extern int init_main(int argc, char **argv)
/* Make sure an init script exists before trying to run it */
if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) {
wait_for_enter = FALSE;
- tty0_commands = init_commands;
+ tty0_command = rc_script_command;
}
@@ -504,11 +508,11 @@ extern int init_main(int argc, char **argv)
pid_t wpid;
int status;
- if (pid1 == 0 && tty0_commands) {
- pid1 = run(tty0_commands, console, wait_for_enter);
+ if (pid1 == 0 && tty0_command) {
+ pid1 = run(tty0_command, console, wait_for_enter);
}
- if (pid2 == 0 && tty1_commands && second_console) {
- pid2 = run(tty1_commands, second_console, TRUE);
+ if (pid2 == 0 && tty1_command && second_console) {
+ pid2 = run(tty1_command, second_console, TRUE);
}
wpid = wait(&status);
if (wpid > 0 ) {
@@ -518,13 +522,13 @@ extern int init_main(int argc, char **argv)
if (wpid == pid1) {
if (run_rc == FALSE) {
pid1 = 0;
- }
-#if 0
-/* Turn this on to start a shell on the console if the init script exits.... */
+ }
+#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
else {
+ pid1 = 0;
run_rc=FALSE;
wait_for_enter=TRUE;
- tty0_commands=shell_commands;
+ tty0_command=rc_exit_command;
}
#endif
}
diff --git a/init/init.c b/init/init.c
index e70d5a1..a3e8d67 100644
--- a/init/init.c
+++ b/init/init.c
@@ -417,10 +417,14 @@ extern int init_main(int argc, char **argv)
pid_t pid1 = 0;
pid_t pid2 = 0;
struct stat statbuf;
- const char* const init_commands[] = { INITSCRIPT, INITSCRIPT, 0};
- const char* const shell_commands[] = { SHELL, "-" SHELL, 0};
- const char* const* tty0_commands = shell_commands;
- const char* const* tty1_commands = shell_commands;
+ const char* const rc_script_command[] = { INITSCRIPT, INITSCRIPT, 0};
+ const char* const shell_command[] = { SHELL, "-" SHELL, 0};
+ const char* const* tty0_command = shell_command;
+ const char* const* tty1_command = shell_command;
+#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
+ const char* const rc_exit_command[] = BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS;
+#endif
+
#ifdef DEBUG_INIT
char *hello_msg_format =
"init(%d) started: BusyBox v%s (%s) multi-call binary\r\n";
@@ -493,7 +497,7 @@ extern int init_main(int argc, char **argv)
/* Make sure an init script exists before trying to run it */
if (run_rc == TRUE && stat(INITSCRIPT, &statbuf)==0) {
wait_for_enter = FALSE;
- tty0_commands = init_commands;
+ tty0_command = rc_script_command;
}
@@ -504,11 +508,11 @@ extern int init_main(int argc, char **argv)
pid_t wpid;
int status;
- if (pid1 == 0 && tty0_commands) {
- pid1 = run(tty0_commands, console, wait_for_enter);
+ if (pid1 == 0 && tty0_command) {
+ pid1 = run(tty0_command, console, wait_for_enter);
}
- if (pid2 == 0 && tty1_commands && second_console) {
- pid2 = run(tty1_commands, second_console, TRUE);
+ if (pid2 == 0 && tty1_command && second_console) {
+ pid2 = run(tty1_command, second_console, TRUE);
}
wpid = wait(&status);
if (wpid > 0 ) {
@@ -518,13 +522,13 @@ extern int init_main(int argc, char **argv)
if (wpid == pid1) {
if (run_rc == FALSE) {
pid1 = 0;
- }
-#if 0
-/* Turn this on to start a shell on the console if the init script exits.... */
+ }
+#ifdef BB_CONSOLE_CMD_IF_RC_SCRIPT_EXITS
else {
+ pid1 = 0;
run_rc=FALSE;
wait_for_enter=TRUE;
- tty0_commands=shell_commands;
+ tty0_command=rc_exit_command;
}
#endif
}
diff --git a/mnc.c b/mnc.c
index a9e66be..81dfd25 100644
--- a/mnc.c
+++ b/mnc.c
@@ -40,8 +40,8 @@
#define BUFSIZE 100
static const char mnc_usage[] =
-"mini-netcat 0.0.3 -- Open pipe to IP:port\n"
-"\tmnc [IP] [port]\n";
+"mnc [IP] [port]\n\n"
+"mini-netcat opens a pipe to IP:port\n";
int
mnc_main(int argc, char **argv)
@@ -56,9 +56,15 @@ mnc_main(int argc, char **argv)
fd_set readfds, testfds;
+ if (argc<=1 || **(argv+1) == '-' ) {
+ usage( mnc_usage);
+ }
+ argc--;
+ argv++;
+
sfd = socket(AF_INET, SOCK_STREAM, 0);
- hostinfo = (struct hostent *) gethostbyname(argv[1]);
+ hostinfo = (struct hostent *) gethostbyname(*argv);
if (!hostinfo)
{
@@ -67,7 +73,7 @@ mnc_main(int argc, char **argv)
address.sin_family = AF_INET;
address.sin_addr = *(struct in_addr *) *hostinfo->h_addr_list;
- address.sin_port = htons(atoi(argv[2]));
+ address.sin_port = htons(atoi(*(++argv)));
len = sizeof(address);
diff --git a/regexp.c b/regexp.c
index fb01707..9f9b5c2 100644
--- a/regexp.c
+++ b/regexp.c
@@ -135,7 +135,7 @@ static char *retext; /* points to the text being compiled */
/* error-handling stuff */
jmp_buf errorhandler;
-#define FAIL(why) fprintf(stderr, why); longjmp(errorhandler, 1)
+#define FAIL(why) do {fprintf(stderr, why); longjmp(errorhandler, 1);} while (0)
diff --git a/tar.c b/tar.c
index 5478af8..1fdbf8c 100644
--- a/tar.c
+++ b/tar.c
@@ -559,6 +559,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
outFd = mknod (name, mode, makedev(major, minor) );
}
else if (S_ISFIFO(mode) ) {
+ devFileFlag = TRUE;
outFd = mkfifo(name, mode);
} else {
outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
diff --git a/umount.c b/umount.c
index 0d105d9..061bb9b 100644
--- a/umount.c
+++ b/umount.c
@@ -124,7 +124,7 @@ umount_main(int argc, char** argv)
}
- if(umountAll) {
+ if(umountAll==TRUE) {
exit(umount_all(useMtab));
}
if ( do_umount(*argv,useMtab) == 0 )
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 0d105d9..061bb9b 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -124,7 +124,7 @@ umount_main(int argc, char** argv)
}
- if(umountAll) {
+ if(umountAll==TRUE) {
exit(umount_all(useMtab));
}
if ( do_umount(*argv,useMtab) == 0 )
diff --git a/utility.c b/utility.c
index 77eb5f2..b4dd0cc 100644
--- a/utility.c
+++ b/utility.c
@@ -488,12 +488,8 @@ extern void createPath (const char *name, int mode)
while (cp) {
cpOld = cp;
cp = strchr (cp + 1, '/');
-
*cpOld = '\0';
-
- if (mkdir (buf, cp ? 0777 : mode) == 0)
- printf ("Directory \"%s\" created\n", buf);
-
+ mkdir (buf, cp ? 0777 : mode);
*cpOld = '/';
}
}