diff options
author | Denis Vlasenko | 2006-12-26 10:42:51 +0000 |
---|---|---|
committer | Denis Vlasenko | 2006-12-26 10:42:51 +0000 |
commit | bf0a201008671f81c107de72c026b1b84967561d (patch) | |
tree | af74820b70fa27929fe218c95822c20651b60637 | |
parent | 5dd7ef0f37373e397a7160cb431a32ae57f9f7d9 (diff) | |
download | busybox-bf0a201008671f81c107de72c026b1b84967561d.zip busybox-bf0a201008671f81c107de72c026b1b84967561d.tar.gz |
style fixes
last xcalloc replaced by xzalloc
39 files changed, 114 insertions, 118 deletions
diff --git a/applets/busybox.c b/applets/busybox.c index 9ca12ac..79634f9 100644 --- a/applets/busybox.c +++ b/applets/busybox.c @@ -129,7 +129,7 @@ int busybox_main(int argc, char **argv) "\twill act like whatever it was invoked as!\n" "\nCurrently defined functions:\n", bb_msg_full_version); col = 0; - for(a = applets; a->name;) { + for (a = applets; a->name;) { col += printf("%s%s", (col ? ", " : "\t"), a->name); a++; if (col > output_width && a->name) { diff --git a/archival/libunarchive/check_header_gzip.c b/archival/libunarchive/check_header_gzip.c index 3e42035..0cfa944 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) /* Discard original name if any */ if (header.formatted.flags & 0x08) { /* bit 3 set: original file name present */ - while(xread_char(src_fd) != 0); + while (xread_char(src_fd) != 0); } /* Discard file comment if any */ if (header.formatted.flags & 0x10) { /* bit 4 set: file comment present */ - while(xread_char(src_fd) != 0); + while (xread_char(src_fd) != 0); } /* Read the header checksum */ diff --git a/archival/libunarchive/decompress_bunzip2.c b/archival/libunarchive/decompress_bunzip2.c index d0a4ecb..ff7d64d 100644 --- a/archival/libunarchive/decompress_bunzip2.c +++ b/archival/libunarchive/decompress_bunzip2.c @@ -32,25 +32,25 @@ #include "unarchive.h" /* Constants for Huffman coding */ -#define MAX_GROUPS 6 -#define GROUP_SIZE 50 /* 64 would have been more efficient */ -#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */ -#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ -#define SYMBOL_RUNA 0 -#define SYMBOL_RUNB 1 +#define MAX_GROUPS 6 +#define GROUP_SIZE 50 /* 64 would have been more efficient */ +#define MAX_HUFCODE_BITS 20 /* Longest Huffman code allowed */ +#define MAX_SYMBOLS 258 /* 256 literals + RUNA + RUNB */ +#define SYMBOL_RUNA 0 +#define SYMBOL_RUNB 1 /* Status return values */ -#define RETVAL_OK 0 -#define RETVAL_LAST_BLOCK (-1) -#define RETVAL_NOT_BZIP_DATA (-2) -#define RETVAL_UNEXPECTED_INPUT_EOF (-3) -#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4) -#define RETVAL_DATA_ERROR (-5) -#define RETVAL_OUT_OF_MEMORY (-6) -#define RETVAL_OBSOLETE_INPUT (-7) +#define RETVAL_OK 0 +#define RETVAL_LAST_BLOCK (-1) +#define RETVAL_NOT_BZIP_DATA (-2) +#define RETVAL_UNEXPECTED_INPUT_EOF (-3) +#define RETVAL_UNEXPECTED_OUTPUT_EOF (-4) +#define RETVAL_DATA_ERROR (-5) +#define RETVAL_OUT_OF_MEMORY (-6) +#define RETVAL_OBSOLETE_INPUT (-7) /* Other housekeeping constants */ -#define IOBUF_SIZE 4096 +#define IOBUF_SIZE 4096 /* This is what we know about each Huffman coding group */ struct group_data { @@ -151,7 +151,7 @@ static int get_next_block(bunzip_data *bd) /* Reset longjmp I/O error handling */ i=setjmp(bd->jmpbuf); - if(i) return i; + if (i) return i; /* Read in header signature and CRC, then validate signature. (last block signature means CRC is for whole file, return now) */ @@ -166,8 +166,8 @@ static int get_next_block(bunzip_data *bd) some code for this in busybox 1.0.0-pre3, but nobody ever noticed that it didn't actually work. */ - if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT; - if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR; + if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT; + if ((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR; /* mapping table: if some byte values are never used (encoding things like ascii text), the compression code removes the gaps to have fewer @@ -180,7 +180,7 @@ static int get_next_block(bunzip_data *bd) for (i=0;i<16;i++) { if(t&(1<<(15-i))) { k=get_bits(bd,16); - for(j=0;j<16;j++) + for (j=0;j<16;j++) if(k&(1<<(15-j))) symToByte[symTotal++]=(16*i)+j; } } @@ -196,17 +196,17 @@ static int get_next_block(bunzip_data *bd) start of the list.) */ if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR; - for(i=0; i<groupCount; i++) mtfSymbol[i] = i; - for(i=0; i<nSelectors; i++) { + for (i=0; i<groupCount; i++) mtfSymbol[i] = i; + for (i=0; i<nSelectors; i++) { /* Get next value */ - for(j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR; + for (j=0;get_bits(bd,1);j++) if (j>=groupCount) return RETVAL_DATA_ERROR; /* Decode MTF to get the next selector */ uc = mtfSymbol[j]; - for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1]; + for (;j;j--) mtfSymbol[j] = mtfSymbol[j-1]; mtfSymbol[0]=selectors[i]=uc; } @@ -227,7 +227,7 @@ static int get_next_block(bunzip_data *bd) t=get_bits(bd, 5)-1; for (i = 0; i < symCount; i++) { - for(;;) { + for (;;) { if (((unsigned)t) > (MAX_HUFCODE_BITS-1)) return RETVAL_DATA_ERROR; @@ -254,7 +254,7 @@ static int get_next_block(bunzip_data *bd) /* Find largest and smallest lengths in this group */ minLen=maxLen=length[0]; - for(i = 1; i < symCount; i++) { + for (i = 1; i < symCount; i++) { if(length[i] > maxLen) maxLen = length[i]; else if(length[i] < minLen) minLen = length[i]; } @@ -284,9 +284,9 @@ static int get_next_block(bunzip_data *bd) /* Calculate permute[]. Concurently, initialize 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; } @@ -325,7 +325,7 @@ static int get_next_block(bunzip_data *bd) /* Initialize symbol occurrence counters and symbol Move To Front table */ - for(i=0;i<256;i++) { + for (i=0;i<256;i++) { byteCount[i] = 0; mtfSymbol[i]=(unsigned char)i; } @@ -333,7 +333,7 @@ static int get_next_block(bunzip_data *bd) /* Loop through compressed symbols. */ runPos=dbufCount=selector=0; - for(;;) { + for (;;) { /* fetch next Huffman coding group from list. */ @@ -372,7 +372,7 @@ got_huff_bits: /* Figure how how many bits are in next symbol and unget extras */ i=hufGroup->minLen; - while(j>limit[i]) ++i; + while (j>limit[i]) ++i; bd->inbufBitCount += (hufGroup->maxLen - i); /* Huffman decode value to get nextSym (with bounds checking) */ @@ -421,7 +421,7 @@ got_huff_bits: uc = symToByte[mtfSymbol[0]]; byteCount[uc] += t; - while(t--) dbuf[dbufCount++]=uc; + while (t--) dbuf[dbufCount++]=uc; } /* Is this the terminating symbol? */ @@ -473,7 +473,7 @@ end_of_huffman_loop: /* Turn byteCount into cumulative occurrence counts of 0 to n-1. */ j=0; - for(i=0;i<256;i++) { + for (i=0;i<256;i++) { k=j+byteCount[i]; byteCount[i] = j; j=k; @@ -535,7 +535,7 @@ static int read_bunzip(bunzip_data *bd, char *outbuf, int len) /* Loop outputting bytes */ - for(;;) { + for (;;) { /* If the output buffer is full, snapshot state and return */ @@ -682,7 +682,7 @@ uncompressStream(int src_fd, int dst_fd) outbuf=xmalloc(IOBUF_SIZE); i=start_bunzip(&bd,src_fd,0,0); if(!i) { - for(;;) { + for (;;) { if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break; if(i!=write(dst_fd,outbuf,i)) { i=RETVAL_UNEXPECTED_OUTPUT_EOF; diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 3826260..09f89e2 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c @@ -791,7 +791,7 @@ static int inflate_get_next_window(void) gunzip_outbuf_count = 0; - while(1) { + while (1) { int ret; if (needAnotherBlock) { @@ -859,7 +859,7 @@ inflate_unzip(int in, int out) /* Allocate space for buffer */ bytebuffer = xmalloc(bytebuffer_max); - while(1) { + while (1) { int ret = inflate_get_next_window(); nwrote = full_write(out, gunzip_window, gunzip_outbuf_count); if (nwrote == -1) { diff --git a/archival/unzip.c b/archival/unzip.c index 1c03a4c..5707894 100644 --- a/archival/unzip.c +++ b/archival/unzip.c @@ -112,7 +112,7 @@ int unzip_main(int argc, char **argv) char key_buf[512]; struct stat stat_buf; - while((opt = getopt(argc, argv, "-d:lnopqx")) != -1) { + while ((opt = getopt(argc, argv, "-d:lnopqx")) != -1) { switch (opt_range) { case 0: /* Options */ switch (opt) { @@ -192,7 +192,7 @@ int unzip_main(int argc, char **argv) } else { static const char *const extn[] = {"", ".zip", ".ZIP"}; int orig_src_fn_len = strlen(src_fn); - for(i = 0; (i < 3) && (src_fd == -1); i++) { + for (i = 0; (i < 3) && (src_fd == -1); i++) { strcpy(src_fn + orig_src_fn_len, extn[i]); src_fd = open(src_fn, O_RDONLY); } diff --git a/coreutils/ls.c b/coreutils/ls.c index 960c161..ae28f64 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c @@ -291,7 +291,7 @@ static void dfree(struct dnode **dnp, int nfiles) free(dnp); /* free the array holding the dnode pointers */ } #else -#define dfree(...) do {} while(0) +#define dfree(...) do {} while (0) #endif static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which) @@ -375,7 +375,7 @@ static void dnsort(struct dnode **dn, int size) qsort(dn, size, sizeof(*dn), sortcmp); } #else -#define dnsort(dn, size) do {} while(0) +#define dnsort(dn, size) do {} while (0) #endif diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index bd9f925..6ae0e04 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c @@ -490,7 +490,7 @@ print_ascii(size_t n_bytes, const char *block, static void open_next_file(void) { - while(1) { + while (1) { input_filename = *file_list; if (!input_filename) return; diff --git a/coreutils/sort.c b/coreutils/sort.c index c37810f..f2152c0 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -163,7 +163,7 @@ static int compare_keys(const void *xarg, const void *yarg) y = get_key(*(char **)yarg, key, flags); #else /* This curly bracket serves no purpose but to match the nesting - level of the for() loop we're not using */ + level of the for () loop we're not using */ { x = *(char **)xarg; y = *(char **)yarg; @@ -231,7 +231,7 @@ static int compare_keys(const void *xarg, const void *yarg) /* Free key copies. */ if (x != *(char **)xarg) free(x); if (y != *(char **)yarg) free(y); - /* if (retval) break; - done by for() anyway */ + /* if (retval) break; - done by for () anyway */ #else /* Integer version of -n for tiny systems */ case FLAG_n: diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 396174e..acba5ec 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -813,7 +813,7 @@ static int opt_in_list(char *opt, char *optlist) list = xstrdup(optlist); s = strtok(list, ","); - while(s) { + while (s) { if (strcmp(s, opt) == 0) { free(list); return 1; diff --git a/editors/awk.c b/editors/awk.c index 2fea551..5a500aa 100644 --- a/editors/awk.c +++ b/editors/awk.c @@ -571,7 +571,7 @@ static void skip_spaces(char **s) { char *p = *s; - while(*p == ' ' || *p == '\t' || + while (*p == ' ' || *p == '\t' || (*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) { p++; } @@ -938,7 +938,7 @@ static uint32_t next_token(uint32_t expected) syntax_error(EMSG_UNEXP_TOKEN); t.string = --p; - while(isalnum_(*(++p))) { + while (isalnum_(*(++p))) { *(p-1) = *p; } *(p-1) = '\0'; @@ -1192,7 +1192,7 @@ static void chain_group(void) } while (c & TC_NEWLINE); if (c & TC_GRPSTART) { - while(next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { + while (next_token(TC_GRPSEQ | TC_GRPTERM) != TC_GRPTERM) { if (t.tclass & TC_NEWLINE) continue; rollback_token(); chain_group(); @@ -1233,7 +1233,7 @@ static void chain_group(void) case ST_FOR: next_token(TC_SEQSTART); n2 = parse_expr(TC_SEMICOL | TC_SEQTERM); - if (t.tclass & TC_SEQTERM) { /* for-in */ + if (t.tclass & TC_SEQTERM) { /* for-in */ if ((n2->info & OPCLSMASK) != OC_IN) syntax_error(EMSG_UNEXP_TOKEN); n = chain_node(OC_WALKINIT | VV); @@ -1242,7 +1242,7 @@ static void chain_group(void) n = chain_loop(NULL); n->info = OC_WALKNEXT | Vx; n->l.n = n2->l.n; - } else { /* for(;;) */ + } else { /* for (;;) */ n = chain_node(OC_EXEC | Vx); n->l.n = n2; n2 = parse_expr(TC_SEMICOL); @@ -1279,7 +1279,6 @@ static void chain_group(void) /* delete, next, nextfile, return, exit */ default: chain_expr(t.info); - } } } @@ -1293,7 +1292,7 @@ static void parse_program(char *p) pos = p; t.lineno = 1; - while((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | + while ((tclass = next_token(TC_EOF | TC_OPSEQ | TC_GRPSTART | TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) { if (tclass & TC_OPTERM) @@ -1314,7 +1313,7 @@ static void parse_program(char *p) f = newfunc(t.string); f->body.first = NULL; f->nargs = 0; - while(next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) { + while (next_token(TC_VARIABLE | TC_SEQTERM) & TC_VARIABLE) { v = findvar(ahash, t.string); v->x.aidx = (f->nargs)++; @@ -1452,7 +1451,7 @@ static int awk_split(char *s, node *spl, char **slist) n++; } } else if (c[0] == '\0') { /* null split */ - while(*s) { + while (*s) { *(s1++) = *(s++); *(s1++) = '\0'; n++; @@ -1588,7 +1587,7 @@ static void hashwalk_init(var *v, xhash *array) *w = *(w+1) = (char *)(w + 2); for (i=0; i<array->csize; i++) { hi = array->items[i]; - while(hi) { + while (hi) { strcpy(*w, hi->name); nextword(w); hi = hi->next; @@ -2567,7 +2566,7 @@ static int awk_exit(int r) /* waiting for children */ for (i=0; i<fdhash->csize; i++) { hi = fdhash->items[i]; - while(hi) { + while (hi) { if (hi->data.rs.F && hi->data.rs.is_pipe) pclose(hi->data.rs.F); hi = hi->next; @@ -2729,7 +2728,7 @@ keep_going: /* fill in ARGV array */ setvar_i(V[ARGC], argc - optind + 1); setari_u(V[ARGV], 0, "awk"); - for(i=optind; i < argc; i++) + for (i = optind; i < argc; i++) setari_u(V[ARGV], i+1-optind, argv[i]); evaluate(beginseq.first, &tv); diff --git a/editors/vi.c b/editors/vi.c index 1122f99..dc93bc4 100644 --- a/editors/vi.c +++ b/editors/vi.c @@ -2817,7 +2817,7 @@ static void refresh(int full_screen) int nic = ce-cs+1; char *out = (char*)sp+cs; - while(nic-- > 0) { + while (nic-- > 0) { putchar(*out); out++; } diff --git a/include/platform.h b/include/platform.h index 1cc9782..1754406 100644 --- a/include/platform.h +++ b/include/platform.h @@ -227,7 +227,7 @@ static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) { #define PRIu32 "u" /* use legacy setpgrp(pidt_,pid_t) for now. move to platform.c */ -#define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0) +#define bb_setpgrp do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0) #if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET #define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) diff --git a/init/init.c b/init/init.c index bc53fee..2e8ca3c 100644 --- a/init/init.c +++ b/init/init.c @@ -173,7 +173,7 @@ static void loop_forever(void) #if ENABLE_DEBUG_INIT #define messageD message #else -#define messageD(...) do {;} while(0); +#define messageD(...) do {} while (0) #endif static void message(int device, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); @@ -534,7 +534,7 @@ static pid_t run(const struct init_action *a) "(pid %d, terminal %s)\n", cmdpath, getpid(), a->terminal); full_write(1, press_enter, sizeof(press_enter) - 1); - while(read(0, &c, 1) == 1 && c != '\n') + while (read(0, &c, 1) == 1 && c != '\n') ; } #endif @@ -1021,7 +1021,7 @@ int init_main(int argc, char **argv) { const char * const *e; /* Make sure environs is set to something sane */ - for(e = environment; *e; e++) + for (e = environment; *e; e++) putenv((char *) *e); } diff --git a/libbb/dump.c b/libbb/dump.c index 06b73c9..1815ca9 100644 --- a/libbb/dump.c +++ b/libbb/dump.c @@ -726,7 +726,7 @@ void bb_dump_add(const char *fmt) if (isdigit(*p)) { // TODO: use bb_strtou savep = p; - do p++; while(isdigit(*p)); + do p++; while (isdigit(*p)); if (!isspace(*p)) { bb_error_msg_and_die("bad format {%s}", fmt); } diff --git a/libbb/find_root_device.c b/libbb/find_root_device.c index 71b79b8..1d74d1e 100644 --- a/libbb/find_root_device.c +++ b/libbb/find_root_device.c @@ -17,12 +17,13 @@ char *find_block_device(char *path) dev_t dev; char *retpath=NULL; - if(stat(path, &st) || !(dir = opendir("/dev"))) return NULL; + if (stat(path, &st) || !(dir = opendir("/dev"))) + return NULL; dev = (st.st_mode & S_IFMT) == S_IFBLK ? st.st_rdev : st.st_dev; - while((entry = readdir(dir)) != NULL) { + while ((entry = readdir(dir)) != NULL) { char devpath[PATH_MAX]; sprintf(devpath,"/dev/%s", entry->d_name); - if(!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) { + if (!stat(devpath, &st) && S_ISBLK(st.st_mode) && st.st_rdev == dev) { retpath = xstrdup(devpath); break; } diff --git a/libbb/sha1.c b/libbb/sha1.c index 34813e2..734fde4 100644 --- a/libbb/sha1.c +++ b/libbb/sha1.c @@ -47,7 +47,7 @@ do { \ t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \ e = d; d = c; c = rotl32(b, 30); b = t; \ - } while(0) + } while (0) static void sha1_compile(sha1_ctx_t *ctx) { diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index ebd32f8..81ae126 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c @@ -15,13 +15,9 @@ * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. */ -#include <unistd.h> -#include <stdio.h> -#include <fcntl.h> #include <paths.h> #include "libbb.h" - #ifdef BB_NOMMU void vfork_daemon_rexec(int nochdir, int noclose, int argc, char **argv, char *foreground_opt) @@ -43,9 +39,9 @@ void vfork_daemon_rexec(int nochdir, int noclose, close(fd); } - vfork_args = xcalloc(sizeof(char *), argc + 3); + vfork_args = xzalloc(sizeof(char *) * (argc + 3)); vfork_args[a++] = CONFIG_BUSYBOX_EXEC_PATH; - while(*argv) { + while (*argv) { vfork_args[a++] = *argv; argv++; } diff --git a/loginutils/login.c b/loginutils/login.c index bd3c112..94bb0dd 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -138,7 +138,7 @@ static int check_securetty(void) return 1; } while (fgets(buf, sizeof(buf)-1, fp)) { - for(i = strlen(buf)-1; i>=0; --i) { + for (i = strlen(buf)-1; i>=0; --i) { if (!isspace(buf[i])) break; } diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index f39bb7e..5435a6a 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -457,7 +457,7 @@ int devfsd_main (int argc, char **argv) } /* strip last / from mount point, so we don't need to check for it later */ - while( argv[1][1]!='\0' && argv[1][strlen(argv[1])-1] == '/' ) + while (argv[1][1]!='\0' && argv[1][strlen(argv[1])-1] == '/' ) argv[1][strlen(argv[1]) -1] = '\0'; mount_point = argv[1]; @@ -557,7 +557,7 @@ static void read_config_file (char *path, int optional, unsigned long *event_mas if ( S_ISDIR (statbuf.st_mode) ) { /* strip last / from dirname so we don't need to check for it later */ - while( path && path[1]!='\0' && path[strlen(path)-1] == '/') + while (path && path[1]!='\0' && path[strlen(path)-1] == '/') path[strlen(path) -1] = '\0'; dir_operation(READ_CONFIG, path, 0, event_mask); @@ -665,7 +665,7 @@ static void process_config_line (const char *line, unsigned long *event_mask) i = index_in_str_array(options, what ); - switch(i) + switch (i) { case 4: /* "PERMISSIONS" */ new->action.what = AC_PERMISSIONS; @@ -1052,7 +1052,7 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int if( i == 9 ) snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2); /* esac */ - } /* switch(action) */ + } /* switch (action) */ if(compat_name == NULL ) return; @@ -1073,7 +1073,7 @@ static void action_compat (const struct devfsd_notify_struct *info, unsigned int debug_msg_logger(LOG_ERR, "unlink: %s: %m", compat_name); break; /*esac*/ - } /* switch(action) */ + } /* switch (action) */ } /* End Function action_compat */ static void restore(char *spath, struct stat source_stat, int rootlen) @@ -1265,7 +1265,7 @@ static mode_t get_mode (const char *string) mode = 0; i= S_IRUSR; - while(i>0) + while (i>0) { if(string[0]=='r'||string[0]=='w'||string[0]=='x') mode+=i; @@ -1381,7 +1381,7 @@ static void dir_operation(int type, const char * dir_name, int var, unsigned lon debug_msg_logger(LOG_ERR, "%s: %s: %m", __FUNCTION__, path); continue; } - switch(type) + switch (type) { case SERVICE: service(statbuf,path); @@ -1710,7 +1710,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor) c+=2; } i++; - } while(i<=IDE9_MAJOR); + } while (i<=IDE9_MAJOR); if (minor > 63) ++letter; diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 90c1639..16485b9 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -2043,10 +2043,10 @@ static void identify_from_stdin(void) // Convert the newline-separated hex data into an identify block. - for (i = 0; i<256; i++) - { + for (i = 0; i<256; i++) { int j; - for(j=0;j<4;j++) sbuf[i] = (sbuf[i] <<4) + fromhex(*(b++)); + for (j = 0; j < 4; j++) + sbuf[i] = (sbuf[i] <<4) + fromhex(*(b++)); } // Parse the data. diff --git a/miscutils/nmeter.c b/miscutils/nmeter.c index 0c94853..1fa35b2 100644 --- a/miscutils/nmeter.c +++ b/miscutils/nmeter.c @@ -594,7 +594,7 @@ static void collect_mem(mem_stat *s) } m_free += m_bufs + m_cached + m_slab; - switch(s->opt) { + switch (s->opt) { case 'f': scale(m_free << 10); break; default: diff --git a/modutils/insmod.c b/modutils/insmod.c index 1906697..3b71d1c 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) close(fd); } #else /* FEATURE_CHECK_TAINTED_MODULE */ -#define check_tainted_module(x, y) do { } while(0); +#define check_tainted_module(x, y) do { } while (0); #endif /* FEATURE_CHECK_TAINTED_MODULE */ #if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS diff --git a/modutils/lsmod.c b/modutils/lsmod.c index ffde3d8..9871740 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -82,7 +82,7 @@ int lsmod_main(int argc, char **argv) module_names = deps = NULL; bufsize = depsize = 0; - while(query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { + while (query_module(NULL, QM_MODULES, module_names, bufsize, &nmod)) { if (errno != ENOSPC) bb_perror_msg_and_die("QM_MODULES"); module_names = xmalloc(bufsize = nmod); } diff --git a/networking/fakeidentd.c b/networking/fakeidentd.c index 04138cc..8967a7a 100644 --- a/networking/fakeidentd.c +++ b/networking/fakeidentd.c @@ -302,7 +302,7 @@ deleteconn: conns[i].lasttime = time(NULL); } } - } /* end of while(1) */ + } /* end of while (1) */ return 0; } diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 242bd06..dd4ce5e 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -497,7 +497,7 @@ int ifconfig_main(int argc, char **argv) ifr.ifr_flags &= ~selector; if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0) bb_perror_msg_and_die("SIOCSIFFLAGS"); - } /* while() */ + } /* while () */ if (ENABLE_FEATURE_CLEAN_UP) close(sockfd); diff --git a/networking/inetd.c b/networking/inetd.c index 7c89be2..75665ba 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -835,7 +835,7 @@ static servtab_t *getconfigent(void) sigaddset(&m, SIGHUP); \ sigaddset(&m, SIGALRM); \ sigprocmask(SIG_BLOCK, &m, NULL); \ -} while(0) +} while (0) static servtab_t *enter(servtab_t *cp) { @@ -1495,7 +1495,7 @@ do_exit1: if (!sep->se_wait && sep->se_socktype == SOCK_STREAM) close(ctrl); } /* for (sep = servtab...) */ - } /* for(;;) */ + } /* for (;;) */ } /* diff --git a/networking/ipcalc.c b/networking/ipcalc.c index 0ee9646..685f0e3 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -43,7 +43,7 @@ static int get_prefix(unsigned long netmask) int ret = 0; netmask = htonl(netmask); - while(msk) { + while (msk) { if (netmask & msk) ret++; msk >>= 1; diff --git a/networking/libiproute/utils.h b/networking/libiproute/utils.h index 0b0d754..98634dd 100644 --- a/networking/libiproute/utils.h +++ b/networking/libiproute/utils.h @@ -30,7 +30,7 @@ extern char * _SL_; extern void incomplete_command(void) ATTRIBUTE_NORETURN; -#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while(0) +#define NEXT_ARG() do { argv++; if (--argc <= 0) incomplete_command(); } while (0) typedef struct { diff --git a/networking/telnet.c b/networking/telnet.c index 6085d88..e65b691 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -320,7 +320,7 @@ static void putiac_subopt(byte c, char *str) putiac(c); putiac(0); - while(*str) + while (*str) putiac(*str++); putiac(IAC); @@ -343,12 +343,12 @@ static void putiac_subopt_autologin(void) putiac(TELQUAL_IS); putiac(NEW_ENV_VAR); - while(*user) + while (*user) putiac(*user++); putiac(NEW_ENV_VALUE); - while(*autologin) + while (*autologin) putiac(*autologin++); putiac(IAC); diff --git a/networking/traceroute.c b/networking/traceroute.c index adb9ef0..0f3da90 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -989,7 +989,7 @@ traceroute_main(int argc, char *argv[]) if (sourse_route_list) { llist_t *l_sr; - for(l_sr = sourse_route_list; l_sr; ) { + for (l_sr = sourse_route_list; l_sr; ) { if (lsrr >= NGATEWAYS) bb_error_msg_and_die("no more than %d gateways", NGATEWAYS); getaddr(gwlist + lsrr, l_sr->data); diff --git a/procps/fuser.c b/procps/fuser.c index a216eae..9752af7 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -319,7 +319,7 @@ int fuser_main(int argc, char **argv) bb_show_usage(); fni = xmalloc(sizeof(int)); - for(i=1;i<argc;i++) { + for (i=1;i<argc;i++) { optn = fuser_option(argv[i]); if(optn) opt |= optn; else if(argv[i][0] == '-') { @@ -335,7 +335,7 @@ int fuser_main(int argc, char **argv) if(!fnic) return 1; inodes = xmalloc(sizeof(inode_list)); - for(i=0;i<fnic;i++) { + for (i=0;i<fnic;i++) { if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) { fuser_scan_proc_net(opt, proto, port, inodes); } diff --git a/runit/runit_lib.c b/runit/runit_lib.c index 5ebbc58..8612a1b 100644 --- a/runit/runit_lib.c +++ b/runit/runit_lib.c @@ -337,7 +337,7 @@ unsigned fmt_ulong(char *s,unsigned long u) while (q > 9) { ++len; q /= 10; } if (s) { s += len; - do { *--s = '0' + (u % 10); u /= 10; } while(u); /* handles u == 0 */ + do { *--s = '0' + (u % 10); u /= 10; } while (u); /* handles u == 0 */ } return len; } diff --git a/runit/runsv.c b/runit/runsv.c index e1b5459..9e117fe 100644 --- a/runit/runsv.c +++ b/runit/runsv.c @@ -155,7 +155,7 @@ static void update_status(struct svdir *s) if (s->ctrl & C_PAUSE) p = add_str(p, ", paused"); if (s->ctrl & C_TERM) p = add_str(p, ", got TERM"); if (s->state != S_DOWN) - switch(s->want) { + switch (s->want) { case W_DOWN: p = add_str(p, ", want down"); break; @@ -329,7 +329,7 @@ static void startservice(struct svdir *s) static int ctrl(struct svdir *s, char c) { - switch(c) { + switch (c) { case 'd': /* down */ s->want = W_DOWN; update_status(s); @@ -75,7 +75,7 @@ static int svstatus_get(void) } r = read(fd, svstatus, 20); close(fd); - switch(r) { + switch (r) { case 20: break; case -1: warn_cannot("read supervise/status"); return -1; default: warnx_cannot("read supervise/status: bad format"); return -1; @@ -124,7 +124,7 @@ static unsigned svstatus_print(char *m) static int status(char *unused) { r = svstatus_get(); - switch(r) { case -1: case 0: return 0; } + switch (r) { case -1: case 0: return 0; } r = svstatus_print(*service); if (chdir("log") == -1) { if (errno != ENOENT) { diff --git a/runit/svlogd.c b/runit/svlogd.c index 7024c3d..c91f85f 100644 --- a/runit/svlogd.c +++ b/runit/svlogd.c @@ -262,7 +262,7 @@ static unsigned rotate(struct logdir *ld) return 0; } if (ld->ppid) - while(!processorstop(ld)) + while (!processorstop(ld)) /* wait */; while (fchdir(ld->fddir) == -1) diff --git a/shell/ash.c b/shell/ash.c index e8f7d30..afb9b6a 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2402,7 +2402,7 @@ static const char * updatepwd(const char *dir) } p = strtok(cdcomppath, "/"); while (p) { - switch(*p) { + switch (*p) { case '.': if (p[1] == '.' && p[2] == '\0') { while (new > lim) { @@ -4802,7 +4802,7 @@ exptilde(char *startp, char *p, int flag) name = p + 1; while ((c = *++p) != '\0') { - switch(c) { + switch (c) { case CTLESC: return startp; case CTLQUOTEMARK: @@ -10211,7 +10211,7 @@ readtoken1(int firstc, int syntax, char *eofmark, int striptabs) CHECKEND(); /* set c to PEOF if at end of here document */ for (;;) { /* until end of line or end of word */ CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */ - switch(SIT(c, syntax)) { + switch (SIT(c, syntax)) { case CNL: /* '\n' */ if (syntax == BASESYNTAX) goto endword; /* exit outer loop */ @@ -11282,7 +11282,7 @@ shtree(union node *n, int ind, char *pfx, FILE *fp) return; indent(ind, pfx, fp); - switch(n->type) { + switch (n->type) { case NSEMI: s = "; "; goto binop; @@ -12613,7 +12613,7 @@ readcmd(int argc, char **argv) while ((i = nextopt("p:r")) != '\0') #endif { - switch(i) { + switch (i) { case 'p': prompt = optionarg; break; @@ -13579,7 +13579,7 @@ static arith_t arith (const char *expr, int *perrcode) * a number, since it evaluates to one). Think about it. * It makes sense. */ if (lasttok != TOK_NUM) { - switch(op) { + switch (op) { case TOK_ADD: op = TOK_UPLUS; break; diff --git a/shell/cmdedit.c b/shell/cmdedit.c index bc9cc5e..7af73ec 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -1799,7 +1799,7 @@ rewrite_line: /* After max history, remove the oldest command */ if (i >= MAX_HISTORY) { free(history[0]); - for(i = 0; i < MAX_HISTORY-1; i++) + for (i = 0; i < MAX_HISTORY-1; i++) history[i] = history[i+1]; } history[i++] = xstrdup(command); diff --git a/shell/hush.c b/shell/hush.c index a6e029e..9bc0013 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -2269,7 +2269,7 @@ static int parse_group(o_string *dest, struct p_context *ctx, return 1; /* syntax error, groups and arglists don't mix */ } initialize_context(&sub); - switch(ch) { + switch (ch) { case '(': endch=')'; child->subshell=1; break; case '{': endch='}'; break; default: syntax(); /* really logic error */ diff --git a/shell/lash.c b/shell/lash.c index 5257671..52b1174 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -789,7 +789,7 @@ static int expand_arguments(char *command) src = command; while((dst = strchr(src,'$')) != NULL){ var = NULL; - switch(*(dst+1)) { + switch (*(dst+1)) { case '?': var = itoa(last_return_code); break; @@ -1163,7 +1163,7 @@ static int pseudo_exec(struct child_prog *child) char **argv_l = child->argv; int argc_l; - for(argc_l=0; *argv_l; argv_l++, argc_l++); + for (argc_l=0; *argv_l; argv_l++, argc_l++); optind = 1; run_applet_by_name(child->argv[0], argc_l, child->argv); } |