From 2c226859cfc911c4a1eea009897050a16714aeec Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 15 Nov 2007 18:30:30 -0600 Subject: Remove trailing whitespace (thanks to Charlie Shepherd), and a couple comment tweaks. --- lib/args.c | 6 +++--- lib/bunzip.c | 6 +++--- lib/dirtree.c | 2 +- lib/lib.c | 12 ++++++------ main.c | 2 +- scripts/test/testing.sh | 2 +- toys/df.c | 2 +- toys/echo.c | 4 ++-- toys/mdev.c | 28 ++++++++++++++-------------- toys/oneit.c | 2 +- toys/toysh.c | 10 +++++----- www/design.html | 7 ++++--- 12 files changed, 42 insertions(+), 41 deletions(-) diff --git a/lib/args.c b/lib/args.c index 542b8cf0..8be84d8b 100644 --- a/lib/args.c +++ b/lib/args.c @@ -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 @@ static int dofileargs(char ***files, int fd, int iswrite) for (;;) { // Are there no more files? - if (!*filename) + if (!*filename) return (fd == -1) ? iswrite : -1; // A filename of "-" means stdin. diff --git a/lib/bunzip.c b/lib/bunzip.c index b7996983..17c91a9b 100644 --- a/lib/bunzip.c +++ b/lib/bunzip.c @@ -212,7 +212,7 @@ int read_bunzip_data(bunzip_data *bd) * * 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 @@ int read_bunzip_data(bunzip_data *bd) // 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 --git a/lib/dirtree.c b/lib/dirtree.c index b64dfaf5..d56a5dcb 100644 --- a/lib/dirtree.c +++ b/lib/dirtree.c @@ -14,7 +14,7 @@ struct dirtree *dirtree_add_node(char *path) char *name; // Find last chunk of name. - + for (;;) { name = strrchr(path, '/'); diff --git a/lib/lib.c b/lib/lib.c index eed72968..4cbb2228 100644 --- a/lib/lib.c +++ b/lib/lib.c @@ -117,7 +117,7 @@ void *xstrndup(char *s, size_t n) { void *ret = xmalloc(++n); strlcpy(ret, s, n); - + return ret; } @@ -133,7 +133,7 @@ char *xmsprintf(char *format, ...) va_list va, va2; int len; char *ret; - + va_start(va, format); va_copy(va2, va); @@ -144,7 +144,7 @@ char *xmsprintf(char *format, ...) // 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 @@ char *xabspath(char *path) // Skip duplicate slashes. while (*from=='/') from++; - + // Start of a new filename. Handle . and .. while (*from=='.') { // Skip . @@ -505,7 +505,7 @@ char *readfile(char *name) 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 @@ void xpidfile(char *name) // 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 --git a/main.c b/main.c index cfa920e3..7a9aea3d 100644 --- a/main.c +++ b/main.c @@ -40,7 +40,7 @@ struct toy_list *toy_find(char *name) top = TOY_LIST_LEN-1; for (;;) { int result; - + middle = (top+bottom)/2; if (middletop) return NULL; result = strcmp(name,toy_list[middle].name); diff --git a/scripts/test/testing.sh b/scripts/test/testing.sh index 14c9493f..1531193c 100644 --- a/scripts/test/testing.sh +++ b/scripts/test/testing.sh @@ -1,4 +1,4 @@ -# Simple test harness infrastructurei for BusyBox +# Simple test harness infrastructure # # Copyright 2005 by Rob Landley diff --git a/toys/df.c b/toys/df.c index 52a6c1df..60008ce8 100644 --- a/toys/df.c +++ b/toys/df.c @@ -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 --git a/toys/echo.c b/toys/echo.c index 397c21a7..d8ee08f2 100644 --- a/toys/echo.c +++ b/toys/echo.c @@ -9,14 +9,14 @@ int echo_main(void) { 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 --git a/toys/mdev.c b/toys/mdev.c index 53be23e0..a4ddb0b7 100644 --- a/toys/mdev.c +++ b/toys/mdev.c @@ -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 @@ static void make_device(char *path) 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 @@ static void make_device(char *path) for (pos = conf; pos-conf