0.35
+ * gzip now obeys the principle of least surprise and acts like god intended
+ (i.e. it accepts a file name, answers --help, and obeys the '-c' flag
+ and only then outputs to stdout).
+ * Fixed more.c to compile autowidth on sparc and set initial winsize
+ to 0,0 in case the TIOCGWINSZ ioctl fails. Fix thanks to Eric Delaunay.
* Fixed tar so it now works as expected (it had TRUE/FALSE backwards)
* tar now accepts --help
* chmod, chown, and chgrp usage now works
- * General usage cleanups in most apps
+ * General usage (i.e. --help) cleanups for most apps
* umount now parses options correctly
+ * tar can now unpack tarballs containing device special files,
+ sockets, and fifos (though it can't pack them up) thanks
+ to Matt Porter. Creating archives containing these is still
+ left to the interested student.
+ * fixed up the license in more.c to properly point to Bruce Perens.
- -Erik Andersen
+ -Erik Andersen, Nov 11, 1999
0.34
* ls -l now displays link names outside the current directory,
* ls -l now bypasses libc6 nss when displaying user/group names.
Now uses my_getpwuid and my_getgrgid.
- -Erik Andersen
+ -Erik Andersen, Nov 8, 1999
0.33
* Fixed a bug where init could hang instead of rebooting.
state the real root device name)
* merged some redundant code from mtab.c/df.c into utility.c
- -Erik Andersen
+ -Erik Andersen, Nov 5, 1999
0.32
* More changes -- many thanks to Lineo for paying me to work on
as the name suggests. Fix thanks to Matt Porter <porter@debian.org>.
- -Erik Andersen
+ -Erik Andersen, Nov 4, 1999
0.31
* I added a changelog for version 0.30.
it wasn't supported before GNU libc 2.1, and some folks use
glibc 2.0.7 since it is much smaller than that latest and greatest.
- -Erik Andersen
+ -Erik Andersen, Oct 21, 1999
0.30
Major changes -- lots of stuff rewritten. Many thanks to Lineo for
* sfdisk -- Added from util-linux (minus internationalization and such).
* Probably some other changes that I forgot to document...
- -Erik Andersen
+ -Erik Andersen, Oct 20, 1999
+
+0.29
+ This version was a messy pre-alpha. stay away or it will bite you.
+ -Erik Andersen, Sep 24, 1999
0.28
mini-netcat (mnc) rewritten.
PROG=busybox
-VERSION=0.34
+VERSION=0.35
BUILDTIME=$(shell date "+%Y%m%d-%H%M")
# Comment out the following to make a debuggable build
CFLAGS+= -DBB_VER='"$(VERSION)"'
CFLAGS+= -DBB_BT='"$(BUILDTIME)"'
-all: busybox links
+all: busybox busybox.links
busybox: $(OBJECTS)
$(CC) $(LDFLAGS) -o $(PROG) $(OBJECTS) $(LIBRARIES)
$(STRIP)
-links:
- - ./busybox.mkll | sort >busybox.links
+busybox.links:
+ - ./busybox.mkll | sort >$@
clean:
- rm -f $(PROG) busybox.links *~ *.o core
install: $(PROG)
install.sh $(BINDIR)
+whichversion:
+ @echo $(VERSION)
+
+release: distclean
+ (cd .. ; cp -a busybox busybox-$(VERSION); tar -cvzf busybox-$(VERSION).tar.gz busybox-$(VERSION))
+
//#endif
static const char gzip_usage[] =
- "gzip [OPTION]... [FILE]...\n\n"
- "Compress FILEs with maximum compression.\n\n"
+ "gzip [OPTION]... FILE\n\n"
+ "Compress FILE with maximum compression.\n"
+ "When FILE is -, reads standard input. Implies -c.\n\n"
"Options:\n"
- "\t-c\tWrite output on standard output\n";
+ "\t-c\tWrite output to standard output instead of FILE.gz\n";
/* gzip.h -- common declarations for all gzip modules
int ascii = 0; /* convert end-of-lines to local OS conventions */
int decompress = 0; /* decompress (-d) */
-int tostdout = 0; /* uncompress to stdout (-c) */
int no_name = -1; /* don't save or restore the original file name */
int no_time = -1; /* don't save or restore the original file time */
int foreground; /* set if program run in foreground */
// char **argv;
int gzip_main(int argc, char ** argv)
{
-
+ int result;
int inFileNum;
int outFileNum;
+ struct stat statBuf;
+ char* delFileName;
+ int tostdout = 0;
+ int fromstdin = 0;
+
+ if (argc==1)
+ usage(gzip_usage);
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
+ if (*((*argv)+1) == '\0') {
+ fromstdin = 1;
+ tostdout = 1;
+ }
while (*(++(*argv))) {
+ fprintf(stderr, "**argv='%c'\n", **argv);
switch (**argv) {
case 'c':
tostdout = 1;
ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
#endif
- if (tostdout==1) {
- /* And get to work */
- SET_BINARY_MODE(fileno(stdout));
- strcpy(ifname, "stdin");
- strcpy(ofname, "stdout");
- inFileNum=fileno(stdin);
- outFileNum=fileno(stdout);
+ if (fromstdin==1) {
+ strcpy(ofname, "stdin");
- /* Get the time stamp on the input file. */
+ inFileNum=fileno(stdin);
time_stamp = 0; /* time unknown by default */
-
ifile_size = -1L; /* convention for unknown size */
-
- clear_bufs(); /* clear input and output buffers */
- part_nb = 0;
-
- /* Actually do the compression/decompression. */
- zip(inFileNum, outFileNum);
-
} else {
- int result;
- struct stat statBuf;
-
- /* And get to work */
+ /* Open up the input file */
if (*argv=='\0')
usage(gzip_usage);
strncpy(ifname, *argv, MAX_PATH_LEN);
- strncpy(ofname, *argv, MAX_PATH_LEN-4);
- strcat(ofname, ".gz");
+ /* Open input fille */
inFileNum=open( ifname, O_RDONLY);
if (inFileNum < 0) {
perror(ifname);
do_exit(WARNING);
}
+ /* Get the time stamp on the input file. */
result = stat(ifname, &statBuf);
if (result < 0) {
perror(ifname);
do_exit(WARNING);
}
+ time_stamp = statBuf.st_ctime;
+ ifile_size = statBuf.st_size;
+ }
+
- outFileNum=open( ofname, O_RDONLY);
+ if (tostdout==1) {
+ /* And get to work */
+ strcpy(ofname, "stdout");
+ outFileNum=fileno(stdout);
+ SET_BINARY_MODE(fileno(stdout));
+
+ clear_bufs(); /* clear input and output buffers */
+ part_nb = 0;
+
+ /* Actually do the compression/decompression. */
+ zip(inFileNum, outFileNum);
+
+ } else {
+
+ /* And get to work */
+ strncpy(ofname, ifname, MAX_PATH_LEN-4);
+ strcat(ofname, ".gz");
+
+
+ /* Open output fille */
+ outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
if (outFileNum < 0) {
perror(ofname);
do_exit(WARNING);
}
SET_BINARY_MODE(outFileNum);
-
- /* Get the time stamp on the input file. */
- time_stamp = statBuf.st_ctime; /* time unknown by default */
-
- ifile_size = statBuf.st_size; /* convention for unknown size */
+ /* Set permissions on the file */
+ fchmod(outFileNum, statBuf.st_mode);
clear_bufs(); /* clear input and output buffers */
part_nb = 0;
/* Actually do the compression/decompression. */
- zip(inFileNum, outFileNum);
+ result=zip(inFileNum, outFileNum);
+ close( outFileNum);
+ close( inFileNum);
+ /* Delete the original file */
+ if (result == OK)
+ delFileName=ifname;
+ else
+ delFileName=ofname;
+
+ if (unlink (delFileName) < 0) {
+ perror (delFileName);
+ exit( FALSE);
+ }
}
do_exit(exit_code);
/* Write the header to the gzip file. See algorithm.doc for the format */
+
method = DEFLATED;
put_byte(GZIP_MAGIC[0]); /* magic header */
put_byte(GZIP_MAGIC[1]);
* Modified for busybox by Erik Andersen <andersee@debian.org>
* Adjusted to grok stdin/stdout options.
*
+ * Modified to handle device special files by Matt Porter
+ * <porter@debian.org>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
#include <fcntl.h>
#include <signal.h>
#include <time.h>
+#include <sys/types.h>
static const char tar_usage[] =
int uid;
int gid;
int checkSum;
+ int major;
+ int minor;
long size;
time_t mtime;
const char *name;
int cc;
int hardLink;
int softLink;
+ int devFileFlag;
/*
* If the block is completely empty, then this is the end of the
size = getOctal (hp->size, sizeof (hp->size));
mtime = getOctal (hp->mtime, sizeof (hp->mtime));
checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum));
+ major = getOctal (hp->devMajor, sizeof (hp->devMajor));
+ minor = getOctal (hp->devMinor, sizeof (hp->devMinor));
if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) {
if (badHeader==FALSE)
badHeader = FALSE;
skipFileFlag = FALSE;
+ devFileFlag = FALSE;
/*
* Check for the file modes.
(hp->typeFlag == TAR_TYPE_SOFT_LINK - '0'));
/*
- * Check for a directory or a regular file.
+ * Check for a directory.
*/
if (name[strlen (name) - 1] == '/')
mode |= S_IFDIR;
- else if ((mode & S_IFMT) == 0)
- mode |= S_IFREG;
/*
* Check for absolute paths in the file.
* If not, then set up to skip it.
*/
if (wantFileName (name, fileCount, fileTable) == FALSE) {
- if (!hardLink && !softLink && S_ISREG (mode)) {
+ if ( !hardLink && !softLink && (S_ISREG (mode) || S_ISCHR (mode)
+ || S_ISBLK (mode) || S_ISSOCK(mode) || S_ISFIFO(mode) ) ) {
inHeader = (size == 0)? TRUE : FALSE;
dataCc = size;
}
printf (" (link to \"%s\")", hp->linkName);
else if (softLink)
printf (" (symlink to \"%s\")", hp->linkName);
- else if (S_ISREG (mode)) {
+ else if (S_ISREG (mode) || S_ISCHR (mode) || S_ISBLK (mode) ||
+ S_ISSOCK(mode) || S_ISFIFO(mode) ) {
inHeader = (size == 0)? TRUE : FALSE;
dataCc = size;
}
*/
if (tostdoutFlag == TRUE)
outFd = STDOUT;
- else
- outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ else {
+ if ( S_ISCHR(mode) || S_ISBLK(mode) || S_ISSOCK(mode) ) {
+ devFileFlag = TRUE;
+ outFd = mknod (name, mode, makedev(major, minor) );
+ }
+ else if (S_ISFIFO(mode) ) {
+ outFd = mkfifo(name, mode);
+ } else {
+ outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ }
+ }
if (outFd < 0) {
perror (name);
/*
* If the file is empty, then that's all we need to do.
*/
- if (size == 0 && tostdoutFlag == FALSE) {
+ if (size == 0 && (tostdoutFlag == FALSE) && (devFileFlag == FALSE)) {
(void) close (outFd);
outFd = -1;
}
return;
}
-
if (S_ISREG (mode)) {
saveRegularFile (fileName, &statbuf);
return;
}
+
+ /* Some day add support for tarring these up... but not today. :) */
+// if (S_ISLNK(mode) || S_ISFIFO(mode) || S_ISBLK(mode) || S_ISCHR (mode) ) {
+// fprintf (stderr, "%s: This version of tar can't store this type of file\n", fileName);
+// }
/*
* The file is a strange type of file, ignore it.
//#define BB_FDFLUSH
#define BB_FIND
#define BB_FSCK_MINIX
-#define BB_MKFS_MINIX
+//#define BB_MKFS_MINIX
#define BB_CHVT
#define BB_DEALLOCVT
#define BB_GREP
Name: busybox
-Version: 0.33
+Version: 0.35
Release: 1
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
Packager : Erik Andersen <andersen@lineo.com>
Conflicts: fileutils grep shellutils
Buildroot: /tmp/%{Name}-%{Version}
-Source: busybox-%{Version}.tar.gz
+Source: %{Name}-%{Version}.tar.gz
%Description
BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
embedded system.
%Prep
-%setup -q -n busybox
+%setup -q -n %{Name}-%{Version}
%Build
make
if (statfs(mountPoint, &s) != 0) {
perror(mountPoint);
- return 1;
+ return FALSE;
}
if (s.f_blocks > 0) {
}
- return 0;
+ return TRUE;
}
extern int df_main(int argc, char **argv)
if ((mountEntry = findMountPoint(argv[1], mtab_file)) ==
0) {
fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
- return 1;
+ exit( FALSE);
}
status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
if (status != 0)
- return status;
+ exit( status);
argc--;
argv++;
}
- return 0;
+ exit( TRUE);
} else {
FILE *mountTable;
struct mntent *mountEntry;
while ((mountEntry = getmntent(mountTable))) {
int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
if (status)
- return status;
+ exit( status);
}
endmntent(mountTable);
}
- return 0;
+ exit( TRUE);
}
if (statfs(mountPoint, &s) != 0) {
perror(mountPoint);
- return 1;
+ return FALSE;
}
if (s.f_blocks > 0) {
}
- return 0;
+ return TRUE;
}
extern int df_main(int argc, char **argv)
if ((mountEntry = findMountPoint(argv[1], mtab_file)) ==
0) {
fprintf(stderr, "%s: can't find mount point.\n", argv[1]);
- return 1;
+ exit( FALSE);
}
status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
if (status != 0)
- return status;
+ exit( status);
argc--;
argv++;
}
- return 0;
+ exit( TRUE);
} else {
FILE *mountTable;
struct mntent *mountEntry;
while ((mountEntry = getmntent(mountTable))) {
int status = df(mountEntry->mnt_fsname, mountEntry->mnt_dir);
if (status)
- return status;
+ exit( status);
}
endmntent(mountTable);
}
- return 0;
+ exit( TRUE);
}
Name: busybox
-Version: 0.33
+Version: 0.35
Release: 1
Group: System/Utilities
Summary: BusyBox is a tiny suite of Unix utilities in a multi-call binary.
Packager : Erik Andersen <andersen@lineo.com>
Conflicts: fileutils grep shellutils
Buildroot: /tmp/%{Name}-%{Version}
-Source: busybox-%{Version}.tar.gz
+Source: %{Name}-%{Version}.tar.gz
%Description
BusyBox is a suite of "tiny" Unix utilities in a multi-call binary. It
embedded system.
%Prep
-%setup -q -n busybox
+%setup -q -n %{Name}-%{Version}
%Build
make
//#endif
static const char gzip_usage[] =
- "gzip [OPTION]... [FILE]...\n\n"
- "Compress FILEs with maximum compression.\n\n"
+ "gzip [OPTION]... FILE\n\n"
+ "Compress FILE with maximum compression.\n"
+ "When FILE is -, reads standard input. Implies -c.\n\n"
"Options:\n"
- "\t-c\tWrite output on standard output\n";
+ "\t-c\tWrite output to standard output instead of FILE.gz\n";
/* gzip.h -- common declarations for all gzip modules
int ascii = 0; /* convert end-of-lines to local OS conventions */
int decompress = 0; /* decompress (-d) */
-int tostdout = 0; /* uncompress to stdout (-c) */
int no_name = -1; /* don't save or restore the original file name */
int no_time = -1; /* don't save or restore the original file time */
int foreground; /* set if program run in foreground */
// char **argv;
int gzip_main(int argc, char ** argv)
{
-
+ int result;
int inFileNum;
int outFileNum;
+ struct stat statBuf;
+ char* delFileName;
+ int tostdout = 0;
+ int fromstdin = 0;
+
+ if (argc==1)
+ usage(gzip_usage);
/* Parse any options */
while (--argc > 0 && **(++argv) == '-') {
+ if (*((*argv)+1) == '\0') {
+ fromstdin = 1;
+ tostdout = 1;
+ }
while (*(++(*argv))) {
+ fprintf(stderr, "**argv='%c'\n", **argv);
switch (**argv) {
case 'c':
tostdout = 1;
ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
#endif
- if (tostdout==1) {
- /* And get to work */
- SET_BINARY_MODE(fileno(stdout));
- strcpy(ifname, "stdin");
- strcpy(ofname, "stdout");
- inFileNum=fileno(stdin);
- outFileNum=fileno(stdout);
+ if (fromstdin==1) {
+ strcpy(ofname, "stdin");
- /* Get the time stamp on the input file. */
+ inFileNum=fileno(stdin);
time_stamp = 0; /* time unknown by default */
-
ifile_size = -1L; /* convention for unknown size */
-
- clear_bufs(); /* clear input and output buffers */
- part_nb = 0;
-
- /* Actually do the compression/decompression. */
- zip(inFileNum, outFileNum);
-
} else {
- int result;
- struct stat statBuf;
-
- /* And get to work */
+ /* Open up the input file */
if (*argv=='\0')
usage(gzip_usage);
strncpy(ifname, *argv, MAX_PATH_LEN);
- strncpy(ofname, *argv, MAX_PATH_LEN-4);
- strcat(ofname, ".gz");
+ /* Open input fille */
inFileNum=open( ifname, O_RDONLY);
if (inFileNum < 0) {
perror(ifname);
do_exit(WARNING);
}
+ /* Get the time stamp on the input file. */
result = stat(ifname, &statBuf);
if (result < 0) {
perror(ifname);
do_exit(WARNING);
}
+ time_stamp = statBuf.st_ctime;
+ ifile_size = statBuf.st_size;
+ }
+
- outFileNum=open( ofname, O_RDONLY);
+ if (tostdout==1) {
+ /* And get to work */
+ strcpy(ofname, "stdout");
+ outFileNum=fileno(stdout);
+ SET_BINARY_MODE(fileno(stdout));
+
+ clear_bufs(); /* clear input and output buffers */
+ part_nb = 0;
+
+ /* Actually do the compression/decompression. */
+ zip(inFileNum, outFileNum);
+
+ } else {
+
+ /* And get to work */
+ strncpy(ofname, ifname, MAX_PATH_LEN-4);
+ strcat(ofname, ".gz");
+
+
+ /* Open output fille */
+ outFileNum=open( ofname, O_RDWR|O_CREAT|O_EXCL|O_NOFOLLOW);
if (outFileNum < 0) {
perror(ofname);
do_exit(WARNING);
}
SET_BINARY_MODE(outFileNum);
-
- /* Get the time stamp on the input file. */
- time_stamp = statBuf.st_ctime; /* time unknown by default */
-
- ifile_size = statBuf.st_size; /* convention for unknown size */
+ /* Set permissions on the file */
+ fchmod(outFileNum, statBuf.st_mode);
clear_bufs(); /* clear input and output buffers */
part_nb = 0;
/* Actually do the compression/decompression. */
- zip(inFileNum, outFileNum);
+ result=zip(inFileNum, outFileNum);
+ close( outFileNum);
+ close( inFileNum);
+ /* Delete the original file */
+ if (result == OK)
+ delFileName=ifname;
+ else
+ delFileName=ofname;
+
+ if (unlink (delFileName) < 0) {
+ perror (delFileName);
+ exit( FALSE);
+ }
}
do_exit(exit_code);
/* Write the header to the gzip file. See algorithm.doc for the format */
+
method = DEFLATED;
put_byte(GZIP_MAGIC[0]); /* magic header */
put_byte(GZIP_MAGIC[1]);
* Mini more implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
- * Blended by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
- * based on the original more implementation and code from the Debian
- * boot-floppies team.
+ * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
+ *
+ * Latest version blended together by Erik Andersen <andersen@lineo.com>,
+ * based on the original more implementation by Bruce, and code from the
+ * Debian boot-floppies team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define TERMINAL_HEIGHT 24
-#if defined BB_FEATURE_AUTOWIDTH && ! defined USE_OLD_TERMIO
+#if defined BB_FEATURE_AUTOWIDTH
static int terminal_width = 0, terminal_height = 0;
#else
#define terminal_width TERMINAL_WIDTH
struct stat st;
FILE *file;
#ifdef BB_FEATURE_AUTOWIDTH
- struct winsize win;
+ struct winsize win = {0,0};
#endif
argc--;
int token;
int peek;
char *build;
- regexp *re;
+ regexp *re; // Ignore compiler whining. If we longjmp, we don't use re anymore.
/* prepare for error handling */
* Modified for busybox by Erik Andersen <andersee@debian.org>
* Adjusted to grok stdin/stdout options.
*
+ * Modified to handle device special files by Matt Porter
+ * <porter@debian.org>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
#include <fcntl.h>
#include <signal.h>
#include <time.h>
+#include <sys/types.h>
static const char tar_usage[] =
int uid;
int gid;
int checkSum;
+ int major;
+ int minor;
long size;
time_t mtime;
const char *name;
int cc;
int hardLink;
int softLink;
+ int devFileFlag;
/*
* If the block is completely empty, then this is the end of the
size = getOctal (hp->size, sizeof (hp->size));
mtime = getOctal (hp->mtime, sizeof (hp->mtime));
checkSum = getOctal (hp->checkSum, sizeof (hp->checkSum));
+ major = getOctal (hp->devMajor, sizeof (hp->devMajor));
+ minor = getOctal (hp->devMinor, sizeof (hp->devMinor));
if ((mode < 0) || (uid < 0) || (gid < 0) || (size < 0)) {
if (badHeader==FALSE)
badHeader = FALSE;
skipFileFlag = FALSE;
+ devFileFlag = FALSE;
/*
* Check for the file modes.
(hp->typeFlag == TAR_TYPE_SOFT_LINK - '0'));
/*
- * Check for a directory or a regular file.
+ * Check for a directory.
*/
if (name[strlen (name) - 1] == '/')
mode |= S_IFDIR;
- else if ((mode & S_IFMT) == 0)
- mode |= S_IFREG;
/*
* Check for absolute paths in the file.
* If not, then set up to skip it.
*/
if (wantFileName (name, fileCount, fileTable) == FALSE) {
- if (!hardLink && !softLink && S_ISREG (mode)) {
+ if ( !hardLink && !softLink && (S_ISREG (mode) || S_ISCHR (mode)
+ || S_ISBLK (mode) || S_ISSOCK(mode) || S_ISFIFO(mode) ) ) {
inHeader = (size == 0)? TRUE : FALSE;
dataCc = size;
}
printf (" (link to \"%s\")", hp->linkName);
else if (softLink)
printf (" (symlink to \"%s\")", hp->linkName);
- else if (S_ISREG (mode)) {
+ else if (S_ISREG (mode) || S_ISCHR (mode) || S_ISBLK (mode) ||
+ S_ISSOCK(mode) || S_ISFIFO(mode) ) {
inHeader = (size == 0)? TRUE : FALSE;
dataCc = size;
}
*/
if (tostdoutFlag == TRUE)
outFd = STDOUT;
- else
- outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ else {
+ if ( S_ISCHR(mode) || S_ISBLK(mode) || S_ISSOCK(mode) ) {
+ devFileFlag = TRUE;
+ outFd = mknod (name, mode, makedev(major, minor) );
+ }
+ else if (S_ISFIFO(mode) ) {
+ outFd = mkfifo(name, mode);
+ } else {
+ outFd = open (name, O_WRONLY | O_CREAT | O_TRUNC, mode);
+ }
+ }
if (outFd < 0) {
perror (name);
/*
* If the file is empty, then that's all we need to do.
*/
- if (size == 0 && tostdoutFlag == FALSE) {
+ if (size == 0 && (tostdoutFlag == FALSE) && (devFileFlag == FALSE)) {
(void) close (outFd);
outFd = -1;
}
return;
}
-
if (S_ISREG (mode)) {
saveRegularFile (fileName, &statbuf);
return;
}
+
+ /* Some day add support for tarring these up... but not today. :) */
+// if (S_ISLNK(mode) || S_ISFIFO(mode) || S_ISBLK(mode) || S_ISCHR (mode) ) {
+// fprintf (stderr, "%s: This version of tar can't store this type of file\n", fileName);
+// }
/*
* The file is a strange type of file, ignore it.
* Mini more implementation for busybox
*
*
- * Copyright (C) 1999 by Lineo, inc.
- * Blended by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
- * based on the original more implementation and code from the Debian
- * boot-floppies team.
+ * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
+ *
+ * Latest version blended together by Erik Andersen <andersen@lineo.com>,
+ * based on the original more implementation by Bruce, and code from the
+ * Debian boot-floppies team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define TERMINAL_HEIGHT 24
-#if defined BB_FEATURE_AUTOWIDTH && ! defined USE_OLD_TERMIO
+#if defined BB_FEATURE_AUTOWIDTH
static int terminal_width = 0, terminal_height = 0;
#else
#define terminal_width TERMINAL_WIDTH
struct stat st;
FILE *file;
#ifdef BB_FEATURE_AUTOWIDTH
- struct winsize win;
+ struct winsize win = {0,0};
#endif
argc--;