This commit is contained in:
Eric Andersen 1999-11-16 00:46:00 +00:00
parent a9c95ea655
commit d80e851dc0
15 changed files with 54 additions and 2263 deletions

View File

@ -11,6 +11,11 @@
* NFS support added to mount by Eric Delaunay. It costs 10k when compiled
in, but that is still a big win for those that use NFS.
* Made 'rm -f' be silent for non-existant files (thanks to Eric Delaunay).
* changed zcat.c to gunzip.c. It now obeys the principle of least surprise
and acts as god intended gunzip and zcat to act. They answer --help and
obey the '-c' flag.
* Fixed a bug in mv which caused it to not move files when the destination
was a directory name.
-Erik Andersen

View File

@ -31,6 +31,30 @@ DOSTATIC=false
#This will choke on a non-debian system
ARCH=`uname -m | sed -e 's/i.86/i386/' | sed -e 's/sparc.*/sparc/'`
GCCMAJVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\1/p"`
GCCMINVERSION=`$(CC) --version | sed -n "s/^\([0-9]\)\.\([0-9].*\)[\.].*/\2/p"`
GCCSUPPORTSOPTSIZE=$(shell \
if ( test $(GCCMAJVERSION) -eq 2 ) ; then \
if ( test $(GCCMINVERSION) -ge 95 ) ; then \
echo "true"; \
else \
echo "false"; \
fi; \
else \
if ( test $(GCCMAJVERSION) -gt 2 ) ; then \
echo "true"; \
else \
echo "false"; \
fi; \
fi; )
ifeq ($(GCCSUPPORTSOPTSIZE), true)
OPTIMIZATION=-Os
else
OPTIMIZATION=-O2
endif
# -D_GNU_SOURCE is needed because environ is used in init.c
ifeq ($(DODEBUG),true)
@ -38,7 +62,7 @@ ifeq ($(DODEBUG),true)
STRIP=
LDFLAGS=
else
CFLAGS+=-Wall -Os -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
CFLAGS+=-Wall $(OPTIMIZATION) -fomit-frame-pointer -fno-builtin -D_GNU_SOURCE
LDFLAGS= -s
STRIP= strip --remove-section=.note --remove-section=.comment $(PROG)
#Only staticly link when _not_ debugging

View File

@ -174,9 +174,9 @@ static const struct Applet applets[] = {
#ifdef BB_UPDATE //sbin
{"update", update_main},
#endif
#ifdef BB_ZCAT //bin
{"zcat", zcat_main},
{"gunzip", zcat_main},
#ifdef BB_GUNZIP //bin
{"zcat", gunzip_main},
{"gunzip", gunzip_main},
#endif
#ifdef BB_GZIP //bin
{"gzip", gzip_main},

View File

@ -1788,7 +1788,6 @@ int gzip_main(int argc, char ** argv)
tostdout = 1;
}
while (*(++(*argv))) {
fprintf(stderr, "**argv='%c'\n", **argv);
switch (**argv) {
case 'c':
tostdout = 1;

View File

@ -174,9 +174,9 @@ static const struct Applet applets[] = {
#ifdef BB_UPDATE //sbin
{"update", update_main},
#endif
#ifdef BB_ZCAT //bin
{"zcat", zcat_main},
{"gunzip", zcat_main},
#ifdef BB_GUNZIP //bin
{"zcat", gunzip_main},
{"gunzip", gunzip_main},
#endif
#ifdef BB_GZIP //bin
{"gzip", gzip_main},

View File

@ -59,8 +59,8 @@
#define BB_UMOUNT
#define BB_UPDATE
#define BB_UNAME
#define BB_ZCAT
#define BB_GZIP
#define BB_GUNZIP
// Don't turn BB_UTILITY off. It contains support code
// that compiles to 0 if everything else if turned off.
#define BB_UTILITY

View File

@ -54,6 +54,8 @@ static int fileAction(const char *fileName, struct stat* statbuf)
strcat(newdestName, "/");
if ( skipName != NULL)
strcat(newdestName, strstr(fileName, skipName));
else
strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, preserveFlag, followLinks));
}

View File

@ -56,7 +56,7 @@ extern int mv_main(int argc, char **argv)
fprintf(stderr, "%s: not a directory\n", destName);
exit (FALSE);
}
while (argc-- > 1) {
srcName = *(argv++);
skipName = strrchr(srcName, '/');
@ -67,6 +67,11 @@ extern int mv_main(int argc, char **argv)
strcat(newdestName, "/");
if ( skipName != NULL)
strcat(newdestName, strstr(srcName, skipName));
else
strcat(newdestName, srcName);
fprintf(stderr, "srcName='%s'\n", srcName);
fprintf(stderr, "skipName='%s'\n", skipName);
fprintf(stderr, "newdestName='%s'\n", newdestName);
}
if (copyFile(srcName, newdestName, FALSE, FALSE) == FALSE) {
exit( FALSE);

2
cp.c
View File

@ -54,6 +54,8 @@ static int fileAction(const char *fileName, struct stat* statbuf)
strcat(newdestName, "/");
if ( skipName != NULL)
strcat(newdestName, strstr(fileName, skipName));
else
strcat(newdestName, srcName);
}
return (copyFile(fileName, newdestName, preserveFlag, followLinks));
}

1
gzip.c
View File

@ -1788,7 +1788,6 @@ int gzip_main(int argc, char ** argv)
tostdout = 1;
}
while (*(++(*argv))) {
fprintf(stderr, "**argv='%c'\n", **argv);
switch (**argv) {
case 'c':
tostdout = 1;

4
init.c
View File

@ -538,7 +538,3 @@ extern int init_main(int argc, char **argv)
sleep(1);
}
}
#if defined FOO
#error Ack!
#endif

View File

@ -538,7 +538,3 @@ extern int init_main(int argc, char **argv)
sleep(1);
}
}
#if defined FOO
#error Ack!
#endif

View File

@ -114,7 +114,7 @@ extern int tryopen_main(int argc, char** argv);
extern int umount_main(int argc, char** argv);
extern int update_main(int argc, char** argv);
extern int uname_main(int argc, char** argv);
extern int zcat_main(int argc, char** argv);
extern int gunzip_main (int argc, char** argv);
extern int gzip_main(int argc, char** argv);

7
mv.c
View File

@ -56,7 +56,7 @@ extern int mv_main(int argc, char **argv)
fprintf(stderr, "%s: not a directory\n", destName);
exit (FALSE);
}
while (argc-- > 1) {
srcName = *(argv++);
skipName = strrchr(srcName, '/');
@ -67,6 +67,11 @@ extern int mv_main(int argc, char **argv)
strcat(newdestName, "/");
if ( skipName != NULL)
strcat(newdestName, strstr(srcName, skipName));
else
strcat(newdestName, srcName);
fprintf(stderr, "srcName='%s'\n", srcName);
fprintf(stderr, "skipName='%s'\n", skipName);
fprintf(stderr, "newdestName='%s'\n", newdestName);
}
if (copyFile(srcName, newdestName, FALSE, FALSE) == FALSE) {
exit( FALSE);

2242
zcat.c

File diff suppressed because it is too large Load Diff