aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>1999-11-19 05:31:45 +0000
committerEric Andersen <andersen@codepoet.org>1999-11-19 05:31:45 +0000
commit6a76e652aab7d614c2b47b50318e0690c06779c4 (patch)
treeeb5564c774b9ef03dc095e7c06e8adb2a8ede1c8
parent08b1034f4f0b910660a8b1a537f86462fa41ebad (diff)
downloadbusybox-w32-6a76e652aab7d614c2b47b50318e0690c06779c4.tar.gz
busybox-w32-6a76e652aab7d614c2b47b50318e0690c06779c4.tar.bz2
busybox-w32-6a76e652aab7d614c2b47b50318e0690c06779c4.zip
Stuf
-rw-r--r--applets/busybox.c3
-rwxr-xr-xapplets/busybox.sh4
-rwxr-xr-xapplets/install.sh15
-rw-r--r--busybox.c3
-rw-r--r--busybox.def.h11
-rwxr-xr-xbusybox.sh4
-rw-r--r--coreutils/dd.c37
-rw-r--r--dd.c37
-rwxr-xr-xinstall.sh15
-rw-r--r--more.c8
-rw-r--r--util-linux/more.c8
11 files changed, 65 insertions, 80 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index c41c350d1..efa4ec72d 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -72,6 +72,9 @@ static const struct Applet applets[] = {
72#ifdef BB_INIT //sbin 72#ifdef BB_INIT //sbin
73 {"init", init_main}, 73 {"init", init_main},
74#endif 74#endif
75#ifdef BB_FEATURE_LINUXRC //
76 {"linuxrc", init_main},
77#endif
75#ifdef BB_KILL //bin 78#ifdef BB_KILL //bin
76 {"kill", kill_main}, 79 {"kill", kill_main},
77#endif 80#endif
diff --git a/applets/busybox.sh b/applets/busybox.sh
index 6e448dc65..cab248f11 100755
--- a/applets/busybox.sh
+++ b/applets/busybox.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2sed -n '/^#define/{s/.*BB_//; s/$/.o/p; }' busybox.def.h | \ 2ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \
3tr [:upper:] [:lower:] 3tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g'
4 4
diff --git a/applets/install.sh b/applets/install.sh
index 29c9e26d9..5f0d2d5da 100755
--- a/applets/install.sh
+++ b/applets/install.sh
@@ -6,17 +6,20 @@ if [ "$1" == "" ]; then
6 echo "No installation directory, aborting." 6 echo "No installation directory, aborting."
7 exit 1; 7 exit 1;
8fi 8fi
9rm -rf $1
9 10
10# can't just use cat, rmdir is not unique
11#h=`cat busybox.links`
12h=`sort busybox.links | uniq` 11h=`sort busybox.links | uniq`
13 12
14mkdir -p $1/bin
15for i in $h ; do 13for i in $h ; do
16 [ ${verbose} ] && echo " making link to $i" 14 echo "working on $i now"
17 mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` 15 mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
18 ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` 16 myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
17 echo "mkdir -p $1$mypath"
18 echo "(cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )"
19 mkdir -p $1$mypath
20 (cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )
19done 21done
20rm -f $1/bin/busybox 22rm -f $1/bin/busybox
21install -m 755 busybox $1/bin/busybox 23install -m 755 busybox $1/bin/busybox
22 24
25
diff --git a/busybox.c b/busybox.c
index c41c350d1..efa4ec72d 100644
--- a/busybox.c
+++ b/busybox.c
@@ -72,6 +72,9 @@ static const struct Applet applets[] = {
72#ifdef BB_INIT //sbin 72#ifdef BB_INIT //sbin
73 {"init", init_main}, 73 {"init", init_main},
74#endif 74#endif
75#ifdef BB_FEATURE_LINUXRC //
76 {"linuxrc", init_main},
77#endif
75#ifdef BB_KILL //bin 78#ifdef BB_KILL //bin
76 {"kill", kill_main}, 79 {"kill", kill_main},
77#endif 80#endif
diff --git a/busybox.def.h b/busybox.def.h
index c20650f86..fcdd66e37 100644
--- a/busybox.def.h
+++ b/busybox.def.h
@@ -64,3 +64,14 @@
64// Don't turn BB_UTILITY off. It contains support code 64// Don't turn BB_UTILITY off. It contains support code
65// that compiles to 0 if everything else if turned off. 65// that compiles to 0 if everything else if turned off.
66#define BB_UTILITY 66#define BB_UTILITY
67//
68//This is where feature definitions go.
69#define BB_FEATURE_LINUXRC
70/* Turning this off makes things a bit smaller (and less pretty) */
71#define BB_FEATURE_USE_TERMIOS
72/* Turning this off makes things a bit smaller (and less pretty) */
73#define BB_FEATURE_AUTOWIDTH
74
75
76
77
diff --git a/busybox.sh b/busybox.sh
index 6e448dc65..cab248f11 100755
--- a/busybox.sh
+++ b/busybox.sh
@@ -1,4 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2sed -n '/^#define/{s/.*BB_//; s/$/.o/p; }' busybox.def.h | \ 2ls -1 `sed -n '/^#define/{s/.*BB_// ; s/$/.c/p; }' busybox.def.h | \
3tr [:upper:] [:lower:] 3tr [:upper:] [:lower:]` 2> /dev/null | sed -e 's/\.c$/\.o/g'
4 4
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 39c6a6263..64948571c 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -32,6 +32,7 @@
32#include <stdio.h> 32#include <stdio.h>
33#include <fcntl.h> 33#include <fcntl.h>
34#include <errno.h> 34#include <errno.h>
35#include <inttypes.h>
35 36
36static const char dd_usage[] = 37static const char dd_usage[] =
37"dd [if=name] [of=name] [bs=n] [count=n]\n\n" 38"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
@@ -92,27 +93,20 @@ static long getNum (const char *cp)
92 93
93extern int dd_main (int argc, char **argv) 94extern int dd_main (int argc, char **argv)
94{ 95{
95 const char *inFile; 96 const char *inFile = NULL;
96 const char *outFile; 97 const char *outFile = NULL;
97 char *cp; 98 char *cp;
98 int inFd; 99 int inFd;
99 int outFd; 100 int outFd;
100 int inCc = 0; 101 int inCc = 0;
101 int outCc; 102 int outCc;
102 int skipBlocks; 103 size_t blockSize = 512;
103 int blockSize; 104 //uintmax_t skipBlocks = 0;
104 long count; 105 uintmax_t count = (uintmax_t)-1;
105 long intotal; 106 uintmax_t intotal;
106 long outTotal; 107 uintmax_t outTotal;
107 unsigned char *buf; 108 unsigned char *buf;
108 109
109 inFile = NULL;
110 outFile = NULL;
111 blockSize = 512;
112 skipBlocks = 0;
113 count = 1;
114
115
116 argc--; 110 argc--;
117 argv++; 111 argv++;
118 112
@@ -125,14 +119,14 @@ extern int dd_main (int argc, char **argv)
125 else if (strncmp("count", *argv, 5) == 0) { 119 else if (strncmp("count", *argv, 5) == 0) {
126 count = getNum ((strchr(*argv, '='))+1); 120 count = getNum ((strchr(*argv, '='))+1);
127 if (count <= 0) { 121 if (count <= 0) {
128 fprintf (stderr, "Bad count value %ld\n", count); 122 fprintf (stderr, "Bad count value %s\n", *argv);
129 goto usage; 123 goto usage;
130 } 124 }
131 } 125 }
132 else if (strncmp(*argv, "bs", 2) == 0) { 126 else if (strncmp(*argv, "bs", 2) == 0) {
133 blockSize = getNum ((strchr(*argv, '='))+1); 127 blockSize = getNum ((strchr(*argv, '='))+1);
134 if (blockSize <= 0) { 128 if (blockSize <= 0) {
135 fprintf (stderr, "Bad block size value %d\n", blockSize); 129 fprintf (stderr, "Bad block size value %s\n", *argv);
136 goto usage; 130 goto usage;
137 } 131 }
138 } 132 }
@@ -162,13 +156,8 @@ extern int dd_main (int argc, char **argv)
162 intotal = 0; 156 intotal = 0;
163 outTotal = 0; 157 outTotal = 0;
164 158
165 if (inFile == NULL) { 159 if (inFile == NULL)
166 struct stat statBuf;
167 inFd = fileno(stdin); 160 inFd = fileno(stdin);
168 if (fstat(inFd, &statBuf) < 0)
169 exit( FALSE);
170 count = statBuf.st_size;
171 }
172 else 161 else
173 inFd = open (inFile, 0); 162 inFd = open (inFile, 0);
174 163
@@ -227,9 +216,9 @@ extern int dd_main (int argc, char **argv)
227 close (outFd); 216 close (outFd);
228 free (buf); 217 free (buf);
229 218
230 printf ("%ld+%d records in\n", intotal / blockSize, 219 printf ("%ld+%d records in\n", (long)(intotal / blockSize),
231 (intotal % blockSize) != 0); 220 (intotal % blockSize) != 0);
232 printf ("%ld+%d records out\n", outTotal / blockSize, 221 printf ("%ld+%d records out\n", (long)(outTotal / blockSize),
233 (outTotal % blockSize) != 0); 222 (outTotal % blockSize) != 0);
234 exit( TRUE); 223 exit( TRUE);
235 usage: 224 usage:
diff --git a/dd.c b/dd.c
index 39c6a6263..64948571c 100644
--- a/dd.c
+++ b/dd.c
@@ -32,6 +32,7 @@
32#include <stdio.h> 32#include <stdio.h>
33#include <fcntl.h> 33#include <fcntl.h>
34#include <errno.h> 34#include <errno.h>
35#include <inttypes.h>
35 36
36static const char dd_usage[] = 37static const char dd_usage[] =
37"dd [if=name] [of=name] [bs=n] [count=n]\n\n" 38"dd [if=name] [of=name] [bs=n] [count=n]\n\n"
@@ -92,27 +93,20 @@ static long getNum (const char *cp)
92 93
93extern int dd_main (int argc, char **argv) 94extern int dd_main (int argc, char **argv)
94{ 95{
95 const char *inFile; 96 const char *inFile = NULL;
96 const char *outFile; 97 const char *outFile = NULL;
97 char *cp; 98 char *cp;
98 int inFd; 99 int inFd;
99 int outFd; 100 int outFd;
100 int inCc = 0; 101 int inCc = 0;
101 int outCc; 102 int outCc;
102 int skipBlocks; 103 size_t blockSize = 512;
103 int blockSize; 104 //uintmax_t skipBlocks = 0;
104 long count; 105 uintmax_t count = (uintmax_t)-1;
105 long intotal; 106 uintmax_t intotal;
106 long outTotal; 107 uintmax_t outTotal;
107 unsigned char *buf; 108 unsigned char *buf;
108 109
109 inFile = NULL;
110 outFile = NULL;
111 blockSize = 512;
112 skipBlocks = 0;
113 count = 1;
114
115
116 argc--; 110 argc--;
117 argv++; 111 argv++;
118 112
@@ -125,14 +119,14 @@ extern int dd_main (int argc, char **argv)
125 else if (strncmp("count", *argv, 5) == 0) { 119 else if (strncmp("count", *argv, 5) == 0) {
126 count = getNum ((strchr(*argv, '='))+1); 120 count = getNum ((strchr(*argv, '='))+1);
127 if (count <= 0) { 121 if (count <= 0) {
128 fprintf (stderr, "Bad count value %ld\n", count); 122 fprintf (stderr, "Bad count value %s\n", *argv);
129 goto usage; 123 goto usage;
130 } 124 }
131 } 125 }
132 else if (strncmp(*argv, "bs", 2) == 0) { 126 else if (strncmp(*argv, "bs", 2) == 0) {
133 blockSize = getNum ((strchr(*argv, '='))+1); 127 blockSize = getNum ((strchr(*argv, '='))+1);
134 if (blockSize <= 0) { 128 if (blockSize <= 0) {
135 fprintf (stderr, "Bad block size value %d\n", blockSize); 129 fprintf (stderr, "Bad block size value %s\n", *argv);
136 goto usage; 130 goto usage;
137 } 131 }
138 } 132 }
@@ -162,13 +156,8 @@ extern int dd_main (int argc, char **argv)
162 intotal = 0; 156 intotal = 0;
163 outTotal = 0; 157 outTotal = 0;
164 158
165 if (inFile == NULL) { 159 if (inFile == NULL)
166 struct stat statBuf;
167 inFd = fileno(stdin); 160 inFd = fileno(stdin);
168 if (fstat(inFd, &statBuf) < 0)
169 exit( FALSE);
170 count = statBuf.st_size;
171 }
172 else 161 else
173 inFd = open (inFile, 0); 162 inFd = open (inFile, 0);
174 163
@@ -227,9 +216,9 @@ extern int dd_main (int argc, char **argv)
227 close (outFd); 216 close (outFd);
228 free (buf); 217 free (buf);
229 218
230 printf ("%ld+%d records in\n", intotal / blockSize, 219 printf ("%ld+%d records in\n", (long)(intotal / blockSize),
231 (intotal % blockSize) != 0); 220 (intotal % blockSize) != 0);
232 printf ("%ld+%d records out\n", outTotal / blockSize, 221 printf ("%ld+%d records out\n", (long)(outTotal / blockSize),
233 (outTotal % blockSize) != 0); 222 (outTotal % blockSize) != 0);
234 exit( TRUE); 223 exit( TRUE);
235 usage: 224 usage:
diff --git a/install.sh b/install.sh
index 29c9e26d9..5f0d2d5da 100755
--- a/install.sh
+++ b/install.sh
@@ -6,17 +6,20 @@ if [ "$1" == "" ]; then
6 echo "No installation directory, aborting." 6 echo "No installation directory, aborting."
7 exit 1; 7 exit 1;
8fi 8fi
9rm -rf $1
9 10
10# can't just use cat, rmdir is not unique
11#h=`cat busybox.links`
12h=`sort busybox.links | uniq` 11h=`sort busybox.links | uniq`
13 12
14mkdir -p $1/bin
15for i in $h ; do 13for i in $h ; do
16 [ ${verbose} ] && echo " making link to $i" 14 echo "working on $i now"
17 mkdir -p $1/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' ` 15 mypath=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\1/g' `;
18 ln -s busybox $1/bin/`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' ` 16 myapp=`echo $i | sed -e 's/\(^.*\/\)\(.*\)/\2/g' `;
17 echo "mkdir -p $1$mypath"
18 echo "(cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )"
19 mkdir -p $1$mypath
20 (cd $1$mypath ; ln -s /bin/busybox $1$mypath$myapp )
19done 21done
20rm -f $1/bin/busybox 22rm -f $1/bin/busybox
21install -m 755 busybox $1/bin/busybox 23install -m 755 busybox $1/bin/busybox
22 24
25
diff --git a/more.c b/more.c
index 7fbca2317..821427dda 100644
--- a/more.c
+++ b/more.c
@@ -24,14 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27
28/* Turning this off makes things a bit smaller (and less pretty) */
29#define BB_FEATURE_USE_TERMIOS
30/* Turning this off makes things a bit smaller (and less pretty) */
31#define BB_FEATURE_AUTOWIDTH
32
33
34
35#include "internal.h" 27#include "internal.h"
36#include <stdio.h> 28#include <stdio.h>
37#include <fcntl.h> 29#include <fcntl.h>
diff --git a/util-linux/more.c b/util-linux/more.c
index 7fbca2317..821427dda 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -24,14 +24,6 @@
24 * 24 *
25 */ 25 */
26 26
27
28/* Turning this off makes things a bit smaller (and less pretty) */
29#define BB_FEATURE_USE_TERMIOS
30/* Turning this off makes things a bit smaller (and less pretty) */
31#define BB_FEATURE_AUTOWIDTH
32
33
34
35#include "internal.h" 27#include "internal.h"
36#include <stdio.h> 28#include <stdio.h>
37#include <fcntl.h> 29#include <fcntl.h>