From cb6e25655f894c90e4befc4bee0e66794dd6858f Mon Sep 17 00:00:00 2001
From: Eric Andersen <andersen@codepoet.org>
Date: Sat, 16 Oct 1999 15:48:40 +0000
Subject: More stuff

---
 Makefile           |  2 +-
 archival/gzip.c    | 18 +++++++++---------
 busybox.def.h      |  2 +-
 gzip.c             | 18 +++++++++---------
 init.c             | 21 +++------------------
 init/init.c        | 21 +++------------------
 mount.c            | 13 +++++++++++--
 util-linux/mount.c | 13 +++++++++++--
 8 files changed, 48 insertions(+), 60 deletions(-)

diff --git a/Makefile b/Makefile
index 3069c0711..4b05075f9 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@ ifeq ($(DODEBUG),true)
     STRIP=
     LDFLAGS=
 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
     STRIP= strip --remove-section=.note --remove-section=.comment busybox
 endif
diff --git a/archival/gzip.c b/archival/gzip.c
index 4b1d32ddd..c7fb25ed0 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -8,7 +8,7 @@
 #ifdef BB_GZIP
 
 #ifndef BB_ZCAT
-error: you need zcat to have gzip support!
+#error you need zcat to have gzip support!
 #endif
 
 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
 #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
  * Copyright (C) 1992-1993 Jean-loup Gailly.
  * 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.
  */
 
-/* $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)
 #  define MSDOS
@@ -767,7 +767,7 @@ extern int block_mode;   /* block compress mode -C compatible with 2.0 */
 #endif
 
 #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
 
 /* ===========================================================================
@@ -976,7 +976,7 @@ void copy_block(buf, len, header)
 #include <stdio.h>
 
 #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
 
 /* ===========================================================================
@@ -1592,7 +1592,7 @@ ulg deflate()
  */
 
 #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
 
 #include <ctype.h>
@@ -1925,7 +1925,7 @@ local void do_exit(int exitcode)
 #include <ctype.h>
 
 #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
 
 /* ===========================================================================
@@ -2943,7 +2943,7 @@ local void set_file_type()
  */
 
 #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
 
 #include <ctype.h>
@@ -3142,7 +3142,7 @@ void display_ratio(num, den, file)
  */
 
 #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
 
 #include <ctype.h>
diff --git a/busybox.def.h b/busybox.def.h
index a236520c1..15c8edc43 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -52,4 +52,4 @@
 //#define BB_UPDATE
 #define BB_UTILITY
 #define BB_ZCAT
-#define BB_GZIP
+//#define BB_GZIP
diff --git a/gzip.c b/gzip.c
index 4b1d32ddd..c7fb25ed0 100644
--- a/gzip.c
+++ b/gzip.c
@@ -8,7 +8,7 @@
 #ifdef BB_GZIP
 
 #ifndef BB_ZCAT
-error: you need zcat to have gzip support!
+#error you need zcat to have gzip support!
 #endif
 
 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
 #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
  * Copyright (C) 1992-1993 Jean-loup Gailly.
  * 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.
  */
 
-/* $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)
 #  define MSDOS
@@ -767,7 +767,7 @@ extern int block_mode;   /* block compress mode -C compatible with 2.0 */
 #endif
 
 #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
 
 /* ===========================================================================
@@ -976,7 +976,7 @@ void copy_block(buf, len, header)
 #include <stdio.h>
 
 #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
 
 /* ===========================================================================
@@ -1592,7 +1592,7 @@ ulg deflate()
  */
 
 #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
 
 #include <ctype.h>
@@ -1925,7 +1925,7 @@ local void do_exit(int exitcode)
 #include <ctype.h>
 
 #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
 
 /* ===========================================================================
@@ -2943,7 +2943,7 @@ local void set_file_type()
  */
 
 #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
 
 #include <ctype.h>
@@ -3142,7 +3142,7 @@ void display_ratio(num, den, file)
  */
 
 #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
 
 #include <ctype.h>
diff --git a/init.c b/init.c
index 19cbec130..ade29c7c2 100644
--- a/init.c
+++ b/init.c
@@ -99,7 +99,7 @@ run(const char* program, const char* const* arguments,
 	};
 
 	static const char	press_enter[] =
- "Please press Enter to activate this console. ";
+ "\nPlease press Enter to activate this console. ";
 
 	int	pid;
 
@@ -388,13 +388,8 @@ init_main(int argc, char * * argv)
 	arguments[j] = 0;
 
 	if ( run_rc ) {
-		printf("running %s with args \"",rc);
-		for ( j = 0; j < argc; j++ ) {
-			printf("%s ", arguments[j]);
-		}
-		printf("\" on console %s\n", console);
-		waitfor(run(rc, arguments, console, 0));
-		printf("done.\n");
+		run(rc, arguments, console, 0);
+		//waitfor(run(rc, arguments, console, 0));
 	}
 
 	if ( 0 == create_swap) {
@@ -414,19 +409,9 @@ init_main(int argc, char * * argv)
 			/*
 			 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);
 		}
 		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);
 		}
 		wpid = wait(&status);
diff --git a/init/init.c b/init/init.c
index 19cbec130..ade29c7c2 100644
--- a/init/init.c
+++ b/init/init.c
@@ -99,7 +99,7 @@ run(const char* program, const char* const* arguments,
 	};
 
 	static const char	press_enter[] =
- "Please press Enter to activate this console. ";
+ "\nPlease press Enter to activate this console. ";
 
 	int	pid;
 
@@ -388,13 +388,8 @@ init_main(int argc, char * * argv)
 	arguments[j] = 0;
 
 	if ( run_rc ) {
-		printf("running %s with args \"",rc);
-		for ( j = 0; j < argc; j++ ) {
-			printf("%s ", arguments[j]);
-		}
-		printf("\" on console %s\n", console);
-		waitfor(run(rc, arguments, console, 0));
-		printf("done.\n");
+		run(rc, arguments, console, 0);
+		//waitfor(run(rc, arguments, console, 0));
 	}
 
 	if ( 0 == create_swap) {
@@ -414,19 +409,9 @@ init_main(int argc, char * * argv)
 			/*
 			 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);
 		}
 		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);
 		}
 		wpid = wait(&status);
diff --git a/mount.c b/mount.c
index d7b2682ce..26d4693d0 100644
--- a/mount.c
+++ b/mount.c
@@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
     char *filesystemType = "auto";
     char *device = NULL;
     char *directory = NULL;
+    struct stat statBuf;
     int all = 0;
     int i;
 
+    if (stat("/etc/fstab", &statBuf) < 0) 
+	fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
+
     if (argc == 1) {
 	FILE *mountTable;
 	if ((mountTable = setmntent ("/proc/mounts", "r"))) {
 	    struct mntent *m;
 	    while ((m = getmntent (mountTable)) != 0) {
+		struct fstab* fstabItem;
 		char *blockDevice = m->mnt_fsname;
-		if (strcmp (blockDevice, "/dev/root") == 0)
-		    blockDevice = (getfsfile ("/"))->fs_spec;
+		/* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
+		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,
 			m->mnt_type, m->mnt_opts);
 	    }
diff --git a/util-linux/mount.c b/util-linux/mount.c
index d7b2682ce..26d4693d0 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -174,17 +174,26 @@ extern int mount_main (int argc, char **argv)
     char *filesystemType = "auto";
     char *device = NULL;
     char *directory = NULL;
+    struct stat statBuf;
     int all = 0;
     int i;
 
+    if (stat("/etc/fstab", &statBuf) < 0) 
+	fprintf(stderr, "/etc/fstab file missing -- Please install one.\n\n");
+
     if (argc == 1) {
 	FILE *mountTable;
 	if ((mountTable = setmntent ("/proc/mounts", "r"))) {
 	    struct mntent *m;
 	    while ((m = getmntent (mountTable)) != 0) {
+		struct fstab* fstabItem;
 		char *blockDevice = m->mnt_fsname;
-		if (strcmp (blockDevice, "/dev/root") == 0)
-		    blockDevice = (getfsfile ("/"))->fs_spec;
+		/* Note that if /etc/fstab is missing, libc can't fix up /dev/root for us */
+		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,
 			m->mnt_type, m->mnt_opts);
 	    }
-- 
cgit v1.2.3-55-g6feb