aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-12 01:30:18 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-12 01:30:18 +0000
commit96bcfd346b436aef16b29d9157b80fd4148b1421 (patch)
tree339ad54804ab9399bbdb8a87e7bbc76408a11019
parent0dfac6b9cec891b8d523f85d7989d772a1447828 (diff)
downloadbusybox-w32-96bcfd346b436aef16b29d9157b80fd4148b1421.tar.gz
busybox-w32-96bcfd346b436aef16b29d9157b80fd4148b1421.tar.bz2
busybox-w32-96bcfd346b436aef16b29d9157b80fd4148b1421.zip
Latest and greatest
-Erik
-rw-r--r--Changelog28
-rw-r--r--Makefile14
-rw-r--r--archival/gzip.c98
-rw-r--r--archival/tar.c41
-rw-r--r--busybox.def.h2
-rw-r--r--busybox.spec6
-rw-r--r--coreutils/df.c14
-rw-r--r--df.c14
-rw-r--r--examples/busybox.spec6
-rw-r--r--gzip.c98
-rw-r--r--more.c13
-rw-r--r--regexp.c2
-rw-r--r--tar.c41
-rw-r--r--util-linux/more.c13
14 files changed, 259 insertions, 131 deletions
diff --git a/Changelog b/Changelog
index 7279efe64..f94855eb4 100644
--- a/Changelog
+++ b/Changelog
@@ -1,11 +1,21 @@
10.35 10.35
2 * gzip now obeys the principle of least surprise and acts like god intended
3 (i.e. it accepts a file name, answers --help, and obeys the '-c' flag
4 and only then outputs to stdout).
5 * Fixed more.c to compile autowidth on sparc and set initial winsize
6 to 0,0 in case the TIOCGWINSZ ioctl fails. Fix thanks to Eric Delaunay.
2 * Fixed tar so it now works as expected (it had TRUE/FALSE backwards) 7 * Fixed tar so it now works as expected (it had TRUE/FALSE backwards)
3 * tar now accepts --help 8 * tar now accepts --help
4 * chmod, chown, and chgrp usage now works 9 * chmod, chown, and chgrp usage now works
5 * General usage cleanups in most apps 10 * General usage (i.e. --help) cleanups for most apps
6 * umount now parses options correctly 11 * umount now parses options correctly
12 * tar can now unpack tarballs containing device special files,
13 sockets, and fifos (though it can't pack them up) thanks
14 to Matt Porter. Creating archives containing these is still
15 left to the interested student.
16 * fixed up the license in more.c to properly point to Bruce Perens.
7 17
8 -Erik Andersen 18 -Erik Andersen, Nov 11, 1999
9 19
100.34 200.34
11 * ls -l now displays link names outside the current directory, 21 * ls -l now displays link names outside the current directory,
@@ -27,7 +37,7 @@
27 * ls -l now bypasses libc6 nss when displaying user/group names. 37 * ls -l now bypasses libc6 nss when displaying user/group names.
28 Now uses my_getpwuid and my_getgrgid. 38 Now uses my_getpwuid and my_getgrgid.
29 39
30 -Erik Andersen 40 -Erik Andersen, Nov 8, 1999
31 41
320.33 420.33
33 * Fixed a bug where init could hang instead of rebooting. 43 * Fixed a bug where init could hang instead of rebooting.
@@ -39,7 +49,7 @@
39 state the real root device name) 49 state the real root device name)
40 * merged some redundant code from mtab.c/df.c into utility.c 50 * merged some redundant code from mtab.c/df.c into utility.c
41 51
42 -Erik Andersen 52 -Erik Andersen, Nov 5, 1999
43 53
440.32 540.32
45 * More changes -- many thanks to Lineo for paying me to work on 55 * More changes -- many thanks to Lineo for paying me to work on
@@ -68,7 +78,7 @@
68 as the name suggests. Fix thanks to Matt Porter <porter@debian.org>. 78 as the name suggests. Fix thanks to Matt Porter <porter@debian.org>.
69 79
70 80
71 -Erik Andersen 81 -Erik Andersen, Nov 4, 1999
72 82
730.31 830.31
74 * I added a changelog for version 0.30. 84 * I added a changelog for version 0.30.
@@ -83,7 +93,7 @@
83 it wasn't supported before GNU libc 2.1, and some folks use 93 it wasn't supported before GNU libc 2.1, and some folks use
84 glibc 2.0.7 since it is much smaller than that latest and greatest. 94 glibc 2.0.7 since it is much smaller than that latest and greatest.
85 95
86 -Erik Andersen 96 -Erik Andersen, Oct 21, 1999
87 97
880.30 980.30
89 Major changes -- lots of stuff rewritten. Many thanks to Lineo for 99 Major changes -- lots of stuff rewritten. Many thanks to Lineo for
@@ -152,7 +162,11 @@
152 * sfdisk -- Added from util-linux (minus internationalization and such). 162 * sfdisk -- Added from util-linux (minus internationalization and such).
153 * Probably some other changes that I forgot to document... 163 * Probably some other changes that I forgot to document...
154 164
155 -Erik Andersen 165 -Erik Andersen, Oct 20, 1999
166
1670.29
168 This version was a messy pre-alpha. stay away or it will bite you.
169 -Erik Andersen, Sep 24, 1999
156 170
1570.28 1710.28
158 mini-netcat (mnc) rewritten. 172 mini-netcat (mnc) rewritten.
diff --git a/Makefile b/Makefile
index 53a7d8ea8..ddf356f19 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@
17 17
18 18
19PROG=busybox 19PROG=busybox
20VERSION=0.34 20VERSION=0.35
21BUILDTIME=$(shell date "+%Y%m%d-%H%M") 21BUILDTIME=$(shell date "+%Y%m%d-%H%M")
22 22
23# Comment out the following to make a debuggable build 23# Comment out the following to make a debuggable build
@@ -58,14 +58,14 @@ OBJECTS=$(shell ./busybox.sh)
58CFLAGS+= -DBB_VER='"$(VERSION)"' 58CFLAGS+= -DBB_VER='"$(VERSION)"'
59CFLAGS+= -DBB_BT='"$(BUILDTIME)"' 59CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
60 60
61all: busybox links 61all: busybox busybox.links
62 62
63busybox: $(OBJECTS) 63busybox: $(OBJECTS)
64 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES) 64 $(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
65 $(STRIP) 65 $(STRIP)
66 66
67links: 67busybox.links:
68 - ./busybox.mkll | sort >busybox.links 68 - ./busybox.mkll | sort >$@
69 69
70clean: 70clean:
71 - rm -f $(PROG) busybox.links *~ *.o core 71 - rm -f $(PROG) busybox.links *~ *.o core
@@ -80,3 +80,9 @@ $(OBJECTS): busybox.def.h internal.h Makefile
80install: $(PROG) 80install: $(PROG)
81 install.sh $(BINDIR) 81 install.sh $(BINDIR)
82 82
83whichversion:
84 @echo $(VERSION)
85
86release: distclean
87 (cd .. ; cp -a busybox busybox-$(VERSION); tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION))
88
diff --git a/archival/gzip.c b/archival/gzip.c
index 500d6d7e0..8f2c1c454 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -12,10 +12,11 @@
12//#endif 12//#endif
13 13
14static const char gzip_usage[] = 14static const char gzip_usage[] =
15 "gzip [OPTION]... [FILE]...\n\n" 15 "gzip [OPTION]... FILE\n\n"
16 "Compress FILEs with maximum compression.\n\n" 16 "Compress FILE with maximum compression.\n"
17 "When FILE is -, reads standard input. Implies -c.\n\n"
17 "Options:\n" 18 "Options:\n"
18 "\t-c\tWrite output on standard output\n"; 19 "\t-c\tWrite output to standard output instead of FILE.gz\n";
19 20
20 21
21/* gzip.h -- common declarations for all gzip modules 22/* gzip.h -- common declarations for all gzip modules
@@ -1731,7 +1732,6 @@ DECLARE(uch, window, 2L*WSIZE);
1731 1732
1732int ascii = 0; /* convert end-of-lines to local OS conventions */ 1733int ascii = 0; /* convert end-of-lines to local OS conventions */
1733int decompress = 0; /* decompress (-d) */ 1734int decompress = 0; /* decompress (-d) */
1734int tostdout = 0; /* uncompress to stdout (-c) */
1735int no_name = -1; /* don't save or restore the original file name */ 1735int no_name = -1; /* don't save or restore the original file name */
1736int no_time = -1; /* don't save or restore the original file time */ 1736int no_time = -1; /* don't save or restore the original file time */
1737int foreground; /* set if program run in foreground */ 1737int foreground; /* set if program run in foreground */
@@ -1770,13 +1770,25 @@ unsigned outcnt; /* bytes in output buffer */
1770// char **argv; 1770// char **argv;
1771int gzip_main(int argc, char ** argv) 1771int gzip_main(int argc, char ** argv)
1772{ 1772{
1773 1773 int result;
1774 int inFileNum; 1774 int inFileNum;
1775 int outFileNum; 1775 int outFileNum;
1776 struct stat statBuf;
1777 char* delFileName;
1778 int tostdout = 0;
1779 int fromstdin = 0;
1780
1781 if (argc==1)
1782 usage(gzip_usage);
1776 1783
1777 /* Parse any options */ 1784 /* Parse any options */
1778 while (--argc > 0 && **(++argv) == '-') { 1785 while (--argc > 0 && **(++argv) == '-') {
1786 if (*((*argv)+1) == '\0') {
1787 fromstdin = 1;
1788 tostdout = 1;
1789 }
1779 while (*(++(*argv))) { 1790 while (*(++(*argv))) {
1791 fprintf(stderr, "**argv='%c'\n", **argv);
1780 switch (**argv) { 1792 switch (**argv) {
1781 case 'c': 1793 case 'c':
1782 tostdout = 1; 1794 tostdout = 1;
@@ -1817,64 +1829,81 @@ int gzip_main(int argc, char ** argv)
1817 ALLOC(ush, tab_prefix1, 1L<<(BITS-1)); 1829 ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
1818#endif 1830#endif
1819 1831
1820 if (tostdout==1) { 1832 if (fromstdin==1) {
1821 /* And get to work */ 1833 strcpy(ofname, "stdin");
1822 SET_BINARY_MODE(fileno(stdout));
1823 strcpy(ifname, "stdin");
1824 strcpy(ofname, "stdout");
1825 inFileNum=fileno(stdin);
1826 outFileNum=fileno(stdout);
1827 1834
1828 /* Get the time stamp on the input file. */ 1835 inFileNum=fileno(stdin);
1829 time_stamp = 0; /* time unknown by default */ 1836 time_stamp = 0; /* time unknown by default */
1830
1831 ifile_size = -1L; /* convention for unknown size */ 1837 ifile_size = -1L; /* convention for unknown size */
1832
1833 clear_bufs(); /* clear input and output buffers */
1834 part_nb = 0;
1835
1836 /* Actually do the compression/decompression. */
1837 zip(inFileNum, outFileNum);
1838
1839 } else { 1838 } else {
1840 int result; 1839 /* Open up the input file */
1841 struct stat statBuf;
1842
1843 /* And get to work */
1844 if (*argv=='\0') 1840 if (*argv=='\0')
1845 usage(gzip_usage); 1841 usage(gzip_usage);
1846 strncpy(ifname, *argv, MAX_PATH_LEN); 1842 strncpy(ifname, *argv, MAX_PATH_LEN);
1847 strncpy(ofname, *argv, MAX_PATH_LEN-4);
1848 strcat(ofname, ".gz");
1849 1843
1844 /* Open input fille */
1850 inFileNum=open( ifname, O_RDONLY); 1845 inFileNum=open( ifname, O_RDONLY);
1851 if (inFileNum < 0) { 1846 if (inFileNum < 0) {
1852 perror(ifname); 1847 perror(ifname);
1853 do_exit(WARNING); 1848 do_exit(WARNING);
1854 } 1849 }
1850 /* Get the time stamp on the input file. */
1855 result = stat(ifname, &statBuf); 1851 result = stat(ifname, &statBuf);
1856 if (result < 0) { 1852 if (result < 0) {
1857 perror(ifname); 1853 perror(ifname);
1858 do_exit(WARNING); 1854 do_exit(WARNING);
1859 } 1855 }
1856 time_stamp = statBuf.st_ctime;
1857 ifile_size = statBuf.st_size;
1858 }
1859
1860 1860
1861 outFileNum=open( ofname, O_RDONLY); 1861 if (tostdout==1) {
1862 /* And get to work */
1863 strcpy(ofname, "stdout");
1864 outFileNum=fileno(stdout);
1865 SET_BINARY_MODE(fileno(stdout));
1866
1867 clear_bufs(); /* clear input and output buffers */
1868 part_nb = 0;
1869
1870 /* Actually do the compression/decompression. */
1871 zip(inFileNum, outFileNum);
1872
1873 } else {
1874
1875 /* And get to work */
1876 strncpy(ofname, ifname, MAX_PATH_LEN-4);
1877 strcat(ofname, ".gz");
1878
1879
1880 /* Open output fille */
1881 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
1862 if (outFileNum < 0) { 1882 if (outFileNum < 0) {
1863 perror(ofname); 1883 perror(ofname);
1864 do_exit(WARNING); 1884 do_exit(WARNING);
1865 } 1885 }
1866 SET_BINARY_MODE(outFileNum); 1886 SET_BINARY_MODE(outFileNum);
1867 1887 /* Set permissions on the file */
1868 /* Get the time stamp on the input file. */ 1888 fchmod(outFileNum, statBuf.st_mode);
1869 time_stamp = statBuf.st_ctime; /* time unknown by default */
1870
1871 ifile_size = statBuf.st_size; /* convention for unknown size */
1872 1889
1873 clear_bufs(); /* clear input and output buffers */ 1890 clear_bufs(); /* clear input and output buffers */
1874 part_nb = 0; 1891 part_nb = 0;
1875 1892
1876 /* Actually do the compression/decompression. */ 1893 /* Actually do the compression/decompression. */
1877 zip(inFileNum, outFileNum); 1894 result=zip(inFileNum, outFileNum);
1895 close( outFileNum);
1896 close( inFileNum);
1897 /* Delete the original file */
1898 if (result == OK)
1899 delFileName=ifname;
1900 else
1901 delFileName=ofname;
1902
1903 if (unlink (delFileName) < 0) {
1904 perror (delFileName);
1905 exit( FALSE);
1906 }
1878 } 1907 }
1879 1908
1880 do_exit(exit_code); 1909 do_exit(exit_code);
@@ -3198,6 +3227,7 @@ int zip(in, out)
3198 3227
3199 /* Write the header to the gzip file. See algorithm.doc for the format */ 3228 /* Write the header to the gzip file. See algorithm.doc for the format */
3200 3229
3230
3201 method = DEFLATED; 3231 method = DEFLATED;
3202 put_byte(GZIP_MAGIC[0]); /* magic header */ 3232 put_byte(GZIP_MAGIC[0]); /* magic header */
3203 put_byte(GZIP_MAGIC[1]); 3233 put_byte(GZIP_MAGIC[1]);
diff --git a/archival/tar.c b/archival/tar.c
index ed6f3b6b5..5478af86e 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -10,6 +10,9 @@
10 * Modified for busybox by Erik Andersen <andersee@debian.org> 10 * Modified for busybox by Erik Andersen <andersee@debian.org>
11 * Adjusted to grok stdin/stdout options. 11 * Adjusted to grok stdin/stdout options.
12 * 12 *
13 * Modified to handle device special files by Matt Porter
14 * <porter@debian.org>
15 *
13 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or 18 * the Free Software Foundation; either version 2 of the License, or
@@ -34,6 +37,7 @@
34#include <fcntl.h> 37#include <fcntl.h>
35#include <signal.h> 38#include <signal.h>
36#include <time.h> 39#include <time.h>
40#include <sys/types.h>
37 41
38 42
39static const char tar_usage[] = 43static const char tar_usage[] =
@@ -377,12 +381,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
377 int uid; 381 int uid;
378 int gid; 382 int gid;
379 int checkSum; 383 int checkSum;
384 int major;
385 int minor;
380 long size; 386 long size;
381 time_t mtime; 387 time_t mtime;
382 const char *name; 388 const char *name;
383 int cc; 389 int cc;
384 int hardLink; 390 int hardLink;
385 int softLink; 391 int softLink;
392 int devFileFlag;
386 393
387 /* 394 /*
388 * If the block is completely empty, then this is the end of the 395 * If the block is completely empty, then this is the end of the
@@ -411,6 +418,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
411 size = getOctal (hp->size, sizeof (hp->size)); 418 size = getOctal (hp->size, sizeof (hp->size));
412 mtime = getOctal (hp->mtime, sizeof (hp->mtime)); 419 mtime = getOctal (hp->mtime, sizeof (hp->mtime));
413 checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); 420 checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum));
421 major = getOctal (hp->devMajor, sizeof (hp->devMajor));
422 minor = getOctal (hp->devMinor, sizeof (hp->devMinor));
414 423
415 if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { 424 if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) {
416 if (badHeader==FALSE) 425 if (badHeader==FALSE)
@@ -423,6 +432,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
423 432
424 badHeader = FALSE; 433 badHeader = FALSE;
425 skipFileFlag = FALSE; 434 skipFileFlag = FALSE;
435 devFileFlag = FALSE;
426 436
427 /* 437 /*
428 * Check for the file modes. 438 * Check for the file modes.
@@ -434,12 +444,10 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
434 (hp->typeFlag == TAR_TYPE_SOFT_LINK - '0')); 444 (hp->typeFlag == TAR_TYPE_SOFT_LINK - '0'));
435 445
436 /* 446 /*
437 * Check for a directory or a regular file. 447 * Check for a directory.
438 */ 448 */
439 if (name[strlen (name) - 1] == '/') 449 if (name[strlen (name) - 1] == '/')
440 mode |= S_IFDIR; 450 mode |= S_IFDIR;
441 else if ((mode & S_IFMT) == 0)
442 mode |= S_IFREG;
443 451
444 /* 452 /*
445 * Check for absolute paths in the file. 453 * Check for absolute paths in the file.
@@ -462,7 +470,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
462 * If not, then set up to skip it. 470 * If not, then set up to skip it.
463 */ 471 */
464 if (wantFileName (name, fileCount, fileTable) == FALSE) { 472 if (wantFileName (name, fileCount, fileTable) == FALSE) {
465 if (!hardLink && !softLink && S_ISREG (mode)) { 473 if ( !hardLink && !softLink && (S_ISREG (mode) || S_ISCHR (mode)
474 || S_ISBLK (mode) || S_ISSOCK(mode) || S_ISFIFO(mode) ) ) {
466 inHeader = (size == 0)? TRUE : FALSE; 475 inHeader = (size == 0)? TRUE : FALSE;
467 dataCc = size; 476 dataCc = size;
468 } 477 }
@@ -487,7 +496,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
487 printf (" (link to \"%s\")", hp->linkName); 496 printf (" (link to \"%s\")", hp->linkName);
488 else if (softLink) 497 else if (softLink)
489 printf (" (symlink to \"%s\")", hp->linkName); 498 printf (" (symlink to \"%s\")", hp->linkName);
490 else if (S_ISREG (mode)) { 499 else if (S_ISREG (mode) || S_ISCHR (mode) || S_ISBLK (mode) ||
500 S_ISSOCK(mode) || S_ISFIFO(mode) ) {
491 inHeader = (size == 0)? TRUE : FALSE; 501 inHeader = (size == 0)? TRUE : FALSE;
492 dataCc = size; 502 dataCc = size;
493 } 503 }
@@ -543,8 +553,17 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
543 */ 553 */
544 if (tostdoutFlag == TRUE) 554 if (tostdoutFlag == TRUE)
545 outFd = STDOUT; 555 outFd = STDOUT;
546 else 556 else {
547 outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); 557 if ( S_ISCHR(mode) || S_ISBLK(mode) || S_ISSOCK(mode) ) {
558 devFileFlag = TRUE;
559 outFd = mknod (name, mode, makedev(major, minor) );
560 }
561 else if (S_ISFIFO(mode) ) {
562 outFd = mkfifo(name, mode);
563 } else {
564 outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
565 }
566 }
548 567
549 if (outFd < 0) { 568 if (outFd < 0) {
550 perror (name); 569 perror (name);
@@ -555,7 +574,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
555 /* 574 /*
556 * If the file is empty, then that's all we need to do. 575 * If the file is empty, then that's all we need to do.
557 */ 576 */
558 if (size == 0 && tostdoutFlag == FALSE) { 577 if (size == 0 && (tostdoutFlag == FALSE) && (devFileFlag == FALSE)) {
559 (void) close (outFd); 578 (void) close (outFd);
560 outFd = -1; 579 outFd = -1;
561 } 580 }
@@ -735,12 +754,16 @@ static void saveFile (const char *fileName, int seeLinks)
735 754
736 return; 755 return;
737 } 756 }
738
739 if (S_ISREG (mode)) { 757 if (S_ISREG (mode)) {
740 saveRegularFile (fileName, &statbuf); 758 saveRegularFile (fileName, &statbuf);
741 759
742 return; 760 return;
743 } 761 }
762
763 /* Some day add support for tarring these up... but not today. :) */
764// if (S_ISLNK(mode) || S_ISFIFO(mode) || S_ISBLK(mode) || S_ISCHR (mode) ) {
765// fprintf (stderr, "%s: This version of tar can't store this type of file\n", fileName);
766// }
744 767
745 /* 768 /*
746 * The file is a strange type of file, ignore it. 769 * The file is a strange type of file, ignore it.
diff --git a/busybox.def.h b/busybox.def.h
index 79cbb27f1..5896861de 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -17,7 +17,7 @@
17//#define BB_FDFLUSH 17//#define BB_FDFLUSH
18#define BB_FIND 18#define BB_FIND
19#define BB_FSCK_MINIX 19#define BB_FSCK_MINIX
20#define BB_MKFS_MINIX 20//#define BB_MKFS_MINIX
21#define BB_CHVT 21#define BB_CHVT
22#define BB_DEALLOCVT 22#define BB_DEALLOCVT
23#define BB_GREP 23#define BB_GREP
diff --git a/busybox.spec b/busybox.spec
index 635ffe00a..5e6befbdf 100644
--- a/busybox.spec
+++ b/busybox.spec
@@ -1,5 +1,5 @@
1Name: busybox 1Name: busybox
2Version: 0.33 2Version: 0.35
3Release: 1 3Release: 1
4Group: System/Utilities 4Group: System/Utilities
5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. 5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
@@ -7,7 +7,7 @@ Copyright: GPL
7Packager : Erik Andersen <andersen@lineo.com> 7Packager : Erik Andersen <andersen@lineo.com>
8Conflicts: fileutils grep shellutils 8Conflicts: fileutils grep shellutils
9Buildroot: /tmp/%{Name}-%{Version} 9Buildroot: /tmp/%{Name}-%{Version}
10Source: busybox-%{Version}.tar.gz 10Source: %{Name}-%{Version}.tar.gz
11 11
12%Description 12%Description
13BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It 13BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
@@ -18,7 +18,7 @@ is makes an excellent environment for a "rescue" disk or any small or
18embedded system. 18embedded system.
19 19
20%Prep 20%Prep
21%setup -q -n busybox 21%setup -q -n %{Name}-%{Version}
22 22
23%Build 23%Build
24make 24make
diff --git a/coreutils/df.c b/coreutils/df.c
index a84a330d8..8b8db78a6 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -42,7 +42,7 @@ static int df(char *device, const char *mountPoint)
42 42
43 if (statfs(mountPoint, &s) != 0) { 43 if (statfs(mountPoint, &s) != 0) {
44 perror(mountPoint); 44 perror(mountPoint);
45 return 1; 45 return FALSE;
46 } 46 }
47 47
48 if (s.f_blocks > 0) { 48 if (s.f_blocks > 0) {
@@ -64,7 +64,7 @@ static int df(char *device, const char *mountPoint)
64 64
65 } 65 }
66 66
67 return 0; 67 return TRUE;
68} 68}
69 69
70extern int df_main(int argc, char **argv) 70extern int df_main(int argc, char **argv)
@@ -83,15 +83,15 @@ extern int df_main(int argc, char **argv)
83 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 83 if ((mountEntry = findMountPoint(argv[1], mtab_file)) ==
84 0) { 84 0) {
85 fprintf(stderr, "%s: can't find mount point.\n", argv[1]); 85 fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
86 return 1; 86 exit( FALSE);
87 } 87 }
88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); 88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
89 if (status != 0) 89 if (status != 0)
90 return status; 90 exit( status);
91 argc--; 91 argc--;
92 argv++; 92 argv++;
93 } 93 }
94 return 0; 94 exit( TRUE);
95 } else { 95 } else {
96 FILE *mountTable; 96 FILE *mountTable;
97 struct mntent *mountEntry; 97 struct mntent *mountEntry;
@@ -105,10 +105,10 @@ extern int df_main(int argc, char **argv)
105 while ((mountEntry = getmntent(mountTable))) { 105 while ((mountEntry = getmntent(mountTable))) {
106 int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); 106 int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
107 if (status) 107 if (status)
108 return status; 108 exit( status);
109 } 109 }
110 endmntent(mountTable); 110 endmntent(mountTable);
111 } 111 }
112 112
113 return 0; 113 exit( TRUE);
114} 114}
diff --git a/df.c b/df.c
index a84a330d8..8b8db78a6 100644
--- a/df.c
+++ b/df.c
@@ -42,7 +42,7 @@ static int df(char *device, const char *mountPoint)
42 42
43 if (statfs(mountPoint, &s) != 0) { 43 if (statfs(mountPoint, &s) != 0) {
44 perror(mountPoint); 44 perror(mountPoint);
45 return 1; 45 return FALSE;
46 } 46 }
47 47
48 if (s.f_blocks > 0) { 48 if (s.f_blocks > 0) {
@@ -64,7 +64,7 @@ static int df(char *device, const char *mountPoint)
64 64
65 } 65 }
66 66
67 return 0; 67 return TRUE;
68} 68}
69 69
70extern int df_main(int argc, char **argv) 70extern int df_main(int argc, char **argv)
@@ -83,15 +83,15 @@ extern int df_main(int argc, char **argv)
83 if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 83 if ((mountEntry = findMountPoint(argv[1], mtab_file)) ==
84 0) { 84 0) {
85 fprintf(stderr, "%s: can't find mount point.\n", argv[1]); 85 fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
86 return 1; 86 exit( FALSE);
87 } 87 }
88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); 88 status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
89 if (status != 0) 89 if (status != 0)
90 return status; 90 exit( status);
91 argc--; 91 argc--;
92 argv++; 92 argv++;
93 } 93 }
94 return 0; 94 exit( TRUE);
95 } else { 95 } else {
96 FILE *mountTable; 96 FILE *mountTable;
97 struct mntent *mountEntry; 97 struct mntent *mountEntry;
@@ -105,10 +105,10 @@ extern int df_main(int argc, char **argv)
105 while ((mountEntry = getmntent(mountTable))) { 105 while ((mountEntry = getmntent(mountTable))) {
106 int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir); 106 int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
107 if (status) 107 if (status)
108 return status; 108 exit( status);
109 } 109 }
110 endmntent(mountTable); 110 endmntent(mountTable);
111 } 111 }
112 112
113 return 0; 113 exit( TRUE);
114} 114}
diff --git a/examples/busybox.spec b/examples/busybox.spec
index 635ffe00a..5e6befbdf 100644
--- a/examples/busybox.spec
+++ b/examples/busybox.spec
@@ -1,5 +1,5 @@
1Name: busybox 1Name: busybox
2Version: 0.33 2Version: 0.35
3Release: 1 3Release: 1
4Group: System/Utilities 4Group: System/Utilities
5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary. 5Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
@@ -7,7 +7,7 @@ Copyright: GPL
7Packager : Erik Andersen <andersen@lineo.com> 7Packager : Erik Andersen <andersen@lineo.com>
8Conflicts: fileutils grep shellutils 8Conflicts: fileutils grep shellutils
9Buildroot: /tmp/%{Name}-%{Version} 9Buildroot: /tmp/%{Name}-%{Version}
10Source: busybox-%{Version}.tar.gz 10Source: %{Name}-%{Version}.tar.gz
11 11
12%Description 12%Description
13BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It 13BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
@@ -18,7 +18,7 @@ is makes an excellent environment for a "rescue" disk or any small or
18embedded system. 18embedded system.
19 19
20%Prep 20%Prep
21%setup -q -n busybox 21%setup -q -n %{Name}-%{Version}
22 22
23%Build 23%Build
24make 24make
diff --git a/gzip.c b/gzip.c
index 500d6d7e0..8f2c1c454 100644
--- a/gzip.c
+++ b/gzip.c
@@ -12,10 +12,11 @@
12//#endif 12//#endif
13 13
14static const char gzip_usage[] = 14static const char gzip_usage[] =
15 "gzip [OPTION]... [FILE]...\n\n" 15 "gzip [OPTION]... FILE\n\n"
16 "Compress FILEs with maximum compression.\n\n" 16 "Compress FILE with maximum compression.\n"
17 "When FILE is -, reads standard input. Implies -c.\n\n"
17 "Options:\n" 18 "Options:\n"
18 "\t-c\tWrite output on standard output\n"; 19 "\t-c\tWrite output to standard output instead of FILE.gz\n";
19 20
20 21
21/* gzip.h -- common declarations for all gzip modules 22/* gzip.h -- common declarations for all gzip modules
@@ -1731,7 +1732,6 @@ DECLARE(uch, window, 2L*WSIZE);
1731 1732
1732int ascii = 0; /* convert end-of-lines to local OS conventions */ 1733int ascii = 0; /* convert end-of-lines to local OS conventions */
1733int decompress = 0; /* decompress (-d) */ 1734int decompress = 0; /* decompress (-d) */
1734int tostdout = 0; /* uncompress to stdout (-c) */
1735int no_name = -1; /* don't save or restore the original file name */ 1735int no_name = -1; /* don't save or restore the original file name */
1736int no_time = -1; /* don't save or restore the original file time */ 1736int no_time = -1; /* don't save or restore the original file time */
1737int foreground; /* set if program run in foreground */ 1737int foreground; /* set if program run in foreground */
@@ -1770,13 +1770,25 @@ unsigned outcnt; /* bytes in output buffer */
1770// char **argv; 1770// char **argv;
1771int gzip_main(int argc, char ** argv) 1771int gzip_main(int argc, char ** argv)
1772{ 1772{
1773 1773 int result;
1774 int inFileNum; 1774 int inFileNum;
1775 int outFileNum; 1775 int outFileNum;
1776 struct stat statBuf;
1777 char* delFileName;
1778 int tostdout = 0;
1779 int fromstdin = 0;
1780
1781 if (argc==1)
1782 usage(gzip_usage);
1776 1783
1777 /* Parse any options */ 1784 /* Parse any options */
1778 while (--argc > 0 && **(++argv) == '-') { 1785 while (--argc > 0 && **(++argv) == '-') {
1786 if (*((*argv)+1) == '\0') {
1787 fromstdin = 1;
1788 tostdout = 1;
1789 }
1779 while (*(++(*argv))) { 1790 while (*(++(*argv))) {
1791 fprintf(stderr, "**argv='%c'\n", **argv);
1780 switch (**argv) { 1792 switch (**argv) {
1781 case 'c': 1793 case 'c':
1782 tostdout = 1; 1794 tostdout = 1;
@@ -1817,64 +1829,81 @@ int gzip_main(int argc, char ** argv)
1817 ALLOC(ush, tab_prefix1, 1L<<(BITS-1)); 1829 ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
1818#endif 1830#endif
1819 1831
1820 if (tostdout==1) { 1832 if (fromstdin==1) {
1821 /* And get to work */ 1833 strcpy(ofname, "stdin");
1822 SET_BINARY_MODE(fileno(stdout));
1823 strcpy(ifname, "stdin");
1824 strcpy(ofname, "stdout");
1825 inFileNum=fileno(stdin);
1826 outFileNum=fileno(stdout);
1827 1834
1828 /* Get the time stamp on the input file. */ 1835 inFileNum=fileno(stdin);
1829 time_stamp = 0; /* time unknown by default */ 1836 time_stamp = 0; /* time unknown by default */
1830
1831 ifile_size = -1L; /* convention for unknown size */ 1837 ifile_size = -1L; /* convention for unknown size */
1832
1833 clear_bufs(); /* clear input and output buffers */
1834 part_nb = 0;
1835
1836 /* Actually do the compression/decompression. */
1837 zip(inFileNum, outFileNum);
1838
1839 } else { 1838 } else {
1840 int result; 1839 /* Open up the input file */
1841 struct stat statBuf;
1842
1843 /* And get to work */
1844 if (*argv=='\0') 1840 if (*argv=='\0')
1845 usage(gzip_usage); 1841 usage(gzip_usage);
1846 strncpy(ifname, *argv, MAX_PATH_LEN); 1842 strncpy(ifname, *argv, MAX_PATH_LEN);
1847 strncpy(ofname, *argv, MAX_PATH_LEN-4);
1848 strcat(ofname, ".gz");
1849 1843
1844 /* Open input fille */
1850 inFileNum=open( ifname, O_RDONLY); 1845 inFileNum=open( ifname, O_RDONLY);
1851 if (inFileNum < 0) { 1846 if (inFileNum < 0) {
1852 perror(ifname); 1847 perror(ifname);
1853 do_exit(WARNING); 1848 do_exit(WARNING);
1854 } 1849 }
1850 /* Get the time stamp on the input file. */
1855 result = stat(ifname, &statBuf); 1851 result = stat(ifname, &statBuf);
1856 if (result < 0) { 1852 if (result < 0) {
1857 perror(ifname); 1853 perror(ifname);
1858 do_exit(WARNING); 1854 do_exit(WARNING);
1859 } 1855 }
1856 time_stamp = statBuf.st_ctime;
1857 ifile_size = statBuf.st_size;
1858 }
1859
1860 1860
1861 outFileNum=open( ofname, O_RDONLY); 1861 if (tostdout==1) {
1862 /* And get to work */
1863 strcpy(ofname, "stdout");
1864 outFileNum=fileno(stdout);
1865 SET_BINARY_MODE(fileno(stdout));
1866
1867 clear_bufs(); /* clear input and output buffers */
1868 part_nb = 0;
1869
1870 /* Actually do the compression/decompression. */
1871 zip(inFileNum, outFileNum);
1872
1873 } else {
1874
1875 /* And get to work */
1876 strncpy(ofname, ifname, MAX_PATH_LEN-4);
1877 strcat(ofname, ".gz");
1878
1879
1880 /* Open output fille */
1881 outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
1862 if (outFileNum < 0) { 1882 if (outFileNum < 0) {
1863 perror(ofname); 1883 perror(ofname);
1864 do_exit(WARNING); 1884 do_exit(WARNING);
1865 } 1885 }
1866 SET_BINARY_MODE(outFileNum); 1886 SET_BINARY_MODE(outFileNum);
1867 1887 /* Set permissions on the file */
1868 /* Get the time stamp on the input file. */ 1888 fchmod(outFileNum, statBuf.st_mode);
1869 time_stamp = statBuf.st_ctime; /* time unknown by default */
1870
1871 ifile_size = statBuf.st_size; /* convention for unknown size */
1872 1889
1873 clear_bufs(); /* clear input and output buffers */ 1890 clear_bufs(); /* clear input and output buffers */
1874 part_nb = 0; 1891 part_nb = 0;
1875 1892
1876 /* Actually do the compression/decompression. */ 1893 /* Actually do the compression/decompression. */
1877 zip(inFileNum, outFileNum); 1894 result=zip(inFileNum, outFileNum);
1895 close( outFileNum);
1896 close( inFileNum);
1897 /* Delete the original file */
1898 if (result == OK)
1899 delFileName=ifname;
1900 else
1901 delFileName=ofname;
1902
1903 if (unlink (delFileName) < 0) {
1904 perror (delFileName);
1905 exit( FALSE);
1906 }
1878 } 1907 }
1879 1908
1880 do_exit(exit_code); 1909 do_exit(exit_code);
@@ -3198,6 +3227,7 @@ int zip(in, out)
3198 3227
3199 /* Write the header to the gzip file. See algorithm.doc for the format */ 3228 /* Write the header to the gzip file. See algorithm.doc for the format */
3200 3229
3230
3201 method = DEFLATED; 3231 method = DEFLATED;
3202 put_byte(GZIP_MAGIC[0]); /* magic header */ 3232 put_byte(GZIP_MAGIC[0]); /* magic header */
3203 put_byte(GZIP_MAGIC[1]); 3233 put_byte(GZIP_MAGIC[1]);
diff --git a/more.c b/more.c
index 515857e0f..7d0ddb8ec 100644
--- a/more.c
+++ b/more.c
@@ -2,10 +2,11 @@
2 * Mini more implementation for busybox 2 * Mini more implementation for busybox
3 * 3 *
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 * Blended by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 *
7 * based on the original more implementation and code from the Debian 7 * Latest version blended together by Erik Andersen <andersen@lineo.com>,
8 * boot-floppies team. 8 * based on the original more implementation by Bruce, and code from the
9 * Debian boot-floppies team.
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -68,7 +69,7 @@ static const char more_usage[] = "more [file ...]\n";
68#define TERMINAL_HEIGHT 24 69#define TERMINAL_HEIGHT 24
69 70
70 71
71#if defined BB_FEATURE_AUTOWIDTH && ! defined USE_OLD_TERMIO 72#if defined BB_FEATURE_AUTOWIDTH
72static int terminal_width = 0, terminal_height = 0; 73static int terminal_width = 0, terminal_height = 0;
73#else 74#else
74#define terminal_width TERMINAL_WIDTH 75#define terminal_width TERMINAL_WIDTH
@@ -84,7 +85,7 @@ extern int more_main(int argc, char **argv)
84 struct stat st; 85 struct stat st;
85 FILE *file; 86 FILE *file;
86#ifdef BB_FEATURE_AUTOWIDTH 87#ifdef BB_FEATURE_AUTOWIDTH
87 struct winsize win; 88 struct winsize win = {0,0};
88#endif 89#endif
89 90
90 argc--; 91 argc--;
diff --git a/regexp.c b/regexp.c
index 5500b1da7..fb0170739 100644
--- a/regexp.c
+++ b/regexp.c
@@ -504,7 +504,7 @@ extern regexp *regcomp(char* text)
504 int token; 504 int token;
505 int peek; 505 int peek;
506 char *build; 506 char *build;
507 regexp *re; 507 regexp *re; // Ignore compiler whining. If we longjmp, we don't use re anymore.
508 508
509 509
510 /* prepare for error handling */ 510 /* prepare for error handling */
diff --git a/tar.c b/tar.c
index ed6f3b6b5..5478af86e 100644
--- a/tar.c
+++ b/tar.c
@@ -10,6 +10,9 @@
10 * Modified for busybox by Erik Andersen <andersee@debian.org> 10 * Modified for busybox by Erik Andersen <andersee@debian.org>
11 * Adjusted to grok stdin/stdout options. 11 * Adjusted to grok stdin/stdout options.
12 * 12 *
13 * Modified to handle device special files by Matt Porter
14 * <porter@debian.org>
15 *
13 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or 18 * the Free Software Foundation; either version 2 of the License, or
@@ -34,6 +37,7 @@
34#include <fcntl.h> 37#include <fcntl.h>
35#include <signal.h> 38#include <signal.h>
36#include <time.h> 39#include <time.h>
40#include <sys/types.h>
37 41
38 42
39static const char tar_usage[] = 43static const char tar_usage[] =
@@ -377,12 +381,15 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
377 int uid; 381 int uid;
378 int gid; 382 int gid;
379 int checkSum; 383 int checkSum;
384 int major;
385 int minor;
380 long size; 386 long size;
381 time_t mtime; 387 time_t mtime;
382 const char *name; 388 const char *name;
383 int cc; 389 int cc;
384 int hardLink; 390 int hardLink;
385 int softLink; 391 int softLink;
392 int devFileFlag;
386 393
387 /* 394 /*
388 * If the block is completely empty, then this is the end of the 395 * If the block is completely empty, then this is the end of the
@@ -411,6 +418,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
411 size = getOctal (hp->size, sizeof (hp->size)); 418 size = getOctal (hp->size, sizeof (hp->size));
412 mtime = getOctal (hp->mtime, sizeof (hp->mtime)); 419 mtime = getOctal (hp->mtime, sizeof (hp->mtime));
413 checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum)); 420 checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum));
421 major = getOctal (hp->devMajor, sizeof (hp->devMajor));
422 minor = getOctal (hp->devMinor, sizeof (hp->devMinor));
414 423
415 if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) { 424 if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) {
416 if (badHeader==FALSE) 425 if (badHeader==FALSE)
@@ -423,6 +432,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
423 432
424 badHeader = FALSE; 433 badHeader = FALSE;
425 skipFileFlag = FALSE; 434 skipFileFlag = FALSE;
435 devFileFlag = FALSE;
426 436
427 /* 437 /*
428 * Check for the file modes. 438 * Check for the file modes.
@@ -434,12 +444,10 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
434 (hp->typeFlag == TAR_TYPE_SOFT_LINK - '0')); 444 (hp->typeFlag == TAR_TYPE_SOFT_LINK - '0'));
435 445
436 /* 446 /*
437 * Check for a directory or a regular file. 447 * Check for a directory.
438 */ 448 */
439 if (name[strlen (name) - 1] == '/') 449 if (name[strlen (name) - 1] == '/')
440 mode |= S_IFDIR; 450 mode |= S_IFDIR;
441 else if ((mode & S_IFMT) == 0)
442 mode |= S_IFREG;
443 451
444 /* 452 /*
445 * Check for absolute paths in the file. 453 * Check for absolute paths in the file.
@@ -462,7 +470,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
462 * If not, then set up to skip it. 470 * If not, then set up to skip it.
463 */ 471 */
464 if (wantFileName (name, fileCount, fileTable) == FALSE) { 472 if (wantFileName (name, fileCount, fileTable) == FALSE) {
465 if (!hardLink && !softLink && S_ISREG (mode)) { 473 if ( !hardLink && !softLink && (S_ISREG (mode) || S_ISCHR (mode)
474 || S_ISBLK (mode) || S_ISSOCK(mode) || S_ISFIFO(mode) ) ) {
466 inHeader = (size == 0)? TRUE : FALSE; 475 inHeader = (size == 0)? TRUE : FALSE;
467 dataCc = size; 476 dataCc = size;
468 } 477 }
@@ -487,7 +496,8 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
487 printf (" (link to \"%s\")", hp->linkName); 496 printf (" (link to \"%s\")", hp->linkName);
488 else if (softLink) 497 else if (softLink)
489 printf (" (symlink to \"%s\")", hp->linkName); 498 printf (" (symlink to \"%s\")", hp->linkName);
490 else if (S_ISREG (mode)) { 499 else if (S_ISREG (mode) || S_ISCHR (mode) || S_ISBLK (mode) ||
500 S_ISSOCK(mode) || S_ISFIFO(mode) ) {
491 inHeader = (size == 0)? TRUE : FALSE; 501 inHeader = (size == 0)? TRUE : FALSE;
492 dataCc = size; 502 dataCc = size;
493 } 503 }
@@ -543,8 +553,17 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
543 */ 553 */
544 if (tostdoutFlag == TRUE) 554 if (tostdoutFlag == TRUE)
545 outFd = STDOUT; 555 outFd = STDOUT;
546 else 556 else {
547 outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode); 557 if ( S_ISCHR(mode) || S_ISBLK(mode) || S_ISSOCK(mode) ) {
558 devFileFlag = TRUE;
559 outFd = mknod (name, mode, makedev(major, minor) );
560 }
561 else if (S_ISFIFO(mode) ) {
562 outFd = mkfifo(name, mode);
563 } else {
564 outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
565 }
566 }
548 567
549 if (outFd < 0) { 568 if (outFd < 0) {
550 perror (name); 569 perror (name);
@@ -555,7 +574,7 @@ readHeader (const TarHeader * hp, int fileCount, char **fileTable)
555 /* 574 /*
556 * If the file is empty, then that's all we need to do. 575 * If the file is empty, then that's all we need to do.
557 */ 576 */
558 if (size == 0 && tostdoutFlag == FALSE) { 577 if (size == 0 && (tostdoutFlag == FALSE) && (devFileFlag == FALSE)) {
559 (void) close (outFd); 578 (void) close (outFd);
560 outFd = -1; 579 outFd = -1;
561 } 580 }
@@ -735,12 +754,16 @@ static void saveFile (const char *fileName, int seeLinks)
735 754
736 return; 755 return;
737 } 756 }
738
739 if (S_ISREG (mode)) { 757 if (S_ISREG (mode)) {
740 saveRegularFile (fileName, &statbuf); 758 saveRegularFile (fileName, &statbuf);
741 759
742 return; 760 return;
743 } 761 }
762
763 /* Some day add support for tarring these up... but not today. :) */
764// if (S_ISLNK(mode) || S_ISFIFO(mode) || S_ISBLK(mode) || S_ISCHR (mode) ) {
765// fprintf (stderr, "%s: This version of tar can't store this type of file\n", fileName);
766// }
744 767
745 /* 768 /*
746 * The file is a strange type of file, ignore it. 769 * The file is a strange type of file, ignore it.
diff --git a/util-linux/more.c b/util-linux/more.c
index 515857e0f..7d0ddb8ec 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -2,10 +2,11 @@
2 * Mini more implementation for busybox 2 * Mini more implementation for busybox
3 * 3 *
4 * 4 *
5 * Copyright (C) 1999 by Lineo, inc. 5 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
6 * Blended by Erik Andersen <andersen@lineo.com>, <andersee@debian.org> 6 *
7 * based on the original more implementation and code from the Debian 7 * Latest version blended together by Erik Andersen <andersen@lineo.com>,
8 * boot-floppies team. 8 * based on the original more implementation by Bruce, and code from the
9 * Debian boot-floppies team.
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -68,7 +69,7 @@ static const char more_usage[] = "more [file ...]\n";
68#define TERMINAL_HEIGHT 24 69#define TERMINAL_HEIGHT 24
69 70
70 71
71#if defined BB_FEATURE_AUTOWIDTH && ! defined USE_OLD_TERMIO 72#if defined BB_FEATURE_AUTOWIDTH
72static int terminal_width = 0, terminal_height = 0; 73static int terminal_width = 0, terminal_height = 0;
73#else 74#else
74#define terminal_width TERMINAL_WIDTH 75#define terminal_width TERMINAL_WIDTH
@@ -84,7 +85,7 @@ extern int more_main(int argc, char **argv)
84 struct stat st; 85 struct stat st;
85 FILE *file; 86 FILE *file;
86#ifdef BB_FEATURE_AUTOWIDTH 87#ifdef BB_FEATURE_AUTOWIDTH
87 struct winsize win; 88 struct winsize win = {0,0};
88#endif 89#endif
89 90
90 argc--; 91 argc--;