# HG changeset patch
# User Rob Landley
# Date 1195173030 21600
# Node ID 1e8f4b05cb65830ed50e5dda72c1882e1ec59c0a
# Parent 6c7836dbc16e81e8854f3952a34a403fe40677e9
Remove trailing whitespace (thanks to Charlie Shepherd), and a couple comment
tweaks.
diff -r 6c7836dbc16e -r 1e8f4b05cb65 lib/args.c
--- a/lib/args.c Tue Nov 06 23:24:56 2007 +0000
+++ b/lib/args.c Thu Nov 15 18:30:30 2007 -0600
@@ -38,7 +38,7 @@
// -abc means -a -b -c
/* This uses a getopt-like option string, but not getopt() itself.
- *
+ *
* Each option in options corresponds to a bit position in the return
* value (last argument is (1<<0), the next to last is (1<<1) and so on).
* If the option isn't seen in argv[] its bit is 0.
@@ -57,7 +57,7 @@
* flags = 5, toy[0]=NULL, toy[1]="fruit";
*/
-//
+//
struct opts {
struct opts *next;
char c;
@@ -316,7 +316,7 @@
for (;;) {
// Are there no more files?
- if (!*filename)
+ if (!*filename)
return (fd == -1) ? iswrite : -1;
// A filename of "-" means stdin.
diff -r 6c7836dbc16e -r 1e8f4b05cb65 lib/bunzip.c
--- a/lib/bunzip.c Tue Nov 06 23:24:56 2007 +0000
+++ b/lib/bunzip.c Thu Nov 15 18:30:30 2007 -0600
@@ -212,7 +212,7 @@
*
* permute[] is the lookup table for converting huffman coded symbols
* into decoded symbols. It contains symbol values sorted by length.
- *
+ *
* base[] is the amount to subtract from the value of a huffman symbol
* of a given length when using permute[].
*
@@ -235,9 +235,9 @@
// Calculate permute[], and zero temp[] and limit[].
pp = 0;
- for (i = minLen; i <= maxLen; i++)
+ for (i = minLen; i <= maxLen; i++)
temp[i] = limit[i] = 0;
- for (t = 0; t < symCount; t++)
+ for (t = 0; t < symCount; t++)
if (length[t] == i) hufGroup->permute[pp++] = t;
// Count symbols coded for at each bit length
diff -r 6c7836dbc16e -r 1e8f4b05cb65 lib/dirtree.c
--- a/lib/dirtree.c Tue Nov 06 23:24:56 2007 +0000
+++ b/lib/dirtree.c Thu Nov 15 18:30:30 2007 -0600
@@ -14,7 +14,7 @@
char *name;
// Find last chunk of name.
-
+
for (;;) {
name = strrchr(path, '/');
diff -r 6c7836dbc16e -r 1e8f4b05cb65 lib/lib.c
--- a/lib/lib.c Tue Nov 06 23:24:56 2007 +0000
+++ b/lib/lib.c Thu Nov 15 18:30:30 2007 -0600
@@ -117,7 +117,7 @@
{
void *ret = xmalloc(++n);
strlcpy(ret, s, n);
-
+
return ret;
}
@@ -133,7 +133,7 @@
va_list va, va2;
int len;
char *ret;
-
+
va_start(va, format);
va_copy(va2, va);
@@ -144,7 +144,7 @@
// Allocate and do the sprintf()
ret = xmalloc(len);
- vsnprintf(ret, len, format, va2);
+ vsnprintf(ret, len, format, va2);
va_end(va2);
return ret;
@@ -299,7 +299,7 @@
// Skip duplicate slashes.
while (*from=='/') from++;
-
+
// Start of a new filename. Handle . and ..
while (*from=='.') {
// Skip .
@@ -505,7 +505,7 @@
int fd;
char *buf;
- fd = open(pidfile, O_RDONLY);
+ fd = open(name, O_RDONLY);
if (fd == -1) return 0;
len = fdlength(fd);
buf = xmalloc(len+1);
@@ -549,7 +549,7 @@
// An else with more sanity checking might be nice here.
}
-
+
if (i == 3) error_exit("xpidfile %s", name);
xwrite(fd, spid, sprintf(spid, "%ld\n", (long)getpid()));
diff -r 6c7836dbc16e -r 1e8f4b05cb65 main.c
--- a/main.c Tue Nov 06 23:24:56 2007 +0000
+++ b/main.c Thu Nov 15 18:30:30 2007 -0600
@@ -40,7 +40,7 @@
top = TOY_LIST_LEN-1;
for (;;) {
int result;
-
+
middle = (top+bottom)/2;
if (middletop) return NULL;
result = strcmp(name,toy_list[middle].name);
diff -r 6c7836dbc16e -r 1e8f4b05cb65 scripts/test/testing.sh
--- a/scripts/test/testing.sh Tue Nov 06 23:24:56 2007 +0000
+++ b/scripts/test/testing.sh Thu Nov 15 18:30:30 2007 -0600
@@ -1,4 +1,4 @@
-# Simple test harness infrastructurei for BusyBox
+# Simple test harness infrastructure
#
# Copyright 2005 by Rob Landley
diff -r 6c7836dbc16e -r 1e8f4b05cb65 toys/df.c
--- a/toys/df.c Tue Nov 06 23:24:56 2007 +0000
+++ b/toys/df.c Thu Nov 15 18:30:30 2007 -0600
@@ -4,7 +4,7 @@
*
* Implemented roughly according to SUSv3:
* http://www.opengroup.org/onlinepubs/009695399/utilities/df.html
- *
+ *
* usage: df [-k] [-P|-t] [file...]
*/
diff -r 6c7836dbc16e -r 1e8f4b05cb65 toys/echo.c
--- a/toys/echo.c Tue Nov 06 23:24:56 2007 +0000
+++ b/toys/echo.c Thu Nov 15 18:30:30 2007 -0600
@@ -9,14 +9,14 @@
{
int i = 0;
char *arg, *from = "\\abfnrtv", *to = "\\\a\b\f\n\r\t\v";
-
+
for (;;) {
arg = toys.optargs[i];
if (!arg) break;
if (i++) xputc(' ');
// Handle -e
-
+
if (toys.optflags&2) {
int c, j = 0;
for (;;) {
diff -r 6c7836dbc16e -r 1e8f4b05cb65 toys/mdev.c
--- a/toys/mdev.c Tue Nov 06 23:24:56 2007 +0000
+++ b/toys/mdev.c Thu Nov 15 18:30:30 2007 -0600
@@ -1,7 +1,7 @@
/* vi:set ts=4:
- *
+ *
* mdev - Mini udev for busybox
- *
+ *
* Copyright 2005 Rob Landley
* Copyright 2005 Frank Sorenson
*/
@@ -29,16 +29,16 @@
close(fd);
if (len<1) return;
temp[len] = 0;
-
+
// Determine device name, type, major and minor
-
+
device_name = strrchr(path, '/') + 1;
type = path[5]=='c' ? S_IFCHR : S_IFBLK;
major = minor = 0;
sscanf(temp, "%u:%u", &major, &minor);
// If we have a config file, look up permissions for this device
-
+
if (CFG_MDEV_CONF) {
char *conf, *pos, *end;
@@ -53,7 +53,7 @@
for (pos = conf; pos-confd_name, "dev")) make_device(path);
}
-
+
closedir(dir);
}
@@ -188,9 +188,9 @@
strcpy(toybuf, "/sys/class");
find_dev(toybuf);
return 0;
- }
-
+ }
+
// hotplug support goes here
-
+
return 0;
}
diff -r 6c7836dbc16e -r 1e8f4b05cb65 toys/oneit.c
--- a/toys/oneit.c Tue Nov 06 23:24:56 2007 +0000
+++ b/toys/oneit.c Thu Nov 15 18:30:30 2007 -0600
@@ -30,7 +30,7 @@
sync();
reboot(toys.optflags ? RB_POWER_OFF : RB_AUTOBOOT);
}
-
+
// Redirect stdio to /dev/tty0, with new session ID, so ctrl-c works.
setsid();
for (i=0; i<3; i++) {
diff -r 6c7836dbc16e -r 1e8f4b05cb65 toys/toysh.c
--- a/toys/toysh.c Tue Nov 06 23:24:56 2007 +0000
+++ b/toys/toysh.c Thu Nov 15 18:30:30 2007 -0600
@@ -1,5 +1,5 @@
/* vi: set sw=4 ts=4:
- *
+ *
* toysh - toybox shell
*
* Copyright 2006 Rob Landley
@@ -80,11 +80,11 @@
if (!cmdline) return 0;
if (CFG_TOYSH_JOBCTL) line->cmdline = cmdline;
-
+
// Parse command into argv[]
for (;;) {
char *end;
-
+
// Skip leading whitespace and detect end of line.
while (isspace(*start)) start++;
if (!*start || *start=='#') {
@@ -192,7 +192,7 @@
}
int exit_main(void)
-{
+{
exit(*toys.optargs ? atoi(*toys.optargs) : 0);
}
@@ -216,6 +216,6 @@
free(command);
}
}
-
+
return 1;
}
diff -r 6c7836dbc16e -r 1e8f4b05cb65 www/design.html
--- a/www/design.html Tue Nov 06 23:24:56 2007 +0000
+++ b/www/design.html Thu Nov 15 18:30:30 2007 -0600
@@ -52,7 +52,7 @@
part three,
plus this
article on
-cacheing, and this one on
+cacheing, and this one on
bandwidth
and latency.
And there's more where that came from.)
@@ -72,7 +72,8 @@
copy-on-write mappings of the zero page. Actual physical pages get allocated
when the copy-on-write gets broken by writing to the virtual page. This
is why checking the return value of malloc() isn't very useful anymore, it
-only detects running out of virtual memory, not physical memory.)
+only detects running out of virtual memory, not physical memory. Unless
+you're using a NOMMU system, where all bets are off.)
Don't think that just because you don't have a swap file the system can't
start swap thrashing: any file backed page (ala mmap) can be evicted, and
@@ -123,7 +124,7 @@
Your binary is the executable file on disk, your heap is where malloc() memory
lives, and your stack is where local variables (and function call return
addresses) live. Optimizing for binary size is generally good: executing
-fewer instructions makes your program run faster (and fits more of it in
+fewer instructions makes your program run faster (and fits more of it in
cache). On embedded systems, binary size is especially precious because
flash is expensive (and its successor, MRAM, even more so). Small stack size
is important for nommu systems because they have to preallocate their stack