updates for the day

This commit is contained in:
Eric Andersen 1999-11-13 04:47:09 +00:00
parent eded54bd96
commit b6a44b8d39
13 changed files with 65 additions and 45 deletions

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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) {

2
dd.c
View File

@ -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) {

30
init.c
View File

@ -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
}

View File

@ -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
}

14
mnc.c
View File

@ -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);

View File

@ -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)

1
tar.c
View File

@ -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);

View File

@ -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 )

View File

@ -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 )

View File

@ -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 = '/';
}
}