mirror of
https://github.com/sheumann/hush.git
synced 2025-01-18 07:31:34 +00:00
style fixes
last xcalloc replaced by xzalloc
This commit is contained in:
parent
5dd7ef0f37
commit
bf0a201008
@ -129,7 +129,7 @@ int busybox_main(int argc, char **argv)
|
|||||||
"\twill act like whatever it was invoked as!\n"
|
"\twill act like whatever it was invoked as!\n"
|
||||||
"\nCurrently defined functions:\n", bb_msg_full_version);
|
"\nCurrently defined functions:\n", bb_msg_full_version);
|
||||||
col = 0;
|
col = 0;
|
||||||
for(a = applets; a->name;) {
|
for (a = applets; a->name;) {
|
||||||
col += printf("%s%s", (col ? ", " : "\t"), a->name);
|
col += printf("%s%s", (col ? ", " : "\t"), a->name);
|
||||||
a++;
|
a++;
|
||||||
if (col > output_width && a->name) {
|
if (col > output_width && a->name) {
|
||||||
|
@ -43,13 +43,13 @@ void check_header_gzip(int src_fd)
|
|||||||
/* Discard original name if any */
|
/* Discard original name if any */
|
||||||
if (header.formatted.flags & 0x08) {
|
if (header.formatted.flags & 0x08) {
|
||||||
/* bit 3 set: original file name present */
|
/* bit 3 set: original file name present */
|
||||||
while(xread_char(src_fd) != 0);
|
while (xread_char(src_fd) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discard file comment if any */
|
/* Discard file comment if any */
|
||||||
if (header.formatted.flags & 0x10) {
|
if (header.formatted.flags & 0x10) {
|
||||||
/* bit 4 set: file comment present */
|
/* bit 4 set: file comment present */
|
||||||
while(xread_char(src_fd) != 0);
|
while (xread_char(src_fd) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the header checksum */
|
/* Read the header checksum */
|
||||||
|
@ -151,7 +151,7 @@ static int get_next_block(bunzip_data *bd)
|
|||||||
/* Reset longjmp I/O error handling */
|
/* Reset longjmp I/O error handling */
|
||||||
|
|
||||||
i=setjmp(bd->jmpbuf);
|
i=setjmp(bd->jmpbuf);
|
||||||
if(i) return i;
|
if (i) return i;
|
||||||
|
|
||||||
/* Read in header signature and CRC, then validate signature.
|
/* Read in header signature and CRC, then validate signature.
|
||||||
(last block signature means CRC is for whole file, return now) */
|
(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
|
some code for this in busybox 1.0.0-pre3, but nobody ever noticed that
|
||||||
it didn't actually work. */
|
it didn't actually work. */
|
||||||
|
|
||||||
if(get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
|
if (get_bits(bd,1)) return RETVAL_OBSOLETE_INPUT;
|
||||||
if((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
|
if ((origPtr=get_bits(bd,24)) > dbufSize) return RETVAL_DATA_ERROR;
|
||||||
|
|
||||||
/* mapping table: if some byte values are never used (encoding things
|
/* mapping table: if some byte values are never used (encoding things
|
||||||
like ascii text), the compression code removes the gaps to have fewer
|
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++) {
|
for (i=0;i<16;i++) {
|
||||||
if(t&(1<<(15-i))) {
|
if(t&(1<<(15-i))) {
|
||||||
k=get_bits(bd,16);
|
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;
|
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.) */
|
start of the list.) */
|
||||||
|
|
||||||
if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
|
if(!(nSelectors=get_bits(bd, 15))) return RETVAL_DATA_ERROR;
|
||||||
for(i=0; i<groupCount; i++) mtfSymbol[i] = i;
|
for (i=0; i<groupCount; i++) mtfSymbol[i] = i;
|
||||||
for(i=0; i<nSelectors; i++) {
|
for (i=0; i<nSelectors; i++) {
|
||||||
|
|
||||||
/* Get next value */
|
/* 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 */
|
/* Decode MTF to get the next selector */
|
||||||
|
|
||||||
uc = mtfSymbol[j];
|
uc = mtfSymbol[j];
|
||||||
for(;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
|
for (;j;j--) mtfSymbol[j] = mtfSymbol[j-1];
|
||||||
mtfSymbol[0]=selectors[i]=uc;
|
mtfSymbol[0]=selectors[i]=uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ static int get_next_block(bunzip_data *bd)
|
|||||||
|
|
||||||
t=get_bits(bd, 5)-1;
|
t=get_bits(bd, 5)-1;
|
||||||
for (i = 0; i < symCount; i++) {
|
for (i = 0; i < symCount; i++) {
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
|
if (((unsigned)t) > (MAX_HUFCODE_BITS-1))
|
||||||
return RETVAL_DATA_ERROR;
|
return RETVAL_DATA_ERROR;
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ static int get_next_block(bunzip_data *bd)
|
|||||||
/* Find largest and smallest lengths in this group */
|
/* Find largest and smallest lengths in this group */
|
||||||
|
|
||||||
minLen=maxLen=length[0];
|
minLen=maxLen=length[0];
|
||||||
for(i = 1; i < symCount; i++) {
|
for (i = 1; i < symCount; i++) {
|
||||||
if(length[i] > maxLen) maxLen = length[i];
|
if(length[i] > maxLen) maxLen = length[i];
|
||||||
else if(length[i] < minLen) minLen = 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[]. */
|
/* Calculate permute[]. Concurently, initialize temp[] and limit[]. */
|
||||||
|
|
||||||
pp=0;
|
pp=0;
|
||||||
for(i=minLen;i<=maxLen;i++) {
|
for (i=minLen;i<=maxLen;i++) {
|
||||||
temp[i]=limit[i]=0;
|
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;
|
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 */
|
/* 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;
|
byteCount[i] = 0;
|
||||||
mtfSymbol[i]=(unsigned char)i;
|
mtfSymbol[i]=(unsigned char)i;
|
||||||
}
|
}
|
||||||
@ -333,7 +333,7 @@ static int get_next_block(bunzip_data *bd)
|
|||||||
/* Loop through compressed symbols. */
|
/* Loop through compressed symbols. */
|
||||||
|
|
||||||
runPos=dbufCount=selector=0;
|
runPos=dbufCount=selector=0;
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
/* fetch next Huffman coding group from list. */
|
/* 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 */
|
/* Figure how how many bits are in next symbol and unget extras */
|
||||||
|
|
||||||
i=hufGroup->minLen;
|
i=hufGroup->minLen;
|
||||||
while(j>limit[i]) ++i;
|
while (j>limit[i]) ++i;
|
||||||
bd->inbufBitCount += (hufGroup->maxLen - i);
|
bd->inbufBitCount += (hufGroup->maxLen - i);
|
||||||
|
|
||||||
/* Huffman decode value to get nextSym (with bounds checking) */
|
/* Huffman decode value to get nextSym (with bounds checking) */
|
||||||
@ -421,7 +421,7 @@ got_huff_bits:
|
|||||||
|
|
||||||
uc = symToByte[mtfSymbol[0]];
|
uc = symToByte[mtfSymbol[0]];
|
||||||
byteCount[uc] += t;
|
byteCount[uc] += t;
|
||||||
while(t--) dbuf[dbufCount++]=uc;
|
while (t--) dbuf[dbufCount++]=uc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is this the terminating symbol? */
|
/* Is this the terminating symbol? */
|
||||||
@ -473,7 +473,7 @@ end_of_huffman_loop:
|
|||||||
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
|
/* Turn byteCount into cumulative occurrence counts of 0 to n-1. */
|
||||||
|
|
||||||
j=0;
|
j=0;
|
||||||
for(i=0;i<256;i++) {
|
for (i=0;i<256;i++) {
|
||||||
k=j+byteCount[i];
|
k=j+byteCount[i];
|
||||||
byteCount[i] = j;
|
byteCount[i] = j;
|
||||||
j=k;
|
j=k;
|
||||||
@ -535,7 +535,7 @@ static int read_bunzip(bunzip_data *bd, char *outbuf, int len)
|
|||||||
|
|
||||||
/* Loop outputting bytes */
|
/* Loop outputting bytes */
|
||||||
|
|
||||||
for(;;) {
|
for (;;) {
|
||||||
|
|
||||||
/* If the output buffer is full, snapshot state and return */
|
/* 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);
|
outbuf=xmalloc(IOBUF_SIZE);
|
||||||
i=start_bunzip(&bd,src_fd,0,0);
|
i=start_bunzip(&bd,src_fd,0,0);
|
||||||
if(!i) {
|
if(!i) {
|
||||||
for(;;) {
|
for (;;) {
|
||||||
if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break;
|
if((i=read_bunzip(bd,outbuf,IOBUF_SIZE)) <= 0) break;
|
||||||
if(i!=write(dst_fd,outbuf,i)) {
|
if(i!=write(dst_fd,outbuf,i)) {
|
||||||
i=RETVAL_UNEXPECTED_OUTPUT_EOF;
|
i=RETVAL_UNEXPECTED_OUTPUT_EOF;
|
||||||
|
@ -791,7 +791,7 @@ static int inflate_get_next_window(void)
|
|||||||
|
|
||||||
gunzip_outbuf_count = 0;
|
gunzip_outbuf_count = 0;
|
||||||
|
|
||||||
while(1) {
|
while (1) {
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (needAnotherBlock) {
|
if (needAnotherBlock) {
|
||||||
@ -859,7 +859,7 @@ inflate_unzip(int in, int out)
|
|||||||
/* Allocate space for buffer */
|
/* Allocate space for buffer */
|
||||||
bytebuffer = xmalloc(bytebuffer_max);
|
bytebuffer = xmalloc(bytebuffer_max);
|
||||||
|
|
||||||
while(1) {
|
while (1) {
|
||||||
int ret = inflate_get_next_window();
|
int ret = inflate_get_next_window();
|
||||||
nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
|
nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
|
||||||
if (nwrote == -1) {
|
if (nwrote == -1) {
|
||||||
|
@ -112,7 +112,7 @@ int unzip_main(int argc, char **argv)
|
|||||||
char key_buf[512];
|
char key_buf[512];
|
||||||
struct stat stat_buf;
|
struct stat stat_buf;
|
||||||
|
|
||||||
while((opt = getopt(argc, argv, "-d:lnopqx")) != -1) {
|
while ((opt = getopt(argc, argv, "-d:lnopqx")) != -1) {
|
||||||
switch (opt_range) {
|
switch (opt_range) {
|
||||||
case 0: /* Options */
|
case 0: /* Options */
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
@ -192,7 +192,7 @@ int unzip_main(int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
static const char *const extn[] = {"", ".zip", ".ZIP"};
|
static const char *const extn[] = {"", ".zip", ".ZIP"};
|
||||||
int orig_src_fn_len = strlen(src_fn);
|
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]);
|
strcpy(src_fn + orig_src_fn_len, extn[i]);
|
||||||
src_fd = open(src_fn, O_RDONLY);
|
src_fd = open(src_fn, O_RDONLY);
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ static void dfree(struct dnode **dnp, int nfiles)
|
|||||||
free(dnp); /* free the array holding the dnode pointers */
|
free(dnp); /* free the array holding the dnode pointers */
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define dfree(...) do {} while(0)
|
#define dfree(...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct dnode **splitdnarray(struct dnode **dn, int nfiles, int which)
|
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);
|
qsort(dn, size, sizeof(*dn), sortcmp);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define dnsort(dn, size) do {} while(0)
|
#define dnsort(dn, size) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ print_ascii(size_t n_bytes, const char *block,
|
|||||||
static void
|
static void
|
||||||
open_next_file(void)
|
open_next_file(void)
|
||||||
{
|
{
|
||||||
while(1) {
|
while (1) {
|
||||||
input_filename = *file_list;
|
input_filename = *file_list;
|
||||||
if (!input_filename)
|
if (!input_filename)
|
||||||
return;
|
return;
|
||||||
|
@ -163,7 +163,7 @@ static int compare_keys(const void *xarg, const void *yarg)
|
|||||||
y = get_key(*(char **)yarg, key, flags);
|
y = get_key(*(char **)yarg, key, flags);
|
||||||
#else
|
#else
|
||||||
/* This curly bracket serves no purpose but to match the nesting
|
/* 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;
|
x = *(char **)xarg;
|
||||||
y = *(char **)yarg;
|
y = *(char **)yarg;
|
||||||
@ -231,7 +231,7 @@ static int compare_keys(const void *xarg, const void *yarg)
|
|||||||
/* Free key copies. */
|
/* Free key copies. */
|
||||||
if (x != *(char **)xarg) free(x);
|
if (x != *(char **)xarg) free(x);
|
||||||
if (y != *(char **)yarg) free(y);
|
if (y != *(char **)yarg) free(y);
|
||||||
/* if (retval) break; - done by for() anyway */
|
/* if (retval) break; - done by for () anyway */
|
||||||
#else
|
#else
|
||||||
/* Integer version of -n for tiny systems */
|
/* Integer version of -n for tiny systems */
|
||||||
case FLAG_n:
|
case FLAG_n:
|
||||||
|
@ -813,7 +813,7 @@ static int opt_in_list(char *opt, char *optlist)
|
|||||||
list = xstrdup(optlist);
|
list = xstrdup(optlist);
|
||||||
|
|
||||||
s = strtok(list, ",");
|
s = strtok(list, ",");
|
||||||
while(s) {
|
while (s) {
|
||||||
if (strcmp(s, opt) == 0) {
|
if (strcmp(s, opt) == 0) {
|
||||||
free(list);
|
free(list);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -571,7 +571,7 @@ static void skip_spaces(char **s)
|
|||||||
{
|
{
|
||||||
char *p = *s;
|
char *p = *s;
|
||||||
|
|
||||||
while(*p == ' ' || *p == '\t' ||
|
while (*p == ' ' || *p == '\t' ||
|
||||||
(*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) {
|
(*p == '\\' && *(p+1) == '\n' && (++p, ++t.lineno))) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
@ -938,7 +938,7 @@ static uint32_t next_token(uint32_t expected)
|
|||||||
syntax_error(EMSG_UNEXP_TOKEN);
|
syntax_error(EMSG_UNEXP_TOKEN);
|
||||||
|
|
||||||
t.string = --p;
|
t.string = --p;
|
||||||
while(isalnum_(*(++p))) {
|
while (isalnum_(*(++p))) {
|
||||||
*(p-1) = *p;
|
*(p-1) = *p;
|
||||||
}
|
}
|
||||||
*(p-1) = '\0';
|
*(p-1) = '\0';
|
||||||
@ -1192,7 +1192,7 @@ static void chain_group(void)
|
|||||||
} while (c & TC_NEWLINE);
|
} while (c & TC_NEWLINE);
|
||||||
|
|
||||||
if (c & TC_GRPSTART) {
|
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;
|
if (t.tclass & TC_NEWLINE) continue;
|
||||||
rollback_token();
|
rollback_token();
|
||||||
chain_group();
|
chain_group();
|
||||||
@ -1242,7 +1242,7 @@ static void chain_group(void)
|
|||||||
n = chain_loop(NULL);
|
n = chain_loop(NULL);
|
||||||
n->info = OC_WALKNEXT | Vx;
|
n->info = OC_WALKNEXT | Vx;
|
||||||
n->l.n = n2->l.n;
|
n->l.n = n2->l.n;
|
||||||
} else { /* for(;;) */
|
} else { /* for (;;) */
|
||||||
n = chain_node(OC_EXEC | Vx);
|
n = chain_node(OC_EXEC | Vx);
|
||||||
n->l.n = n2;
|
n->l.n = n2;
|
||||||
n2 = parse_expr(TC_SEMICOL);
|
n2 = parse_expr(TC_SEMICOL);
|
||||||
@ -1279,7 +1279,6 @@ static void chain_group(void)
|
|||||||
/* delete, next, nextfile, return, exit */
|
/* delete, next, nextfile, return, exit */
|
||||||
default:
|
default:
|
||||||
chain_expr(t.info);
|
chain_expr(t.info);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1293,7 +1292,7 @@ static void parse_program(char *p)
|
|||||||
|
|
||||||
pos = p;
|
pos = p;
|
||||||
t.lineno = 1;
|
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) {
|
TC_OPTERM | TC_BEGIN | TC_END | TC_FUNCDECL)) != TC_EOF) {
|
||||||
|
|
||||||
if (tclass & TC_OPTERM)
|
if (tclass & TC_OPTERM)
|
||||||
@ -1314,7 +1313,7 @@ static void parse_program(char *p)
|
|||||||
f = newfunc(t.string);
|
f = newfunc(t.string);
|
||||||
f->body.first = NULL;
|
f->body.first = NULL;
|
||||||
f->nargs = 0;
|
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 = findvar(ahash, t.string);
|
||||||
v->x.aidx = (f->nargs)++;
|
v->x.aidx = (f->nargs)++;
|
||||||
|
|
||||||
@ -1452,7 +1451,7 @@ static int awk_split(char *s, node *spl, char **slist)
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
} else if (c[0] == '\0') { /* null split */
|
} else if (c[0] == '\0') { /* null split */
|
||||||
while(*s) {
|
while (*s) {
|
||||||
*(s1++) = *(s++);
|
*(s1++) = *(s++);
|
||||||
*(s1++) = '\0';
|
*(s1++) = '\0';
|
||||||
n++;
|
n++;
|
||||||
@ -1588,7 +1587,7 @@ static void hashwalk_init(var *v, xhash *array)
|
|||||||
*w = *(w+1) = (char *)(w + 2);
|
*w = *(w+1) = (char *)(w + 2);
|
||||||
for (i=0; i<array->csize; i++) {
|
for (i=0; i<array->csize; i++) {
|
||||||
hi = array->items[i];
|
hi = array->items[i];
|
||||||
while(hi) {
|
while (hi) {
|
||||||
strcpy(*w, hi->name);
|
strcpy(*w, hi->name);
|
||||||
nextword(w);
|
nextword(w);
|
||||||
hi = hi->next;
|
hi = hi->next;
|
||||||
@ -2567,7 +2566,7 @@ static int awk_exit(int r)
|
|||||||
/* waiting for children */
|
/* waiting for children */
|
||||||
for (i=0; i<fdhash->csize; i++) {
|
for (i=0; i<fdhash->csize; i++) {
|
||||||
hi = fdhash->items[i];
|
hi = fdhash->items[i];
|
||||||
while(hi) {
|
while (hi) {
|
||||||
if (hi->data.rs.F && hi->data.rs.is_pipe)
|
if (hi->data.rs.F && hi->data.rs.is_pipe)
|
||||||
pclose(hi->data.rs.F);
|
pclose(hi->data.rs.F);
|
||||||
hi = hi->next;
|
hi = hi->next;
|
||||||
@ -2729,7 +2728,7 @@ keep_going:
|
|||||||
/* fill in ARGV array */
|
/* fill in ARGV array */
|
||||||
setvar_i(V[ARGC], argc - optind + 1);
|
setvar_i(V[ARGC], argc - optind + 1);
|
||||||
setari_u(V[ARGV], 0, "awk");
|
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]);
|
setari_u(V[ARGV], i+1-optind, argv[i]);
|
||||||
|
|
||||||
evaluate(beginseq.first, &tv);
|
evaluate(beginseq.first, &tv);
|
||||||
|
@ -2817,7 +2817,7 @@ static void refresh(int full_screen)
|
|||||||
int nic = ce-cs+1;
|
int nic = ce-cs+1;
|
||||||
char *out = (char*)sp+cs;
|
char *out = (char*)sp+cs;
|
||||||
|
|
||||||
while(nic-- > 0) {
|
while (nic-- > 0) {
|
||||||
putchar(*out);
|
putchar(*out);
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ static ATTRIBUTE_ALWAYS_INLINE char* strchrnul(const char *s, char c) {
|
|||||||
#define PRIu32 "u"
|
#define PRIu32 "u"
|
||||||
|
|
||||||
/* use legacy setpgrp(pidt_,pid_t) for now. move to platform.c */
|
/* 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
|
#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
|
||||||
#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
|
#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
|
||||||
|
@ -173,7 +173,7 @@ static void loop_forever(void)
|
|||||||
#if ENABLE_DEBUG_INIT
|
#if ENABLE_DEBUG_INIT
|
||||||
#define messageD message
|
#define messageD message
|
||||||
#else
|
#else
|
||||||
#define messageD(...) do {;} while(0);
|
#define messageD(...) do {} while (0)
|
||||||
#endif
|
#endif
|
||||||
static void message(int device, const char *fmt, ...)
|
static void message(int device, const char *fmt, ...)
|
||||||
__attribute__ ((format(printf, 2, 3)));
|
__attribute__ ((format(printf, 2, 3)));
|
||||||
@ -534,7 +534,7 @@ static pid_t run(const struct init_action *a)
|
|||||||
"(pid %d, terminal %s)\n",
|
"(pid %d, terminal %s)\n",
|
||||||
cmdpath, getpid(), a->terminal);
|
cmdpath, getpid(), a->terminal);
|
||||||
full_write(1, press_enter, sizeof(press_enter) - 1);
|
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
|
#endif
|
||||||
@ -1021,7 +1021,7 @@ int init_main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
const char * const *e;
|
const char * const *e;
|
||||||
/* Make sure environs is set to something sane */
|
/* Make sure environs is set to something sane */
|
||||||
for(e = environment; *e; e++)
|
for (e = environment; *e; e++)
|
||||||
putenv((char *) *e);
|
putenv((char *) *e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ void bb_dump_add(const char *fmt)
|
|||||||
if (isdigit(*p)) {
|
if (isdigit(*p)) {
|
||||||
// TODO: use bb_strtou
|
// TODO: use bb_strtou
|
||||||
savep = p;
|
savep = p;
|
||||||
do p++; while(isdigit(*p));
|
do p++; while (isdigit(*p));
|
||||||
if (!isspace(*p)) {
|
if (!isspace(*p)) {
|
||||||
bb_error_msg_and_die("bad format {%s}", fmt);
|
bb_error_msg_and_die("bad format {%s}", fmt);
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,13 @@ char *find_block_device(char *path)
|
|||||||
dev_t dev;
|
dev_t dev;
|
||||||
char *retpath=NULL;
|
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;
|
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];
|
char devpath[PATH_MAX];
|
||||||
sprintf(devpath,"/dev/%s", entry->d_name);
|
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);
|
retpath = xstrdup(devpath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
do { \
|
do { \
|
||||||
t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \
|
t = a; a = rotl32(a,5) + f(b,c,d) + e + k + w[i]; \
|
||||||
e = d; d = c; c = rotl32(b, 30); b = t; \
|
e = d; d = c; c = rotl32(b, 30); b = t; \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
static void sha1_compile(sha1_ctx_t *ctx)
|
static void sha1_compile(sha1_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
|
@ -15,13 +15,9 @@
|
|||||||
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
|
* 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 <paths.h>
|
||||||
#include "libbb.h"
|
#include "libbb.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef BB_NOMMU
|
#ifdef BB_NOMMU
|
||||||
void vfork_daemon_rexec(int nochdir, int noclose,
|
void vfork_daemon_rexec(int nochdir, int noclose,
|
||||||
int argc, char **argv, char *foreground_opt)
|
int argc, char **argv, char *foreground_opt)
|
||||||
@ -43,9 +39,9 @@ void vfork_daemon_rexec(int nochdir, int noclose,
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
vfork_args = xcalloc(sizeof(char *), argc + 3);
|
vfork_args = xzalloc(sizeof(char *) * (argc + 3));
|
||||||
vfork_args[a++] = CONFIG_BUSYBOX_EXEC_PATH;
|
vfork_args[a++] = CONFIG_BUSYBOX_EXEC_PATH;
|
||||||
while(*argv) {
|
while (*argv) {
|
||||||
vfork_args[a++] = *argv;
|
vfork_args[a++] = *argv;
|
||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ static int check_securetty(void)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
while (fgets(buf, sizeof(buf)-1, fp)) {
|
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]))
|
if (!isspace(buf[i]))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
/* 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';
|
argv[1][strlen(argv[1]) -1] = '\0';
|
||||||
|
|
||||||
mount_point = argv[1];
|
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) )
|
if ( S_ISDIR (statbuf.st_mode) )
|
||||||
{
|
{
|
||||||
/* strip last / from dirname so we don't need to check for it later */
|
/* 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';
|
path[strlen(path) -1] = '\0';
|
||||||
|
|
||||||
dir_operation(READ_CONFIG, path, 0, event_mask);
|
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 );
|
i = index_in_str_array(options, what );
|
||||||
|
|
||||||
switch(i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case 4: /* "PERMISSIONS" */
|
case 4: /* "PERMISSIONS" */
|
||||||
new->action.what = AC_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 )
|
if( i == 9 )
|
||||||
snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2);
|
snprintf (compat_buf, sizeof (compat_buf), fmt[i], host, bus, target, lun, ptr + 2);
|
||||||
/* esac */
|
/* esac */
|
||||||
} /* switch(action) */
|
} /* switch (action) */
|
||||||
|
|
||||||
if(compat_name == NULL )
|
if(compat_name == NULL )
|
||||||
return;
|
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);
|
debug_msg_logger(LOG_ERR, "unlink: %s: %m", compat_name);
|
||||||
break;
|
break;
|
||||||
/*esac*/
|
/*esac*/
|
||||||
} /* switch(action) */
|
} /* switch (action) */
|
||||||
} /* End Function action_compat */
|
} /* End Function action_compat */
|
||||||
|
|
||||||
static void restore(char *spath, struct stat source_stat, int rootlen)
|
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;
|
mode = 0;
|
||||||
i= S_IRUSR;
|
i= S_IRUSR;
|
||||||
while(i>0)
|
while (i>0)
|
||||||
{
|
{
|
||||||
if(string[0]=='r'||string[0]=='w'||string[0]=='x')
|
if(string[0]=='r'||string[0]=='w'||string[0]=='x')
|
||||||
mode+=i;
|
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);
|
debug_msg_logger(LOG_ERR, "%s: %s: %m", __FUNCTION__, path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch(type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SERVICE:
|
case SERVICE:
|
||||||
service(statbuf,path);
|
service(statbuf,path);
|
||||||
@ -1710,7 +1710,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor)
|
|||||||
c+=2;
|
c+=2;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
} while(i<=IDE9_MAJOR);
|
} while (i<=IDE9_MAJOR);
|
||||||
|
|
||||||
if (minor > 63)
|
if (minor > 63)
|
||||||
++letter;
|
++letter;
|
||||||
|
@ -2043,10 +2043,10 @@ static void identify_from_stdin(void)
|
|||||||
|
|
||||||
// Convert the newline-separated hex data into an identify block.
|
// Convert the newline-separated hex data into an identify block.
|
||||||
|
|
||||||
for (i = 0; i<256; i++)
|
for (i = 0; i<256; i++) {
|
||||||
{
|
|
||||||
int j;
|
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.
|
// Parse the data.
|
||||||
|
@ -594,7 +594,7 @@ static void collect_mem(mem_stat *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_free += m_bufs + m_cached + m_slab;
|
m_free += m_bufs + m_cached + m_slab;
|
||||||
switch(s->opt) {
|
switch (s->opt) {
|
||||||
case 'f':
|
case 'f':
|
||||||
scale(m_free << 10); break;
|
scale(m_free << 10); break;
|
||||||
default:
|
default:
|
||||||
|
@ -3719,7 +3719,7 @@ static void check_tainted_module(struct obj_file *f, char *m_name)
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
#else /* FEATURE_CHECK_TAINTED_MODULE */
|
#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 */
|
#endif /* FEATURE_CHECK_TAINTED_MODULE */
|
||||||
|
|
||||||
#if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS
|
#if ENABLE_FEATURE_INSMOD_KSYMOOPS_SYMBOLS
|
||||||
|
@ -82,7 +82,7 @@ int lsmod_main(int argc, char **argv)
|
|||||||
|
|
||||||
module_names = deps = NULL;
|
module_names = deps = NULL;
|
||||||
bufsize = depsize = 0;
|
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");
|
if (errno != ENOSPC) bb_perror_msg_and_die("QM_MODULES");
|
||||||
module_names = xmalloc(bufsize = nmod);
|
module_names = xmalloc(bufsize = nmod);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ deleteconn:
|
|||||||
conns[i].lasttime = time(NULL);
|
conns[i].lasttime = time(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* end of while(1) */
|
} /* end of while (1) */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -497,7 +497,7 @@ int ifconfig_main(int argc, char **argv)
|
|||||||
ifr.ifr_flags &= ~selector;
|
ifr.ifr_flags &= ~selector;
|
||||||
if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0)
|
if (ioctl(sockfd, SIOCSIFFLAGS, &ifr) < 0)
|
||||||
bb_perror_msg_and_die("SIOCSIFFLAGS");
|
bb_perror_msg_and_die("SIOCSIFFLAGS");
|
||||||
} /* while() */
|
} /* while () */
|
||||||
|
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
if (ENABLE_FEATURE_CLEAN_UP)
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
@ -835,7 +835,7 @@ static servtab_t *getconfigent(void)
|
|||||||
sigaddset(&m, SIGHUP); \
|
sigaddset(&m, SIGHUP); \
|
||||||
sigaddset(&m, SIGALRM); \
|
sigaddset(&m, SIGALRM); \
|
||||||
sigprocmask(SIG_BLOCK, &m, NULL); \
|
sigprocmask(SIG_BLOCK, &m, NULL); \
|
||||||
} while(0)
|
} while (0)
|
||||||
|
|
||||||
static servtab_t *enter(servtab_t *cp)
|
static servtab_t *enter(servtab_t *cp)
|
||||||
{
|
{
|
||||||
@ -1495,7 +1495,7 @@ do_exit1:
|
|||||||
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
|
if (!sep->se_wait && sep->se_socktype == SOCK_STREAM)
|
||||||
close(ctrl);
|
close(ctrl);
|
||||||
} /* for (sep = servtab...) */
|
} /* for (sep = servtab...) */
|
||||||
} /* for(;;) */
|
} /* for (;;) */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,7 +43,7 @@ static int get_prefix(unsigned long netmask)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
netmask = htonl(netmask);
|
netmask = htonl(netmask);
|
||||||
while(msk) {
|
while (msk) {
|
||||||
if (netmask & msk)
|
if (netmask & msk)
|
||||||
ret++;
|
ret++;
|
||||||
msk >>= 1;
|
msk >>= 1;
|
||||||
|
@ -30,7 +30,7 @@ extern char * _SL_;
|
|||||||
|
|
||||||
extern void incomplete_command(void) ATTRIBUTE_NORETURN;
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -320,7 +320,7 @@ static void putiac_subopt(byte c, char *str)
|
|||||||
putiac(c);
|
putiac(c);
|
||||||
putiac(0);
|
putiac(0);
|
||||||
|
|
||||||
while(*str)
|
while (*str)
|
||||||
putiac(*str++);
|
putiac(*str++);
|
||||||
|
|
||||||
putiac(IAC);
|
putiac(IAC);
|
||||||
@ -343,12 +343,12 @@ static void putiac_subopt_autologin(void)
|
|||||||
putiac(TELQUAL_IS);
|
putiac(TELQUAL_IS);
|
||||||
putiac(NEW_ENV_VAR);
|
putiac(NEW_ENV_VAR);
|
||||||
|
|
||||||
while(*user)
|
while (*user)
|
||||||
putiac(*user++);
|
putiac(*user++);
|
||||||
|
|
||||||
putiac(NEW_ENV_VALUE);
|
putiac(NEW_ENV_VALUE);
|
||||||
|
|
||||||
while(*autologin)
|
while (*autologin)
|
||||||
putiac(*autologin++);
|
putiac(*autologin++);
|
||||||
|
|
||||||
putiac(IAC);
|
putiac(IAC);
|
||||||
|
@ -989,7 +989,7 @@ traceroute_main(int argc, char *argv[])
|
|||||||
if (sourse_route_list) {
|
if (sourse_route_list) {
|
||||||
llist_t *l_sr;
|
llist_t *l_sr;
|
||||||
|
|
||||||
for(l_sr = sourse_route_list; l_sr; ) {
|
for (l_sr = sourse_route_list; l_sr; ) {
|
||||||
if (lsrr >= NGATEWAYS)
|
if (lsrr >= NGATEWAYS)
|
||||||
bb_error_msg_and_die("no more than %d gateways", NGATEWAYS);
|
bb_error_msg_and_die("no more than %d gateways", NGATEWAYS);
|
||||||
getaddr(gwlist + lsrr, l_sr->data);
|
getaddr(gwlist + lsrr, l_sr->data);
|
||||||
|
@ -319,7 +319,7 @@ int fuser_main(int argc, char **argv)
|
|||||||
bb_show_usage();
|
bb_show_usage();
|
||||||
|
|
||||||
fni = xmalloc(sizeof(int));
|
fni = xmalloc(sizeof(int));
|
||||||
for(i=1;i<argc;i++) {
|
for (i=1;i<argc;i++) {
|
||||||
optn = fuser_option(argv[i]);
|
optn = fuser_option(argv[i]);
|
||||||
if(optn) opt |= optn;
|
if(optn) opt |= optn;
|
||||||
else if(argv[i][0] == '-') {
|
else if(argv[i][0] == '-') {
|
||||||
@ -335,7 +335,7 @@ int fuser_main(int argc, char **argv)
|
|||||||
if(!fnic) return 1;
|
if(!fnic) return 1;
|
||||||
|
|
||||||
inodes = xmalloc(sizeof(inode_list));
|
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)) {
|
if(fuser_parse_net_arg(argv[fni[i]], &proto, &port)) {
|
||||||
fuser_scan_proc_net(opt, proto, port, inodes);
|
fuser_scan_proc_net(opt, proto, port, inodes);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ unsigned fmt_ulong(char *s,unsigned long u)
|
|||||||
while (q > 9) { ++len; q /= 10; }
|
while (q > 9) { ++len; q /= 10; }
|
||||||
if (s) {
|
if (s) {
|
||||||
s += len;
|
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;
|
return len;
|
||||||
}
|
}
|
||||||
|
@ -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_PAUSE) p = add_str(p, ", paused");
|
||||||
if (s->ctrl & C_TERM) p = add_str(p, ", got TERM");
|
if (s->ctrl & C_TERM) p = add_str(p, ", got TERM");
|
||||||
if (s->state != S_DOWN)
|
if (s->state != S_DOWN)
|
||||||
switch(s->want) {
|
switch (s->want) {
|
||||||
case W_DOWN:
|
case W_DOWN:
|
||||||
p = add_str(p, ", want down");
|
p = add_str(p, ", want down");
|
||||||
break;
|
break;
|
||||||
@ -329,7 +329,7 @@ static void startservice(struct svdir *s)
|
|||||||
|
|
||||||
static int ctrl(struct svdir *s, char c)
|
static int ctrl(struct svdir *s, char c)
|
||||||
{
|
{
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case 'd': /* down */
|
case 'd': /* down */
|
||||||
s->want = W_DOWN;
|
s->want = W_DOWN;
|
||||||
update_status(s);
|
update_status(s);
|
||||||
|
@ -75,7 +75,7 @@ static int svstatus_get(void)
|
|||||||
}
|
}
|
||||||
r = read(fd, svstatus, 20);
|
r = read(fd, svstatus, 20);
|
||||||
close(fd);
|
close(fd);
|
||||||
switch(r) {
|
switch (r) {
|
||||||
case 20: break;
|
case 20: break;
|
||||||
case -1: warn_cannot("read supervise/status"); return -1;
|
case -1: warn_cannot("read supervise/status"); return -1;
|
||||||
default: warnx_cannot("read supervise/status: bad format"); 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)
|
static int status(char *unused)
|
||||||
{
|
{
|
||||||
r = svstatus_get();
|
r = svstatus_get();
|
||||||
switch(r) { case -1: case 0: return 0; }
|
switch (r) { case -1: case 0: return 0; }
|
||||||
r = svstatus_print(*service);
|
r = svstatus_print(*service);
|
||||||
if (chdir("log") == -1) {
|
if (chdir("log") == -1) {
|
||||||
if (errno != ENOENT) {
|
if (errno != ENOENT) {
|
||||||
|
@ -262,7 +262,7 @@ static unsigned rotate(struct logdir *ld)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (ld->ppid)
|
if (ld->ppid)
|
||||||
while(!processorstop(ld))
|
while (!processorstop(ld))
|
||||||
/* wait */;
|
/* wait */;
|
||||||
|
|
||||||
while (fchdir(ld->fddir) == -1)
|
while (fchdir(ld->fddir) == -1)
|
||||||
|
12
shell/ash.c
12
shell/ash.c
@ -2402,7 +2402,7 @@ static const char * updatepwd(const char *dir)
|
|||||||
}
|
}
|
||||||
p = strtok(cdcomppath, "/");
|
p = strtok(cdcomppath, "/");
|
||||||
while (p) {
|
while (p) {
|
||||||
switch(*p) {
|
switch (*p) {
|
||||||
case '.':
|
case '.':
|
||||||
if (p[1] == '.' && p[2] == '\0') {
|
if (p[1] == '.' && p[2] == '\0') {
|
||||||
while (new > lim) {
|
while (new > lim) {
|
||||||
@ -4802,7 +4802,7 @@ exptilde(char *startp, char *p, int flag)
|
|||||||
name = p + 1;
|
name = p + 1;
|
||||||
|
|
||||||
while ((c = *++p) != '\0') {
|
while ((c = *++p) != '\0') {
|
||||||
switch(c) {
|
switch (c) {
|
||||||
case CTLESC:
|
case CTLESC:
|
||||||
return startp;
|
return startp;
|
||||||
case CTLQUOTEMARK:
|
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 */
|
CHECKEND(); /* set c to PEOF if at end of here document */
|
||||||
for (;;) { /* until end of line or end of word */
|
for (;;) { /* until end of line or end of word */
|
||||||
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
CHECKSTRSPACE(4, out); /* permit 4 calls to USTPUTC */
|
||||||
switch(SIT(c, syntax)) {
|
switch (SIT(c, syntax)) {
|
||||||
case CNL: /* '\n' */
|
case CNL: /* '\n' */
|
||||||
if (syntax == BASESYNTAX)
|
if (syntax == BASESYNTAX)
|
||||||
goto endword; /* exit outer loop */
|
goto endword; /* exit outer loop */
|
||||||
@ -11282,7 +11282,7 @@ shtree(union node *n, int ind, char *pfx, FILE *fp)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
indent(ind, pfx, fp);
|
indent(ind, pfx, fp);
|
||||||
switch(n->type) {
|
switch (n->type) {
|
||||||
case NSEMI:
|
case NSEMI:
|
||||||
s = "; ";
|
s = "; ";
|
||||||
goto binop;
|
goto binop;
|
||||||
@ -12613,7 +12613,7 @@ readcmd(int argc, char **argv)
|
|||||||
while ((i = nextopt("p:r")) != '\0')
|
while ((i = nextopt("p:r")) != '\0')
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
switch(i) {
|
switch (i) {
|
||||||
case 'p':
|
case 'p':
|
||||||
prompt = optionarg;
|
prompt = optionarg;
|
||||||
break;
|
break;
|
||||||
@ -13579,7 +13579,7 @@ static arith_t arith (const char *expr, int *perrcode)
|
|||||||
* a number, since it evaluates to one). Think about it.
|
* a number, since it evaluates to one). Think about it.
|
||||||
* It makes sense. */
|
* It makes sense. */
|
||||||
if (lasttok != TOK_NUM) {
|
if (lasttok != TOK_NUM) {
|
||||||
switch(op) {
|
switch (op) {
|
||||||
case TOK_ADD:
|
case TOK_ADD:
|
||||||
op = TOK_UPLUS;
|
op = TOK_UPLUS;
|
||||||
break;
|
break;
|
||||||
|
@ -1799,7 +1799,7 @@ rewrite_line:
|
|||||||
/* After max history, remove the oldest command */
|
/* After max history, remove the oldest command */
|
||||||
if (i >= MAX_HISTORY) {
|
if (i >= MAX_HISTORY) {
|
||||||
free(history[0]);
|
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] = history[i+1];
|
||||||
}
|
}
|
||||||
history[i++] = xstrdup(command);
|
history[i++] = xstrdup(command);
|
||||||
|
@ -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 */
|
return 1; /* syntax error, groups and arglists don't mix */
|
||||||
}
|
}
|
||||||
initialize_context(&sub);
|
initialize_context(&sub);
|
||||||
switch(ch) {
|
switch (ch) {
|
||||||
case '(': endch=')'; child->subshell=1; break;
|
case '(': endch=')'; child->subshell=1; break;
|
||||||
case '{': endch='}'; break;
|
case '{': endch='}'; break;
|
||||||
default: syntax(); /* really logic error */
|
default: syntax(); /* really logic error */
|
||||||
|
@ -789,7 +789,7 @@ static int expand_arguments(char *command)
|
|||||||
src = command;
|
src = command;
|
||||||
while((dst = strchr(src,'$')) != NULL){
|
while((dst = strchr(src,'$')) != NULL){
|
||||||
var = NULL;
|
var = NULL;
|
||||||
switch(*(dst+1)) {
|
switch (*(dst+1)) {
|
||||||
case '?':
|
case '?':
|
||||||
var = itoa(last_return_code);
|
var = itoa(last_return_code);
|
||||||
break;
|
break;
|
||||||
@ -1163,7 +1163,7 @@ static int pseudo_exec(struct child_prog *child)
|
|||||||
char **argv_l = child->argv;
|
char **argv_l = child->argv;
|
||||||
int argc_l;
|
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;
|
optind = 1;
|
||||||
run_applet_by_name(child->argv[0], argc_l, child->argv);
|
run_applet_by_name(child->argv[0], argc_l, child->argv);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user