[BusyBox-cvs] busybox/util-linux dmesg.c,1.27,1.28 fbset.c,1.30,1.31 fdflush.c,1.21,1.22 fdisk.c,1.4,1.5 freeramdisk.c,1.20,1.21 fsck_minix.c,1.36,1.37 getopt.c,1.11,1.12 hexdump.c,1.2,1.3 hwclock.c,1.4,1.5 losetup.c,1.1,1.2 mkfs_minix.c,1.37,1.38 mkswap.c,1.26,1.27 more.c,1.55,1.56 mount.c,1.109,1.110 nfsmount.c,1.24,1.25 pivot_root.c,1.6,1.7 rdate.c,1.21,1.22 swaponoff.c,1.32,1.33 umount.c,1.59,1.60

Manuel Novoa III mjn3 at busybox.net
Wed Mar 19 09:13:07 UTC 2003


Update of /var/cvs/busybox/util-linux
In directory winder:/home/mjn3/work/busybox/util-linux

Modified Files:
	dmesg.c fbset.c fdflush.c fdisk.c freeramdisk.c fsck_minix.c 
	getopt.c hexdump.c hwclock.c losetup.c mkfs_minix.c mkswap.c 
	more.c mount.c nfsmount.c pivot_root.c rdate.c swaponoff.c 
	umount.c 
Log Message:
Major coreutils update.


Index: dmesg.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/dmesg.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- dmesg.c	7 Mar 2003 17:59:32 -0000	1.27
+++ dmesg.c	19 Mar 2003 09:13:00 -0000	1.28
@@ -42,7 +42,7 @@
 	int lastc;
 	int cmd = 3;
 
-	while ((i = getopt(argc, argv, "cn:s:")) != EOF) {
+	while ((i = getopt(argc, argv, "cn:s:")) > 0) {
 		switch (i) {
 			case 'c':
 				cmd = 4;
@@ -58,12 +58,12 @@
 				bufsize = bb_xgetlarg(optarg, 10, 4096, 512*1024);
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
 	if (optind < argc) {
-		show_usage();
+		bb_show_usage();
 	}
 
 	if (cmd == 8) {
@@ -98,5 +98,5 @@
 #endif
 	return EXIT_SUCCESS;
 die_the_death:
-	perror_msg_and_die(NULL);
+	bb_perror_nomsg_and_die();
 }

Index: fbset.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fbset.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- fbset.c	17 Sep 2002 08:44:16 -0000	1.30
+++ fbset.c	19 Mar 2003 09:13:00 -0000	1.31
@@ -194,7 +194,7 @@
 	char buf[256];
 	char *p = buf;
 
-	f = xfopen(fn, "r");
+	f = bb_xfopen(fn, "r");
 	while (!feof(f)) {
 		fgets(buf, sizeof(buf), f);
 		if ((p = strstr(buf, "mode ")) || (p = strstr(buf, "mode\t"))) {
@@ -279,7 +279,7 @@
 		}
 	}
 #else
-	error_msg( "mode reading not compiled in");
+	bb_error_msg( "mode reading not compiled in");
 #endif
 	return 0;
 }
@@ -350,7 +350,7 @@
 		for (i = 0; g_cmdoptions[i].name; i++) {
 			if (!strcmp(thisarg, g_cmdoptions[i].name)) {
 				if (argc - 1 < g_cmdoptions[i].param_count)
-					show_usage();
+					bb_show_usage();
 				switch (g_cmdoptions[i].code) {
 				case CMD_FB:
 					fbdev = argv[1];
@@ -399,18 +399,18 @@
 				mode = *argv;
 				g_options |= OPT_READMODE;
 			} else {
-				show_usage();
+				bb_show_usage();
 			}
 		}
 	}
 
 	if ((fh = open(fbdev, O_RDONLY)) < 0)
-		perror_msg_and_die("fbset(open)");
+		bb_perror_msg_and_die("fbset(open)");
 	if (ioctl(fh, FBIOGET_VSCREENINFO, &var))
-		perror_msg_and_die("fbset(ioctl)");
+		bb_perror_msg_and_die("fbset(ioctl)");
 	if (g_options & OPT_READMODE) {
 		if (!readmode(&var, modefile, mode)) {
-			error_msg("Unknown video mode `%s'", mode);
+			bb_error_msg("Unknown video mode `%s'", mode);
 			return EXIT_FAILURE;
 		}
 	}
@@ -418,7 +418,7 @@
 	setmode(&var, &varset);
 	if (g_options & OPT_CHANGE)
 		if (ioctl(fh, FBIOPUT_VSCREENINFO, &var))
-			perror_msg_and_die("fbset(ioctl)");
+			bb_perror_msg_and_die("fbset(ioctl)");
 	showmode(&var);
 	/* Don't close the file, as exiting will take care of that */
 	/* close(fh); */

Index: fdflush.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fdflush.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- fdflush.c	7 Mar 2003 18:09:06 -0000	1.21
+++ fdflush.c	19 Mar 2003 09:13:00 -0000	1.22
@@ -25,6 +25,7 @@
 #include <sys/ioctl.h>
 #include <fcntl.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include "busybox.h"
 
 /* From <linux/fd.h> */
@@ -35,22 +36,19 @@
 	int fd, result;
 
 	if (argc <= 1)
-		show_usage();
-	if ((fd = open(*(++argv), 0)) < 0)
-		goto die_the_death;
+		bb_show_usage();
+
+	fd = bb_xopen(argv[1], 0);
 
 	result = ioctl(fd, FDFLUSH, 0);
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	close(fd);
 #endif
 	if (result) {
-		goto die_the_death;
+		bb_perror_nomsg_and_die();
 	}
 
 	/* Don't bother closing.  Exit does
 	 * that, so we can save a few bytes */
 	return EXIT_SUCCESS;
-
-die_the_death:
-	perror_msg_and_die(NULL);
 }

Index: fdisk.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fdisk.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fdisk.c	4 Jan 2003 11:56:06 -0000	1.4
+++ fdisk.c	19 Mar 2003 09:13:00 -0000	1.5
@@ -5655,7 +5655,7 @@
 	char line[100], ptname[100], devname[120], *s;
 	int ma, mi, sz;
 
-	procpt = wfopen(PROC_PARTITIONS, "r");
+	procpt = bb_wfopen(PROC_PARTITIONS, "r");
 
 	while (fgets(line, sizeof(line), procpt)) {
 		if (sscanf (line, " %d %d %d %[^\n ]",
@@ -5711,7 +5711,7 @@
 			sector_size = atoi(optarg);
 			if (sector_size != 512 && sector_size != 1024 &&
 			    sector_size != 2048)
-				show_usage();
+				bb_show_usage();
 			sector_offset = 2;
 			user_set_sector_size = 1;
 			break;
@@ -5746,7 +5746,7 @@
 			printf("fdisk v" UTIL_LINUX_VERSION "\n");
 			return 0;
 		default:
-			show_usage();
+			bb_show_usage();
 		}
 	}
 
@@ -5794,7 +5794,7 @@
 
 		opts = argc - optind;
 		if (opts <= 0)
-			show_usage();
+			bb_show_usage();
 
 		for (j = optind; j < argc; j++) {
 			disk_device = argv[j];
@@ -5816,7 +5816,7 @@
 	if (argc-optind == 1)
 		disk_device = argv[optind];
 	else
-		show_usage();
+		bb_show_usage();
 
 	get_boot(fdisk);
 

Index: freeramdisk.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/freeramdisk.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- freeramdisk.c	7 Mar 2003 18:09:06 -0000	1.20
+++ freeramdisk.c	19 Mar 2003 09:13:00 -0000	1.21
@@ -41,17 +41,17 @@
 	FILE *f;
 
 	if (argc != 2) {
-		show_usage();
+		bb_show_usage();
 	}
 
-	f = xfopen(argv[1], "r+");
+	f = bb_xfopen(argv[1], "r+");
 	
 	result = ioctl(fileno(f), BLKFLSBUF);
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	fclose(f);
 #endif
 	if (result < 0) {
-		perror_msg_and_die("failed ioctl on %s", argv[1]);
+		bb_perror_msg_and_die("failed ioctl on %s", argv[1]);
 	}
 
 	/* Don't bother closing.  Exit does

Index: fsck_minix.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/fsck_minix.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- fsck_minix.c	28 Nov 2002 11:27:31 -0000	1.36
+++ fsck_minix.c	19 Mar 2003 09:13:00 -0000	1.37
@@ -279,7 +279,7 @@
 
 static void die(const char *str)
 {
-	error_msg("%s", str);
+	bb_error_msg("%s", str);
 	leave(8);
 }
 
@@ -1344,7 +1344,7 @@
 		argv++;
 		if (argv[0][0] != '-') {
 			if (device_name)
-				show_usage();
+				bb_show_usage();
 			else
 				device_name = argv[0];
 		} else
@@ -1374,11 +1374,11 @@
 					force = 1;
 					break;
 				default:
-					show_usage();
+					bb_show_usage();
 				}
 	}
 	if (!device_name)
-		show_usage();
+		bb_show_usage();
 	check_mount();				/* trying to check a mounted filesystem? */
 	if (repair && !automatic) {
 		if (!isatty(0) || !isatty(1))
@@ -1399,7 +1399,7 @@
 	 * flags and whether or not the -f switch was specified on the 
 	 * command line.
 	 */
-	printf("%s, %s\n", applet_name, program_version);
+	printf("%s, %s\n", bb_applet_name, program_version);
 	if (!(Super.s_state & MINIX_ERROR_FS) &&
 		(Super.s_state & MINIX_VALID_FS) && !force) {
 		if (repair)

Index: getopt.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/getopt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- getopt.c	28 Nov 2002 11:27:31 -0000	1.11
+++ getopt.c	19 Mar 2003 09:13:00 -0000	1.12
@@ -37,7 +37,7 @@
  *     <misiek at misiek.eu.org>)
  * Ported to Busybox - Alfred M. Szmidt <ams at trillian.itslinux.org>
  *  Removed --version/-V and --help/-h in
- *  Removed prase_error(), using error_msg() from Busybox instead
+ *  Removed prase_error(), using bb_error_msg() from Busybox instead
  *  Replaced our_malloc with xmalloc and our_realloc with xrealloc
  *
  */
@@ -95,7 +95,7 @@
         free(BUFFER);
 
         if (!quote) { /* Just copy arg */
-               BUFFER=xstrdup(arg);
+               BUFFER=bb_xstrdup(arg);
                 return BUFFER;
         }
 
@@ -224,7 +224,7 @@
                 long_options[long_options_nr-1].has_arg=has_arg;
                 long_options[long_options_nr-1].flag=NULL;
                 long_options[long_options_nr-1].val=LONG_OPT;
-               long_options[long_options_nr-1].name=xstrdup(name);
+               long_options[long_options_nr-1].name=bb_xstrdup(name);
         }
         long_options_nr++;
 }
@@ -254,7 +254,7 @@
                                         arg_opt=required_argument;
                                 }
                                 if (tlen == 0)
-                                        error_msg("empty long option after -l or --long argument");
+                                        bb_error_msg("empty long option after -l or --long argument");
                         }
                         add_longopt(tokptr,arg_opt);
                 }
@@ -273,7 +273,7 @@
         else if (!strcmp(new_shell,"csh"))
                 shell=TCSH;
         else
-                error_msg("unknown shell after -s or --shell argument");
+                bb_error_msg("unknown shell after -s or --shell argument");
 }
 
 
@@ -322,7 +322,7 @@
                         printf(" --\n");
                        return 0;
                 } else
-                        error_msg_and_die("missing optstring argument");
+                        bb_error_msg_and_die("missing optstring argument");
         }
 
         if (argv[1][0] != '-' || compatible) {
@@ -340,14 +340,14 @@
                         break;
                 case 'o':
                        free(optstr);
-                       optstr=xstrdup(optarg);
+                       optstr=bb_xstrdup(optarg);
                         break;
                 case 'l':
                         add_long_options(optarg);
                         break;
                 case 'n':
                        free(name);
-                       name=xstrdup(optarg);
+                       name=bb_xstrdup(optarg);
                         break;
                 case 'q':
                         quiet_errors=1;
@@ -364,14 +364,14 @@
                         quote=0;
                         break;
                 default:
-                        show_usage();
+                        bb_show_usage();
                 }
 
         if (!optstr) {
                 if (optind >= argc)
-                        error_msg_and_die("missing optstring argument");
+                        bb_error_msg_and_die("missing optstring argument");
                 else {
-                       optstr=xstrdup(argv[optind]);
+                       optstr=bb_xstrdup(argv[optind]);
                         optind++;
                 }
         }

Index: hexdump.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/hexdump.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- hexdump.c	23 Jun 2002 22:25:24 -0000	1.2
+++ hexdump.c	19 Mar 2003 09:13:01 -0000	1.3
@@ -25,115 +25,92 @@
 #include <getopt.h>
 #include <stdlib.h>
 #include <string.h>
-#include "dump.h"
 #include "busybox.h"
+#include "dump.h"
 
-extern off_t skip;                      /* bytes to skip */
-
-extern FS *fshead;				/* head of format strings */
-extern int blocksize;				/* data block size */
-extern int length;			/* max bytes to read */
-
-void addfile(char *name)
+static void bb_dump_addfile(char *name)
 {
 	register char *p;
 	FILE *fp;
-	int ch;
-	char buf[2048 + 1];
+	char *buf;
 
-	if (!(fp = fopen(name, "r"))) {
-		error_msg_and_die("hexdump: can't read %s.\n", name);
-	}
-	while (fgets(buf, sizeof(buf), fp)) {
-		if (!(p = index(buf, '\n'))) {
-			error_msg("hexdump: line too long.\n");
-			while ((ch = getchar()) != '\n' && ch != EOF);
-			continue;
-		}
-		*p = '\0';
-		for (p = buf; *p && isspace(*p); ++p);
-		if (!*p || *p == '#') {
-			continue;
+	fp = bb_xfopen(name, "r");
+
+	while ((buf = bb_get_chomped_line_from_file(fp)) != NULL) {
+		p = (char *) bb_skip_whitespace(buf);
+
+		if (*p && (*p != '#')) {
+			bb_dump_add(p);
 		}
-		add(p);
+		free(buf);
 	}
-	(void)fclose(fp);
+	fclose(fp);
 }
 
+static const char * const add_strings[] = {
+			"\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"",		/* b */
+			"\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"",		/* c */
+			"\"%07.7_ax \" 8/2 \"  %05u \" \"\\n\"",	/* d */
+			"\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"",		/* o */
+			"\"%07.7_ax \" 8/2 \"   %04x \" \"\\n\"",	/* x */
+};
+
+static const char add_first[] = "\"%07.7_Ax\n\"";
+
+static const char hexdump_opts[] = "bcdoxe:f:n:s:v";
+
+static const struct suffix_mult suffixes[] = {
+	{"b",  512 },
+	{"k",  1024 },
+	{"m",  1024*1024 },
+	{NULL, 0 }
+};
+
 int hexdump_main(int argc, char **argv)
 {
 //	register FS *tfs;
-	char *p;
+	const char *p;
 	int ch;
-	extern enum _vflag vflag;
-	vflag = FIRST;
-	length = -1;
 
-	while ((ch = getopt(argc, argv, "bcde:f:n:os:vx")) != EOF) {
-		switch (ch) {
-		case 'b':
-			add("\"%07.7_Ax\n\"");
-			add("\"%07.7_ax \" 16/1 \"%03o \" \"\\n\"");
-			break;
-		case 'c':
-			add("\"%07.7_Ax\n\"");
-			add("\"%07.7_ax \" 16/1 \"%3_c \" \"\\n\"");
-			break;
-		case 'd':
-			add("\"%07.7_Ax\n\"");
-			add("\"%07.7_ax \" 8/2 \"  %05u \" \"\\n\"");
-			break;
-		case 'e':
-			add(optarg);
-			break;
-		case 'f':
-			addfile(optarg);
-			break;
-		case 'n':
-			if ((length = atoi(optarg)) < 0) {
-				error_msg_and_die("hexdump: bad length value.\n");
-			}
-			break;
-		case 'o':
-			add("\"%07.7_Ax\n\"");
-			add("\"%07.7_ax \" 8/2 \" %06o \" \"\\n\"");
-			break;
-		case 's':
-			if ((skip = strtol(optarg, &p, 0)) < 0) {
-				error_msg_and_die("hexdump: bad skip value.\n");
-			}
-			switch(*p) {
-				case 'b':
-					skip *= 512;
-					break;
-				case 'k':
-					skip *= 1024;
-					break;
-				case 'm':
-					skip *= 1048576;
-					break;
+	bb_dump_vflag = FIRST;
+	bb_dump_length = -1;
+
+	while ((ch = getopt(argc, argv, hexdump_opts)) > 0) {
+		if ((p = strchr(hexdump_opts, ch)) != NULL) {
+			if ((p - hexdump_opts) < 5) {
+				bb_dump_add(add_first);
+				bb_dump_add(add_strings[(int)(p - hexdump_opts)]);
+			} else {
+				/* Sae a little bit of space below by omitting the 'else's. */
+				if (ch == 'e') {
+					bb_dump_add(optarg);
+				} /* else */
+				if (ch == 'f') {
+					bb_dump_addfile(optarg);
+				} /* else */
+				if (ch == 'n') {
+					bb_dump_length = bb_xgetularg10_bnd(optarg, 0, INT_MAX);
+				} /* else */
+				if (ch == 's') {
+					bb_dump_skip = bb_xgetularg_bnd_sfx(optarg, 10, 0, LONG_MAX, suffixes);
+				} /* else */
+				if (ch == 'v') {
+					bb_dump_vflag = ALL;
+				}
 			}
-			break;
-		case 'v':
-			vflag = ALL;
-			break;
-		case 'x':
-			add("\"%07.7_Ax\n\"");
-			add("\"%07.7_ax \" 8/2 \"   %04x \" \"\\n\"");
-			break;
-		case '?':
-			show_usage();
+		} else {
+			bb_show_usage();
 		}
 	}
 
-	if (!fshead) {
-		add("\"%07.7_Ax\n\"");
-		add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\"");
+	if (!bb_dump_fshead) {
+		bb_dump_add(add_first);
+		bb_dump_add("\"%07.7_ax \" 8/2 \"%04x \" \"\\n\"");
 	}
 
 	argv += optind;
 
-	return(dump(argv));
+	return(bb_dump_dump(argv));
 }
 /*
  * Copyright (c) 1989 The Regents of the University of California.

Index: hwclock.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/hwclock.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- hwclock.c	2 Jan 2003 07:16:53 -0000	1.4
+++ hwclock.c	19 Mar 2003 09:13:01 -0000	1.5
@@ -77,11 +77,11 @@
 
 	if (( rtc = open ( "/dev/rtc", O_RDONLY )) < 0 ) {
 		if (( rtc = open ( "/dev/misc/rtc", O_RDONLY )) < 0 )
-			perror_msg_and_die ( "Could not access RTC" );
+			bb_perror_msg_and_die ( "Could not access RTC" );
 	}
  	memset ( &tm, 0, sizeof( struct tm ));
 	if ( ioctl ( rtc, RTC_RD_TIME, &tm ) < 0 )
-		perror_msg_and_die ( "Could not read time from RTC" );
+		bb_perror_msg_and_die ( "Could not read time from RTC" );
 	tm. tm_isdst = -1; // not known
 	
 	close ( rtc );
@@ -111,7 +111,7 @@
 
 	if (( rtc = open ( "/dev/rtc", O_WRONLY )) < 0 ) {
 		if (( rtc = open ( "/dev/misc/rtc", O_WRONLY )) < 0 )
-			perror_msg_and_die ( "Could not access RTC" );
+			bb_perror_msg_and_die ( "Could not access RTC" );
 	}
  	
  	printf ( "1\n" );
@@ -122,7 +122,7 @@
  	printf ( "2\n") ;
  	
 	if ( ioctl ( rtc, RTC_SET_TIME, &tm ) < 0 )
-		perror_msg_and_die ( "Could not set the RTC time" );
+		bb_perror_msg_and_die ( "Could not set the RTC time" );
 	
 	close ( rtc );
 }
@@ -138,7 +138,7 @@
 	
 	safe_strncpy ( buffer, ctime ( &t ), sizeof( buffer ));
 	if ( buffer [0] )
-		buffer [xstrlen ( buffer ) - 1] = 0;
+		buffer [bb_strlen ( buffer ) - 1] = 0;
 	
 	//printf ( "%s  %.6f seconds %s\n", buffer, 0.0, utc ? "" : ( ptm-> tm_isdst ? tzname [1] : tzname [0] ));
 	printf ( "%s  %.6f seconds\n", buffer, 0.0 );
@@ -154,7 +154,7 @@
 	tv. tv_sec = read_rtc ( utc );
 
 	if ( settimeofday ( &tv, &tz ))
-		perror_msg_and_die ( "settimeofday() failed" );
+		bb_perror_msg_and_die ( "settimeofday() failed" );
 
 	return 0;
 }
@@ -165,7 +165,7 @@
 	struct timezone tz = { 0, 0 };
 
 	if ( gettimeofday ( &tv, &tz ))
-		perror_msg_and_die ( "gettimeofday() failed" );
+		bb_perror_msg_and_die ( "gettimeofday() failed" );
 
 	write_rtc ( tv. tv_sec, utc );
 	return 0;
@@ -181,7 +181,7 @@
 		char buffer [128];
 	
 		while ( fgets ( buffer, sizeof( buffer ), f )) {
-			int len = xstrlen ( buffer );
+			int len = bb_strlen ( buffer );
 			
 			while ( len && isspace ( buffer [len - 1] ))
 				len--;
@@ -238,7 +238,7 @@
 			utc_arg = 1;
 			break;
 		default:
-			show_usage();
+			bb_show_usage();
 			break;
 		}
 	}

Index: losetup.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/losetup.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- losetup.c	20 Mar 2002 17:38:37 -0000	1.1
+++ losetup.c	19 Mar 2003 09:13:01 -0000	1.2
@@ -39,16 +39,16 @@
 	break;
 
       case 'o':
-	offset = parse_number (optarg, NULL);
+	offset = bb_xparse_number (optarg, NULL);
 	break;
 
       default:
-	show_usage ();
+	bb_show_usage();
       }
 
   if ((delete && (offset || optind + 1 != argc))
       || (!delete && optind + 2 != argc))
-    show_usage ();
+    bb_show_usage();
 
   if (delete)
     return del_loop (argv[optind]) ? EXIT_SUCCESS : EXIT_FAILURE;

Index: mkfs_minix.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/mkfs_minix.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- mkfs_minix.c	21 Aug 2002 13:21:20 -0000	1.37
+++ mkfs_minix.c	19 Mar 2003 09:13:01 -0000	1.38
@@ -268,7 +268,7 @@
 	if (!mnt)
 		return;
 
-	error_msg_and_die("%s is mounted; will not make a filesystem here!", device_name);
+	bb_error_msg_and_die("%s is mounted; will not make a filesystem here!", device_name);
 }
 
 static long valid_offset(int fd, int offset)
@@ -307,7 +307,7 @@
 	long size;
 
 	if ((fd = open(file, O_RDWR)) < 0)
-		perror_msg_and_die("%s", file);
+		bb_perror_msg_and_die("%s", file);
 	if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
 		close(fd);
 		return (size * 512);
@@ -325,28 +325,28 @@
 	Super.s_state &= ~MINIX_ERROR_FS;
 
 	if (lseek(DEV, 0, SEEK_SET))
-		error_msg_and_die("seek to boot block failed in write_tables");
+		bb_error_msg_and_die("seek to boot block failed in write_tables");
 	if (512 != write(DEV, boot_block_buffer, 512))
-		error_msg_and_die("unable to clear boot sector");
+		bb_error_msg_and_die("unable to clear boot sector");
 	if (BLOCK_SIZE != lseek(DEV, BLOCK_SIZE, SEEK_SET))
-		error_msg_and_die("seek failed in write_tables");
+		bb_error_msg_and_die("seek failed in write_tables");
 	if (BLOCK_SIZE != write(DEV, super_block_buffer, BLOCK_SIZE))
-		error_msg_and_die("unable to write super-block");
+		bb_error_msg_and_die("unable to write super-block");
 	if (IMAPS * BLOCK_SIZE != write(DEV, inode_map, IMAPS * BLOCK_SIZE))
-		error_msg_and_die("unable to write inode map");
+		bb_error_msg_and_die("unable to write inode map");
 	if (ZMAPS * BLOCK_SIZE != write(DEV, zone_map, ZMAPS * BLOCK_SIZE))
-		error_msg_and_die("unable to write zone map");
+		bb_error_msg_and_die("unable to write zone map");
 	if (INODE_BUFFER_SIZE != write(DEV, inode_buffer, INODE_BUFFER_SIZE))
-		error_msg_and_die("unable to write inodes");
+		bb_error_msg_and_die("unable to write inodes");
 
 }
 
 static void write_block(int blk, char *buffer)
 {
 	if (blk * BLOCK_SIZE != lseek(DEV, blk * BLOCK_SIZE, SEEK_SET))
-		error_msg_and_die("seek failed in write_block");
+		bb_error_msg_and_die("seek failed in write_block");
 	if (BLOCK_SIZE != write(DEV, buffer, BLOCK_SIZE))
-		error_msg_and_die("write failed in write_block");
+		bb_error_msg_and_die("write failed in write_block");
 }
 
 static int get_free_block(void)
@@ -354,7 +354,7 @@
 	int blk;
 
 	if (used_good_blocks + 1 >= MAX_GOOD_BLOCKS)
-		error_msg_and_die("too many bad blocks");
+		bb_error_msg_and_die("too many bad blocks");
 	if (used_good_blocks)
 		blk = good_blocks_table[used_good_blocks - 1] + 1;
 	else
@@ -362,7 +362,7 @@
 	while (blk < ZONES && zone_in_use(blk))
 		blk++;
 	if (blk >= ZONES)
-		error_msg_and_die("not enough good blocks");
+		bb_error_msg_and_die("not enough good blocks");
 	good_blocks_table[used_good_blocks] = blk;
 	used_good_blocks++;
 	return blk;
@@ -428,7 +428,7 @@
 				goto end_bad;
 		}
 	}
-	error_msg_and_die("too many bad blocks");
+	bb_error_msg_and_die("too many bad blocks");
   end_bad:
 	if (ind)
 		write_block(ind, (char *) ind_block);
@@ -478,7 +478,7 @@
 		}
 	}
 	/* Could make triple indirect block here */
-	error_msg_and_die("too many bad blocks");
+	bb_error_msg_and_die("too many bad blocks");
   end_bad:
 	if (ind)
 		write_block(ind, (char *) ind_block);
@@ -579,7 +579,7 @@
 	 * /sbin/mkfs.minix -i 200 test.fs
 	 * */
 	if (i >= 999) {
-		error_msg_and_die("unable to allocate buffers for maps");
+		bb_error_msg_and_die("unable to allocate buffers for maps");
 	}
 	FIRSTZONE = NORM_FIRSTZONE;
 	inode_map = xmalloc(IMAPS * BLOCK_SIZE);
@@ -610,7 +610,7 @@
 	/* Seek to the correct loc. */
 	if (lseek(DEV, current_block * BLOCK_SIZE, SEEK_SET) !=
 		current_block * BLOCK_SIZE) {
-		error_msg_and_die("seek failed during testing of blocks");
+		bb_error_msg_and_die("seek failed during testing of blocks");
 	}
 
 
@@ -650,7 +650,7 @@
 	while (currently_testing < ZONES) {
 		if (lseek(DEV, currently_testing * BLOCK_SIZE, SEEK_SET) !=
 			currently_testing * BLOCK_SIZE)
-			error_msg_and_die("seek failed in check_blocks");
+			bb_error_msg_and_die("seek failed in check_blocks");
 		try = TEST_BUFFER_BLOCKS;
 		if (currently_testing + try > ZONES)
 			try = ZONES - currently_testing;
@@ -659,7 +659,7 @@
 		if (got == try)
 			continue;
 		if (currently_testing < FIRSTZONE)
-			error_msg_and_die("bad blocks before data-area: cannot make fs");
+			bb_error_msg_and_die("bad blocks before data-area: cannot make fs");
 		mark_zone(currently_testing);
 		badblocks++;
 		currently_testing++;
@@ -675,7 +675,7 @@
 	FILE *listfile;
 	unsigned long blockno;
 
-	listfile = xfopen(filename, "r");
+	listfile = bb_xfopen(filename, "r");
 	while (!feof(listfile)) {
 		fscanf(listfile, "%ld\n", &blockno);
 		mark_zone(blockno);
@@ -696,10 +696,10 @@
 	int stopIt=FALSE;
 
 	if (INODE_SIZE * MINIX_INODES_PER_BLOCK != BLOCK_SIZE)
-		error_msg_and_die("bad inode size");
+		bb_error_msg_and_die("bad inode size");
 #ifdef CONFIG_FEATURE_MINIX2
 	if (INODE_SIZE2 * MINIX2_INODES_PER_BLOCK != BLOCK_SIZE)
-		error_msg_and_die("bad inode size");
+		bb_error_msg_and_die("bad inode size");
 #endif
 	
 	/* Parse options */
@@ -725,7 +725,7 @@
 							}
 							req_nr_inodes = strtoul(cp, &tmp, 0);
 							if (*tmp)
-								show_usage();
+								bb_show_usage();
 							stopIt=TRUE;
 							break;
 						}
@@ -749,13 +749,13 @@
 							}
 							i = strtoul(cp, &tmp, 0);
 							if (*tmp)
-								show_usage();
+								bb_show_usage();
 							if (i == 14)
 								magic = MINIX_SUPER_MAGIC;
 							else if (i == 30)
 								magic = MINIX_SUPER_MAGIC2;
 							else 
-								show_usage();
+								bb_show_usage();
 							namelen = i;
 							dirsize = i + 2;
 							stopIt=TRUE;
@@ -765,7 +765,7 @@
 #ifdef CONFIG_FEATURE_MINIX2
 						version2 = 1;
 #else
-						error_msg("%s: not compiled with minix v2 support",
+						bb_error_msg("%s: not compiled with minix v2 support",
 								device_name);
 						exit(-1);
 #endif
@@ -774,7 +774,7 @@
 					case 'h':
 					default:
 goodbye:
-						show_usage();
+						bb_show_usage();
 				}
 			}
 		} else {
@@ -792,7 +792,7 @@
 	if (device_name && !BLOCKS)
 		BLOCKS = get_size(device_name) / 1024;
 	if (!device_name || BLOCKS < 10) {
-		show_usage();
+		bb_show_usage();
 	}
 #ifdef CONFIG_FEATURE_MINIX2
 	if (version2) {
@@ -816,13 +816,13 @@
 	strcpy(tmp + 2, ".badblocks");
 	DEV = open(device_name, O_RDWR);
 	if (DEV < 0)
-		error_msg_and_die("unable to open %s", device_name);
+		bb_error_msg_and_die("unable to open %s", device_name);
 	if (fstat(DEV, &statbuf) < 0)
-		error_msg_and_die("unable to stat %s", device_name);
+		bb_error_msg_and_die("unable to stat %s", device_name);
 	if (!S_ISBLK(statbuf.st_mode))
 		check = 0;
 	else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
-		error_msg_and_die("will not try to make filesystem on '%s'", device_name);
+		bb_error_msg_and_die("will not try to make filesystem on '%s'", device_name);
 	setup_tables();
 	if (check)
 		check_blocks();

Index: mkswap.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/mkswap.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- mkswap.c	6 Apr 2002 05:17:53 -0000	1.26
+++ mkswap.c	19 Mar 2003 09:13:01 -0000	1.27
@@ -87,7 +87,7 @@
 
 #ifdef PAGE_SIZE
 	if (pagesize != PAGE_SIZE)
-		error_msg("Assuming pages of size %d", pagesize);
+		bb_error_msg("Assuming pages of size %d", pagesize);
 #endif
 	signature_page = (int *) xmalloc(pagesize);
 	memset(signature_page, 0, pagesize);
@@ -185,7 +185,7 @@
 		bit_test_and_clear(signature_page, page);
 	else {
 		if (badpages == MAX_BADPAGES)
-			error_msg_and_die("too many bad pages");
+			bb_error_msg_and_die("too many bad pages");
 		p->badpages[badpages] = page;
 	}
 	badpages++;
@@ -206,7 +206,7 @@
 		}
 		if (do_seek && lseek(DEV, current_page * pagesize, SEEK_SET) !=
 			current_page * pagesize)
-			error_msg_and_die("seek failed in check_blocks");
+			bb_error_msg_and_die("seek failed in check_blocks");
 		if ((do_seek = (pagesize != read(DEV, buffer, pagesize)))) {
 			page_bad(current_page++);
 			continue;
@@ -255,7 +255,7 @@
 	long size;
 
 	if ((fd = open(file, O_RDONLY)) < 0)
-		perror_msg_and_die("%s", file);
+		bb_perror_msg_and_die("%s", file);
 	if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
 		int sectors_per_page = pagesize / 512;
 
@@ -287,7 +287,7 @@
 
 				PAGES = strtol(argv[0], &tmp, 0) / blocks_per_page;
 				if (*tmp)
-					show_usage();
+					bb_show_usage();
 			} else
 				device_name = argv[0];
 		} else {
@@ -302,19 +302,19 @@
 				version = atoi(argv[0] + 2);
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 			}
 		}
 	}
 	if (!device_name) {
-		error_msg("error: Nowhere to set up swap on?");
-		show_usage();
+		bb_error_msg("error: Nowhere to set up swap on?");
+		bb_show_usage();
 	}
 	sz = get_size(device_name);
 	if (!PAGES) {
 		PAGES = sz;
 	} else if (PAGES > sz && !force) {
-		error_msg("error: size %ld is larger than device size %d",
+		bb_error_msg("error: size %ld is larger than device size %d",
 				PAGES * (pagesize / 1024), sz * (pagesize / 1024));
 		return EXIT_FAILURE;
 	}
@@ -330,13 +330,13 @@
 			version = 1;
 	}
 	if (version != 0 && version != 1) {
-		error_msg("error: unknown version %d", version);
-		show_usage();
+		bb_error_msg("error: unknown version %d", version);
+		bb_show_usage();
 	}
 	if (PAGES < 10) {
-		error_msg("error: swap area needs to be at least %ldkB",
+		bb_error_msg("error: swap area needs to be at least %ldkB",
 				(long) (10 * pagesize / 1024));
-		show_usage();
+		bb_show_usage();
 	}
 #if 0
 	maxpages = ((version == 0) ? V0_MAX_PAGES : V1_MAX_PAGES);
@@ -353,17 +353,17 @@
 #endif
 	if (PAGES > maxpages) {
 		PAGES = maxpages;
-		error_msg("warning: truncating swap area to %ldkB",
+		bb_error_msg("warning: truncating swap area to %ldkB",
 				PAGES * pagesize / 1024);
 	}
 
 	DEV = open(device_name, O_RDWR);
 	if (DEV < 0 || fstat(DEV, &statbuf) < 0)
-		perror_msg_and_die("%s", device_name);
+		bb_perror_msg_and_die("%s", device_name);
 	if (!S_ISBLK(statbuf.st_mode))
 		check = 0;
 	else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
-		error_msg_and_die("Will not try to make swapdevice on '%s'", device_name);
+		bb_error_msg_and_die("Will not try to make swapdevice on '%s'", device_name);
 
 #ifdef __sparc__
 	if (!force && version == 0) {
@@ -372,13 +372,13 @@
 		unsigned short *q, sum;
 
 		if (read(DEV, buffer, 512) != 512)
-			error_msg_and_die("fatal: first page unreadable");
+			bb_error_msg_and_die("fatal: first page unreadable");
 		if (buffer[508] == 0xDA && buffer[509] == 0xBE) {
 			q = (unsigned short *) (buffer + 510);
 			for (sum = 0; q >= (unsigned short *) buffer;)
 				sum ^= *q--;
 			if (!sum) {
-				error_msg("Device '%s' contains a valid Sun disklabel.\n"
+				bb_error_msg("Device '%s' contains a valid Sun disklabel.\n"
 "This probably means creating v0 swap would destroy your partition table\n"
 "No swap created. If you really want to create swap v0 on that device, use\n"
 "the -f option to force it.", device_name);
@@ -391,7 +391,7 @@
 	if (version == 0 || check)
 		check_blocks();
 	if (version == 0 && !bit_test_and_clear(signature_page, 0))
-		error_msg_and_die("fatal: first page unreadable");
+		bb_error_msg_and_die("fatal: first page unreadable");
 	if (version == 1) {
 		p->version = version;
 		p->last_page = PAGES - 1;
@@ -400,23 +400,23 @@
 
 	goodpages = PAGES - badpages - 1;
 	if (goodpages <= 0)
-		error_msg_and_die("Unable to set up swap-space: unreadable");
+		bb_error_msg_and_die("Unable to set up swap-space: unreadable");
 	printf("Setting up swapspace version %d, size = %ld bytes\n",
 		   version, (long) (goodpages * pagesize));
 	write_signature((version == 0) ? "SWAP-SPACE" : "SWAPSPACE2");
 
 	offset = ((version == 0) ? 0 : 1024);
 	if (lseek(DEV, offset, SEEK_SET) != offset)
-		error_msg_and_die("unable to rewind swap-device");
+		bb_error_msg_and_die("unable to rewind swap-device");
 	if (write(DEV, (char *) signature_page + offset, pagesize - offset)
 		!= pagesize - offset)
-		error_msg_and_die("unable to write signature page");
+		bb_error_msg_and_die("unable to write signature page");
 
 	/*
 	 * A subsequent swapon() will fail if the signature
 	 * is not actually on disk. (This is a kernel bug.)
 	 */
 	if (fsync(DEV))
-		error_msg_and_die("fsync failed");
+		bb_error_msg_and_die("fsync failed");
 	return EXIT_SUCCESS;
 }

Index: more.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/more.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- more.c	13 Jan 2003 22:09:50 -0000	1.55
+++ more.c	19 Mar 2003 09:13:01 -0000	1.56
@@ -81,7 +81,7 @@
 	if(isatty(fileno(stdout))) {
 		cin = fopen(CURRENT_TTY, "r");
 		if (!cin)
-			cin = xfopen(CONSOLE_DEV, "r");
+			cin = bb_xfopen(CONSOLE_DEV, "r");
 		please_display_more_prompt = 0;
 #ifdef CONFIG_FEATURE_USE_TERMIOS
 		getTermSettings(fileno(cin), &initial_settings);
@@ -105,7 +105,7 @@
 		if (argc == 0) {
 			file = stdin;
 		} else
-			file = wfopen(*argv, "r");
+			file = bb_wfopen(*argv, "r");
 		if(file==0)
 			goto loop;
 			

Index: mount.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/mount.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- mount.c	28 Feb 2003 06:29:27 -0000	1.109
+++ mount.c	19 Mar 2003 09:13:01 -0000	1.110
@@ -86,8 +86,6 @@
 
 extern int sysfs(int option, unsigned int fs_index, char *buf);
 
-extern const char mtab_file[];	/* Defined in utility.c */
-
 struct mount_options {
 	const char *name;
 	unsigned long and;
@@ -136,20 +134,20 @@
 
 			specialfile = find_unused_loop_device();
 			if (specialfile == NULL) {
-				error_msg_and_die("Could not find a spare loop device");
+				bb_error_msg_and_die("Could not find a spare loop device");
 			}
 			if (set_loop(specialfile, lofile, 0, &loro)) {
-				error_msg_and_die("Could not setup loop device");
+				bb_error_msg_and_die("Could not setup loop device");
 			}
 			if (!(flags & MS_RDONLY) && loro) {	/* loop is ro, but wanted rw */
-				error_msg("WARNING: loop device is read-only");
+				bb_error_msg("WARNING: loop device is read-only");
 				flags |= MS_RDONLY;
 			}
 		}
 #endif
 		status = mount(specialfile, dir, filesystemtype, flags, string_flags);
 		if (status < 0 && errno == EROFS) {
-			error_msg("%s is write-protected, mounting read-only",
+			bb_error_msg("%s is write-protected, mounting read-only",
 					  specialfile);
 			status = mount(specialfile, dir, filesystemtype, flags |=
 						   MS_RDONLY, string_flags);
@@ -181,7 +179,7 @@
 #endif
 
 	if (errno == EPERM) {
-		error_msg_and_die("permission denied. Are you root?");
+		bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
 	}
 
 	return (FALSE);
@@ -268,7 +266,7 @@
 
 					filesystemType = buf;
 
-					if (xstrlen(filesystemType)) {
+					if (bb_strlen(filesystemType)) {
 						status =
 							do_mount(blockDevice, directory, filesystemType,
 									 flags | MS_MGC_VAL, string_flags,
@@ -284,7 +282,7 @@
 		}
 
 		if ((!f || read_proc) && !status) {
-			f = xfopen("/proc/filesystems", "r");
+			f = bb_xfopen("/proc/filesystems", "r");
 
 			while (fgets(buf, sizeof(buf), f) != NULL) {
 				filesystemType = buf;
@@ -319,7 +317,7 @@
 
 	if (!status) {
 		if (whineOnErrors) {
-			perror_msg("Mounting %s on %s failed", blockDevice, directory);
+			bb_perror_msg("Mounting %s on %s failed", blockDevice, directory);
 		}
 		return (FALSE);
 	}
@@ -328,7 +326,7 @@
 
 static void show_mounts(char *onlytype)
 {
-	FILE *mountTable = setmntent(mtab_file, "r");
+	FILE *mountTable = setmntent(bb_path_mtab_file, "r");
 
 	if (mountTable) {
 		struct mntent *m;
@@ -351,7 +349,7 @@
 		}
 		endmntent(mountTable);
 	} else {
-		perror_msg_and_die("%s", mtab_file);
+		bb_perror_msg_and_die(bb_path_mtab_file);
 	}
 	exit(EXIT_SUCCESS);
 }
@@ -359,7 +357,7 @@
 extern int mount_main(int argc, char **argv)
 {
 	struct stat statbuf;
-	char *string_flags = xstrdup("");
+	char *string_flags = bb_xstrdup("");
 	char *extra_opts;
 	int flags = 0;
 	char *filesystemType = "auto";
@@ -413,7 +411,7 @@
 	if (optind < argc) {
 		/* if device is a filename get its real path */
 		if (stat(argv[optind], &statbuf) == 0) {
-			char *tmp = simplify_path(argv[optind]);
+			char *tmp = bb_simplify_path(argv[optind]);
 
 			safe_strncpy(device, tmp, PATH_MAX);
 		} else {
@@ -422,13 +420,13 @@
 	}
 
 	if (optind + 1 < argc)
-		directory = simplify_path(argv[optind + 1]);
+		directory = bb_simplify_path(argv[optind + 1]);
 
 	if (all || optind + 1 == argc) {
 		f = setmntent("/etc/fstab", "r");
 
 		if (f == NULL)
-			perror_msg_and_die("\nCannot read /etc/fstab");
+			bb_perror_msg_and_die("\nCannot read /etc/fstab");
 
 		while ((m = getmntent(f)) != NULL) {
 			if (!all && (optind + 1 == argc)
@@ -452,7 +450,7 @@
 
 			strcpy(device, m->mnt_fsname);
 			strcpy(directory, m->mnt_dir);
-			filesystemType = xstrdup(m->mnt_type);
+			filesystemType = bb_xstrdup(m->mnt_type);
 		  singlemount:
 			extra_opts = string_flags;
 			rc = EXIT_SUCCESS;
@@ -462,7 +460,7 @@
 				if (nfsmount
 					(device, directory, &flags, &extra_opts, &string_flags,
 					 1)) {
-					perror_msg("nfsmount failed");
+					bb_perror_msg("nfsmount failed");
 					rc = EXIT_FAILURE;
 				}
 			}

Index: nfsmount.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/nfsmount.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- nfsmount.c	11 Dec 2002 04:04:26 -0000	1.24
+++ nfsmount.c	19 Mar 2003 09:13:01 -0000	1.25
@@ -357,7 +357,7 @@
 	msock = fsock = -1;
 	mclient = NULL;
 	if (strlen(spec) >= sizeof(hostdir)) {
-		error_msg("excessively long host:dir argument");
+		bb_error_msg("excessively long host:dir argument");
 		goto fail;
 	}
 	strcpy(hostdir, spec);
@@ -369,10 +369,10 @@
 		   until they can be fully supported. (mack at sgi.com) */
 		if ((s = strchr(hostdir, ','))) {
 			*s = '\0';
-			error_msg("warning: multiple hostnames not supported");
+			bb_error_msg("warning: multiple hostnames not supported");
 		}
 	} else {
-		error_msg("directory to mount not in host:dir format");
+		bb_error_msg("directory to mount not in host:dir format");
 		goto fail;
 	}
 
@@ -382,11 +382,11 @@
 #endif
 	{
 		if ((hp = gethostbyname(hostname)) == NULL) {
-			herror_msg("%s", hostname);
+			bb_herror_msg("%s", hostname);
 			goto fail;
 		} else {
 			if (hp->h_length > sizeof(struct in_addr)) {
-				error_msg("got bad hp->h_length");
+				bb_error_msg("got bad hp->h_length");
 				hp->h_length = sizeof(struct in_addr);
 			}
 			memcpy(&server_addr.sin_addr,
@@ -403,12 +403,12 @@
 	if (!old_opts)
 		old_opts = "";
 	if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
-		error_msg("excessively long option argument");
+		bb_error_msg("excessively long option argument");
 		goto fail;
 	}
 	sprintf(new_opts, "%s%saddr=%s",
 		old_opts, *old_opts ? "," : "", s);
-	*extra_opts = xstrdup(new_opts);
+	*extra_opts = bb_xstrdup(new_opts);
 
 	/* Set default options.
 	 * rsize/wsize (and bsize, for ver >= 3) are left 0 in order to
@@ -476,7 +476,7 @@
 			else if (!strcmp(opt, "mountport"))
 			        mountport = val;
 			else if (!strcmp(opt, "mounthost"))
-			        mounthost=xstrndup(opteq+1,
+			        mounthost=bb_xstrndup(opteq+1,
 						  strcspn(opteq+1," \t\n\r,"));
 			else if (!strcmp(opt, "mountprog"))
 				mountprog = val;
@@ -563,11 +563,11 @@
 		data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
 #endif
 	if (nfsvers > MAX_NFSPROT) {
-		error_msg("NFSv%d not supported!", nfsvers);
+		bb_error_msg("NFSv%d not supported!", nfsvers);
 		return 0;
 	}
 	if (mountvers > MAX_NFSPROT) {
-		error_msg("NFSv%d not supported!", nfsvers);
+		bb_error_msg("NFSv%d not supported!", nfsvers);
 		return 0;
 	}
 	if (nfsvers && !mountvers)
@@ -627,11 +627,11 @@
 	    mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
 	  } else {
 		  if ((hp = gethostbyname(mounthost)) == NULL) {
-			  herror_msg("%s", mounthost);
+			  bb_herror_msg("%s", mounthost);
 			  goto fail;
 		  } else {
 			  if (hp->h_length > sizeof(struct in_addr)) {
-				  error_msg("got bad hp->h_length?");
+				  bb_error_msg("got bad hp->h_length?");
 				  hp->h_length = sizeof(struct in_addr);
 			  }
 			  mount_server_addr.sin_family = AF_INET;
@@ -753,7 +753,7 @@
 		if (!bg)
 		        goto fail;
 		if (!running_bg) {
-			prev_bg_host = xstrdup(hostname);
+			prev_bg_host = bb_xstrdup(hostname);
 			if (retry > 0)
 				retval = EX_BG;
 			goto fail;
@@ -766,7 +766,7 @@
 
 	if (nfsvers == 2) {
 		if (status.nfsv2.fhs_status != 0) {
-			error_msg("%s:%s failed, reason given by server: %s",
+			bb_error_msg("%s:%s failed, reason given by server: %s",
 				hostname, pathname,
 				nfs_strerror(status.nfsv2.fhs_status));
 			goto fail;
@@ -784,7 +784,7 @@
 #if NFS_MOUNT_VERSION >= 4
 		fhandle3 *my_fhandle;
 		if (status.nfsv3.fhs_status != 0) {
-			error_msg("%s:%s failed, reason given by server: %s",
+			bb_error_msg("%s:%s failed, reason given by server: %s",
 				hostname, pathname,
 				nfs_strerror(status.nfsv3.fhs_status));
 			goto fail;

Index: pivot_root.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/pivot_root.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pivot_root.c	5 Apr 2001 03:14:39 -0000	1.6
+++ pivot_root.c	19 Mar 2003 09:13:01 -0000	1.7
@@ -16,10 +16,10 @@
 int pivot_root_main(int argc, char **argv)
 {
     if (argc != 3)
-        show_usage();
+        bb_show_usage();
 
 	if (pivot_root(argv[1],argv[2]) < 0)
-		perror_msg_and_die("pivot_root");
+		bb_perror_msg_and_die("pivot_root");
 
     return EXIT_SUCCESS;
 

Index: rdate.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/rdate.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- rdate.c	3 Jul 2002 11:51:42 -0000	1.21
+++ rdate.c	19 Mar 2003 09:13:01 -0000	1.22
@@ -49,7 +49,7 @@
 	fd = xconnect(host, port);
 
 	if (read(fd, (void *)&nett, 4) != 4)    /* read time from server */
-		error_msg_and_die("%s did not send the complete time", host);
+		bb_error_msg_and_die("%s did not send the complete time", host);
 
 	close(fd);
 
@@ -83,18 +83,18 @@
 				setdate = 0;
 				break;
 			default:
-				show_usage();
+				bb_show_usage();
 		}
 	}
 
 	if (optind == argc)
-		show_usage();
+		bb_show_usage();
 
 	remote_time = askremotedate(argv[optind]);
 
 	if (setdate) {
 		if (stime(&remote_time) < 0)
-			perror_msg_and_die("Could not set time of day");
+			bb_perror_msg_and_die("Could not set time of day");
 	}
 
 	if (printdate)

Index: swaponoff.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/swaponoff.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- swaponoff.c	3 Nov 2002 00:25:23 -0000	1.32
+++ swaponoff.c	19 Mar 2003 09:13:01 -0000	1.33
@@ -51,13 +51,13 @@
 	struct stat st;
 
 	if (stat(device, &st) < 0) {
-		perror_msg_and_die("cannot stat %s");
+		bb_perror_msg_and_die("cannot stat %s", device);
 	}
 
 	/* test for holes */
 	if (S_ISREG(st.st_mode)) {
 		if (st.st_blocks * 512 < st.st_size) {
-			error_msg_and_die("swap file has holes");
+			bb_error_msg_and_die("swap file has holes");
 		}
 	}
 
@@ -67,7 +67,7 @@
 		status = swapoff(device);
 
 	if (status != 0) {
-		perror_msg("%s", device);
+		bb_perror_msg("%s", device);
 		return EXIT_FAILURE;
 	}
 	return EXIT_SUCCESS;
@@ -80,7 +80,7 @@
 	int err = 0;
 
 	if (f == NULL)
-		perror_msg_and_die("/etc/fstab");
+		bb_perror_msg_and_die("/etc/fstab");
 	while ((m = getmntent(f)) != NULL) {
 		if (strcmp(m->mnt_type, MNTTYPE_SWAP)==0) {
 			if(swap_enable_disable(m->mnt_fsname) == EXIT_FAILURE)
@@ -94,7 +94,7 @@
 
 extern int swap_on_off_main(int argc, char **argv)
 {
-	if (applet_name[5] == 'f') { /* "swapoff" */
+	if (bb_applet_name[5] == 'f') { /* "swapoff" */
 		whichApp = SWAPOFF_APP;
 	}
 
@@ -113,7 +113,7 @@
 					struct stat statBuf;
 
 					if (stat("/etc/fstab", &statBuf) < 0)
-						error_msg_and_die("/etc/fstab file missing");
+						bb_error_msg_and_die("/etc/fstab file missing");
 				}
 				return do_em_all();
 				break;
@@ -124,5 +124,5 @@
 	return swap_enable_disable(*argv);
 
   usage_and_exit:
-	show_usage();
+	bb_show_usage();
 }

Index: umount.c
===================================================================
RCS file: /var/cvs/busybox/util-linux/umount.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- umount.c	28 Nov 2002 11:27:31 -0000	1.59
+++ umount.c	19 Mar 2003 09:13:01 -0000	1.60
@@ -67,7 +67,6 @@
 #endif
 static int umountAll = FALSE;
 static int doRemount = FALSE;
-extern const char mtab_file[];	/* Defined in utility.c */
 
 
 
@@ -87,8 +86,8 @@
 	if (mtab_cache != NULL)
 		return;
 
-	if ((fp = setmntent(mtab_file, "r")) == NULL) {
-		error_msg("Cannot open %s", mtab_file);
+	if ((fp = setmntent(bb_path_mtab_file, "r")) == NULL) {
+		bb_error_msg("Cannot open %s", bb_path_mtab_file);
 		return;
 	}
 	while ((e = getmntent(fp))) {
@@ -185,7 +184,7 @@
 	if (status != 0 && doForce) {
 		status = umount2(blockDevice, MNT_FORCE);
 		if (status != 0) {
-			error_msg_and_die("forced umount of %s failed!", blockDevice);
+			bb_error_msg_and_die("forced umount of %s failed!", blockDevice);
 		}
 	}
 #endif
@@ -193,9 +192,9 @@
 		status = mount(blockDevice, name, NULL,
 					   MS_MGC_VAL | MS_REMOUNT | MS_RDONLY, NULL);
 		if (status == 0) {
-			error_msg("%s busy - remounted read-only", blockDevice);
+			bb_error_msg("%s busy - remounted read-only", blockDevice);
 		} else {
-			error_msg("Cannot remount %s read-only", blockDevice);
+			bb_error_msg("Cannot remount %s read-only", blockDevice);
 		}
 	}
 	if (status == 0) {
@@ -221,7 +220,7 @@
 		if (!do_umount(mountpt)) {
 			/* Don't bother retrying the umount on busy devices */
 			if (errno == EBUSY) {
-				perror_msg("%s", mountpt);
+				bb_perror_msg("%s", mountpt);
 				status = FALSE;
 				continue;
 			}
@@ -241,7 +240,7 @@
 	char path[PATH_MAX];
 
 	if (argc < 2) {
-		show_usage();
+		bb_show_usage();
 	}
 #ifdef CONFIG_FEATURE_CLEAN_UP
 	atexit(mtab_free);
@@ -275,7 +274,7 @@
 			case 'v':
 				break; /* ignore -v */
 			default:
-				show_usage();
+				bb_show_usage();
 			}
 	}
 
@@ -287,9 +286,9 @@
 			return EXIT_FAILURE;
 	}
 	if (realpath(*argv, path) == NULL)
-		perror_msg_and_die("%s", path);
+		bb_perror_msg_and_die("%s", path);
 	if (do_umount(path))
 		return EXIT_SUCCESS;
-	perror_msg_and_die("%s", *argv);
+	bb_perror_msg_and_die("%s", *argv);
 }
 




More information about the busybox-cvs mailing list