"\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) {
/* 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 */
#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 {
/* 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) */
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
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;
}
}
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;
}
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;
/* 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];
}
/* 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;
}
/* 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;
}
/* Loop through compressed symbols. */
runPos=dbufCount=selector=0;
- for(;;) {
+ for (;;) {
/* fetch next Huffman coding group from list. */
/* 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) */
uc = symToByte[mtfSymbol[0]];
byteCount[uc] += t;
- while(t--) dbuf[dbufCount++]=uc;
+ while (t--) dbuf[dbufCount++]=uc;
}
/* Is this the terminating symbol? */
/* 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;
/* Loop outputting bytes */
- for(;;) {
+ for (;;) {
/* If the output buffer is full, snapshot state and return */
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;
gunzip_outbuf_count = 0;
- while(1) {
+ while (1) {
int ret;
if (needAnotherBlock) {
/* 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) {
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) {
} 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);
}
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)
qsort(dn, size, sizeof(*dn), sortcmp);
}
#else
-#define dnsort(dn, size) do {} while(0)
+#define dnsort(dn, size) do {} while (0)
#endif
static void
open_next_file(void)
{
- while(1) {
+ while (1) {
input_filename = *file_list;
if (!input_filename)
return;
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;
/* 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:
list = xstrdup(optlist);
s = strtok(list, ",");
- while(s) {
+ while (s) {
if (strcmp(s, opt) == 0) {
free(list);
return 1;
{
char *p = *s;
- while(*p == ' ' || *p == '\t' ||
+ while (*p == ' ' || *p == '\t' ||
(*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) {
p++;
}
syntax_error(EMSG_UNEXP_TOKEN);
t.string = --p;
- while(isalnum_(*(++p))) {
+ while (isalnum_(*(++p))) {
*(p-1) = *p;
}
*(p-1) = '\0';
} 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();
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);
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);
/* delete, next, nextfile, return, exit */
default:
chain_expr(t.info);
-
}
}
}
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)
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)++;
n++;
}
} else if (c[0] == '\0') { /* null split */
- while(*s) {
+ while (*s) {
*(s1++) = *(s++);
*(s1++) = '\0';
n++;
*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;
/* 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;
/* 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);
int nic = ce-cs+1;
char *out = (char*)sp+cs;
- while(nic-- > 0) {
+ while (nic-- > 0) {
putchar(*out);
out++;
}
#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)
#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)));
"(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
{
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);
}
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);
}
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;
}
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)
{
* 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)
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++;
}
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;
}
}
/* 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];
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);
i = index_in_str_array(options, what );
- switch(i)
+ switch (i)
{
case 4: /* "PERMISSIONS" */
new->action.what = AC_PERMISSIONS;
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;
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)
mode = 0;
i= S_IRUSR;
- while(i>0)
+ while (i>0)
{
if(string[0]=='r'||string[0]=='w'||string[0]=='x')
mode+=i;
debug_msg_logger(LOG_ERR, "%s: %s: %m", __FUNCTION__, path);
continue;
}
- switch(type)
+ switch (type)
{
case SERVICE:
service(statbuf,path);
c+=2;
}
i++;
- } while(i<=IDE9_MAJOR);
+ } while (i<=IDE9_MAJOR);
if (minor > 63)
++letter;
// 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.
}
m_free += m_bufs + m_cached + m_slab;
- switch(s->opt) {
+ switch (s->opt) {
case 'f':
scale(m_free << 10); break;
default:
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
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);
}
conns[i].lasttime = time(NULL);
}
}
- } /* end of while(1) */
+ } /* end of while (1) */
return 0;
}
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);
sigaddset(&m, SIGHUP); \
sigaddset(&m, SIGALRM); \
sigprocmask(SIG_BLOCK, &m, NULL); \
-} while(0)
+} while (0)
static servtab_t *enter(servtab_t *cp)
{
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
close(ctrl);
} /* for (sep = servtab...) */
- } /* for(;;) */
+ } /* for (;;) */
}
/*
int ret = 0;
netmask = htonl(netmask);
- while(msk) {
+ while (msk) {
if (netmask & msk)
ret++;
msk >>= 1;
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
{
putiac(c);
putiac(0);
- while(*str)
+ while (*str)
putiac(*str++);
putiac(IAC);
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);
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);
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] == '-') {
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);
}
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;
}
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;
static int ctrl(struct svdir *s, char c)
{
- switch(c) {
+ switch (c) {
case 'd': /* down */
s->want = W_DOWN;
update_status(s);
}
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;
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) {
return 0;
}
if (ld->ppid)
- while(!processorstop(ld))
+ while (!processorstop(ld))
/* wait */;
while (fchdir(ld->fddir) == -1)
}
p = strtok(cdcomppath, "/");
while (p) {
- switch(*p) {
+ switch (*p) {
case '.':
if (p[1] == '.' && p[2] == '\0') {
while (new > lim) {
name = p + 1;
while ((c = *++p) != '\0') {
- switch(c) {
+ switch (c) {
case CTLESC:
return startp;
case CTLQUOTEMARK:
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 */
return;
indent(ind, pfx, fp);
- switch(n->type) {
+ switch (n->type) {
case NSEMI:
s = "; ";
goto binop;
while ((i = nextopt("p:r")) != '\0')
#endif
{
- switch(i) {
+ switch (i) {
case 'p':
prompt = optionarg;
break;
* 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;
/* 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);
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 */
src = command;
while((dst = strchr(src,'$')) != NULL){
var = NULL;
- switch(*(dst+1)) {
+ switch (*(dst+1)) {
case '?':
var = itoa(last_return_code);
break;
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);
}