More stuff

This commit is contained in:
Eric Andersen 1999-10-16 15:48:40 +00:00
parent 3c163822d8
commit cb6e25655f
8 changed files with 48 additions and 60 deletions

View File

@ -16,7 +16,7 @@ ifeq ($(DODEBUG),true)
STRIP= STRIP=
LDFLAGS= LDFLAGS=
else else
CFLAGS=-Wall -O2 -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE CFLAGS=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
LDFLAGS= -s LDFLAGS= -s
STRIP= strip --remove-section=.note --remove-section=.comment busybox STRIP= strip --remove-section=.note --remove-section=.comment busybox
endif endif

View File

@ -8,7 +8,7 @@
#ifdef BB_GZIP #ifdef BB_GZIP
#ifndef BB_ZCAT #ifndef BB_ZCAT
error: you need zcat to have gzip support! #error you need zcat to have gzip support!
#endif #endif
const char gzip_usage[] = "gzip\nignores all command line arguments\ncompress stdin to stdout with -9 compression\n"; const char gzip_usage[] = "gzip\nignores all command line arguments\ncompress stdin to stdout with -9 compression\n";
@ -380,7 +380,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
# undef LZW # undef LZW
#endif #endif
/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ /* $Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $ */
/* tailor.h -- target dependent definitions /* tailor.h -- target dependent definitions
* Copyright (C) 1992-1993 Jean-loup Gailly. * Copyright (C) 1992-1993 Jean-loup Gailly.
* This is free software; you can redistribute it and/or modify it under the * This is free software; you can redistribute it and/or modify it under the
@ -391,7 +391,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
* The target dependent functions should be defined in tailor.c. * The target dependent functions should be defined in tailor.c.
*/ */
/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ /* $Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $ */
#if defined(__MSDOS__) && !defined(MSDOS) #if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS # define MSDOS
@ -767,7 +767,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
#endif #endif
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -976,7 +976,7 @@ void copy_block(buf, len, header)
#include <stdio.h> #include <stdio.h>
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -1592,7 +1592,7 @@ ulg deflate()
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>
@ -1925,7 +1925,7 @@ local void do_exit(int exitcode)
#include <ctype.h> #include <ctype.h>
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -2943,7 +2943,7 @@ local void set_file_type()
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>
@ -3142,7 +3142,7 @@ void display_ratio(num, den, file)
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>

View File

@ -52,4 +52,4 @@
//#define BB_UPDATE //#define BB_UPDATE
#define BB_UTILITY #define BB_UTILITY
#define BB_ZCAT #define BB_ZCAT
#define BB_GZIP //#define BB_GZIP

18
gzip.c
View File

@ -8,7 +8,7 @@
#ifdef BB_GZIP #ifdef BB_GZIP
#ifndef BB_ZCAT #ifndef BB_ZCAT
error: you need zcat to have gzip support! #error you need zcat to have gzip support!
#endif #endif
const char gzip_usage[] = "gzip\nignores all command line arguments\ncompress stdin to stdout with -9 compression\n"; const char gzip_usage[] = "gzip\nignores all command line arguments\ncompress stdin to stdout with -9 compression\n";
@ -380,7 +380,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
# undef LZW # undef LZW
#endif #endif
/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ /* $Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $ */
/* tailor.h -- target dependent definitions /* tailor.h -- target dependent definitions
* Copyright (C) 1992-1993 Jean-loup Gailly. * Copyright (C) 1992-1993 Jean-loup Gailly.
* This is free software; you can redistribute it and/or modify it under the * This is free software; you can redistribute it and/or modify it under the
@ -391,7 +391,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
* The target dependent functions should be defined in tailor.c. * The target dependent functions should be defined in tailor.c.
*/ */
/* $Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $ */ /* $Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $ */
#if defined(__MSDOS__) && !defined(MSDOS) #if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS # define MSDOS
@ -767,7 +767,7 @@ extern int block_mode; /* block compress mode -C compatible with 2.0 */
#endif #endif
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -976,7 +976,7 @@ void copy_block(buf, len, header)
#include <stdio.h> #include <stdio.h>
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -1592,7 +1592,7 @@ ulg deflate()
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>
@ -1925,7 +1925,7 @@ local void do_exit(int exitcode)
#include <ctype.h> #include <ctype.h>
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
/* =========================================================================== /* ===========================================================================
@ -2943,7 +2943,7 @@ local void set_file_type()
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>
@ -3142,7 +3142,7 @@ void display_ratio(num, den, file)
*/ */
#ifdef RCSID #ifdef RCSID
static char rcsid[] = "$Id: gzip.c,v 1.2 1999/10/06 20:25:32 andersen Exp $"; static char rcsid[] = "$Id: gzip.c,v 1.3 1999/10/16 15:48:40 andersen Exp $";
#endif #endif
#include <ctype.h> #include <ctype.h>

21
init.c
View File

@ -99,7 +99,7 @@ run(const char* program, const char* const* arguments,
}; };
static const char press_enter[] = static const char press_enter[] =
"Please press Enter to activate this console. "; "\nPlease press Enter to activate this console. ";
int pid; int pid;
@ -388,13 +388,8 @@ init_main(int argc, char * * argv)
arguments[j] = 0; arguments[j] = 0;
if ( run_rc ) { if ( run_rc ) {
printf("running %s with args \"",rc); run(rc, arguments, console, 0);
for ( j = 0; j < argc; j++ ) { //waitfor(run(rc, arguments, console, 0));
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", console);
waitfor(run(rc, arguments, console, 0));
printf("done.\n");
} }
if ( 0 == create_swap) { if ( 0 == create_swap) {
@ -414,19 +409,9 @@ init_main(int argc, char * * argv)
/* /*
arguments[0] = tty_commands[0]; arguments[0] = tty_commands[0];
*/ */
printf("running %s with args \"",tty_commands[0]);
for ( j = 0; j < argc; j++ ) {
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", first_terminal);
pid1 = run(tty_commands[0], arguments, first_terminal, 1); pid1 = run(tty_commands[0], arguments, first_terminal, 1);
} }
if ( pid2 == 0 && tty_commands[1] ) { if ( pid2 == 0 && tty_commands[1] ) {
printf("running %s with args \"",tty_commands[0]);
for ( j = 0; j < argc; j++ ) {
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", first_terminal);
pid2 = run(tty_commands[1], arguments, second_terminal, 1); pid2 = run(tty_commands[1], arguments, second_terminal, 1);
} }
wpid = wait(&status); wpid = wait(&status);

View File

@ -99,7 +99,7 @@ run(const char* program, const char* const* arguments,
}; };
static const char press_enter[] = static const char press_enter[] =
"Please press Enter to activate this console. "; "\nPlease press Enter to activate this console. ";
int pid; int pid;
@ -388,13 +388,8 @@ init_main(int argc, char * * argv)
arguments[j] = 0; arguments[j] = 0;
if ( run_rc ) { if ( run_rc ) {
printf("running %s with args \"",rc); run(rc, arguments, console, 0);
for ( j = 0; j < argc; j++ ) { //waitfor(run(rc, arguments, console, 0));
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", console);
waitfor(run(rc, arguments, console, 0));
printf("done.\n");
} }
if ( 0 == create_swap) { if ( 0 == create_swap) {
@ -414,19 +409,9 @@ init_main(int argc, char * * argv)
/* /*
arguments[0] = tty_commands[0]; arguments[0] = tty_commands[0];
*/ */
printf("running %s with args \"",tty_commands[0]);
for ( j = 0; j < argc; j++ ) {
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", first_terminal);
pid1 = run(tty_commands[0], arguments, first_terminal, 1); pid1 = run(tty_commands[0], arguments, first_terminal, 1);
} }
if ( pid2 == 0 && tty_commands[1] ) { if ( pid2 == 0 && tty_commands[1] ) {
printf("running %s with args \"",tty_commands[0]);
for ( j = 0; j < argc; j++ ) {
printf("%s ", arguments[j]);
}
printf("\" on console %s\n", first_terminal);
pid2 = run(tty_commands[1], arguments, second_terminal, 1); pid2 = run(tty_commands[1], arguments, second_terminal, 1);
} }
wpid = wait(&status); wpid = wait(&status);

13
mount.c
View File

@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
char *filesystemType = "auto"; char *filesystemType = "auto";
char *device = NULL; char *device = NULL;
char *directory = NULL; char *directory = NULL;
struct stat statBuf;
int all = 0; int all = 0;
int i; int i;
if (stat("/etc/fstab", &statBuf) < 0)
fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
if (argc == 1) { if (argc == 1) {
FILE *mountTable; FILE *mountTable;
if ((mountTable = setmntent ("/proc/mounts", "r"))) { if ((mountTable = setmntent ("/proc/mounts", "r"))) {
struct mntent *m; struct mntent *m;
while ((m = getmntent (mountTable)) != 0) { while ((m = getmntent (mountTable)) != 0) {
struct fstab* fstabItem;
char *blockDevice = m->mnt_fsname; char *blockDevice = m->mnt_fsname;
if (strcmp (blockDevice, "/dev/root") == 0) /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
blockDevice = (getfsfile ("/"))->fs_spec; if (strcmp (blockDevice, "/dev/root") == 0) {
fstabItem = getfsfile ("/");
if (fstabItem != NULL)
blockDevice = fstabItem->fs_spec;
}
printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir, printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
m->mnt_type, m->mnt_opts); m->mnt_type, m->mnt_opts);
} }

View File

@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
char *filesystemType = "auto"; char *filesystemType = "auto";
char *device = NULL; char *device = NULL;
char *directory = NULL; char *directory = NULL;
struct stat statBuf;
int all = 0; int all = 0;
int i; int i;
if (stat("/etc/fstab", &statBuf) < 0)
fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
if (argc == 1) { if (argc == 1) {
FILE *mountTable; FILE *mountTable;
if ((mountTable = setmntent ("/proc/mounts", "r"))) { if ((mountTable = setmntent ("/proc/mounts", "r"))) {
struct mntent *m; struct mntent *m;
while ((m = getmntent (mountTable)) != 0) { while ((m = getmntent (mountTable)) != 0) {
struct fstab* fstabItem;
char *blockDevice = m->mnt_fsname; char *blockDevice = m->mnt_fsname;
if (strcmp (blockDevice, "/dev/root") == 0) /* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
blockDevice = (getfsfile ("/"))->fs_spec; if (strcmp (blockDevice, "/dev/root") == 0) {
fstabItem = getfsfile ("/");
if (fstabItem != NULL)
blockDevice = fstabItem->fs_spec;
}
printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir, printf ("%s on %s type %s (%s)\n", blockDevice, m->mnt_dir,
m->mnt_type, m->mnt_opts); m->mnt_type, m->mnt_opts);
} }