style fixes

last xcalloc replaced by xzalloc
This commit is contained in:
Denis Vlasenko 2006-12-26 10:42:51 +00:00
parent 5dd7ef0f37
commit bf0a201008
39 changed files with 114 additions and 118 deletions

View File

@ -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) {

View File

@ -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 */

View File

@ -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;

View File

@ -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) {

View File

@ -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);
}

View File

@ -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

View File

@ -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;

View File

@ -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:

View File

@ -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;

View File

@ -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();
@ -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);

View File

@ -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++;
}

View File

@ -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)

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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)
{

View File

@ -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++;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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.

View File

@ -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:

View File

@ -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

View File

@ -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);
}

View File

@ -302,7 +302,7 @@ deleteconn:
conns[i].lasttime = time(NULL);
}
}
} /* end of while(1) */
} /* end of while (1) */
return 0;
}

View File

@ -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);

View File

@ -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 (;;) */
}
/*

View File

@ -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;

View File

@ -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
{

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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) {

View File

@ -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)

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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);
}