diff options
-rw-r--r-- | applets/busybox.c | 3 | ||||
-rwxr-xr-x | applets/busybox.sh | 4 | ||||
-rwxr-xr-x | applets/install.sh | 15 | ||||
-rw-r--r-- | busybox.c | 3 | ||||
-rw-r--r-- | busybox.def.h | 11 | ||||
-rwxr-xr-x | busybox.sh | 4 | ||||
-rw-r--r-- | coreutils/dd.c | 37 | ||||
-rw-r--r-- | dd.c | 37 | ||||
-rwxr-xr-x | install.sh | 15 | ||||
-rw-r--r-- | more.c | 8 | ||||
-rw-r--r-- | util-linux/more.c | 8 |
11 files changed, 65 insertions, 80 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index c41c350..efa4ec7 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -72,6 +72,9 @@ static const struct Applet applets[] = { #ifdef BB_INIT //sbin {"init", init_main}, #endif +#ifdef BB_FEATURE_LINUXRC // + {"linuxrc", init_main}, +#endif #ifdef BB_KILL //bin {"kill", kill_main}, #endif diff --git a/applets/busybox.sh b/applets/busybox.sh index 6e448dc..cab248f 100755 --- a/applets/busybox.sh +++ b/applets/busybox.sh @@ -1,4 +1,4 @@ #!/bin/sh -sed -n '/^#define/{s/.*BB_//; s/$/.o/p; }' busybox.def.h | \ -tr [:upper:] [:lower:] +ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \ +tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g' diff --git a/applets/install.sh b/applets/install.sh index 29c9e26..5f0d2d5 100755 --- a/applets/install.sh +++ b/applets/install.sh @@ -6,17 +6,20 @@ if [ "$1" == "" ]; then echo "No installation directory, aborting." exit 1; fi +rm -rf $1 -# can't just use cat, rmdir is not unique -#h=`cat busybox.links` h=`sort busybox.links | uniq` -mkdir -p $1/bin for i in $h ; do - [ ${verbose} ] && echo " making link to $i" - mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` - ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` + echo "working on $i now" + mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `; + myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `; + echo "mkdir -p $1$mypath" + echo "(cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )" + mkdir -p $1$mypath + (cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp ) done rm -f $1/bin/busybox install -m 755 busybox $1/bin/busybox + @@ -72,6 +72,9 @@ static const struct Applet applets[] = { #ifdef BB_INIT //sbin {"init", init_main}, #endif +#ifdef BB_FEATURE_LINUXRC // + {"linuxrc", init_main}, +#endif #ifdef BB_KILL //bin {"kill", kill_main}, #endif diff --git a/busybox.def.h b/busybox.def.h index c20650f..fcdd66e 100644 --- a/busybox.def.h +++ b/busybox.def.h @@ -64,3 +64,14 @@ // Don't turn BB_UTILITY off. It contains support code // that compiles to 0 if everything else if turned off. #define BB_UTILITY +// +//This is where feature definitions go. +#define BB_FEATURE_LINUXRC +/* Turning this off makes things a bit smaller (and less pretty) */ +#define BB_FEATURE_USE_TERMIOS +/* Turning this off makes things a bit smaller (and less pretty) */ +#define BB_FEATURE_AUTOWIDTH + + + + @@ -1,4 +1,4 @@ #!/bin/sh -sed -n '/^#define/{s/.*BB_//; s/$/.o/p; }' busybox.def.h | \ -tr [:upper:] [:lower:] +ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \ +tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g' diff --git a/coreutils/dd.c b/coreutils/dd.c index 39c6a62..6494857 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c @@ -32,6 +32,7 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> +#include <inttypes.h> static const char dd_usage[] = "dd [if=name] [of=name] [bs=n] [count=n]\n\n" @@ -92,27 +93,20 @@ static long getNum (const char *cp) extern int dd_main (int argc, char **argv) { - const char *inFile; - const char *outFile; + const char *inFile = NULL; + const char *outFile = NULL; char *cp; int inFd; int outFd; int inCc = 0; int outCc; - int skipBlocks; - int blockSize; - long count; - long intotal; - long outTotal; + size_t blockSize = 512; + //uintmax_t skipBlocks = 0; + uintmax_t count = (uintmax_t)-1; + uintmax_t intotal; + uintmax_t outTotal; unsigned char *buf; - inFile = NULL; - outFile = NULL; - blockSize = 512; - skipBlocks = 0; - count = 1; - - argc--; argv++; @@ -125,14 +119,14 @@ extern int dd_main (int argc, char **argv) else if (strncmp("count", *argv, 5) == 0) { count = getNum ((strchr(*argv, '='))+1); if (count <= 0) { - fprintf (stderr, "Bad count value %ld\n", count); + fprintf (stderr, "Bad count value %s\n", *argv); goto usage; } } else if (strncmp(*argv, "bs", 2) == 0) { blockSize = getNum ((strchr(*argv, '='))+1); if (blockSize <= 0) { - fprintf (stderr, "Bad block size value %d\n", blockSize); + fprintf (stderr, "Bad block size value %s\n", *argv); goto usage; } } @@ -162,13 +156,8 @@ extern int dd_main (int argc, char **argv) intotal = 0; outTotal = 0; - if (inFile == NULL) { - struct stat statBuf; + if (inFile == NULL) inFd = fileno(stdin); - if (fstat(inFd, &statBuf) < 0) - exit( FALSE); - count = statBuf.st_size; - } else inFd = open (inFile, 0); @@ -227,9 +216,9 @@ extern int dd_main (int argc, char **argv) close (outFd); free (buf); - printf ("%ld+%d records in\n", intotal / blockSize, + printf ("%ld+%d records in\n", (long)(intotal / blockSize), (intotal % blockSize) != 0); - printf ("%ld+%d records out\n", outTotal / blockSize, + printf ("%ld+%d records out\n", (long)(outTotal / blockSize), (outTotal % blockSize) != 0); exit( TRUE); usage: @@ -32,6 +32,7 @@ #include <stdio.h> #include <fcntl.h> #include <errno.h> +#include <inttypes.h> static const char dd_usage[] = "dd [if=name] [of=name] [bs=n] [count=n]\n\n" @@ -92,27 +93,20 @@ static long getNum (const char *cp) extern int dd_main (int argc, char **argv) { - const char *inFile; - const char *outFile; + const char *inFile = NULL; + const char *outFile = NULL; char *cp; int inFd; int outFd; int inCc = 0; int outCc; - int skipBlocks; - int blockSize; - long count; - long intotal; - long outTotal; + size_t blockSize = 512; + //uintmax_t skipBlocks = 0; + uintmax_t count = (uintmax_t)-1; + uintmax_t intotal; + uintmax_t outTotal; unsigned char *buf; - inFile = NULL; - outFile = NULL; - blockSize = 512; - skipBlocks = 0; - count = 1; - - argc--; argv++; @@ -125,14 +119,14 @@ extern int dd_main (int argc, char **argv) else if (strncmp("count", *argv, 5) == 0) { count = getNum ((strchr(*argv, '='))+1); if (count <= 0) { - fprintf (stderr, "Bad count value %ld\n", count); + fprintf (stderr, "Bad count value %s\n", *argv); goto usage; } } else if (strncmp(*argv, "bs", 2) == 0) { blockSize = getNum ((strchr(*argv, '='))+1); if (blockSize <= 0) { - fprintf (stderr, "Bad block size value %d\n", blockSize); + fprintf (stderr, "Bad block size value %s\n", *argv); goto usage; } } @@ -162,13 +156,8 @@ extern int dd_main (int argc, char **argv) intotal = 0; outTotal = 0; - if (inFile == NULL) { - struct stat statBuf; + if (inFile == NULL) inFd = fileno(stdin); - if (fstat(inFd, &statBuf) < 0) - exit( FALSE); - count = statBuf.st_size; - } else inFd = open (inFile, 0); @@ -227,9 +216,9 @@ extern int dd_main (int argc, char **argv) close (outFd); free (buf); - printf ("%ld+%d records in\n", intotal / blockSize, + printf ("%ld+%d records in\n", (long)(intotal / blockSize), (intotal % blockSize) != 0); - printf ("%ld+%d records out\n", outTotal / blockSize, + printf ("%ld+%d records out\n", (long)(outTotal / blockSize), (outTotal % blockSize) != 0); exit( TRUE); usage: @@ -6,17 +6,20 @@ if [ "$1" == "" ]; then echo "No installation directory, aborting." exit 1; fi +rm -rf $1 -# can't just use cat, rmdir is not unique -#h=`cat busybox.links` h=`sort busybox.links | uniq` -mkdir -p $1/bin for i in $h ; do - [ ${verbose} ] && echo " making link to $i" - mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` - ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` + echo "working on $i now" + mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `; + myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `; + echo "mkdir -p $1$mypath" + echo "(cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )" + mkdir -p $1$mypath + (cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp ) done rm -f $1/bin/busybox install -m 755 busybox $1/bin/busybox + @@ -24,14 +24,6 @@ * */ - -/* Turning this off makes things a bit smaller (and less pretty) */ -#define BB_FEATURE_USE_TERMIOS -/* Turning this off makes things a bit smaller (and less pretty) */ -#define BB_FEATURE_AUTOWIDTH - - - #include "internal.h" #include <stdio.h> #include <fcntl.h> diff --git a/util-linux/more.c b/util-linux/more.c index 7fbca23..821427d 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -24,14 +24,6 @@ * */ - -/* Turning this off makes things a bit smaller (and less pretty) */ -#define BB_FEATURE_USE_TERMIOS -/* Turning this off makes things a bit smaller (and less pretty) */ -#define BB_FEATURE_AUTOWIDTH - - - #include "internal.h" #include <stdio.h> #include <fcntl.h> |