aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-12-26 10:42:51 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-12-26 10:42:51 +0000
commit52f326a239527e7242321661d2ba06b50daa3c43 (patch)
treeaf74820b70fa27929fe218c95822c20651b60637
parentda5e86c349488f3ea31718b149ce9f0d1493b64b (diff)
downloadbusybox-w32-52f326a239527e7242321661d2ba06b50daa3c43.tar.gz
busybox-w32-52f326a239527e7242321661d2ba06b50daa3c43.tar.bz2
busybox-w32-52f326a239527e7242321661d2ba06b50daa3c43.zip
style fixes
last xcalloc replaced by xzalloc git-svn-id: svn://busybox.net/trunk/busybox@17081 69ca8d6d-28ef-0310-b511-8ec308f3f277
-rw-r--r--applets/busybox.c2
-rw-r--r--archival/libunarchive/check_header_gzip.c4
-rw-r--r--archival/libunarchive/decompress_bunzip2.c68
-rw-r--r--archival/libunarchive/decompress_unzip.c4
-rw-r--r--archival/unzip.c4
-rw-r--r--coreutils/ls.c4
-rw-r--r--coreutils/od_bloaty.c2
-rw-r--r--coreutils/sort.c4
-rw-r--r--e2fsprogs/fsck.c2
-rw-r--r--editors/awk.c23
-rw-r--r--editors/vi.c2
-rw-r--r--include/platform.h2
-rw-r--r--init/init.c6
-rw-r--r--libbb/dump.c2
-rw-r--r--libbb/find_root_device.c7
-rw-r--r--libbb/sha1.c2
-rw-r--r--libbb/vfork_daemon_rexec.c8
-rw-r--r--loginutils/login.c2
-rw-r--r--miscutils/devfsd.c16
-rw-r--r--miscutils/hdparm.c6
-rw-r--r--miscutils/nmeter.c2
-rw-r--r--modutils/insmod.c2
-rw-r--r--modutils/lsmod.c2
-rw-r--r--networking/fakeidentd.c2
-rw-r--r--networking/ifconfig.c2
-rw-r--r--networking/inetd.c4
-rw-r--r--networking/ipcalc.c2
-rw-r--r--networking/libiproute/utils.h2
-rw-r--r--networking/telnet.c6
-rw-r--r--networking/traceroute.c2
-rw-r--r--procps/fuser.c4
-rw-r--r--runit/runit_lib.c2
-rw-r--r--runit/runsv.c4
-rw-r--r--runit/sv.c4
-rw-r--r--runit/svlogd.c2
-rw-r--r--shell/ash.c12
-rw-r--r--shell/cmdedit.c2
-rw-r--r--shell/hush.c2
-rw-r--r--shell/lash.c4
39 files changed, 114 insertions, 118 deletions
diff --git a/applets/busybox.c b/applets/busybox.c
index 9ca12ac2b..79634f99e 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -129,7 +129,7 @@ int busybox_main(int argc, char **argv)
129 "\twill act like whatever it was invoked as!\n" 129 "\twill act like whatever it was invoked as!\n"
130 "\nCurrently defined functions:\n", bb_msg_full_version); 130 "\nCurrently defined functions:\n", bb_msg_full_version);
131 col = 0; 131 col = 0;
132 for(a = applets; a->name;) { 132 for (a = applets; a->name;) {
133 col += printf("%s%s", (col ? ", " : "\t"), a->name); 133 col += printf("%s%s", (col ? ", " : "\t"), a->name);
134 a++; 134 a++;
135 if (col > output_width && a->name) { 135 if (col > output_width && a->name) {
diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c
index 3e42035b9..0cfa94454 100644
--- a/archival/libunarchive/check_header_gzip.c
+++ b/archival/libunarchive/check_header_gzip.c
@@ -43,13 +43,13 @@ void check_header_gzip(int src_fd)
43 /* Discard original name if any */ 43 /* Discard original name if any */
44 if (header.formatted.flags & 0x08) { 44 if (header.formatted.flags & 0x08) {
45 /* bit 3 set: original file name present */ 45 /* bit 3 set: original file name present */
46 while(xread_char(src_fd) != 0); 46 while (xread_char(src_fd) != 0);
47 } 47 }
48 48
49 /* Discard file comment if any */ 49 /* Discard file comment if any */
50 if (header.formatted.flags & 0x10) { 50 if (header.formatted.flags & 0x10) {
51 /* bit 4 set: file comment present */ 51 /* bit 4 set: file comment present */
52 while(xread_char(src_fd) != 0); 52 while (xread_char(src_fd) != 0);
53 } 53 }
54 54
55 /* Read the header checksum */ 55 /* Read the header checksum */
diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c
index d0a4ecb5e..ff7d64d83 100644
--- a/archival/libunarchive/decompress_bunzip2.c
+++ b/archival/libunarchive/decompress_bunzip2.c
@@ -32,25 +32,25 @@
32#include "unarchive.h" 32#include "unarchive.h"
33 33
34/* Constants for Huffman coding */ 34/* Constants for Huffman coding */
35#define MAX_GROUPS 6 35#define MAX_GROUPS 6
36#define GROUP_SIZE 50 /* 64 would have been more efficient */ 36#define GROUP_SIZE 50 /* 64 would have been more efficient */
37#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */ 37#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */
38#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ 38#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */
39#define SYMBOL_RUNA 0 39#define SYMBOL_RUNA 0
40#define SYMBOL_RUNB 1 40#define SYMBOL_RUNB 1
41 41
42/* Status return values */ 42/* Status return values */
43#define RETVAL_OK 0 43#define RETVAL_OK 0
44#define RETVAL_LAST_BLOCK (-1) 44#define RETVAL_LAST_BLOCK (-1)
45#define RETVAL_NOT_BZIP_DATA (-2) 45#define RETVAL_NOT_BZIP_DATA (-2)
46#define RETVAL_UNEXPECTED_INPUT_EOF (-3) 46#define RETVAL_UNEXPECTED_INPUT_EOF (-3)
47#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4) 47#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4)
48#define RETVAL_DATA_ERROR (-5) 48#define RETVAL_DATA_ERROR (-5)
49#define RETVAL_OUT_OF_MEMORY (-6) 49#define RETVAL_OUT_OF_MEMORY (-6)
50#define RETVAL_OBSOLETE_INPUT (-7) 50#define RETVAL_OBSOLETE_INPUT (-7)
51 51
52/* Other housekeeping constants */ 52/* Other housekeeping constants */
53#define IOBUF_SIZE 4096 53#define IOBUF_SIZE 4096
54 54
55/* This is what we know about each Huffman coding group */ 55/* This is what we know about each Huffman coding group */
56struct group_data { 56struct group_data {
@@ -151,7 +151,7 @@ static int get_next_block(bunzip_data *bd)
151 /* Reset longjmp I/O error handling */ 151 /* Reset longjmp I/O error handling */
152 152
153 i=setjmp(bd->jmpbuf); 153 i=setjmp(bd->jmpbuf);
154 if(i) return i; 154 if (i) return i;
155 155
156 /* Read in header signature and CRC, then validate signature. 156 /* Read in header signature and CRC, then validate signature.
157 (last block signature means CRC is for whole file, return now) */ 157 (last block signature means CRC is for whole file, return now) */
@@ -166,8 +166,8 @@ static int get_next_block(bunzip_data *bd)
166 some code for this in busybox 1.0.0-pre3, but nobody ever noticed that 166 some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
167 it didn't actually work. */ 167 it didn't actually work. */
168 168
169 if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT; 169 if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
170 if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR; 170 if ((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
171 171
172 /* mapping table: if some byte values are never used (encoding things 172 /* mapping table: if some byte values are never used (encoding things
173 like ascii text), the compression code removes the gaps to have fewer 173 like ascii text), the compression code removes the gaps to have fewer
@@ -180,7 +180,7 @@ static int get_next_block(bunzip_data *bd)
180 for (i=0;i<16;i++) { 180 for (i=0;i<16;i++) {
181 if(t&(1<<(15-i))) { 181 if(t&(1<<(15-i))) {
182 k=get_bits(bd,16); 182 k=get_bits(bd,16);
183 for(j=0;j<16;j++) 183 for (j=0;j<16;j++)
184 if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j; 184 if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j;
185 } 185 }
186 } 186 }
@@ -196,17 +196,17 @@ static int get_next_block(bunzip_data *bd)
196 start of the list.) */ 196 start of the list.) */
197 197
198 if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR; 198 if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
199 for(i=0; i<groupCount; i++) mtfSymbol[i] = i; 199 for (i=0; i<groupCount; i++) mtfSymbol[i] = i;
200 for(i=0; i<nSelectors; i++) { 200 for (i=0; i<nSelectors; i++) {
201 201
202 /* Get next value */ 202 /* Get next value */
203 203
204 for(j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR; 204 for (j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR;
205 205
206 /* Decode MTF to get the next selector */ 206 /* Decode MTF to get the next selector */
207 207
208 uc = mtfSymbol[j]; 208 uc = mtfSymbol[j];
209 for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1]; 209 for (;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
210 mtfSymbol[0]=selectors[i]=uc; 210 mtfSymbol[0]=selectors[i]=uc;
211 } 211 }
212 212
@@ -227,7 +227,7 @@ static int get_next_block(bunzip_data *bd)
227 227
228 t=get_bits(bd, 5)-1; 228 t=get_bits(bd, 5)-1;
229 for (i = 0; i < symCount; i++) { 229 for (i = 0; i < symCount; i++) {
230 for(;;) { 230 for (;;) {
231 if (((unsigned)t) > (MAX_HUFCODE_BITS-1)) 231 if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
232 return RETVAL_DATA_ERROR; 232 return RETVAL_DATA_ERROR;
233 233
@@ -254,7 +254,7 @@ static int get_next_block(bunzip_data *bd)
254 /* Find largest and smallest lengths in this group */ 254 /* Find largest and smallest lengths in this group */
255 255
256 minLen=maxLen=length[0]; 256 minLen=maxLen=length[0];
257 for(i = 1; i < symCount; i++) { 257 for (i = 1; i < symCount; i++) {
258 if(length[i] > maxLen) maxLen = length[i]; 258 if(length[i] > maxLen) maxLen = length[i];
259 else if(length[i] < minLen) minLen = length[i]; 259 else if(length[i] < minLen) minLen = length[i];
260 } 260 }
@@ -284,9 +284,9 @@ static int get_next_block(bunzip_data *bd)
284 /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */ 284 /* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
285 285
286 pp=0; 286 pp=0;
287 for(i=minLen;i<=maxLen;i++) { 287 for (i=minLen;i<=maxLen;i++) {
288 temp[i]=limit[i]=0; 288 temp[i]=limit[i]=0;
289 for(t=0;t<symCount;t++) 289 for (t=0;t<symCount;t++)
290 if(length[t]==i) hufGroup->permute[pp++] = t; 290 if(length[t]==i) hufGroup->permute[pp++] = t;
291 } 291 }
292 292
@@ -325,7 +325,7 @@ static int get_next_block(bunzip_data *bd)
325 325
326 /* Initialize symbol occurrence counters and symbol Move To Front table */ 326 /* Initialize symbol occurrence counters and symbol Move To Front table */
327 327
328 for(i=0;i<256;i++) { 328 for (i=0;i<256;i++) {
329 byteCount[i] = 0; 329 byteCount[i] = 0;
330 mtfSymbol[i]=(unsigned char)i; 330 mtfSymbol[i]=(unsigned char)i;
331 } 331 }
@@ -333,7 +333,7 @@ static int get_next_block(bunzip_data *bd)
333 /* Loop through compressed symbols. */ 333 /* Loop through compressed symbols. */
334 334
335 runPos=dbufCount=selector=0; 335 runPos=dbufCount=selector=0;
336 for(;;) { 336 for (;;) {
337 337
338 /* fetch next Huffman coding group from list. */ 338 /* fetch next Huffman coding group from list. */
339 339
@@ -372,7 +372,7 @@ got_huff_bits:
372 /* Figure how how many bits are in next symbol and unget extras */ 372 /* Figure how how many bits are in next symbol and unget extras */
373 373
374 i=hufGroup->minLen; 374 i=hufGroup->minLen;
375 while(j>limit[i]) ++i; 375 while (j>limit[i]) ++i;
376 bd->inbufBitCount += (hufGroup->maxLen - i); 376 bd->inbufBitCount += (hufGroup->maxLen - i);
377 377
378 /* Huffman decode value to get nextSym (with bounds checking) */ 378 /* Huffman decode value to get nextSym (with bounds checking) */
@@ -421,7 +421,7 @@ got_huff_bits:
421 421
422 uc = symToByte[mtfSymbol[0]]; 422 uc = symToByte[mtfSymbol[0]];
423 byteCount[uc] += t; 423 byteCount[uc] += t;
424 while(t--) dbuf[dbufCount++]=uc; 424 while (t--) dbuf[dbufCount++]=uc;
425 } 425 }
426 426
427 /* Is this the terminating symbol? */ 427 /* Is this the terminating symbol? */
@@ -473,7 +473,7 @@ end_of_huffman_loop:
473 /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ 473 /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
474 474
475 j=0; 475 j=0;
476 for(i=0;i<256;i++) { 476 for (i=0;i<256;i++) {
477 k=j+byteCount[i]; 477 k=j+byteCount[i];
478 byteCount[i] = j; 478 byteCount[i] = j;
479 j=k; 479 j=k;
@@ -535,7 +535,7 @@ static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
535 535
536 /* Loop outputting bytes */ 536 /* Loop outputting bytes */
537 537
538 for(;;) { 538 for (;;) {
539 539
540 /* If the output buffer is full, snapshot state and return */ 540 /* If the output buffer is full, snapshot state and return */
541 541
@@ -682,7 +682,7 @@ uncompressStream(int src_fd, int dst_fd)
682 outbuf=xmalloc(IOBUF_SIZE); 682 outbuf=xmalloc(IOBUF_SIZE);
683 i=start_bunzip(&bd,src_fd,0,0); 683 i=start_bunzip(&bd,src_fd,0,0);
684 if(!i) { 684 if(!i) {
685 for(;;) { 685 for (;;) {
686 if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break; 686 if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break;
687 if(i!=write(dst_fd,outbuf,i)) { 687 if(i!=write(dst_fd,outbuf,i)) {
688 i=RETVAL_UNEXPECTED_OUTPUT_EOF; 688 i=RETVAL_UNEXPECTED_OUTPUT_EOF;
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c
index 38262608d..09f89e25c 100644
--- a/archival/libunarchive/decompress_unzip.c
+++ b/archival/libunarchive/decompress_unzip.c
@@ -791,7 +791,7 @@ static int inflate_get_next_window(void)
791 791
792 gunzip_outbuf_count = 0; 792 gunzip_outbuf_count = 0;
793 793
794 while(1) { 794 while (1) {
795 int ret; 795 int ret;
796 796
797 if (needAnotherBlock) { 797 if (needAnotherBlock) {
@@ -859,7 +859,7 @@ inflate_unzip(int in, int out)
859 /* Allocate space for buffer */ 859 /* Allocate space for buffer */
860 bytebuffer = xmalloc(bytebuffer_max); 860 bytebuffer = xmalloc(bytebuffer_max);
861 861
862 while(1) { 862 while (1) {
863 int ret = inflate_get_next_window(); 863 int ret = inflate_get_next_window();
864 nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); 864 nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
865 if (nwrote == -1) { 865 if (nwrote == -1) {
diff --git a/archival/unzip.c b/archival/unzip.c
index 1c03a4c47..570789427 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -112,7 +112,7 @@ int unzip_main(int argc, char **argv)
112 char key_buf[512]; 112 char key_buf[512];
113 struct stat stat_buf; 113 struct stat stat_buf;
114 114
115 while((opt = getopt(argc, argv, "-d:lnopqx")) != -1) { 115 while ((opt = getopt(argc, argv, "-d:lnopqx")) != -1) {
116 switch (opt_range) { 116 switch (opt_range) {
117 case 0: /* Options */ 117 case 0: /* Options */
118 switch (opt) { 118 switch (opt) {
@@ -192,7 +192,7 @@ int unzip_main(int argc, char **argv)
192 } else { 192 } else {
193 static const char *const extn[] = {"", ".zip", ".ZIP"}; 193 static const char *const extn[] = {"", ".zip", ".ZIP"};
194 int orig_src_fn_len = strlen(src_fn); 194 int orig_src_fn_len = strlen(src_fn);
195 for(i = 0; (i < 3) && (src_fd == -1); i++) { 195 for (i = 0; (i < 3) && (src_fd == -1); i++) {
196 strcpy(src_fn + orig_src_fn_len, extn[i]); 196 strcpy(src_fn + orig_src_fn_len, extn[i]);
197 src_fd = open(src_fn, O_RDONLY); 197 src_fd = open(src_fn, O_RDONLY);
198 } 198 }
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 960c161b0..ae28f6420 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -291,7 +291,7 @@ static void dfree(struct dnode **dnp, int nfiles)
291 free(dnp); /* free the array holding the dnode pointers */ 291 free(dnp); /* free the array holding the dnode pointers */
292} 292}
293#else 293#else
294#define dfree(...) do {} while(0) 294#define dfree(...) do {} while (0)
295#endif 295#endif
296 296
297static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) 297static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
@@ -375,7 +375,7 @@ static void dnsort(struct dnode **dn, int size)
375 qsort(dn, size, sizeof(*dn), sortcmp); 375 qsort(dn, size, sizeof(*dn), sortcmp);
376} 376}
377#else 377#else
378#define dnsort(dn, size) do {} while(0) 378#define dnsort(dn, size) do {} while (0)
379#endif 379#endif
380 380
381 381
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index bd9f92536..6ae0e046b 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -490,7 +490,7 @@ print_ascii(size_t n_bytes, const char *block,
490static void 490static void
491open_next_file(void) 491open_next_file(void)
492{ 492{
493 while(1) { 493 while (1) {
494 input_filename = *file_list; 494 input_filename = *file_list;
495 if (!input_filename) 495 if (!input_filename)
496 return; 496 return;
diff --git a/coreutils/sort.c b/coreutils/sort.c
index c37810f1a..f2152c0a0 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -163,7 +163,7 @@ static int compare_keys(const void *xarg, const void *yarg)
163 y = get_key(*(char **)yarg, key, flags); 163 y = get_key(*(char **)yarg, key, flags);
164#else 164#else
165 /* This curly bracket serves no purpose but to match the nesting 165 /* This curly bracket serves no purpose but to match the nesting
166 level of the for() loop we're not using */ 166 level of the for () loop we're not using */
167 { 167 {
168 x = *(char **)xarg; 168 x = *(char **)xarg;
169 y = *(char **)yarg; 169 y = *(char **)yarg;
@@ -231,7 +231,7 @@ static int compare_keys(const void *xarg, const void *yarg)
231 /* Free key copies. */ 231 /* Free key copies. */
232 if (x != *(char **)xarg) free(x); 232 if (x != *(char **)xarg) free(x);
233 if (y != *(char **)yarg) free(y); 233 if (y != *(char **)yarg) free(y);
234 /* if (retval) break; - done by for() anyway */ 234 /* if (retval) break; - done by for () anyway */
235#else 235#else
236 /* Integer version of -n for tiny systems */ 236 /* Integer version of -n for tiny systems */
237 case FLAG_n: 237 case FLAG_n:
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c
index 396174ef5..acba5ec7a 100644
--- a/e2fsprogs/fsck.c
+++ b/e2fsprogs/fsck.c
@@ -813,7 +813,7 @@ static int opt_in_list(char *opt, char *optlist)
813 list = xstrdup(optlist); 813 list = xstrdup(optlist);
814 814
815 s = strtok(list, ","); 815 s = strtok(list, ",");
816 while(s) { 816 while (s) {
817 if (strcmp(s, opt) == 0) { 817 if (strcmp(s, opt) == 0) {
818 free(list); 818 free(list);
819 return 1; 819 return 1;
diff --git a/editors/awk.c b/editors/awk.c
index 2fea55113..5a500aa83 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -571,7 +571,7 @@ static void skip_spaces(char **s)
571{ 571{
572 char *p = *s; 572 char *p = *s;
573 573
574 while(*p == ' ' || *p == '\t' || 574 while (*p == ' ' || *p == '\t' ||
575 (*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) { 575 (*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) {
576 p++; 576 p++;
577 } 577 }
@@ -938,7 +938,7 @@ static uint32_t next_token(uint32_t expected)
938 syntax_error(EMSG_UNEXP_TOKEN); 938 syntax_error(EMSG_UNEXP_TOKEN);
939 939
940 t.string = --p; 940 t.string = --p;
941 while(isalnum_(*(++p))) { 941 while (isalnum_(*(++p))) {
942 *(p-1) = *p; 942 *(p-1) = *p;
943 } 943 }
944 *(p-1) = '\0'; 944 *(p-1) = '\0';
@@ -1192,7 +1192,7 @@ static void chain_group(void)
1192 } while (c & TC_NEWLINE); 1192 } while (c & TC_NEWLINE);
1193 1193
1194 if (c & TC_GRPSTART) { 1194 if (c & TC_GRPSTART) {
1195 while(next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { 1195 while (next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) {
1196 if (t.tclass & TC_NEWLINE) continue; 1196 if (t.tclass & TC_NEWLINE) continue;
1197 rollback_token(); 1197 rollback_token();
1198 chain_group(); 1198 chain_group();
@@ -1233,7 +1233,7 @@ static void chain_group(void)
1233 case ST_FOR: 1233 case ST_FOR:
1234 next_token(TC_SEQSTART); 1234 next_token(TC_SEQSTART);
1235 n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); 1235 n2 = parse_expr(TC_SEMICOL | TC_SEQTERM);
1236 if (t.tclass & TC_SEQTERM) { /* for-in */ 1236 if (t.tclass & TC_SEQTERM) { /* for-in */
1237 if ((n2->info & OPCLSMASK) != OC_IN) 1237 if ((n2->info & OPCLSMASK) != OC_IN)
1238 syntax_error(EMSG_UNEXP_TOKEN); 1238 syntax_error(EMSG_UNEXP_TOKEN);
1239 n = chain_node(OC_WALKINIT | VV); 1239 n = chain_node(OC_WALKINIT | VV);
@@ -1242,7 +1242,7 @@ static void chain_group(void)
1242 n = chain_loop(NULL); 1242 n = chain_loop(NULL);
1243 n->info = OC_WALKNEXT | Vx; 1243 n->info = OC_WALKNEXT | Vx;
1244 n->l.n = n2->l.n; 1244 n->l.n = n2->l.n;
1245 } else { /* for(;;) */ 1245 } else { /* for (;;) */
1246 n = chain_node(OC_EXEC | Vx); 1246 n = chain_node(OC_EXEC | Vx);
1247 n->l.n = n2; 1247 n->l.n = n2;
1248 n2 = parse_expr(TC_SEMICOL); 1248 n2 = parse_expr(TC_SEMICOL);
@@ -1279,7 +1279,6 @@ static void chain_group(void)
1279 /* delete, next, nextfile, return, exit */ 1279 /* delete, next, nextfile, return, exit */
1280 default: 1280 default:
1281 chain_expr(t.info); 1281 chain_expr(t.info);
1282
1283 } 1282 }
1284 } 1283 }
1285} 1284}
@@ -1293,7 +1292,7 @@ static void parse_program(char *p)
1293 1292
1294 pos = p; 1293 pos = p;
1295 t.lineno = 1; 1294 t.lineno = 1;
1296 while((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | 1295 while ((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART |
1297 TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { 1296 TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) {
1298 1297
1299 if (tclass & TC_OPTERM) 1298 if (tclass & TC_OPTERM)
@@ -1314,7 +1313,7 @@ static void parse_program(char *p)
1314 f = newfunc(t.string); 1313 f = newfunc(t.string);
1315 f->body.first = NULL; 1314 f->body.first = NULL;
1316 f->nargs = 0; 1315 f->nargs = 0;
1317 while(next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) { 1316 while (next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) {
1318 v = findvar(ahash, t.string); 1317 v = findvar(ahash, t.string);
1319 v->x.aidx = (f->nargs)++; 1318 v->x.aidx = (f->nargs)++;
1320 1319
@@ -1452,7 +1451,7 @@ static int awk_split(char *s, node *spl, char **slist)
1452 n++; 1451 n++;
1453 } 1452 }
1454 } else if (c[0] == '\0') { /* null split */ 1453 } else if (c[0] == '\0') { /* null split */
1455 while(*s) { 1454 while (*s) {
1456 *(s1++) = *(s++); 1455 *(s1++) = *(s++);
1457 *(s1++) = '\0'; 1456 *(s1++) = '\0';
1458 n++; 1457 n++;
@@ -1588,7 +1587,7 @@ static void hashwalk_init(var *v, xhash *array)
1588 *w = *(w+1) = (char *)(w + 2); 1587 *w = *(w+1) = (char *)(w + 2);
1589 for (i=0; i<array->csize; i++) { 1588 for (i=0; i<array->csize; i++) {
1590 hi = array->items[i]; 1589 hi = array->items[i];
1591 while(hi) { 1590 while (hi) {
1592 strcpy(*w, hi->name); 1591 strcpy(*w, hi->name);
1593 nextword(w); 1592 nextword(w);
1594 hi = hi->next; 1593 hi = hi->next;
@@ -2567,7 +2566,7 @@ static int awk_exit(int r)
2567 /* waiting for children */ 2566 /* waiting for children */
2568 for (i=0; i<fdhash->csize; i++) { 2567 for (i=0; i<fdhash->csize; i++) {
2569 hi = fdhash->items[i]; 2568 hi = fdhash->items[i];
2570 while(hi) { 2569 while (hi) {
2571 if (hi->data.rs.F && hi->data.rs.is_pipe) 2570 if (hi->data.rs.F && hi->data.rs.is_pipe)
2572 pclose(hi->data.rs.F); 2571 pclose(hi->data.rs.F);
2573 hi = hi->next; 2572 hi = hi->next;
@@ -2729,7 +2728,7 @@ keep_going:
2729 /* fill in ARGV array */ 2728 /* fill in ARGV array */
2730 setvar_i(V[ARGC], argc - optind + 1); 2729 setvar_i(V[ARGC], argc - optind + 1);
2731 setari_u(V[ARGV], 0, "awk"); 2730 setari_u(V[ARGV], 0, "awk");
2732 for(i=optind; i < argc; i++) 2731 for (i = optind; i < argc; i++)
2733 setari_u(V[ARGV], i+1-optind, argv[i]); 2732 setari_u(V[ARGV], i+1-optind, argv[i]);
2734 2733
2735 evaluate(beginseq.first, &tv); 2734 evaluate(beginseq.first, &tv);
diff --git a/editors/vi.c b/editors/vi.c
index 1122f9919..dc93bc424 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2817,7 +2817,7 @@ static void refresh(int full_screen)
2817 int nic = ce-cs+1; 2817 int nic = ce-cs+1;
2818 char *out = (char*)sp+cs; 2818 char *out = (char*)sp+cs;
2819 2819
2820 while(nic-- > 0) { 2820 while (nic-- > 0) {
2821 putchar(*out); 2821 putchar(*out);
2822 out++; 2822 out++;
2823 } 2823 }
diff --git a/include/platform.h b/include/platform.h
index 1cc978288..175440669 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -227,7 +227,7 @@ static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) {
227#define PRIu32 "u" 227#define PRIu32 "u"
228 228
229/* use legacy setpgrp(pidt_,pid_t) for now. move to platform.c */ 229/* use legacy setpgrp(pidt_,pid_t) for now. move to platform.c */
230#define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0) 230#define bb_setpgrp do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
231 231
232#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET 232#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
233#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) 233#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
diff --git a/init/init.c b/init/init.c
index bc53feeae..2e8ca3ca8 100644
--- a/init/init.c
+++ b/init/init.c
@@ -173,7 +173,7 @@ static void loop_forever(void)
173#if ENABLE_DEBUG_INIT 173#if ENABLE_DEBUG_INIT
174#define messageD message 174#define messageD message
175#else 175#else
176#define messageD(...) do {;} while(0); 176#define messageD(...) do {} while (0)
177#endif 177#endif
178static void message(int device, const char *fmt, ...) 178static void message(int device, const char *fmt, ...)
179 __attribute__ ((format(printf, 2, 3))); 179 __attribute__ ((format(printf, 2, 3)));
@@ -534,7 +534,7 @@ static pid_t run(const struct init_action *a)
534 "(pid %d, terminal %s)\n", 534 "(pid %d, terminal %s)\n",
535 cmdpath, getpid(), a->terminal); 535 cmdpath, getpid(), a->terminal);
536 full_write(1, press_enter, sizeof(press_enter) - 1); 536 full_write(1, press_enter, sizeof(press_enter) - 1);
537 while(read(0, &c, 1) == 1 && c != '\n') 537 while (read(0, &c, 1) == 1 && c != '\n')
538 ; 538 ;
539 } 539 }
540#endif 540#endif
@@ -1021,7 +1021,7 @@ int init_main(int argc, char **argv)
1021 { 1021 {
1022 const char * const *e; 1022 const char * const *e;
1023 /* Make sure environs is set to something sane */ 1023 /* Make sure environs is set to something sane */
1024 for(e = environment; *e; e++) 1024 for (e = environment; *e; e++)
1025 putenv((char *) *e); 1025 putenv((char *) *e);
1026 } 1026 }
1027 1027
diff --git a/libbb/dump.c b/libbb/dump.c
index 06b73c955..1815ca914 100644
--- a/libbb/dump.c
+++ b/libbb/dump.c
@@ -726,7 +726,7 @@ void bb_dump_add(const char *fmt)
726 if (isdigit(*p)) { 726 if (isdigit(*p)) {
727// TODO: use bb_strtou 727// TODO: use bb_strtou
728 savep = p; 728 savep = p;
729 do p++; while(isdigit(*p)); 729 do p++; while (isdigit(*p));
730 if (!isspace(*p)) { 730 if (!isspace(*p)) {
731 bb_error_msg_and_die("bad format {%s}", fmt); 731 bb_error_msg_and_die("bad format {%s}", fmt);
732 } 732 }
diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c
index 71b79b8d0..1d74d1ea8 100644
--- a/libbb/find_root_device.c
+++ b/libbb/find_root_device.c
@@ -17,12 +17,13 @@ char *find_block_device(char *path)
17 dev_t dev; 17 dev_t dev;
18 char *retpath=NULL; 18 char *retpath=NULL;
19 19
20 if(stat(path, &st) || !(dir = opendir("/dev"))) return NULL; 20 if (stat(path, &st) || !(dir = opendir("/dev")))
21 return NULL;
21 dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev; 22 dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev;
22 while((entry = readdir(dir)) != NULL) { 23 while ((entry = readdir(dir)) != NULL) {
23 char devpath[PATH_MAX]; 24 char devpath[PATH_MAX];
24 sprintf(devpath,"/dev/%s", entry->d_name); 25 sprintf(devpath,"/dev/%s", entry->d_name);
25 if(!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) { 26 if (!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) {
26 retpath = xstrdup(devpath); 27 retpath = xstrdup(devpath);
27 break; 28 break;
28 } 29 }
diff --git a/libbb/sha1.c b/libbb/sha1.c
index 34813e24a..734fde4c5 100644
--- a/libbb/sha1.c
+++ b/libbb/sha1.c
@@ -47,7 +47,7 @@
47 do { \ 47 do { \
48 t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \ 48 t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \
49 e = d; d = c; c = rotl32(b, 30); b = t; \ 49 e = d; d = c; c = rotl32(b, 30); b = t; \
50 } while(0) 50 } while (0)
51 51
52static void sha1_compile(sha1_ctx_t *ctx) 52static void sha1_compile(sha1_ctx_t *ctx)
53{ 53{
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c
index ebd32f8cd..81ae12687 100644
--- a/libbb/vfork_daemon_rexec.c
+++ b/libbb/vfork_daemon_rexec.c
@@ -15,13 +15,9 @@
15 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. 15 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
16 */ 16 */
17 17
18#include <unistd.h>
19#include <stdio.h>
20#include <fcntl.h>
21#include <paths.h> 18#include <paths.h>
22#include "libbb.h" 19#include "libbb.h"
23 20
24
25#ifdef BB_NOMMU 21#ifdef BB_NOMMU
26void vfork_daemon_rexec(int nochdir, int noclose, 22void vfork_daemon_rexec(int nochdir, int noclose,
27 int argc, char **argv, char *foreground_opt) 23 int argc, char **argv, char *foreground_opt)
@@ -43,9 +39,9 @@ void vfork_daemon_rexec(int nochdir, int noclose,
43 close(fd); 39 close(fd);
44 } 40 }
45 41
46 vfork_args = xcalloc(sizeof(char *), argc + 3); 42 vfork_args = xzalloc(sizeof(char *) * (argc + 3));
47 vfork_args[a++] = CONFIG_BUSYBOX_EXEC_PATH; 43 vfork_args[a++] = CONFIG_BUSYBOX_EXEC_PATH;
48 while(*argv) { 44 while (*argv) {
49 vfork_args[a++] = *argv; 45 vfork_args[a++] = *argv;
50 argv++; 46 argv++;
51 } 47 }
diff --git a/loginutils/login.c b/loginutils/login.c
index bd3c112b9..94bb0ddcb 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -138,7 +138,7 @@ static int check_securetty(void)
138 return 1; 138 return 1;
139 } 139 }
140 while (fgets(buf, sizeof(buf)-1, fp)) { 140 while (fgets(buf, sizeof(buf)-1, fp)) {
141 for(i = strlen(buf)-1; i>=0; --i) { 141 for (i = strlen(buf)-1; i>=0; --i) {
142 if (!isspace(buf[i])) 142 if (!isspace(buf[i]))
143 break; 143 break;
144 } 144 }
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index f39bb7e3f..5435a6a0b 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -457,7 +457,7 @@ int devfsd_main (int argc, char **argv)
457 } 457 }
458 458
459 /* strip last / from mount point, so we don't need to check for it later */ 459 /* strip last / from mount point, so we don't need to check for it later */
460 while( argv[1][1]!='\0' && argv[1][strlen(argv[1])-1] == '/' ) 460 while (argv[1][1]!='\0' && argv[1][strlen(argv[1])-1] == '/' )
461 argv[1][strlen(argv[1]) -1] = '\0'; 461 argv[1][strlen(argv[1]) -1] = '\0';
462 462
463 mount_point = argv[1]; 463 mount_point = argv[1];
@@ -557,7 +557,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas
557 if ( S_ISDIR (statbuf.st_mode) ) 557 if ( S_ISDIR (statbuf.st_mode) )
558 { 558 {
559 /* strip last / from dirname so we don't need to check for it later */ 559 /* strip last / from dirname so we don't need to check for it later */
560 while( path && path[1]!='\0' && path[strlen(path)-1] == '/') 560 while (path && path[1]!='\0' && path[strlen(path)-1] == '/')
561 path[strlen(path) -1] = '\0'; 561 path[strlen(path) -1] = '\0';
562 562
563 dir_operation(READ_CONFIG, path, 0, event_mask); 563 dir_operation(READ_CONFIG, path, 0, event_mask);
@@ -665,7 +665,7 @@ static void process_config_line (const char *line, unsigned long *event_mask)
665 665
666 i = index_in_str_array(options, what ); 666 i = index_in_str_array(options, what );
667 667
668 switch(i) 668 switch (i)
669 { 669 {
670 case 4: /* "PERMISSIONS" */ 670 case 4: /* "PERMISSIONS" */
671 new->action.what = AC_PERMISSIONS; 671 new->action.what = AC_PERMISSIONS;
@@ -1052,7 +1052,7 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int
1052 if( i == 9 ) 1052 if( i == 9 )
1053 snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2); 1053 snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2);
1054 /* esac */ 1054 /* esac */
1055 } /* switch(action) */ 1055 } /* switch (action) */
1056 1056
1057 if(compat_name == NULL ) 1057 if(compat_name == NULL )
1058 return; 1058 return;
@@ -1073,7 +1073,7 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int
1073 debug_msg_logger(LOG_ERR, "unlink: %s: %m", compat_name); 1073 debug_msg_logger(LOG_ERR, "unlink: %s: %m", compat_name);
1074 break; 1074 break;
1075 /*esac*/ 1075 /*esac*/
1076 } /* switch(action) */ 1076 } /* switch (action) */
1077} /* End Function action_compat */ 1077} /* End Function action_compat */
1078 1078
1079static void restore(char *spath, struct stat source_stat, int rootlen) 1079static void restore(char *spath, struct stat source_stat, int rootlen)
@@ -1265,7 +1265,7 @@ static mode_t get_mode (const char *string)
1265 1265
1266 mode = 0; 1266 mode = 0;
1267 i= S_IRUSR; 1267 i= S_IRUSR;
1268 while(i>0) 1268 while (i>0)
1269 { 1269 {
1270 if(string[0]=='r'||string[0]=='w'||string[0]=='x') 1270 if(string[0]=='r'||string[0]=='w'||string[0]=='x')
1271 mode+=i; 1271 mode+=i;
@@ -1381,7 +1381,7 @@ static void dir_operation(int type, const char * dir_name, int var, unsigned lon
1381 debug_msg_logger(LOG_ERR, "%s: %s: %m", __FUNCTION__, path); 1381 debug_msg_logger(LOG_ERR, "%s: %s: %m", __FUNCTION__, path);
1382 continue; 1382 continue;
1383 } 1383 }
1384 switch(type) 1384 switch (type)
1385 { 1385 {
1386 case SERVICE: 1386 case SERVICE:
1387 service(statbuf,path); 1387 service(statbuf,path);
@@ -1710,7 +1710,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor)
1710 c+=2; 1710 c+=2;
1711 } 1711 }
1712 i++; 1712 i++;
1713 } while(i<=IDE9_MAJOR); 1713 } while (i<=IDE9_MAJOR);
1714 1714
1715 if (minor > 63) 1715 if (minor > 63)
1716 ++letter; 1716 ++letter;
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index 90c163973..16485b900 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -2043,10 +2043,10 @@ static void identify_from_stdin(void)
2043 2043
2044 // Convert the newline-separated hex data into an identify block. 2044 // Convert the newline-separated hex data into an identify block.
2045 2045
2046 for (i = 0; i<256; i++) 2046 for (i = 0; i<256; i++) {
2047 {
2048 int j; 2047 int j;
2049 for(j=0;j<4;j++) sbuf[i] = (sbuf[i] <<4) + fromhex(*(b++)); 2048 for (j = 0; j < 4; j++)
2049 sbuf[i] = (sbuf[i] <<4) + fromhex(*(b++));
2050 } 2050 }
2051 2051
2052 // Parse the data. 2052 // Parse the data.
diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c
index 0c9485350..1fa35b293 100644
--- a/miscutils/nmeter.c
+++ b/miscutils/nmeter.c
@@ -594,7 +594,7 @@ static void collect_mem(mem_stat *s)
594 } 594 }
595 595
596 m_free += m_bufs + m_cached + m_slab; 596 m_free += m_bufs + m_cached + m_slab;
597 switch(s->opt) { 597 switch (s->opt) {
598 case 'f': 598 case 'f':
599 scale(m_free << 10); break; 599 scale(m_free << 10); break;
600 default: 600 default:
diff --git a/modutils/insmod.c b/modutils/insmod.c
index 19066972a..3b71d1c8a 100644
--- a/modutils/insmod.c
+++ b/modutils/insmod.c
@@ -3719,7 +3719,7 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
3719 close(fd); 3719 close(fd);
3720} 3720}
3721#else /* FEATURE_CHECK_TAINTED_MODULE */ 3721#else /* FEATURE_CHECK_TAINTED_MODULE */
3722#define check_tainted_module(x, y) do { } while(0); 3722#define check_tainted_module(x, y) do { } while (0);
3723#endif /* FEATURE_CHECK_TAINTED_MODULE */ 3723#endif /* FEATURE_CHECK_TAINTED_MODULE */
3724 3724
3725#if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS 3725#if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS
diff --git a/modutils/lsmod.c b/modutils/lsmod.c
index ffde3d829..987174081 100644
--- a/modutils/lsmod.c
+++ b/modutils/lsmod.c
@@ -82,7 +82,7 @@ int lsmod_main(int argc, char **argv)
82 82
83 module_names = deps = NULL; 83 module_names = deps = NULL;
84 bufsize = depsize = 0; 84 bufsize = depsize = 0;
85 while(query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { 85 while (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) {
86 if (errno != ENOSPC) bb_perror_msg_and_die("QM_MODULES"); 86 if (errno != ENOSPC) bb_perror_msg_and_die("QM_MODULES");
87 module_names = xmalloc(bufsize = nmod); 87 module_names = xmalloc(bufsize = nmod);
88 } 88 }
diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c
index 04138cca3..8967a7a38 100644
--- a/networking/fakeidentd.c
+++ b/networking/fakeidentd.c
@@ -302,7 +302,7 @@ deleteconn:
302 conns[i].lasttime = time(NULL); 302 conns[i].lasttime = time(NULL);
303 } 303 }
304 } 304 }
305 } /* end of while(1) */ 305 } /* end of while (1) */
306 306
307 return 0; 307 return 0;
308} 308}
diff --git a/networking/ifconfig.c b/networking/ifconfig.c
index 242bd0638..dd4ce5ecd 100644
--- a/networking/ifconfig.c
+++ b/networking/ifconfig.c
@@ -497,7 +497,7 @@ int ifconfig_main(int argc, char **argv)
497 ifr.ifr_flags &= ~selector; 497 ifr.ifr_flags &= ~selector;
498 if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0) 498 if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0)
499 bb_perror_msg_and_die("SIOCSIFFLAGS"); 499 bb_perror_msg_and_die("SIOCSIFFLAGS");
500 } /* while() */ 500 } /* while () */
501 501
502 if (ENABLE_FEATURE_CLEAN_UP) 502 if (ENABLE_FEATURE_CLEAN_UP)
503 close(sockfd); 503 close(sockfd);
diff --git a/networking/inetd.c b/networking/inetd.c
index 7c89be28f..75665ba3e 100644
--- a/networking/inetd.c
+++ b/networking/inetd.c
@@ -835,7 +835,7 @@ static servtab_t *getconfigent(void)
835 sigaddset(&m, SIGHUP); \ 835 sigaddset(&m, SIGHUP); \
836 sigaddset(&m, SIGALRM); \ 836 sigaddset(&m, SIGALRM); \
837 sigprocmask(SIG_BLOCK, &m, NULL); \ 837 sigprocmask(SIG_BLOCK, &m, NULL); \
838} while(0) 838} while (0)
839 839
840static servtab_t *enter(servtab_t *cp) 840static servtab_t *enter(servtab_t *cp)
841{ 841{
@@ -1495,7 +1495,7 @@ do_exit1:
1495 if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) 1495 if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
1496 close(ctrl); 1496 close(ctrl);
1497 } /* for (sep = servtab...) */ 1497 } /* for (sep = servtab...) */
1498 } /* for(;;) */ 1498 } /* for (;;) */
1499} 1499}
1500 1500
1501/* 1501/*
diff --git a/networking/ipcalc.c b/networking/ipcalc.c
index 0ee9646c2..685f0e315 100644
--- a/networking/ipcalc.c
+++ b/networking/ipcalc.c
@@ -43,7 +43,7 @@ static int get_prefix(unsigned long netmask)
43 int ret = 0; 43 int ret = 0;
44 44
45 netmask = htonl(netmask); 45 netmask = htonl(netmask);
46 while(msk) { 46 while (msk) {
47 if (netmask & msk) 47 if (netmask & msk)
48 ret++; 48 ret++;
49 msk >>= 1; 49 msk >>= 1;
diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h
index 0b0d7545a..98634dde7 100644
--- a/networking/libiproute/utils.h
+++ b/networking/libiproute/utils.h
@@ -30,7 +30,7 @@ extern char * _SL_;
30 30
31extern void incomplete_command(void) ATTRIBUTE_NORETURN; 31extern void incomplete_command(void) ATTRIBUTE_NORETURN;
32 32
33#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0) 33#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while (0)
34 34
35typedef struct 35typedef struct
36{ 36{
diff --git a/networking/telnet.c b/networking/telnet.c
index 6085d885a..e65b6918d 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -320,7 +320,7 @@ static void putiac_subopt(byte c, char *str)
320 putiac(c); 320 putiac(c);
321 putiac(0); 321 putiac(0);
322 322
323 while(*str) 323 while (*str)
324 putiac(*str++); 324 putiac(*str++);
325 325
326 putiac(IAC); 326 putiac(IAC);
@@ -343,12 +343,12 @@ static void putiac_subopt_autologin(void)
343 putiac(TELQUAL_IS); 343 putiac(TELQUAL_IS);
344 putiac(NEW_ENV_VAR); 344 putiac(NEW_ENV_VAR);
345 345
346 while(*user) 346 while (*user)
347 putiac(*user++); 347 putiac(*user++);
348 348
349 putiac(NEW_ENV_VALUE); 349 putiac(NEW_ENV_VALUE);
350 350
351 while(*autologin) 351 while (*autologin)
352 putiac(*autologin++); 352 putiac(*autologin++);
353 353
354 putiac(IAC); 354 putiac(IAC);
diff --git a/networking/traceroute.c b/networking/traceroute.c
index adb9ef0b4..0f3da90d6 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -989,7 +989,7 @@ traceroute_main(int argc, char *argv[])
989 if (sourse_route_list) { 989 if (sourse_route_list) {
990 llist_t *l_sr; 990 llist_t *l_sr;
991 991
992 for(l_sr = sourse_route_list; l_sr; ) { 992 for (l_sr = sourse_route_list; l_sr; ) {
993 if (lsrr >= NGATEWAYS) 993 if (lsrr >= NGATEWAYS)
994 bb_error_msg_and_die("no more than %d gateways", NGATEWAYS); 994 bb_error_msg_and_die("no more than %d gateways", NGATEWAYS);
995 getaddr(gwlist + lsrr, l_sr->data); 995 getaddr(gwlist + lsrr, l_sr->data);
diff --git a/procps/fuser.c b/procps/fuser.c
index a216eaec8..9752af74e 100644
--- a/procps/fuser.c
+++ b/procps/fuser.c
@@ -319,7 +319,7 @@ int fuser_main(int argc, char **argv)
319 bb_show_usage(); 319 bb_show_usage();
320 320
321 fni = xmalloc(sizeof(int)); 321 fni = xmalloc(sizeof(int));
322 for(i=1;i<argc;i++) { 322 for (i=1;i<argc;i++) {
323 optn = fuser_option(argv[i]); 323 optn = fuser_option(argv[i]);
324 if(optn) opt |= optn; 324 if(optn) opt |= optn;
325 else if(argv[i][0] == '-') { 325 else if(argv[i][0] == '-') {
@@ -335,7 +335,7 @@ int fuser_main(int argc, char **argv)
335 if(!fnic) return 1; 335 if(!fnic) return 1;
336 336
337 inodes = xmalloc(sizeof(inode_list)); 337 inodes = xmalloc(sizeof(inode_list));
338 for(i=0;i<fnic;i++) { 338 for (i=0;i<fnic;i++) {
339 if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) { 339 if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) {
340 fuser_scan_proc_net(opt, proto, port, inodes); 340 fuser_scan_proc_net(opt, proto, port, inodes);
341 } 341 }
diff --git a/runit/runit_lib.c b/runit/runit_lib.c
index 5ebbc5840..8612a1b94 100644
--- a/runit/runit_lib.c
+++ b/runit/runit_lib.c
@@ -337,7 +337,7 @@ unsigned fmt_ulong(char *s,unsigned long u)
337 while (q > 9) { ++len; q /= 10; } 337 while (q > 9) { ++len; q /= 10; }
338 if (s) { 338 if (s) {
339 s += len; 339 s += len;
340 do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */ 340 do { *--s = '0' + (u % 10); u /= 10; } while (u); /* handles u == 0 */
341 } 341 }
342 return len; 342 return len;
343} 343}
diff --git a/runit/runsv.c b/runit/runsv.c
index e1b5459fb..9e117fe0a 100644
--- a/runit/runsv.c
+++ b/runit/runsv.c
@@ -155,7 +155,7 @@ static void update_status(struct svdir *s)
155 if (s->ctrl & C_PAUSE) p = add_str(p, ", paused"); 155 if (s->ctrl & C_PAUSE) p = add_str(p, ", paused");
156 if (s->ctrl & C_TERM) p = add_str(p, ", got TERM"); 156 if (s->ctrl & C_TERM) p = add_str(p, ", got TERM");
157 if (s->state != S_DOWN) 157 if (s->state != S_DOWN)
158 switch(s->want) { 158 switch (s->want) {
159 case W_DOWN: 159 case W_DOWN:
160 p = add_str(p, ", want down"); 160 p = add_str(p, ", want down");
161 break; 161 break;
@@ -329,7 +329,7 @@ static void startservice(struct svdir *s)
329 329
330static int ctrl(struct svdir *s, char c) 330static int ctrl(struct svdir *s, char c)
331{ 331{
332 switch(c) { 332 switch (c) {
333 case 'd': /* down */ 333 case 'd': /* down */
334 s->want = W_DOWN; 334 s->want = W_DOWN;
335 update_status(s); 335 update_status(s);
diff --git a/runit/sv.c b/runit/sv.c
index 819f31419..9471d09a8 100644
--- a/runit/sv.c
+++ b/runit/sv.c
@@ -75,7 +75,7 @@ static int svstatus_get(void)
75 } 75 }
76 r = read(fd, svstatus, 20); 76 r = read(fd, svstatus, 20);
77 close(fd); 77 close(fd);
78 switch(r) { 78 switch (r) {
79 case 20: break; 79 case 20: break;
80 case -1: warn_cannot("read supervise/status"); return -1; 80 case -1: warn_cannot("read supervise/status"); return -1;
81 default: warnx_cannot("read supervise/status: bad format"); return -1; 81 default: warnx_cannot("read supervise/status: bad format"); return -1;
@@ -124,7 +124,7 @@ static unsigned svstatus_print(char *m)
124static int status(char *unused) 124static int status(char *unused)
125{ 125{
126 r = svstatus_get(); 126 r = svstatus_get();
127 switch(r) { case -1: case 0: return 0; } 127 switch (r) { case -1: case 0: return 0; }
128 r = svstatus_print(*service); 128 r = svstatus_print(*service);
129 if (chdir("log") == -1) { 129 if (chdir("log") == -1) {
130 if (errno != ENOENT) { 130 if (errno != ENOENT) {
diff --git a/runit/svlogd.c b/runit/svlogd.c
index 7024c3db4..c91f85fe1 100644
--- a/runit/svlogd.c
+++ b/runit/svlogd.c
@@ -262,7 +262,7 @@ static unsigned rotate(struct logdir *ld)
262 return 0; 262 return 0;
263 } 263 }
264 if (ld->ppid) 264 if (ld->ppid)
265 while(!processorstop(ld)) 265 while (!processorstop(ld))
266 /* wait */; 266 /* wait */;
267 267
268 while (fchdir(ld->fddir) == -1) 268 while (fchdir(ld->fddir) == -1)
diff --git a/shell/ash.c b/shell/ash.c
index e8f7d30bd..afb9b6a95 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2402,7 +2402,7 @@ static const char * updatepwd(const char *dir)
2402 } 2402 }
2403 p = strtok(cdcomppath, "/"); 2403 p = strtok(cdcomppath, "/");
2404 while (p) { 2404 while (p) {
2405 switch(*p) { 2405 switch (*p) {
2406 case '.': 2406 case '.':
2407 if (p[1] == '.' && p[2] == '\0') { 2407 if (p[1] == '.' && p[2] == '\0') {
2408 while (new > lim) { 2408 while (new > lim) {
@@ -4802,7 +4802,7 @@ exptilde(char *startp, char *p, int flag)
4802 name = p + 1; 4802 name = p + 1;
4803 4803
4804 while ((c = *++p) != '\0') { 4804 while ((c = *++p) != '\0') {
4805 switch(c) { 4805 switch (c) {
4806 case CTLESC: 4806 case CTLESC:
4807 return startp; 4807 return startp;
4808 case CTLQUOTEMARK: 4808 case CTLQUOTEMARK:
@@ -10211,7 +10211,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs)
10211 CHECKEND(); /* set c to PEOF if at end of here document */ 10211 CHECKEND(); /* set c to PEOF if at end of here document */
10212 for (;;) { /* until end of line or end of word */ 10212 for (;;) { /* until end of line or end of word */
10213 CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ 10213 CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
10214 switch(SIT(c, syntax)) { 10214 switch (SIT(c, syntax)) {
10215 case CNL: /* '\n' */ 10215 case CNL: /* '\n' */
10216 if (syntax == BASESYNTAX) 10216 if (syntax == BASESYNTAX)
10217 goto endword; /* exit outer loop */ 10217 goto endword; /* exit outer loop */
@@ -11282,7 +11282,7 @@ shtree(union node *n, int ind, char *pfx, FILE *fp)
11282 return; 11282 return;
11283 11283
11284 indent(ind, pfx, fp); 11284 indent(ind, pfx, fp);
11285 switch(n->type) { 11285 switch (n->type) {
11286 case NSEMI: 11286 case NSEMI:
11287 s = "; "; 11287 s = "; ";
11288 goto binop; 11288 goto binop;
@@ -12613,7 +12613,7 @@ readcmd(int argc, char **argv)
12613 while ((i = nextopt("p:r")) != '\0') 12613 while ((i = nextopt("p:r")) != '\0')
12614#endif 12614#endif
12615 { 12615 {
12616 switch(i) { 12616 switch (i) {
12617 case 'p': 12617 case 'p':
12618 prompt = optionarg; 12618 prompt = optionarg;
12619 break; 12619 break;
@@ -13579,7 +13579,7 @@ static arith_t arith (const char *expr, int *perrcode)
13579 * a number, since it evaluates to one). Think about it. 13579 * a number, since it evaluates to one). Think about it.
13580 * It makes sense. */ 13580 * It makes sense. */
13581 if (lasttok != TOK_NUM) { 13581 if (lasttok != TOK_NUM) {
13582 switch(op) { 13582 switch (op) {
13583 case TOK_ADD: 13583 case TOK_ADD:
13584 op = TOK_UPLUS; 13584 op = TOK_UPLUS;
13585 break; 13585 break;
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index bc9cc5ef4..7af73ec6e 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -1799,7 +1799,7 @@ rewrite_line:
1799 /* After max history, remove the oldest command */ 1799 /* After max history, remove the oldest command */
1800 if (i >= MAX_HISTORY) { 1800 if (i >= MAX_HISTORY) {
1801 free(history[0]); 1801 free(history[0]);
1802 for(i = 0; i < MAX_HISTORY-1; i++) 1802 for (i = 0; i < MAX_HISTORY-1; i++)
1803 history[i] = history[i+1]; 1803 history[i] = history[i+1];
1804 } 1804 }
1805 history[i++] = xstrdup(command); 1805 history[i++] = xstrdup(command);
diff --git a/shell/hush.c b/shell/hush.c
index a6e029e4e..9bc0013d7 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2269,7 +2269,7 @@ static int parse_group(o_string *dest, struct p_context *ctx,
2269 return 1; /* syntax error, groups and arglists don't mix */ 2269 return 1; /* syntax error, groups and arglists don't mix */
2270 } 2270 }
2271 initialize_context(&sub); 2271 initialize_context(&sub);
2272 switch(ch) { 2272 switch (ch) {
2273 case '(': endch=')'; child->subshell=1; break; 2273 case '(': endch=')'; child->subshell=1; break;
2274 case '{': endch='}'; break; 2274 case '{': endch='}'; break;
2275 default: syntax(); /* really logic error */ 2275 default: syntax(); /* really logic error */
diff --git a/shell/lash.c b/shell/lash.c
index 525767190..52b117431 100644
--- a/shell/lash.c
+++ b/shell/lash.c
@@ -789,7 +789,7 @@ static int expand_arguments(char *command)
789 src = command; 789 src = command;
790 while((dst = strchr(src,'$')) != NULL){ 790 while((dst = strchr(src,'$')) != NULL){
791 var = NULL; 791 var = NULL;
792 switch(*(dst+1)) { 792 switch (*(dst+1)) {
793 case '?': 793 case '?':
794 var = itoa(last_return_code); 794 var = itoa(last_return_code);
795 break; 795 break;
@@ -1163,7 +1163,7 @@ static int pseudo_exec(struct child_prog *child)
1163 char **argv_l = child->argv; 1163 char **argv_l = child->argv;
1164 int argc_l; 1164 int argc_l;
1165 1165
1166 for(argc_l=0; *argv_l; argv_l++, argc_l++); 1166 for (argc_l=0; *argv_l; argv_l++, argc_l++);
1167 optind = 1; 1167 optind = 1;
1168 run_applet_by_name(child->argv[0], argc_l, child->argv); 1168 run_applet_by_name(child->argv[0], argc_l, child->argv);
1169 } 1169 }