busybox patch
Here's a patch to synch Debian up with my version. Changes are small so
far.
Thanks
Bruce
diff -Naur busybox/Makefile busybox-0.27/Makefile
--- busybox/Makefile Fri Apr 2 17:36:47 1999
+++ busybox-0.27/Makefile Mon Apr 12 21:46:36 1999
@@ -1,4 +1,4 @@
-VERSION=0.25
+VERSION=0.27
BUILDTIME=$(shell date "+%Y%m%d-%H%M")
#This will choke on a non-debian system
@@ -7,9 +7,10 @@
STRIP= strip --remove-section=.note --remove-section=.comment busybox
LDFLAGS= -s
+OPTIMIZE= -O2 -fomit-frame-pointer -fno-builtin
# -D_GNU_SOURCE is needed because environ is used in init.c
-CFLAGS=-g -Wall -O2 -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
+CFLAGS=-g -Wall -D_GNU_SOURCE $(OPTIMIZE)
LIBRARIES=-lc
LIBRARIESG=-lc
OBJECTS=$(shell ./busybox.obj)
diff -Naur busybox/README busybox-0.27/README
--- busybox/README Thu Nov 26 15:47:48 1998
+++ busybox-0.27/README Thu Apr 8 21:53:31 1999
@@ -22,6 +22,8 @@
to figure out by trial and error.
Please feed patches back to:
+ Bruce Perens <bruce@perens.com>
+and
Dave Cinege <dcinege@psychosis.com>
and:
Enrique Zanardi <ezanard@debian.org>
diff -Naur busybox/block_device.txt busybox-0.27/block_device.txt
--- busybox/block_device.txt Wed Dec 31 16:00:00 1969
+++ busybox-0.27/block_device.txt Sun Apr 11 20:36:15 1999
@@ -0,0 +1,7 @@
+block_device <file>
+ When run on a file or directory, such as "/usr/bin", this returns
+ the block device (for example, "/dev/hda6") for the mounted filesystem
+ on which that file lives.
+
+BUGS: Gives a non-intuitive result for mount points. "/usr" and "/usr/."
+have different block devices.
diff -Naur busybox/busybox.obj busybox-0.27/busybox.obj
--- busybox/busybox.obj Wed Dec 31 16:00:00 1969
+++ busybox-0.27/busybox.obj Thu Nov 26 15:52:00 1998
@@ -0,0 +1,3 @@
+#!/bin/sh
+sed -n '/^#define/{s/.*BB_//; s/$/.o/p; }' busybox.def.h | \
+tr [:upper:] [:lower:]
diff -Naur busybox/cat.txt busybox-0.27/cat.txt
--- busybox/cat.txt Wed Dec 31 16:00:00 1969
+++ busybox-0.27/cat.txt Sun Apr 11 20:36:59 1999
@@ -0,0 +1 @@
+cat file
diff -Naur busybox/dutmp.c busybox-0.27/dutmp.c
--- busybox/dutmp.c Thu Nov 26 15:47:48 1998
+++ busybox-0.27/dutmp.c Thu Apr 8 22:02:17 1999
@@ -1,5 +1,5 @@
/*
- * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ * public domain -- Dave Cinege <dcinege@psychosis.com>
*
* dutmp
* Takes utmp formated file on stdin and dumps it's contents
diff -Naur busybox/gzip.c busybox-0.27/gzip.c
--- busybox/gzip.c Thu Nov 26 15:47:48 1998
+++ busybox-0.27/gzip.c Mon Apr 12 21:26:30 1999
@@ -2963,7 +2963,7 @@
extern int errno;
#endif
-extern ulg crc_32_tab[]; /* crc table, defined below */
+extern const ulg crc_32_tab[]; /* crc table, defined below */
/* ===========================================================================
* Copy input to output unchanged: zcat == cat with --force.
diff -Naur busybox/makedevs.c busybox-0.27/makedevs.c
--- busybox/makedevs.c Thu Nov 26 15:47:49 1998
+++ busybox-0.27/makedevs.c Thu Apr 8 22:02:36 1999
@@ -1,5 +1,5 @@
/*
- * public domain -- Dave 'Kill a Cop' Cinege <dcinege@psychosis.com>
+ * public domain -- Dave Cinege <dcinege@psychosis.com>
*
* makedevs
* Make ranges of device files quickly.
diff -Naur busybox/swapoff.c busybox-0.27/swapoff.c
--- busybox/swapoff.c Mon Apr 5 05:48:37 1999
+++ busybox-0.27/swapoff.c Mon Apr 12 21:27:14 1999
@@ -12,49 +12,56 @@
"\n"
"\tStop swapping virtual memory pages on the given device.\n";
-extern int
-swapoff_fn(const struct FileInfo * i)
+static void
+addSwapTableEntry(const char * name)
{
-#ifdef OLDKERNEL /* For 2.0.x kernels */
- struct mntent entries[100];
- int count = 0;
- FILE * swapsTable = setmntent("/etc/swaps", "r");
- struct mntent * m;
-
- if (!(swapoff(i->source))) {
- if ( swapsTable == 0 ) {
- fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
- return 1;
- }
- while ( (m = getmntent(swapsTable)) != 0 ) {
- entries[count].mnt_fsname = strdup(m->mnt_fsname);
- entries[count].mnt_dir = strdup(m->mnt_dir);
- entries[count].mnt_type = strdup(m->mnt_type);
- entries[count].mnt_opts = strdup(m->mnt_opts);
- entries[count].mnt_freq = m->mnt_freq;
- entries[count].mnt_passno = m->mnt_passno;
- count++;
+#ifdef OLDKERNEL
+
+ struct mntent entries[100];
+ int count = 0;
+ FILE * swapsTable = setmntent("/etc/swaps", "r");
+ struct mntent * m;
+
+ if ( swapsTable == 0 ) {
+ fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
+ return;
+ }
+ while ( (m = getmntent(swapsTable)) != 0 ) {
+ entries[count].mnt_fsname = strdup(m->mnt_fsname);
+ entries[count].mnt_dir = strdup(m->mnt_dir);
+ entries[count].mnt_type = strdup(m->mnt_type);
+ entries[count].mnt_opts = strdup(m->mnt_opts);
+ entries[count].mnt_freq = m->mnt_freq;
+ entries[count].mnt_passno = m->mnt_passno;
+ count++;
+ }
+ endmntent(swapsTable);
+ if ( (swapsTable = setmntent("/etc/swaps", "w")) ) {
+ int id;
+ for ( id = 0; id < count; id++ ) {
+ int result =
+ (strcmp(entries[id].mnt_fsname, name)==0
+ ||strcmp(entries[id].mnt_dir, name)==0);
+ if ( result )
+ continue;
+ else
+ addmntent(swapsTable, &entries[id]);
}
endmntent(swapsTable);
- if ( (swapsTable = setmntent("/etc/swaps", "w")) ) {
- int id;
- for ( id = 0; id < count; id++ ) {
- int result =
- (strcmp(entries[id].mnt_fsname, i->source)==0
- ||strcmp(entries[id].mnt_dir, i->source)==0);
- if ( result )
- continue;
- else
- addmntent(swapsTable, &entries[id]);
- }
- endmntent(swapsTable);
- }
- else if ( errno != EROFS )
- fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
- return (0);
}
- return (-1);
-#else
- return (swapoff(i->source));
-#endif
+ else if ( errno != EROFS )
+ fprintf(stderr, "/etc/swaps: %s\n", strerror(errno));
+
+#endif /* OLDKERNEL */
+}
+
+extern int
+swapoff_fn(const struct FileInfo * i)
+{
+ int status = swapoff(i->source);
+
+ if ( !status )
+ addSwapTableEntry(i->source);
+
+ return status;
}
diff -Naur busybox/swapoff.c.rej busybox-0.27/swapoff.c.rej
--- busybox/swapoff.c.rej Wed Dec 31 16:00:00 1969
+++ busybox-0.27/swapoff.c.rej Mon Apr 12 21:15:57 1999
@@ -0,0 +1,26 @@
+***************
+*** 1
+- #include <stdio.h>
+--- 1,6 -----
++ #ifdef OLDKERNEL /* For 2.0.x kernels */
++ #include <stdio.h>
++ #include <string.h>
++ #include <errno.h>
++ #include <mntent.h>
++ #endif
+***************
+*** 4,6
+- #include <string.h>
+- #include <errno.h>
+- #include <mntent.h>
+--- 0 -----
+***************
+*** 0
+--- 18 -----
++ #ifdef OLDKERNEL /* For 2.0.x kernels */
+***************
+*** 0
+--- 57,59 -----
++ #else
++ return (swapoff(i->source));
++ #endif
diff -Naur busybox/swapon.c busybox-0.27/swapon.c
--- busybox/swapon.c Mon Apr 5 05:48:37 1999
+++ busybox-0.27/swapon.c Mon Apr 12 21:24:39 1999
@@ -13,11 +13,13 @@
extern int
swapon_fn(const struct FileInfo * i)
{
+ int status = swapon(i->source, 0);
+
#ifdef OLDKERNEL /* For 2.0.x kernels */
- FILE *swapsTable;
- struct mntent m;
+ if ( !status ) {
+ FILE *swapsTable;
+ struct mntent m;
- if (!(swapon(i->source, 0))) {
if ((swapsTable = setmntent("/etc/swaps", "a+"))) {
m.mnt_fsname = i->source;
m.mnt_dir = "none";
@@ -28,11 +30,8 @@
addmntent(swapsTable, &m);
endmntent(swapsTable);
}
- return (0);
}
- return (-1);
-#else
- return (swapon(i->source, 0));
-#endif
-}
+#endif /* OLDKERNEL */
+ return status;
+}
diff -Naur busybox/zcat.c busybox-0.27/zcat.c
--- busybox/zcat.c Mon Jun 22 07:53:18 1998
+++ busybox-0.27/zcat.c Mon Apr 12 21:26:35 1999
@@ -1041,7 +1041,7 @@
extern int errno;
#endif
-extern ulg crc_32_tab[]; /* crc table, defined below */
+const ulg crc_32_tab[]; /* crc table, defined below */
/* ===========================================================================
* Run a set of bytes through the crc shift register. If s is a NULL
@@ -1255,7 +1255,7 @@
/* ========================================================================
* Table of CRC-32's of all single-byte values (made by makecrc.c)
*/
-ulg crc_32_tab[] = {
+const ulg crc_32_tab[] = {
0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
Reply to: