diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 16:49:55 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 16:49:55 +0000 |
commit | d9e15f206840219bb0f39c912a42fdcf8cbcaed6 (patch) | |
tree | ffdef7f5ab4a33038d0a62c9355b48f362aa463e | |
parent | 079f8afa0a16112cbaf7012c82b38b7358b82141 (diff) | |
download | busybox-w32-d9e15f206840219bb0f39c912a42fdcf8cbcaed6.tar.gz busybox-w32-d9e15f206840219bb0f39c912a42fdcf8cbcaed6.tar.bz2 busybox-w32-d9e15f206840219bb0f39c912a42fdcf8cbcaed6.zip |
style cleanup: return(a) -> return a, part 2
-rw-r--r-- | archival/gzip.c | 2 | ||||
-rw-r--r-- | archival/libunarchive/get_header_ar.c | 4 | ||||
-rw-r--r-- | archival/libunarchive/get_header_cpio.c | 2 | ||||
-rw-r--r-- | coreutils/diff.c | 16 | ||||
-rw-r--r-- | coreutils/mv.c | 2 | ||||
-rw-r--r-- | docs/ipv4_ipv6.txt | 4 | ||||
-rw-r--r-- | e2fsprogs/blkid/dev.c | 2 | ||||
-rw-r--r-- | e2fsprogs/blkid/resolve.c | 2 | ||||
-rw-r--r-- | e2fsprogs/blkid/tag.c | 2 | ||||
-rw-r--r-- | e2fsprogs/e2fsck.c | 2 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/closefs.c | 2 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/dirblock.c | 2 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/imager.c | 4 | ||||
-rw-r--r-- | e2fsprogs/tune2fs.c | 4 | ||||
-rw-r--r-- | editors/vi.c | 38 | ||||
-rw-r--r-- | libbb/bb_pwd.c | 2 | ||||
-rw-r--r-- | libbb/dump.c | 16 | ||||
-rw-r--r-- | libbb/obscure.c | 2 | ||||
-rw-r--r-- | loginutils/passwd.c | 6 | ||||
-rw-r--r-- | miscutils/devfsd.c | 124 | ||||
-rw-r--r-- | modutils/insmod.c | 6 | ||||
-rw-r--r-- | networking/ifconfig.c | 2 | ||||
-rw-r--r-- | networking/ping.c | 2 | ||||
-rw-r--r-- | shell/ash.c | 18 | ||||
-rw-r--r-- | shell/hush.c | 4 | ||||
-rw-r--r-- | shell/msh.c | 279 | ||||
-rw-r--r-- | util-linux/getopt.c | 4 | ||||
-rw-r--r-- | util-linux/ipcrm.c | 2 |
28 files changed, 273 insertions, 282 deletions
diff --git a/archival/gzip.c b/archival/gzip.c index ef3724c34..c9b67538e 100644 --- a/archival/gzip.c +++ b/archival/gzip.c | |||
@@ -1260,7 +1260,7 @@ int gzip_main(int argc, char **argv) | |||
1260 | } | 1260 | } |
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | return (exit_code); | 1263 | return exit_code; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | /* trees.c -- output deflated data using Huffman coding | 1266 | /* trees.c -- output deflated data using Huffman coding |
diff --git a/archival/libunarchive/get_header_ar.c b/archival/libunarchive/get_header_ar.c index d0791e99c..7f8c81ca0 100644 --- a/archival/libunarchive/get_header_ar.c +++ b/archival/libunarchive/get_header_ar.c | |||
@@ -68,12 +68,12 @@ char get_header_ar(archive_handle_t *archive_handle) | |||
68 | archive_handle->offset += ar_long_name_size; | 68 | archive_handle->offset += ar_long_name_size; |
69 | /* This ar entries data section only contained filenames for other records | 69 | /* This ar entries data section only contained filenames for other records |
70 | * they are stored in the static ar_long_names for future reference */ | 70 | * they are stored in the static ar_long_names for future reference */ |
71 | return (get_header_ar(archive_handle)); /* Return next header */ | 71 | return get_header_ar(archive_handle); /* Return next header */ |
72 | } else if (ar.formatted.name[1] == ' ') { | 72 | } else if (ar.formatted.name[1] == ' ') { |
73 | /* This is the index of symbols in the file for compilers */ | 73 | /* This is the index of symbols in the file for compilers */ |
74 | data_skip(archive_handle); | 74 | data_skip(archive_handle); |
75 | archive_handle->offset += typed->size; | 75 | archive_handle->offset += typed->size; |
76 | return (get_header_ar(archive_handle)); /* Return next header */ | 76 | return get_header_ar(archive_handle); /* Return next header */ |
77 | } else { | 77 | } else { |
78 | /* The number after the '/' indicates the offset in the ar data section | 78 | /* The number after the '/' indicates the offset in the ar data section |
79 | (saved in variable long_name) that conatains the real filename */ | 79 | (saved in variable long_name) that conatains the real filename */ |
diff --git a/archival/libunarchive/get_header_cpio.c b/archival/libunarchive/get_header_cpio.c index f0b07b56c..e0272003c 100644 --- a/archival/libunarchive/get_header_cpio.c +++ b/archival/libunarchive/get_header_cpio.c | |||
@@ -156,5 +156,5 @@ char get_header_cpio(archive_handle_t *archive_handle) | |||
156 | 156 | ||
157 | free(file_header->link_name); | 157 | free(file_header->link_name); |
158 | 158 | ||
159 | return (EXIT_SUCCESS); | 159 | return EXIT_SUCCESS; |
160 | } | 160 | } |
diff --git a/coreutils/diff.c b/coreutils/diff.c index 2920bf143..0b83c9ddf 100644 --- a/coreutils/diff.c +++ b/coreutils/diff.c | |||
@@ -342,7 +342,7 @@ static int isqrt(int n) | |||
342 | x /= 2; | 342 | x /= 2; |
343 | } while ((x - y) > 1 || (x - y) < -1); | 343 | } while ((x - y) > 1 || (x - y) < -1); |
344 | 344 | ||
345 | return (x); | 345 | return x; |
346 | } | 346 | } |
347 | 347 | ||
348 | static int newcand(int x, int y, int pred) | 348 | static int newcand(int x, int y, int pred) |
@@ -357,7 +357,7 @@ static int newcand(int x, int y, int pred) | |||
357 | q->x = x; | 357 | q->x = x; |
358 | q->y = y; | 358 | q->y = y; |
359 | q->pred = pred; | 359 | q->pred = pred; |
360 | return (clen++); | 360 | return clen++; |
361 | } | 361 | } |
362 | 362 | ||
363 | 363 | ||
@@ -366,7 +366,7 @@ static int search(int *c, int k, int y) | |||
366 | int i, j, l, t; | 366 | int i, j, l, t; |
367 | 367 | ||
368 | if (clist[c[k]].y < y) /* quick look for typical case */ | 368 | if (clist[c[k]].y < y) /* quick look for typical case */ |
369 | return (k + 1); | 369 | return k + 1; |
370 | i = 0; | 370 | i = 0; |
371 | j = k + 1; | 371 | j = k + 1; |
372 | while (1) { | 372 | while (1) { |
@@ -379,9 +379,9 @@ static int search(int *c, int k, int y) | |||
379 | else if (t < y) | 379 | else if (t < y) |
380 | i = l; | 380 | i = l; |
381 | else | 381 | else |
382 | return (l); | 382 | return l; |
383 | } | 383 | } |
384 | return (l + 1); | 384 | return l + 1; |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
@@ -428,7 +428,7 @@ static int stone(int *a, int n, int *b, int *c) | |||
428 | } | 428 | } |
429 | } while ((y = b[++j]) > 0 && numtries < bound); | 429 | } while ((y = b[++j]) > 0 && numtries < bound); |
430 | } | 430 | } |
431 | return (k); | 431 | return k; |
432 | } | 432 | } |
433 | 433 | ||
434 | static void unravel(int p) | 434 | static void unravel(int p) |
@@ -461,7 +461,7 @@ static int skipline(FILE * f) | |||
461 | 461 | ||
462 | for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) | 462 | for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) |
463 | continue; | 463 | continue; |
464 | return (i); | 464 | return i; |
465 | } | 465 | } |
466 | 466 | ||
467 | 467 | ||
@@ -977,7 +977,7 @@ static int diffreg(char *ofile1, char *ofile2, int flags) | |||
977 | free(file1); | 977 | free(file1); |
978 | if (file2 != ofile2) | 978 | if (file2 != ofile2) |
979 | free(file2); | 979 | free(file2); |
980 | return (rval); | 980 | return rval; |
981 | } | 981 | } |
982 | 982 | ||
983 | #if ENABLE_FEATURE_DIFF_DIR | 983 | #if ENABLE_FEATURE_DIFF_DIR |
diff --git a/coreutils/mv.c b/coreutils/mv.c index 52ddd9fb7..353124b35 100644 --- a/coreutils/mv.c +++ b/coreutils/mv.c | |||
@@ -127,5 +127,5 @@ RET_0: | |||
127 | } | 127 | } |
128 | } while (*++argv != last); | 128 | } while (*++argv != last); |
129 | 129 | ||
130 | return (status); | 130 | return status; |
131 | } | 131 | } |
diff --git a/docs/ipv4_ipv6.txt b/docs/ipv4_ipv6.txt index 76d8279c1..e83db0dbd 100644 --- a/docs/ipv4_ipv6.txt +++ b/docs/ipv4_ipv6.txt | |||
@@ -175,7 +175,7 @@ Modified IPv6-aware C code: | |||
175 | (void) fprintf(stderr, | 175 | (void) fprintf(stderr, |
176 | "getaddrinfo: %s for host %s service %s\n", | 176 | "getaddrinfo: %s for host %s service %s\n", |
177 | gai_strerror(error), hostname, servicename); | 177 | gai_strerror(error), hostname, servicename); |
178 | return (-1); | 178 | return -1; |
179 | } | 179 | } |
180 | /* Try all returned addresses until one works */ | 180 | /* Try all returned addresses until one works */ |
181 | for (aip = res; aip != NULL; aip = aip->ai_next) { | 181 | for (aip = res; aip != NULL; aip = aip->ai_next) { |
@@ -187,7 +187,7 @@ Modified IPv6-aware C code: | |||
187 | if (sock == -1) { | 187 | if (sock == -1) { |
188 | perror("socket"); | 188 | perror("socket"); |
189 | freeaddrinfo(res); | 189 | freeaddrinfo(res); |
190 | return (-1); | 190 | return -1; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* Connect to the host. */ | 193 | /* Connect to the host. */ |
diff --git a/e2fsprogs/blkid/dev.c b/e2fsprogs/blkid/dev.c index f9f8c63bb..eddbd02b7 100644 --- a/e2fsprogs/blkid/dev.c +++ b/e2fsprogs/blkid/dev.c | |||
@@ -117,7 +117,7 @@ blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache) | |||
117 | iter->magic = DEV_ITERATE_MAGIC; | 117 | iter->magic = DEV_ITERATE_MAGIC; |
118 | iter->cache = cache; | 118 | iter->cache = cache; |
119 | iter->p = cache->bic_devs.next; | 119 | iter->p = cache->bic_devs.next; |
120 | return (iter); | 120 | return iter; |
121 | } | 121 | } |
122 | 122 | ||
123 | /* | 123 | /* |
diff --git a/e2fsprogs/blkid/resolve.c b/e2fsprogs/blkid/resolve.c index 2bbcaf31d..7942de2cd 100644 --- a/e2fsprogs/blkid/resolve.c +++ b/e2fsprogs/blkid/resolve.c | |||
@@ -102,7 +102,7 @@ errout: | |||
102 | if (!cache) { | 102 | if (!cache) { |
103 | blkid_put_cache(c); | 103 | blkid_put_cache(c); |
104 | } | 104 | } |
105 | return (ret); | 105 | return ret; |
106 | } | 106 | } |
107 | 107 | ||
108 | #ifdef TEST_PROGRAM | 108 | #ifdef TEST_PROGRAM |
diff --git a/e2fsprogs/blkid/tag.c b/e2fsprogs/blkid/tag.c index 7cf30b45f..9e862a50a 100644 --- a/e2fsprogs/blkid/tag.c +++ b/e2fsprogs/blkid/tag.c | |||
@@ -257,7 +257,7 @@ blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev) | |||
257 | iter->magic = TAG_ITERATE_MAGIC; | 257 | iter->magic = TAG_ITERATE_MAGIC; |
258 | iter->dev = dev; | 258 | iter->dev = dev; |
259 | iter->p = dev->bid_tags.next; | 259 | iter->p = dev->bid_tags.next; |
260 | return (iter); | 260 | return iter; |
261 | } | 261 | } |
262 | 262 | ||
263 | /* | 263 | /* |
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c index c48244121..efaec7d8f 100644 --- a/e2fsprogs/e2fsck.c +++ b/e2fsprogs/e2fsck.c | |||
@@ -1422,7 +1422,7 @@ static int journal_bmap(journal_t *journal, blk_t block, unsigned long *phys) | |||
1422 | retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino, | 1422 | retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino, |
1423 | &inode->i_ext2, NULL, 0, block, &pblk); | 1423 | &inode->i_ext2, NULL, 0, block, &pblk); |
1424 | *phys = pblk; | 1424 | *phys = pblk; |
1425 | return (retval); | 1425 | return retval; |
1426 | #endif | 1426 | #endif |
1427 | } | 1427 | } |
1428 | 1428 | ||
diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c index 3531cdce7..008d5f36e 100644 --- a/e2fsprogs/ext2fs/closefs.c +++ b/e2fsprogs/ext2fs/closefs.c | |||
@@ -112,7 +112,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs, | |||
112 | *ret_new_desc_blk = new_desc_blk; | 112 | *ret_new_desc_blk = new_desc_blk; |
113 | if (ret_meta_bg) | 113 | if (ret_meta_bg) |
114 | *ret_meta_bg = meta_bg; | 114 | *ret_meta_bg = meta_bg; |
115 | return (numblocks); | 115 | return numblocks; |
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
diff --git a/e2fsprogs/ext2fs/dirblock.c b/e2fsprogs/ext2fs/dirblock.c index 43e8e6eb0..5d3f6a1bc 100644 --- a/e2fsprogs/ext2fs/dirblock.c +++ b/e2fsprogs/ext2fs/dirblock.c | |||
@@ -103,7 +103,7 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block, | |||
103 | if ((dirent->rec_len < 8) || | 103 | if ((dirent->rec_len < 8) || |
104 | (dirent->rec_len % 4)) { | 104 | (dirent->rec_len % 4)) { |
105 | ext2fs_free_mem(&buf); | 105 | ext2fs_free_mem(&buf); |
106 | return (EXT2_ET_DIR_CORRUPTED); | 106 | return EXT2_ET_DIR_CORRUPTED; |
107 | } | 107 | } |
108 | p += dirent->rec_len; | 108 | p += dirent->rec_len; |
109 | if (do_swap) { | 109 | if (do_swap) { |
diff --git a/e2fsprogs/ext2fs/imager.c b/e2fsprogs/ext2fs/imager.c index 2f93cb417..e82321efa 100644 --- a/e2fsprogs/ext2fs/imager.c +++ b/e2fsprogs/ext2fs/imager.c | |||
@@ -324,7 +324,7 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags) | |||
324 | } | 324 | } |
325 | retval = 0; | 325 | retval = 0; |
326 | errout: | 326 | errout: |
327 | return (retval); | 327 | return retval; |
328 | } | 328 | } |
329 | 329 | ||
330 | 330 | ||
@@ -373,5 +373,5 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) | |||
373 | retval = 0; | 373 | retval = 0; |
374 | errout: | 374 | errout: |
375 | free(buf); | 375 | free(buf); |
376 | return (retval); | 376 | return retval; |
377 | } | 377 | } |
diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index c8dfc6927..a2ca1ba09 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c | |||
@@ -380,7 +380,7 @@ static time_t parse_time(char *str) | |||
380 | struct tm ts; | 380 | struct tm ts; |
381 | 381 | ||
382 | if (strcmp(str, "now") == 0) { | 382 | if (strcmp(str, "now") == 0) { |
383 | return (time(0)); | 383 | return time(0); |
384 | } | 384 | } |
385 | memset(&ts, 0, sizeof(ts)); | 385 | memset(&ts, 0, sizeof(ts)); |
386 | #ifdef HAVE_STRPTIME | 386 | #ifdef HAVE_STRPTIME |
@@ -398,7 +398,7 @@ static time_t parse_time(char *str) | |||
398 | if (ts.tm_mday == 0) { | 398 | if (ts.tm_mday == 0) { |
399 | bb_error_msg_and_die("Cannot parse date/time specifier: %s", str); | 399 | bb_error_msg_and_die("Cannot parse date/time specifier: %s", str); |
400 | } | 400 | } |
401 | return (mktime(&ts)); | 401 | return mktime(&ts); |
402 | } | 402 | } |
403 | 403 | ||
404 | static void parse_tune2fs_options(int argc, char **argv) | 404 | static void parse_tune2fs_options(int argc, char **argv) |
diff --git a/editors/vi.c b/editors/vi.c index 3f9ba4698..eef895c53 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -1233,7 +1233,7 @@ static int count_lines(Byte * start, Byte * stop) // count line from start to st | |||
1233 | if (*q == '\n') | 1233 | if (*q == '\n') |
1234 | cnt++; | 1234 | cnt++; |
1235 | } | 1235 | } |
1236 | return (cnt); | 1236 | return cnt; |
1237 | } | 1237 | } |
1238 | 1238 | ||
1239 | static Byte *find_line(int li) // find begining of line #li | 1239 | static Byte *find_line(int li) // find begining of line #li |
@@ -1373,7 +1373,7 @@ static Byte *new_screen(int ro, int co) | |||
1373 | for (li = 1; li < ro - 1; li++) { | 1373 | for (li = 1; li < ro - 1; li++) { |
1374 | screen[(li * co) + 0] = '~'; | 1374 | screen[(li * co) + 0] = '~'; |
1375 | } | 1375 | } |
1376 | return (screen); | 1376 | return screen; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | static Byte *new_text(int size) | 1379 | static Byte *new_text(int size) |
@@ -1384,7 +1384,7 @@ static Byte *new_text(int size) | |||
1384 | text = (Byte *) xmalloc(size + 8); | 1384 | text = (Byte *) xmalloc(size + 8); |
1385 | memset(text, '\0', size); // clear new text[] | 1385 | memset(text, '\0', size); // clear new text[] |
1386 | //text += 4; // leave some room for "oops" | 1386 | //text += 4; // leave some room for "oops" |
1387 | return (text); | 1387 | return text; |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | #ifdef CONFIG_FEATURE_VI_SEARCH | 1390 | #ifdef CONFIG_FEATURE_VI_SEARCH |
@@ -1398,7 +1398,7 @@ static int mycmp(Byte * s1, Byte * s2, int len) | |||
1398 | i = strncasecmp((char *) s1, (char *) s2, len); | 1398 | i = strncasecmp((char *) s1, (char *) s2, len); |
1399 | } | 1399 | } |
1400 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ | 1400 | #endif /* CONFIG_FEATURE_VI_SETOPTS */ |
1401 | return (i); | 1401 | return i; |
1402 | } | 1402 | } |
1403 | 1403 | ||
1404 | static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for pattern starting at p | 1404 | static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for pattern starting at p |
@@ -1414,7 +1414,7 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for | |||
1414 | stop = next_line(p); // range is to next line | 1414 | stop = next_line(p); // range is to next line |
1415 | for (start = p; start < stop; start++) { | 1415 | for (start = p; start < stop; start++) { |
1416 | if (mycmp(start, pat, len) == 0) { | 1416 | if (mycmp(start, pat, len) == 0) { |
1417 | return (start); | 1417 | return start; |
1418 | } | 1418 | } |
1419 | } | 1419 | } |
1420 | } else if (dir == BACK) { | 1420 | } else if (dir == BACK) { |
@@ -1423,12 +1423,12 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for | |||
1423 | stop = prev_line(p); // range is to prev line | 1423 | stop = prev_line(p); // range is to prev line |
1424 | for (start = p - len; start >= stop; start--) { | 1424 | for (start = p - len; start >= stop; start--) { |
1425 | if (mycmp(start, pat, len) == 0) { | 1425 | if (mycmp(start, pat, len) == 0) { |
1426 | return (start); | 1426 | return start; |
1427 | } | 1427 | } |
1428 | } | 1428 | } |
1429 | } | 1429 | } |
1430 | // pattern not found | 1430 | // pattern not found |
1431 | return (NULL); | 1431 | return NULL; |
1432 | #else /*REGEX_SEARCH */ | 1432 | #else /*REGEX_SEARCH */ |
1433 | char *q; | 1433 | char *q; |
1434 | struct re_pattern_buffer preg; | 1434 | struct re_pattern_buffer preg; |
@@ -1608,7 +1608,7 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c) | |||
1608 | *stop = p; | 1608 | *stop = p; |
1609 | } | 1609 | } |
1610 | dot = save_dot; | 1610 | dot = save_dot; |
1611 | return (c); | 1611 | return c; |
1612 | } | 1612 | } |
1613 | 1613 | ||
1614 | static int st_test(Byte * p, int type, int dir, Byte * tested) | 1614 | static int st_test(Byte * p, int type, int dir, Byte * tested) |
@@ -1642,7 +1642,7 @@ static int st_test(Byte * p, int type, int dir, Byte * tested) | |||
1642 | test = ((isalnum(c)) || c == '_'); | 1642 | test = ((isalnum(c)) || c == '_'); |
1643 | } | 1643 | } |
1644 | *tested = c; | 1644 | *tested = c; |
1645 | return (test); | 1645 | return test; |
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | static Byte *skip_thing(Byte * p, int linecnt, int dir, int type) | 1648 | static Byte *skip_thing(Byte * p, int linecnt, int dir, int type) |
@@ -1784,7 +1784,7 @@ static Byte *text_hole_delete(Byte * p, Byte * q) // delete "p" thru "q", inclus | |||
1784 | dest = end = text; // keep pointers valid | 1784 | dest = end = text; // keep pointers valid |
1785 | file_modified++; // has the file been modified | 1785 | file_modified++; // has the file been modified |
1786 | thd0: | 1786 | thd0: |
1787 | return (dest); | 1787 | return dest; |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | // copy text into register, then delete text. | 1790 | // copy text into register, then delete text. |
@@ -1968,7 +1968,7 @@ static Byte what_reg(void) | |||
1968 | c = 'D'; | 1968 | c = 'D'; |
1969 | if (YDreg == 27) | 1969 | if (YDreg == 27) |
1970 | c = 'U'; | 1970 | c = 'U'; |
1971 | return (c); | 1971 | return c; |
1972 | } | 1972 | } |
1973 | 1973 | ||
1974 | static void check_context(Byte cmd) | 1974 | static void check_context(Byte cmd) |
@@ -2086,7 +2086,7 @@ static int mysleep(int hund) // sleep for 'h' 1/100 seconds | |||
2086 | tv.tv_sec = 0; | 2086 | tv.tv_sec = 0; |
2087 | tv.tv_usec = hund * 10000; | 2087 | tv.tv_usec = hund * 10000; |
2088 | select(1, &rfds, NULL, NULL, &tv); | 2088 | select(1, &rfds, NULL, NULL, &tv); |
2089 | return (FD_ISSET(0, &rfds)); | 2089 | return FD_ISSET(0, &rfds); |
2090 | } | 2090 | } |
2091 | 2091 | ||
2092 | #define readbuffer bb_common_bufsiz1 | 2092 | #define readbuffer bb_common_bufsiz1 |
@@ -2214,7 +2214,7 @@ static Byte readit(void) // read (maybe cursor) key from stdin | |||
2214 | readed_for_parse -= n; | 2214 | readed_for_parse -= n; |
2215 | memmove(readbuffer, readbuffer + n, BUFSIZ - n); | 2215 | memmove(readbuffer, readbuffer + n, BUFSIZ - n); |
2216 | (void) alarm(3); // we are done waiting for input, turn alarm ON | 2216 | (void) alarm(3); // we are done waiting for input, turn alarm ON |
2217 | return (c); | 2217 | return c; |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | //----- IO Routines -------------------------------------------- | 2220 | //----- IO Routines -------------------------------------------- |
@@ -2258,7 +2258,7 @@ static Byte get_one_char(void) | |||
2258 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ | 2258 | #else /* CONFIG_FEATURE_VI_DOT_CMD */ |
2259 | c = readit(); // get the users input | 2259 | c = readit(); // get the users input |
2260 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ | 2260 | #endif /* CONFIG_FEATURE_VI_DOT_CMD */ |
2261 | return (c); // return the char, where ever it came from | 2261 | return c; // return the char, where ever it came from |
2262 | } | 2262 | } |
2263 | 2263 | ||
2264 | static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | 2264 | static Byte *get_input_line(Byte * prompt) // get input line- use "status line" |
@@ -2297,7 +2297,7 @@ static Byte *get_input_line(Byte * prompt) // get input line- use "status line" | |||
2297 | refresh(FALSE); | 2297 | refresh(FALSE); |
2298 | free(obufp); | 2298 | free(obufp); |
2299 | obufp = (Byte *) xstrdup((char *) buf); | 2299 | obufp = (Byte *) xstrdup((char *) buf); |
2300 | return (obufp); | 2300 | return obufp; |
2301 | } | 2301 | } |
2302 | 2302 | ||
2303 | static int file_size(const Byte * fn) // what is the byte size of "fn" | 2303 | static int file_size(const Byte * fn) // what is the byte size of "fn" |
@@ -2312,7 +2312,7 @@ static int file_size(const Byte * fn) // what is the byte size of "fn" | |||
2312 | if (sr >= 0) { | 2312 | if (sr >= 0) { |
2313 | cnt = (int) st_buf.st_size; | 2313 | cnt = (int) st_buf.st_size; |
2314 | } | 2314 | } |
2315 | return (cnt); | 2315 | return cnt; |
2316 | } | 2316 | } |
2317 | 2317 | ||
2318 | static int file_insert(Byte * fn, Byte * p, int size) | 2318 | static int file_insert(Byte * fn, Byte * p, int size) |
@@ -2376,7 +2376,7 @@ static int file_insert(Byte * fn, Byte * p, int size) | |||
2376 | if (cnt >= size) | 2376 | if (cnt >= size) |
2377 | file_modified++; | 2377 | file_modified++; |
2378 | fi0: | 2378 | fi0: |
2379 | return (cnt); | 2379 | return cnt; |
2380 | } | 2380 | } |
2381 | 2381 | ||
2382 | static int file_write(Byte * fn, Byte * first, Byte * last) | 2382 | static int file_write(Byte * fn, Byte * first, Byte * last) |
@@ -2385,7 +2385,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) | |||
2385 | 2385 | ||
2386 | if (fn == 0) { | 2386 | if (fn == 0) { |
2387 | psbs("No current filename"); | 2387 | psbs("No current filename"); |
2388 | return (-2); | 2388 | return -2; |
2389 | } | 2389 | } |
2390 | charcnt = 0; | 2390 | charcnt = 0; |
2391 | // FIXIT- use the correct umask() | 2391 | // FIXIT- use the correct umask() |
@@ -2401,7 +2401,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) | |||
2401 | charcnt = 0; | 2401 | charcnt = 0; |
2402 | } | 2402 | } |
2403 | close(fd); | 2403 | close(fd); |
2404 | return (charcnt); | 2404 | return charcnt; |
2405 | } | 2405 | } |
2406 | 2406 | ||
2407 | //----- Terminal Drawing --------------------------------------- | 2407 | //----- Terminal Drawing --------------------------------------- |
diff --git a/libbb/bb_pwd.c b/libbb/bb_pwd.c index 1776fa4f6..48a5c1539 100644 --- a/libbb/bb_pwd.c +++ b/libbb/bb_pwd.c | |||
@@ -47,7 +47,7 @@ long bb_xgetgrnam(const char *name) | |||
47 | if (mygroup==NULL) | 47 | if (mygroup==NULL) |
48 | bb_error_msg_and_die("unknown group name: %s", name); | 48 | bb_error_msg_and_die("unknown group name: %s", name); |
49 | 49 | ||
50 | return (mygroup->gr_gid); | 50 | return mygroup->gr_gid; |
51 | } | 51 | } |
52 | 52 | ||
53 | /* returns a uid given a username */ | 53 | /* returns a uid given a username */ |
diff --git a/libbb/dump.c b/libbb/dump.c index 4e4c2e12c..10710894e 100644 --- a/libbb/dump.c +++ b/libbb/dump.c | |||
@@ -74,7 +74,7 @@ int bb_dump_size(FS * fs) | |||
74 | } | 74 | } |
75 | cur_size += bcnt * fu->reps; | 75 | cur_size += bcnt * fu->reps; |
76 | } | 76 | } |
77 | return (cur_size); | 77 | return cur_size; |
78 | } | 78 | } |
79 | 79 | ||
80 | static void rewrite(FS * fs) | 80 | static void rewrite(FS * fs) |
@@ -374,17 +374,17 @@ static unsigned char *get(void) | |||
374 | */ | 374 | */ |
375 | if (!bb_dump_length || (ateof && !next((char **) NULL))) { | 375 | if (!bb_dump_length || (ateof && !next((char **) NULL))) { |
376 | if (need == bb_dump_blocksize) { | 376 | if (need == bb_dump_blocksize) { |
377 | return ((unsigned char *) NULL); | 377 | return NULL; |
378 | } | 378 | } |
379 | if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) { | 379 | if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) { |
380 | if (bb_dump_vflag != DUP) { | 380 | if (bb_dump_vflag != DUP) { |
381 | printf("*\n"); | 381 | puts("*"); |
382 | } | 382 | } |
383 | return ((unsigned char *) NULL); | 383 | return NULL; |
384 | } | 384 | } |
385 | memset((char *) curp + nread, 0, need); | 385 | memset((char *) curp + nread, 0, need); |
386 | eaddress = address + nread; | 386 | eaddress = address + nread; |
387 | return (curp); | 387 | return curp; |
388 | } | 388 | } |
389 | n = fread((char *) curp + nread, sizeof(unsigned char), | 389 | n = fread((char *) curp + nread, sizeof(unsigned char), |
390 | bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); | 390 | bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); |
@@ -405,10 +405,10 @@ static unsigned char *get(void) | |||
405 | if (bb_dump_vflag == DUP || bb_dump_vflag == FIRST) { | 405 | if (bb_dump_vflag == DUP || bb_dump_vflag == FIRST) { |
406 | bb_dump_vflag = WAIT; | 406 | bb_dump_vflag = WAIT; |
407 | } | 407 | } |
408 | return (curp); | 408 | return curp; |
409 | } | 409 | } |
410 | if (bb_dump_vflag == WAIT) { | 410 | if (bb_dump_vflag == WAIT) { |
411 | printf("*\n"); | 411 | puts("*"); |
412 | } | 412 | } |
413 | bb_dump_vflag = DUP; | 413 | bb_dump_vflag = DUP; |
414 | address = savaddress += bb_dump_blocksize; | 414 | address = savaddress += bb_dump_blocksize; |
@@ -665,7 +665,7 @@ int bb_dump_dump(char **argv) | |||
665 | next(argv); | 665 | next(argv); |
666 | display(); | 666 | display(); |
667 | 667 | ||
668 | return (exitval); | 668 | return exitval; |
669 | } | 669 | } |
670 | 670 | ||
671 | void bb_dump_add(const char *fmt) | 671 | void bb_dump_add(const char *fmt) |
diff --git a/libbb/obscure.c b/libbb/obscure.c index 56aacc910..7d839d624 100644 --- a/libbb/obscure.c +++ b/libbb/obscure.c | |||
@@ -164,7 +164,7 @@ int obscure(const char *old, const char *newval, const struct passwd *pwdp) | |||
164 | if ((msg = obscure_msg(old, newval, pwdp))) { | 164 | if ((msg = obscure_msg(old, newval, pwdp))) { |
165 | printf("Bad password: %s.\n", msg); | 165 | printf("Bad password: %s.\n", msg); |
166 | /* If user is root warn only */ | 166 | /* If user is root warn only */ |
167 | return (getuid())? 1 : 0; | 167 | return getuid() ? 1 : 0; |
168 | } | 168 | } |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
diff --git a/loginutils/passwd.c b/loginutils/passwd.c index 54f35d2d5..2811ab72e 100644 --- a/loginutils/passwd.c +++ b/loginutils/passwd.c | |||
@@ -261,16 +261,16 @@ static int create_backup(const char *backup, FILE * fp) | |||
261 | static int i64c(int i) | 261 | static int i64c(int i) |
262 | { | 262 | { |
263 | if (i <= 0) | 263 | if (i <= 0) |
264 | return ('.'); | 264 | return '.'; |
265 | if (i == 1) | 265 | if (i == 1) |
266 | return ('/'); | 266 | return '/'; |
267 | if (i >= 2 && i < 12) | 267 | if (i >= 2 && i < 12) |
268 | return ('0' - 2 + i); | 268 | return ('0' - 2 + i); |
269 | if (i >= 12 && i < 38) | 269 | if (i >= 12 && i < 38) |
270 | return ('A' - 12 + i); | 270 | return ('A' - 12 + i); |
271 | if (i >= 38 && i < 63) | 271 | if (i >= 38 && i < 63) |
272 | return ('a' - 38 + i); | 272 | return ('a' - 38 + i); |
273 | return ('z'); | 273 | return 'z'; |
274 | } | 274 | } |
275 | 275 | ||
276 | static char *crypt_make_salt(void) | 276 | static char *crypt_make_salt(void) |
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 968270fff..f39bb7e3f 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c | |||
@@ -391,45 +391,35 @@ static void safe_memcpy( char *dest, const char *src, int len) | |||
391 | 391 | ||
392 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr) | 392 | static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr) |
393 | { | 393 | { |
394 | if( d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c') | 394 | if(d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c') |
395 | return (2 + addendum); | 395 | return 2 + addendum; |
396 | else if( d[n - 2]=='c' && d[n - 1]=='d') | 396 | if(d[n - 2]=='c' && d[n - 1]=='d') |
397 | return (3 + addendum); | 397 | return 3 + addendum; |
398 | else if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t') | 398 | if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t') |
399 | return (4 + addendum); | 399 | return 4 + addendum; |
400 | else if( ptr[n - 2]=='m' && ptr[n - 1]=='t') | 400 | if(ptr[n - 2]=='m' && ptr[n - 1]=='t') |
401 | return (5 + addendum); | 401 | return 5 + addendum; |
402 | else | 402 | return 0; |
403 | return 0; | ||
404 | } | 403 | } |
405 | 404 | ||
406 | static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr) | 405 | static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr) |
407 | { | 406 | { |
408 | if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') | 407 | if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') { |
409 | { | ||
410 | if( d[n - 7]=='g' && d[n - 6]=='e' && d[n - 5]=='n' && | 408 | if( d[n - 7]=='g' && d[n - 6]=='e' && d[n - 5]=='n' && |
411 | d[n - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' && | 409 | d[n - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' && |
412 | d[n - 1]=='c' ) | 410 | d[n - 1]=='c' ) |
413 | return 1; | 411 | return 1; |
414 | return scan_dev_name_common(d, n, 0, ptr); | 412 | return scan_dev_name_common(d, n, 0, ptr); |
415 | } | 413 | } |
416 | else if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' && | 414 | if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' && |
417 | d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t') | 415 | d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t') |
418 | { | ||
419 | return scan_dev_name_common(d, n, 4, ptr); | 416 | return scan_dev_name_common(d, n, 4, ptr); |
420 | } | 417 | if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/') |
421 | else if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/') | ||
422 | { | ||
423 | return 10; | 418 | return 10; |
424 | } | 419 | if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/') |
425 | else if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/') | ||
426 | { | ||
427 | return 11; | 420 | return 11; |
428 | } | 421 | if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/') |
429 | else if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/') | ||
430 | { | ||
431 | return 12; | 422 | return 12; |
432 | } | ||
433 | return 0; | 423 | return 0; |
434 | } | 424 | } |
435 | 425 | ||
@@ -787,7 +777,7 @@ static int do_servicing (int fd, unsigned long event_mask) | |||
787 | 777 | ||
788 | caught_signal = FALSE; | 778 | caught_signal = FALSE; |
789 | caught_sighup = FALSE; | 779 | caught_sighup = FALSE; |
790 | return (c_sighup); | 780 | return c_sighup; |
791 | } | 781 | } |
792 | msg_logger_and_die(LOG_ERR, "read error on control file"); | 782 | msg_logger_and_die(LOG_ERR, "read error on control file"); |
793 | } /* End Function do_servicing */ | 783 | } /* End Function do_servicing */ |
@@ -1132,7 +1122,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1132 | { | 1122 | { |
1133 | if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 || | 1123 | if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 || |
1134 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) | 1124 | ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) |
1135 | return (FALSE); | 1125 | return FALSE; |
1136 | source_link[source_len] = '\0'; | 1126 | source_link[source_len] = '\0'; |
1137 | dest_link[dest_len] = '\0'; | 1127 | dest_link[dest_len] = '\0'; |
1138 | if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 0) ) | 1128 | if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 0) ) |
@@ -1140,11 +1130,11 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1140 | unlink (destpath); | 1130 | unlink (destpath); |
1141 | symlink (source_link, destpath); | 1131 | symlink (source_link, destpath); |
1142 | } | 1132 | } |
1143 | return (TRUE); | 1133 | return TRUE; |
1144 | } /* Else not a symlink */ | 1134 | } /* Else not a symlink */ |
1145 | chmod (destpath, new_mode & ~S_IFMT); | 1135 | chmod (destpath, new_mode & ~S_IFMT); |
1146 | chown (destpath, source_stat->st_uid, source_stat->st_gid); | 1136 | chown (destpath, source_stat->st_uid, source_stat->st_gid); |
1147 | return (TRUE); | 1137 | return TRUE; |
1148 | } | 1138 | } |
1149 | /* Different types: unlink and create */ | 1139 | /* Different types: unlink and create */ |
1150 | unlink (destpath); | 1140 | unlink (destpath); |
@@ -1165,7 +1155,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1165 | break; | 1155 | break; |
1166 | symlink_val[val] = '\0'; | 1156 | symlink_val[val] = '\0'; |
1167 | if (symlink (symlink_val, destpath) == 0) | 1157 | if (symlink (symlink_val, destpath) == 0) |
1168 | return (TRUE); | 1158 | return TRUE; |
1169 | break; | 1159 | break; |
1170 | case S_IFREG: | 1160 | case S_IFREG: |
1171 | if ( ( fd = open (destpath, O_RDONLY | O_CREAT, new_mode & ~S_IFMT) ) < 0 ) | 1161 | if ( ( fd = open (destpath, O_RDONLY | O_CREAT, new_mode & ~S_IFMT) ) < 0 ) |
@@ -1185,10 +1175,10 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, | |||
1185 | break; | 1175 | break; |
1186 | do_chown: | 1176 | do_chown: |
1187 | if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0) | 1177 | if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0) |
1188 | return (TRUE); | 1178 | return TRUE; |
1189 | /*break;*/ | 1179 | /*break;*/ |
1190 | } | 1180 | } |
1191 | return (FALSE); | 1181 | return FALSE; |
1192 | } /* End Function copy_inode */ | 1182 | } /* End Function copy_inode */ |
1193 | 1183 | ||
1194 | static void free_config (void) | 1184 | static void free_config (void) |
@@ -1242,13 +1232,13 @@ static int get_uid_gid (int flag, const char *string) | |||
1242 | msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__); | 1232 | msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__); |
1243 | 1233 | ||
1244 | if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) ) | 1234 | if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) ) |
1245 | return atoi (string); | 1235 | return atoi(string); |
1246 | 1236 | ||
1247 | if ( flag == UID && ( pw_ent = getpwnam (string) ) != NULL ) | 1237 | if ( flag == UID && ( pw_ent = getpwnam (string) ) != NULL ) |
1248 | return (pw_ent->pw_uid); | 1238 | return pw_ent->pw_uid; |
1249 | 1239 | ||
1250 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) | 1240 | if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) |
1251 | return (grp_ent->gr_gid); | 1241 | return grp_ent->gr_gid; |
1252 | else if(ENABLE_DEVFSD_VERBOSE) | 1242 | else if(ENABLE_DEVFSD_VERBOSE) |
1253 | msg="group"; | 1243 | msg="group"; |
1254 | 1244 | ||
@@ -1269,7 +1259,7 @@ static mode_t get_mode (const char *string) | |||
1269 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 1259 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
1270 | 1260 | ||
1271 | if ( isdigit (string[0]) ) | 1261 | if ( isdigit (string[0]) ) |
1272 | return strtoul (string, NULL, 8); | 1262 | return strtoul(string, NULL, 8); |
1273 | if (strlen (string) != 9) | 1263 | if (strlen (string) != 9) |
1274 | msg_logger_and_die(LOG_ERR, "bad mode: %s", string); | 1264 | msg_logger_and_die(LOG_ERR, "bad mode: %s", string); |
1275 | 1265 | ||
@@ -1282,7 +1272,7 @@ static mode_t get_mode (const char *string) | |||
1282 | i=i/2; | 1272 | i=i/2; |
1283 | string++; | 1273 | string++; |
1284 | } | 1274 | } |
1285 | return (mode); | 1275 | return mode; |
1286 | } /* End Function get_mode */ | 1276 | } /* End Function get_mode */ |
1287 | 1277 | ||
1288 | static void signal_handler (int sig) | 1278 | static void signal_handler (int sig) |
@@ -1317,7 +1307,7 @@ static const char *get_variable (const char *variable, void *info) | |||
1317 | i=index_in_str_array(field_names, variable); | 1307 | i=index_in_str_array(field_names, variable); |
1318 | 1308 | ||
1319 | if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL)) | 1309 | if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL)) |
1320 | return (NULL); | 1310 | return NULL; |
1321 | if( i >= 0 && i <= 3) | 1311 | if( i >= 0 && i <= 3) |
1322 | { | 1312 | { |
1323 | debug_msg_logger(LOG_INFO, "%s: i=%d %s", __FUNCTION__, i ,field_names[i+7]); | 1313 | debug_msg_logger(LOG_INFO, "%s: i=%d %s", __FUNCTION__, i ,field_names[i+7]); |
@@ -1333,7 +1323,7 @@ static const char *get_variable (const char *variable, void *info) | |||
1333 | 1323 | ||
1334 | debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf); | 1324 | debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf); |
1335 | 1325 | ||
1336 | return (sbuf); | 1326 | return sbuf; |
1337 | } /* End Function get_variable */ | 1327 | } /* End Function get_variable */ |
1338 | 1328 | ||
1339 | static void service(struct stat statbuf, char *path) | 1329 | static void service(struct stat statbuf, char *path) |
@@ -1440,7 +1430,7 @@ static int make_dir_tree (const char *path) | |||
1440 | if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1) | 1430 | if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1) |
1441 | { | 1431 | { |
1442 | debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path); | 1432 | debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path); |
1443 | return (FALSE); | 1433 | return FALSE; |
1444 | } | 1434 | } |
1445 | return TRUE; | 1435 | return TRUE; |
1446 | } /* End Function make_dir_tree */ | 1436 | } /* End Function make_dir_tree */ |
@@ -1471,9 +1461,9 @@ static int expand_expression(char *output, unsigned int outsize, | |||
1471 | debug_msg_logger(LOG_INFO, __FUNCTION__); | 1461 | debug_msg_logger(LOG_INFO, __FUNCTION__); |
1472 | 1462 | ||
1473 | if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) ) | 1463 | if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) ) |
1474 | return (FALSE); | 1464 | return FALSE; |
1475 | expand_regexp (output, outsize, temp, devname, ex, numexp); | 1465 | expand_regexp (output, outsize, temp, devname, ex, numexp); |
1476 | return (TRUE); | 1466 | return TRUE; |
1477 | } /* End Function expand_expression */ | 1467 | } /* End Function expand_expression */ |
1478 | 1468 | ||
1479 | static void expand_regexp (char *output, size_t outsize, const char *input, | 1469 | static void expand_regexp (char *output, size_t outsize, const char *input, |
@@ -1627,9 +1617,9 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1627 | if (strncmp (devname, trans->match, len) == 0) | 1617 | if (strncmp (devname, trans->match, len) == 0) |
1628 | { | 1618 | { |
1629 | if (trans->format == NULL) | 1619 | if (trans->format == NULL) |
1630 | return (devname + len); | 1620 | return devname + len; |
1631 | sprintf (buffer, trans->format, devname + len); | 1621 | sprintf (buffer, trans->format, devname + len); |
1632 | return (buffer); | 1622 | return buffer; |
1633 | } | 1623 | } |
1634 | } | 1624 | } |
1635 | 1625 | ||
@@ -1689,7 +1679,7 @@ const char *get_old_name (const char *devname, unsigned int namelen, | |||
1689 | if(ENABLE_DEBUG && compat_name!=NULL) | 1679 | if(ENABLE_DEBUG && compat_name!=NULL) |
1690 | msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name); | 1680 | msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name); |
1691 | 1681 | ||
1692 | return (compat_name); | 1682 | return compat_name; |
1693 | } /* End Function get_old_name */ | 1683 | } /* End Function get_old_name */ |
1694 | 1684 | ||
1695 | static char get_old_ide_name (unsigned int major, unsigned int minor) | 1685 | static char get_old_ide_name (unsigned int major, unsigned int minor) |
@@ -1724,7 +1714,7 @@ static char get_old_ide_name (unsigned int major, unsigned int minor) | |||
1724 | 1714 | ||
1725 | if (minor > 63) | 1715 | if (minor > 63) |
1726 | ++letter; | 1716 | ++letter; |
1727 | return (letter); | 1717 | return letter; |
1728 | } /* End Function get_old_ide_name */ | 1718 | } /* End Function get_old_ide_name */ |
1729 | 1719 | ||
1730 | static char *write_old_sd_name (char *buffer, | 1720 | static char *write_old_sd_name (char *buffer, |
@@ -1745,7 +1735,7 @@ static char *write_old_sd_name (char *buffer, | |||
1745 | if (major == 8) | 1735 | if (major == 8) |
1746 | { | 1736 | { |
1747 | sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part); | 1737 | sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part); |
1748 | return (buffer); | 1738 | return buffer; |
1749 | } | 1739 | } |
1750 | if ( (major > 64) && (major < 72) ) | 1740 | if ( (major > 64) && (major < 72) ) |
1751 | { | 1741 | { |
@@ -1754,9 +1744,9 @@ static char *write_old_sd_name (char *buffer, | |||
1754 | sprintf (buffer, "sd%c%s", 'a' + disc_index, part); | 1744 | sprintf (buffer, "sd%c%s", 'a' + disc_index, part); |
1755 | else | 1745 | else |
1756 | sprintf (buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26,part); | 1746 | sprintf (buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26,part); |
1757 | return (buffer); | 1747 | return buffer; |
1758 | } | 1748 | } |
1759 | return (NULL); | 1749 | return NULL; |
1760 | } /* End Function write_old_sd_name */ | 1750 | } /* End Function write_old_sd_name */ |
1761 | 1751 | ||
1762 | 1752 | ||
@@ -1799,7 +1789,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1799 | /* Variable expansion */ | 1789 | /* Variable expansion */ |
1800 | input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info); | 1790 | input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info); |
1801 | if (input == NULL) | 1791 | if (input == NULL) |
1802 | return (FALSE); | 1792 | return FALSE; |
1803 | break; | 1793 | break; |
1804 | case '~': | 1794 | case '~': |
1805 | /* Home directory expansion */ | 1795 | /* Home directory expansion */ |
@@ -1810,7 +1800,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1810 | if ( ( env = getenv ("HOME") ) == NULL ) | 1800 | if ( ( env = getenv ("HOME") ) == NULL ) |
1811 | { | 1801 | { |
1812 | msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME"); | 1802 | msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME"); |
1813 | return (FALSE); | 1803 | return FALSE; |
1814 | } | 1804 | } |
1815 | len = strlen (env); | 1805 | len = strlen (env); |
1816 | if (len + out_pos >= length) | 1806 | if (len + out_pos >= length) |
@@ -1830,7 +1820,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1830 | if ( ( pwent = getpwnam (tmp) ) == NULL ) | 1820 | if ( ( pwent = getpwnam (tmp) ) == NULL ) |
1831 | { | 1821 | { |
1832 | msg_logger(LOG_INFO, "no pwent for: %s", tmp); | 1822 | msg_logger(LOG_INFO, "no pwent for: %s", tmp); |
1833 | return (FALSE); | 1823 | return FALSE; |
1834 | } | 1824 | } |
1835 | len = strlen (pwent->pw_dir); | 1825 | len = strlen (pwent->pw_dir); |
1836 | if (len + out_pos >= length) | 1826 | if (len + out_pos >= length) |
@@ -1847,16 +1837,16 @@ int st_expr_expand (char *output, unsigned int length, const char *input, | |||
1847 | if (ch == '\0') | 1837 | if (ch == '\0') |
1848 | { | 1838 | { |
1849 | memcpy (output, buffer, out_pos); | 1839 | memcpy (output, buffer, out_pos); |
1850 | return (TRUE); | 1840 | return TRUE; |
1851 | } | 1841 | } |
1852 | break; | 1842 | break; |
1853 | /* esac */ | 1843 | /* esac */ |
1854 | } | 1844 | } |
1855 | } | 1845 | } |
1856 | return (FALSE); | 1846 | return FALSE; |
1857 | st_expr_expand_out: | 1847 | st_expr_expand_out: |
1858 | msg_logger(LOG_INFO, bb_msg_small_buffer); | 1848 | msg_logger(LOG_INFO, bb_msg_small_buffer); |
1859 | return (FALSE); | 1849 | return FALSE; |
1860 | } /* End Function st_expr_expand */ | 1850 | } /* End Function st_expr_expand */ |
1861 | 1851 | ||
1862 | 1852 | ||
@@ -1899,7 +1889,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1899 | 1889 | ||
1900 | memcpy (buffer + *out_pos, tmp, len + 1); | 1890 | memcpy (buffer + *out_pos, tmp, len + 1); |
1901 | out_pos += len; | 1891 | out_pos += len; |
1902 | return (input); | 1892 | return input; |
1903 | } | 1893 | } |
1904 | /* Ordinary variable expansion, possibly in braces */ | 1894 | /* Ordinary variable expansion, possibly in braces */ |
1905 | if (ch != '{') | 1895 | if (ch != '{') |
@@ -1916,7 +1906,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1916 | if ( ( env = get_variable_v2 (tmp, func, info) ) == NULL ) | 1906 | if ( ( env = get_variable_v2 (tmp, func, info) ) == NULL ) |
1917 | { | 1907 | { |
1918 | msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp); | 1908 | msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp); |
1919 | return (NULL); | 1909 | return NULL; |
1920 | } | 1910 | } |
1921 | len = strlen (env); | 1911 | len = strlen (env); |
1922 | if (len + *out_pos >= length) | 1912 | if (len + *out_pos >= length) |
@@ -1924,7 +1914,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1924 | 1914 | ||
1925 | memcpy (buffer + *out_pos, env, len + 1); | 1915 | memcpy (buffer + *out_pos, env, len + 1); |
1926 | *out_pos += len; | 1916 | *out_pos += len; |
1927 | return (input); | 1917 | return input; |
1928 | } | 1918 | } |
1929 | /* Variable in braces: check for ':' tricks */ | 1919 | /* Variable in braces: check for ':' tricks */ |
1930 | ch = *++input; | 1920 | ch = *++input; |
@@ -1940,13 +1930,13 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1940 | safe_memcpy (tmp, input, len); | 1930 | safe_memcpy (tmp, input, len); |
1941 | ptr = expand_variable (buffer, length, out_pos, tmp, func, info ); | 1931 | ptr = expand_variable (buffer, length, out_pos, tmp, func, info ); |
1942 | if (ptr == NULL) | 1932 | if (ptr == NULL) |
1943 | return (NULL); | 1933 | return NULL; |
1944 | return (input + len); | 1934 | return input + len; |
1945 | } | 1935 | } |
1946 | if (ch != ':' || ptr[1] != '-' ) | 1936 | if (ch != ':' || ptr[1] != '-' ) |
1947 | { | 1937 | { |
1948 | msg_logger(LOG_INFO, "illegal char in var name"); | 1938 | msg_logger(LOG_INFO, "illegal char in var name"); |
1949 | return (NULL); | 1939 | return NULL; |
1950 | } | 1940 | } |
1951 | /* It's that handy "${var:-word}" expression. Check if var is defined */ | 1941 | /* It's that handy "${var:-word}" expression. Check if var is defined */ |
1952 | len = ptr - input; | 1942 | len = ptr - input; |
@@ -1971,7 +1961,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1971 | break; | 1961 | break; |
1972 | case '\0': | 1962 | case '\0': |
1973 | msg_logger(LOG_INFO,"\"}\" not found in: %s", input); | 1963 | msg_logger(LOG_INFO,"\"}\" not found in: %s", input); |
1974 | return (NULL); | 1964 | return NULL; |
1975 | default: | 1965 | default: |
1976 | break; | 1966 | break; |
1977 | } | 1967 | } |
@@ -1989,7 +1979,7 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
1989 | 1979 | ||
1990 | memcpy (buffer + *out_pos, env, len + 1); | 1980 | memcpy (buffer + *out_pos, env, len + 1); |
1991 | *out_pos += len; | 1981 | *out_pos += len; |
1992 | return (input); | 1982 | return input; |
1993 | } | 1983 | } |
1994 | /* Environment variable was not found, so process word. Advance input | 1984 | /* Environment variable was not found, so process word. Advance input |
1995 | pointer to start of word in "${var:-word}" */ | 1985 | pointer to start of word in "${var:-word}" */ |
@@ -2001,17 +1991,17 @@ static const char *expand_variable (char *buffer, unsigned int length, | |||
2001 | safe_memcpy (tmp, input, len); | 1991 | safe_memcpy (tmp, input, len); |
2002 | input = ptr; | 1992 | input = ptr; |
2003 | if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) ) | 1993 | if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) ) |
2004 | return (NULL); | 1994 | return NULL; |
2005 | len = strlen (tmp); | 1995 | len = strlen (tmp); |
2006 | if (len + *out_pos >= length) | 1996 | if (len + *out_pos >= length) |
2007 | goto expand_variable_out; | 1997 | goto expand_variable_out; |
2008 | 1998 | ||
2009 | memcpy (buffer + *out_pos, tmp, len + 1); | 1999 | memcpy (buffer + *out_pos, tmp, len + 1); |
2010 | *out_pos += len; | 2000 | *out_pos += len; |
2011 | return (input); | 2001 | return input; |
2012 | expand_variable_out: | 2002 | expand_variable_out: |
2013 | msg_logger(LOG_INFO, bb_msg_small_buffer); | 2003 | msg_logger(LOG_INFO, bb_msg_small_buffer); |
2014 | return (NULL); | 2004 | return NULL; |
2015 | } /* End Function expand_variable */ | 2005 | } /* End Function expand_variable */ |
2016 | 2006 | ||
2017 | 2007 | ||
@@ -2034,9 +2024,9 @@ static const char *get_variable_v2 (const char *variable, | |||
2034 | { | 2024 | { |
2035 | value = (*func) (variable, info); | 2025 | value = (*func) (variable, info); |
2036 | if (value != NULL) | 2026 | if (value != NULL) |
2037 | return (value); | 2027 | return value; |
2038 | } | 2028 | } |
2039 | return getenv (variable); | 2029 | return getenv(variable); |
2040 | } /* End Function get_variable */ | 2030 | } /* End Function get_variable */ |
2041 | 2031 | ||
2042 | /* END OF CODE */ | 2032 | /* END OF CODE */ |
diff --git a/modutils/insmod.c b/modutils/insmod.c index dd999a672..7b715b9c3 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c | |||
@@ -805,7 +805,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
805 | char *fullname = (char *) userdata; | 805 | char *fullname = (char *) userdata; |
806 | 806 | ||
807 | if (fullname[0] == '\0') | 807 | if (fullname[0] == '\0') |
808 | return (FALSE); | 808 | return FALSE; |
809 | else { | 809 | else { |
810 | char *tmp, *tmp1 = xstrdup(filename); | 810 | char *tmp, *tmp1 = xstrdup(filename); |
811 | tmp = bb_get_last_path_component(tmp1); | 811 | tmp = bb_get_last_path_component(tmp1); |
@@ -813,11 +813,11 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, | |||
813 | free(tmp1); | 813 | free(tmp1); |
814 | /* Stop searching if we find a match */ | 814 | /* Stop searching if we find a match */ |
815 | m_filename = xstrdup(filename); | 815 | m_filename = xstrdup(filename); |
816 | return (FALSE); | 816 | return FALSE; |
817 | } | 817 | } |
818 | free(tmp1); | 818 | free(tmp1); |
819 | } | 819 | } |
820 | return (TRUE); | 820 | return TRUE; |
821 | } | 821 | } |
822 | 822 | ||
823 | 823 | ||
diff --git a/networking/ifconfig.c b/networking/ifconfig.c index d28ca22c5..ae5b468ce 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c | |||
@@ -543,6 +543,6 @@ static int in_ether(const char *bufp, struct sockaddr *sap) | |||
543 | *ptr++ = val; | 543 | *ptr++ = val; |
544 | } while (++i < ETH_ALEN); | 544 | } while (++i < ETH_ALEN); |
545 | 545 | ||
546 | return (int) (*bufp); /* Error if we don't end at end of string. */ | 546 | return *bufp; /* Error if we don't end at end of string. */ |
547 | } | 547 | } |
548 | #endif | 548 | #endif |
diff --git a/networking/ping.c b/networking/ping.c index fc01b5e1d..658c01518 100644 --- a/networking/ping.c +++ b/networking/ping.c | |||
@@ -65,7 +65,7 @@ static int in_cksum(unsigned short *buf, int sz) | |||
65 | sum = (sum >> 16) + (sum & 0xFFFF); | 65 | sum = (sum >> 16) + (sum & 0xFFFF); |
66 | sum += (sum >> 16); | 66 | sum += (sum >> 16); |
67 | ans = ~sum; | 67 | ans = ~sum; |
68 | return (ans); | 68 | return ans; |
69 | } | 69 | } |
70 | 70 | ||
71 | #ifndef CONFIG_FEATURE_FANCY_PING | 71 | #ifndef CONFIG_FEATURE_FANCY_PING |
diff --git a/shell/ash.c b/shell/ash.c index 704d03bec..0704353f5 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -2160,8 +2160,8 @@ lookupalias(const char *name, int check) | |||
2160 | struct alias *ap = *__lookupalias(name); | 2160 | struct alias *ap = *__lookupalias(name); |
2161 | 2161 | ||
2162 | if (check && ap && (ap->flag & ALIASINUSE)) | 2162 | if (check && ap && (ap->flag & ALIASINUSE)) |
2163 | return (NULL); | 2163 | return NULL; |
2164 | return (ap); | 2164 | return ap; |
2165 | } | 2165 | } |
2166 | 2166 | ||
2167 | /* | 2167 | /* |
@@ -2196,7 +2196,7 @@ aliascmd(int argc, char **argv) | |||
2196 | } | 2196 | } |
2197 | } | 2197 | } |
2198 | 2198 | ||
2199 | return (ret); | 2199 | return ret; |
2200 | } | 2200 | } |
2201 | 2201 | ||
2202 | static int | 2202 | static int |
@@ -2217,7 +2217,7 @@ unaliascmd(int argc, char **argv) | |||
2217 | } | 2217 | } |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | return (i); | 2220 | return i; |
2221 | } | 2221 | } |
2222 | 2222 | ||
2223 | static struct alias * | 2223 | static struct alias * |
@@ -4831,10 +4831,10 @@ done: | |||
4831 | startloc = expdest - (char *)stackblock(); | 4831 | startloc = expdest - (char *)stackblock(); |
4832 | strtodest(home, SQSYNTAX, quotes); | 4832 | strtodest(home, SQSYNTAX, quotes); |
4833 | recordregion(startloc, expdest - (char *)stackblock(), 0); | 4833 | recordregion(startloc, expdest - (char *)stackblock(), 0); |
4834 | return (p); | 4834 | return p; |
4835 | lose: | 4835 | lose: |
4836 | *p = c; | 4836 | *p = c; |
4837 | return (startp); | 4837 | return startp; |
4838 | } | 4838 | } |
4839 | 4839 | ||
4840 | 4840 | ||
@@ -9969,7 +9969,7 @@ out: | |||
9969 | else | 9969 | else |
9970 | TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : "")); | 9970 | TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : "")); |
9971 | #endif | 9971 | #endif |
9972 | return (t); | 9972 | return t; |
9973 | } | 9973 | } |
9974 | 9974 | ||
9975 | 9975 | ||
@@ -12531,7 +12531,7 @@ dash_arith(const char *s) | |||
12531 | } | 12531 | } |
12532 | INTON; | 12532 | INTON; |
12533 | 12533 | ||
12534 | return (result); | 12534 | return result; |
12535 | } | 12535 | } |
12536 | 12536 | ||
12537 | 12537 | ||
@@ -12555,7 +12555,7 @@ letcmd(int argc, char **argv) | |||
12555 | i = dash_arith(*ap); | 12555 | i = dash_arith(*ap); |
12556 | } | 12556 | } |
12557 | 12557 | ||
12558 | return (!i); | 12558 | return !i; |
12559 | } | 12559 | } |
12560 | #endif /* CONFIG_ASH_MATH_SUPPORT */ | 12560 | #endif /* CONFIG_ASH_MATH_SUPPORT */ |
12561 | 12561 | ||
diff --git a/shell/hush.c b/shell/hush.c index 57b4a7ac3..a6e029e4e 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -507,7 +507,7 @@ static int builtin_export(struct child_prog *child) | |||
507 | char *name = child->argv[1]; | 507 | char *name = child->argv[1]; |
508 | 508 | ||
509 | if (name == NULL) { | 509 | if (name == NULL) { |
510 | return (builtin_env(child)); | 510 | return builtin_env(child); |
511 | } | 511 | } |
512 | 512 | ||
513 | name = strdup(name); | 513 | name = strdup(name); |
@@ -730,7 +730,7 @@ static int builtin_source(struct child_prog *child) | |||
730 | status = parse_file_outer(input); | 730 | status = parse_file_outer(input); |
731 | mark_closed(fileno(input)); | 731 | mark_closed(fileno(input)); |
732 | fclose(input); | 732 | fclose(input); |
733 | return (status); | 733 | return status; |
734 | } | 734 | } |
735 | 735 | ||
736 | static int builtin_umask(struct child_prog *child) | 736 | static int builtin_umask(struct child_prog *child) |
diff --git a/shell/msh.c b/shell/msh.c index 8f58e9457..492d3cf43 100644 --- a/shell/msh.c +++ b/shell/msh.c | |||
@@ -1022,31 +1022,31 @@ struct op *scantree(struct op *head) | |||
1022 | struct op *dotnode; | 1022 | struct op *dotnode; |
1023 | 1023 | ||
1024 | if (head == NULL) | 1024 | if (head == NULL) |
1025 | return (NULL); | 1025 | return NULL; |
1026 | 1026 | ||
1027 | if (head->left != NULL) { | 1027 | if (head->left != NULL) { |
1028 | dotnode = scantree(head->left); | 1028 | dotnode = scantree(head->left); |
1029 | if (dotnode) | 1029 | if (dotnode) |
1030 | return (dotnode); | 1030 | return dotnode; |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | if (head->right != NULL) { | 1033 | if (head->right != NULL) { |
1034 | dotnode = scantree(head->right); | 1034 | dotnode = scantree(head->right); |
1035 | if (dotnode) | 1035 | if (dotnode) |
1036 | return (dotnode); | 1036 | return dotnode; |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | if (head->words == NULL) | 1039 | if (head->words == NULL) |
1040 | return (NULL); | 1040 | return NULL; |
1041 | 1041 | ||
1042 | DBGPRINTF5(("SCANTREE: checking node %p\n", head)); | 1042 | DBGPRINTF5(("SCANTREE: checking node %p\n", head)); |
1043 | 1043 | ||
1044 | if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) { | 1044 | if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) { |
1045 | DBGPRINTF5(("SCANTREE: dot found in node %p\n", head)); | 1045 | DBGPRINTF5(("SCANTREE: dot found in node %p\n", head)); |
1046 | return (head); | 1046 | return head; |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | return (NULL); | 1049 | return NULL; |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | 1052 | ||
@@ -1219,7 +1219,7 @@ static int any(int c, char *s) | |||
1219 | 1219 | ||
1220 | static char *putn(int n) | 1220 | static char *putn(int n) |
1221 | { | 1221 | { |
1222 | return (itoa(n)); | 1222 | return itoa(n); |
1223 | } | 1223 | } |
1224 | 1224 | ||
1225 | static void next(int f) | 1225 | static void next(int f) |
@@ -1248,7 +1248,7 @@ static char *space(int n) | |||
1248 | 1248 | ||
1249 | if ((cp = getcell(n)) == 0) | 1249 | if ((cp = getcell(n)) == 0) |
1250 | err("out of string space"); | 1250 | err("out of string space"); |
1251 | return (cp); | 1251 | return cp; |
1252 | } | 1252 | } |
1253 | 1253 | ||
1254 | static char *strsave(char *s, int a) | 1254 | static char *strsave(char *s, int a) |
@@ -1258,9 +1258,9 @@ static char *strsave(char *s, int a) | |||
1258 | if ((cp = space(strlen(s) + 1)) != NULL) { | 1258 | if ((cp = space(strlen(s) + 1)) != NULL) { |
1259 | setarea((char *) cp, a); | 1259 | setarea((char *) cp, a); |
1260 | for (xp = cp; (*xp++ = *s++) != '\0';); | 1260 | for (xp = cp; (*xp++ = *s++) != '\0';); |
1261 | return (cp); | 1261 | return cp; |
1262 | } | 1262 | } |
1263 | return (""); | 1263 | return ""; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | /* | 1266 | /* |
@@ -1306,16 +1306,16 @@ static struct var *lookup(char *n) | |||
1306 | c = c * 10 + *n - '0'; | 1306 | c = c * 10 + *n - '0'; |
1307 | dummy.status = RONLY; | 1307 | dummy.status = RONLY; |
1308 | dummy.value = c <= dolc ? dolv[c] : null; | 1308 | dummy.value = c <= dolc ? dolv[c] : null; |
1309 | return (&dummy); | 1309 | return &dummy; |
1310 | } | 1310 | } |
1311 | for (vp = vlist; vp; vp = vp->next) | 1311 | for (vp = vlist; vp; vp = vp->next) |
1312 | if (eqname(vp->name, n)) | 1312 | if (eqname(vp->name, n)) |
1313 | return (vp); | 1313 | return vp; |
1314 | cp = findeq(n); | 1314 | cp = findeq(n); |
1315 | vp = (struct var *) space(sizeof(*vp)); | 1315 | vp = (struct var *) space(sizeof(*vp)); |
1316 | if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) { | 1316 | if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) { |
1317 | dummy.name = dummy.value = ""; | 1317 | dummy.name = dummy.value = ""; |
1318 | return (&dummy); | 1318 | return &dummy; |
1319 | } | 1319 | } |
1320 | for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++); | 1320 | for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++); |
1321 | if (*cp == 0) | 1321 | if (*cp == 0) |
@@ -1327,7 +1327,7 @@ static struct var *lookup(char *n) | |||
1327 | vp->next = vlist; | 1327 | vp->next = vlist; |
1328 | vp->status = GETCELL; | 1328 | vp->status = GETCELL; |
1329 | vlist = vp; | 1329 | vlist = vp; |
1330 | return (vp); | 1330 | return vp; |
1331 | } | 1331 | } |
1332 | 1332 | ||
1333 | /* | 1333 | /* |
@@ -1455,14 +1455,14 @@ static int eqname(char *n1, char *n2) | |||
1455 | for (; *n1 != '=' && *n1 != 0; n1++) | 1455 | for (; *n1 != '=' && *n1 != 0; n1++) |
1456 | if (*n2++ != *n1) | 1456 | if (*n2++ != *n1) |
1457 | return 0; | 1457 | return 0; |
1458 | return (*n2 == 0 || *n2 == '='); | 1458 | return *n2 == 0 || *n2 == '='; |
1459 | } | 1459 | } |
1460 | 1460 | ||
1461 | static char *findeq(char *cp) | 1461 | static char *findeq(char *cp) |
1462 | { | 1462 | { |
1463 | while (*cp != '\0' && *cp != '=') | 1463 | while (*cp != '\0' && *cp != '=') |
1464 | cp++; | 1464 | cp++; |
1465 | return (cp); | 1465 | return cp; |
1466 | } | 1466 | } |
1467 | 1467 | ||
1468 | /* -------- gmatch.c -------- */ | 1468 | /* -------- gmatch.c -------- */ |
@@ -1510,7 +1510,7 @@ static int gmatch(char *s, char *p) | |||
1510 | return 0; | 1510 | return 0; |
1511 | } | 1511 | } |
1512 | } | 1512 | } |
1513 | return (*s == 0); | 1513 | return *s == 0; |
1514 | } | 1514 | } |
1515 | 1515 | ||
1516 | static char *cclass(char *p, int sub) | 1516 | static char *cclass(char *p, int sub) |
@@ -1522,7 +1522,7 @@ static char *cclass(char *p, int sub) | |||
1522 | found = not; | 1522 | found = not; |
1523 | do { | 1523 | do { |
1524 | if (*p == '\0') | 1524 | if (*p == '\0') |
1525 | return ((char *) NULL); | 1525 | return NULL; |
1526 | c = *p & CMASK; | 1526 | c = *p & CMASK; |
1527 | if (p[1] == '-' && p[2] != ']') { | 1527 | if (p[1] == '-' && p[2] != ']') { |
1528 | d = p[2] & CMASK; | 1528 | d = p[2] & CMASK; |
@@ -1532,7 +1532,7 @@ static char *cclass(char *p, int sub) | |||
1532 | if (c == sub || (c <= sub && sub <= d)) | 1532 | if (c == sub || (c <= sub && sub <= d)) |
1533 | found = !not; | 1533 | found = !not; |
1534 | } while (*++p != ']'); | 1534 | } while (*++p != ']'); |
1535 | return (found ? p + 1 : (char *) NULL); | 1535 | return found ? p + 1 : NULL; |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | 1538 | ||
@@ -1596,7 +1596,7 @@ char *getcell(unsigned nbytes) | |||
1596 | i = nregio >= GROWBY ? nregio : GROWBY; | 1596 | i = nregio >= GROWBY ? nregio : GROWBY; |
1597 | p = (struct region *) sbrk(i * REGSIZE); | 1597 | p = (struct region *) sbrk(i * REGSIZE); |
1598 | if (p == (struct region *) -1) | 1598 | if (p == (struct region *) -1) |
1599 | return ((char *) NULL); | 1599 | return NULL; |
1600 | p--; | 1600 | p--; |
1601 | if (p != areatop) { | 1601 | if (p != areatop) { |
1602 | puts("not contig"); | 1602 | puts("not contig"); |
@@ -1608,7 +1608,7 @@ char *getcell(unsigned nbytes) | |||
1608 | q->next = areabot; | 1608 | q->next = areabot; |
1609 | q->area = BUSY; | 1609 | q->area = BUSY; |
1610 | areatop = q; | 1610 | areatop = q; |
1611 | found: | 1611 | found: |
1612 | /* | 1612 | /* |
1613 | * we found a FREE area big enough, pointed to by 'p', and up to 'q' | 1613 | * we found a FREE area big enough, pointed to by 'p', and up to 'q' |
1614 | */ | 1614 | */ |
@@ -1626,7 +1626,7 @@ char *getcell(unsigned nbytes) | |||
1626 | p->next = areanxt; | 1626 | p->next = areanxt; |
1627 | } | 1627 | } |
1628 | p->area = areanum; | 1628 | p->area = areanum; |
1629 | return ((char *) (p + 1)); | 1629 | return (char *) (p + 1); |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | static void freecell(char *cp) | 1632 | static void freecell(char *cp) |
@@ -1732,7 +1732,7 @@ static struct op *pipeline(int cf) | |||
1732 | } | 1732 | } |
1733 | 1733 | ||
1734 | DBGPRINTF7(("PIPELINE: returning t=%p\n", t)); | 1734 | DBGPRINTF7(("PIPELINE: returning t=%p\n", t)); |
1735 | return (t); | 1735 | return t; |
1736 | } | 1736 | } |
1737 | 1737 | ||
1738 | static struct op *andor(void) | 1738 | static struct op *andor(void) |
@@ -1760,7 +1760,7 @@ static struct op *andor(void) | |||
1760 | } | 1760 | } |
1761 | 1761 | ||
1762 | DBGPRINTF7(("ANDOR: returning t=%p\n", t)); | 1762 | DBGPRINTF7(("ANDOR: returning t=%p\n", t)); |
1763 | return (t); | 1763 | return t; |
1764 | } | 1764 | } |
1765 | 1765 | ||
1766 | static struct op *c_list(void) | 1766 | static struct op *c_list(void) |
@@ -1780,7 +1780,7 @@ static struct op *c_list(void) | |||
1780 | || (multiline && c == '\n')) { | 1780 | || (multiline && c == '\n')) { |
1781 | 1781 | ||
1782 | if ((p = andor()) == NULL) | 1782 | if ((p = andor()) == NULL) |
1783 | return (t); | 1783 | return t; |
1784 | 1784 | ||
1785 | if ((peeksym = yylex(0)) == '&') | 1785 | if ((peeksym = yylex(0)) == '&') |
1786 | p = block(TASYNC, p, NOBLOCK, NOWORDS); | 1786 | p = block(TASYNC, p, NOBLOCK, NOWORDS); |
@@ -1792,7 +1792,7 @@ static struct op *c_list(void) | |||
1792 | } | 1792 | } |
1793 | /* IF */ | 1793 | /* IF */ |
1794 | DBGPRINTF7(("C_LIST: returning t=%p\n", t)); | 1794 | DBGPRINTF7(("C_LIST: returning t=%p\n", t)); |
1795 | return (t); | 1795 | return t; |
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | static int synio(int cf) | 1798 | static int synio(int cf) |
@@ -1852,7 +1852,7 @@ static struct op *simple(void) | |||
1852 | break; | 1852 | break; |
1853 | 1853 | ||
1854 | default: | 1854 | default: |
1855 | return (t); | 1855 | return t; |
1856 | } | 1856 | } |
1857 | } | 1857 | } |
1858 | } | 1858 | } |
@@ -1867,7 +1867,7 @@ static struct op *nested(int type, int mark) | |||
1867 | t = c_list(); | 1867 | t = c_list(); |
1868 | musthave(mark, 0); | 1868 | musthave(mark, 0); |
1869 | multiline--; | 1869 | multiline--; |
1870 | return (block(type, t, NOBLOCK, NOWORDS)); | 1870 | return block(type, t, NOBLOCK, NOWORDS); |
1871 | } | 1871 | } |
1872 | 1872 | ||
1873 | static struct op *command(int cf) | 1873 | static struct op *command(int cf) |
@@ -1894,7 +1894,7 @@ static struct op *command(int cf) | |||
1894 | peeksym = c; | 1894 | peeksym = c; |
1895 | if ((t = simple()) == NULL) { | 1895 | if ((t = simple()) == NULL) { |
1896 | if (iolist == NULL) | 1896 | if (iolist == NULL) |
1897 | return ((struct op *) NULL); | 1897 | return NULL; |
1898 | t = newtp(); | 1898 | t = newtp(); |
1899 | t->type = TCOM; | 1899 | t->type = TCOM; |
1900 | } | 1900 | } |
@@ -1980,7 +1980,7 @@ static struct op *command(int cf) | |||
1980 | 1980 | ||
1981 | DBGPRINTF(("COMMAND: returning %p\n", t)); | 1981 | DBGPRINTF(("COMMAND: returning %p\n", t)); |
1982 | 1982 | ||
1983 | return (t); | 1983 | return t; |
1984 | } | 1984 | } |
1985 | 1985 | ||
1986 | static struct op *dowholefile(int type, int mark) | 1986 | static struct op *dowholefile(int type, int mark) |
@@ -1994,7 +1994,7 @@ static struct op *dowholefile(int type, int mark) | |||
1994 | multiline--; | 1994 | multiline--; |
1995 | t = block(type, t, NOBLOCK, NOWORDS); | 1995 | t = block(type, t, NOBLOCK, NOWORDS); |
1996 | DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t)); | 1996 | DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t)); |
1997 | return (t); | 1997 | return t; |
1998 | } | 1998 | } |
1999 | 1999 | ||
2000 | static struct op *dogroup(int onlydone) | 2000 | static struct op *dogroup(int onlydone) |
@@ -2004,12 +2004,12 @@ static struct op *dogroup(int onlydone) | |||
2004 | 2004 | ||
2005 | c = yylex(CONTIN); | 2005 | c = yylex(CONTIN); |
2006 | if (c == DONE && onlydone) | 2006 | if (c == DONE && onlydone) |
2007 | return ((struct op *) NULL); | 2007 | return NULL; |
2008 | if (c != DO) | 2008 | if (c != DO) |
2009 | SYNTAXERR; | 2009 | SYNTAXERR; |
2010 | mylist = c_list(); | 2010 | mylist = c_list(); |
2011 | musthave(DONE, 0); | 2011 | musthave(DONE, 0); |
2012 | return (mylist); | 2012 | return mylist; |
2013 | } | 2013 | } |
2014 | 2014 | ||
2015 | static struct op *thenpart(void) | 2015 | static struct op *thenpart(void) |
@@ -2019,7 +2019,7 @@ static struct op *thenpart(void) | |||
2019 | 2019 | ||
2020 | if ((c = yylex(0)) != THEN) { | 2020 | if ((c = yylex(0)) != THEN) { |
2021 | peeksym = c; | 2021 | peeksym = c; |
2022 | return ((struct op *) NULL); | 2022 | return NULL; |
2023 | } | 2023 | } |
2024 | t = newtp(); | 2024 | t = newtp(); |
2025 | t->type = 0; | 2025 | t->type = 0; |
@@ -2027,7 +2027,7 @@ static struct op *thenpart(void) | |||
2027 | if (t->left == NULL) | 2027 | if (t->left == NULL) |
2028 | SYNTAXERR; | 2028 | SYNTAXERR; |
2029 | t->right = elsepart(); | 2029 | t->right = elsepart(); |
2030 | return (t); | 2030 | return t; |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | static struct op *elsepart(void) | 2033 | static struct op *elsepart(void) |
@@ -2039,18 +2039,18 @@ static struct op *elsepart(void) | |||
2039 | case ELSE: | 2039 | case ELSE: |
2040 | if ((t = c_list()) == NULL) | 2040 | if ((t = c_list()) == NULL) |
2041 | SYNTAXERR; | 2041 | SYNTAXERR; |
2042 | return (t); | 2042 | return t; |
2043 | 2043 | ||
2044 | case ELIF: | 2044 | case ELIF: |
2045 | t = newtp(); | 2045 | t = newtp(); |
2046 | t->type = TELIF; | 2046 | t->type = TELIF; |
2047 | t->left = c_list(); | 2047 | t->left = c_list(); |
2048 | t->right = thenpart(); | 2048 | t->right = thenpart(); |
2049 | return (t); | 2049 | return t; |
2050 | 2050 | ||
2051 | default: | 2051 | default: |
2052 | peeksym = c; | 2052 | peeksym = c; |
2053 | return ((struct op *) NULL); | 2053 | return NULL; |
2054 | } | 2054 | } |
2055 | } | 2055 | } |
2056 | 2056 | ||
@@ -2065,7 +2065,7 @@ static struct op *caselist(void) | |||
2065 | } | 2065 | } |
2066 | 2066 | ||
2067 | DBGPRINTF(("CASELIST, returning t=%p\n", t)); | 2067 | DBGPRINTF(("CASELIST, returning t=%p\n", t)); |
2068 | return (t); | 2068 | return t; |
2069 | } | 2069 | } |
2070 | 2070 | ||
2071 | static struct op *casepart(void) | 2071 | static struct op *casepart(void) |
@@ -2084,7 +2084,7 @@ static struct op *casepart(void) | |||
2084 | 2084 | ||
2085 | DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t)); | 2085 | DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t)); |
2086 | 2086 | ||
2087 | return (t); | 2087 | return t; |
2088 | } | 2088 | } |
2089 | 2089 | ||
2090 | static char **pattern(void) | 2090 | static char **pattern(void) |
@@ -2100,7 +2100,7 @@ static char **pattern(void) | |||
2100 | peeksym = c; | 2100 | peeksym = c; |
2101 | word(NOWORD); | 2101 | word(NOWORD); |
2102 | 2102 | ||
2103 | return (copyw()); | 2103 | return copyw(); |
2104 | } | 2104 | } |
2105 | 2105 | ||
2106 | static char **wordlist(void) | 2106 | static char **wordlist(void) |
@@ -2109,14 +2109,14 @@ static char **wordlist(void) | |||
2109 | 2109 | ||
2110 | if ((c = yylex(0)) != IN) { | 2110 | if ((c = yylex(0)) != IN) { |
2111 | peeksym = c; | 2111 | peeksym = c; |
2112 | return ((char **) NULL); | 2112 | return NULL; |
2113 | } | 2113 | } |
2114 | startl = 0; | 2114 | startl = 0; |
2115 | while ((c = yylex(0)) == WORD) | 2115 | while ((c = yylex(0)) == WORD) |
2116 | word(yylval.cp); | 2116 | word(yylval.cp); |
2117 | word(NOWORD); | 2117 | word(NOWORD); |
2118 | peeksym = c; | 2118 | peeksym = c; |
2119 | return (copyw()); | 2119 | return copyw(); |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | /* | 2122 | /* |
@@ -2127,11 +2127,11 @@ static struct op *list(struct op *t1, struct op *t2) | |||
2127 | DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2)); | 2127 | DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2)); |
2128 | 2128 | ||
2129 | if (t1 == NULL) | 2129 | if (t1 == NULL) |
2130 | return (t2); | 2130 | return t2; |
2131 | if (t2 == NULL) | 2131 | if (t2 == NULL) |
2132 | return (t1); | 2132 | return t1; |
2133 | 2133 | ||
2134 | return (block(TLIST, t1, t2, NOWORDS)); | 2134 | return block(TLIST, t1, t2, NOWORDS); |
2135 | } | 2135 | } |
2136 | 2136 | ||
2137 | static struct op *block(int type, struct op *t1, struct op *t2, char **wp) | 2137 | static struct op *block(int type, struct op *t1, struct op *t2, char **wp) |
@@ -2149,7 +2149,7 @@ static struct op *block(int type, struct op *t1, struct op *t2, char **wp) | |||
2149 | DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1, | 2149 | DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1, |
2150 | t2)); | 2150 | t2)); |
2151 | 2151 | ||
2152 | return (t); | 2152 | return t; |
2153 | } | 2153 | } |
2154 | 2154 | ||
2155 | /* See if given string is a shell multiline (FOR, IF, etc) */ | 2155 | /* See if given string is a shell multiline (FOR, IF, etc) */ |
@@ -2162,7 +2162,7 @@ static int rlookup(char *n) | |||
2162 | for (rp = restab; rp->r_name; rp++) | 2162 | for (rp = restab; rp->r_name; rp++) |
2163 | if (strcmp(rp->r_name, n) == 0) { | 2163 | if (strcmp(rp->r_name, n) == 0) { |
2164 | DBGPRINTF7(("RLOOKUP: match, returning %d\n", rp->r_val)); | 2164 | DBGPRINTF7(("RLOOKUP: match, returning %d\n", rp->r_val)); |
2165 | return (rp->r_val); /* Return numeric code for shell multiline */ | 2165 | return rp->r_val; /* Return numeric code for shell multiline */ |
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | DBGPRINTF7(("RLOOKUP: NO match, returning 0\n")); | 2168 | DBGPRINTF7(("RLOOKUP: NO match, returning 0\n")); |
@@ -2183,7 +2183,7 @@ static struct op *newtp(void) | |||
2183 | 2183 | ||
2184 | DBGPRINTF3(("NEWTP: allocated %p\n", t)); | 2184 | DBGPRINTF3(("NEWTP: allocated %p\n", t)); |
2185 | 2185 | ||
2186 | return (t); | 2186 | return t; |
2187 | } | 2187 | } |
2188 | 2188 | ||
2189 | static struct op *namelist(struct op *t) | 2189 | static struct op *namelist(struct op *t) |
@@ -2204,14 +2204,14 @@ static struct op *namelist(struct op *t) | |||
2204 | t->ioact = t->left->ioact; | 2204 | t->ioact = t->left->ioact; |
2205 | t->left->ioact = NULL; | 2205 | t->left->ioact = NULL; |
2206 | } | 2206 | } |
2207 | return (t); | 2207 | return t; |
2208 | } | 2208 | } |
2209 | 2209 | ||
2210 | word(NOWORD); | 2210 | word(NOWORD); |
2211 | t->words = copyw(); | 2211 | t->words = copyw(); |
2212 | 2212 | ||
2213 | 2213 | ||
2214 | return (t); | 2214 | return t; |
2215 | } | 2215 | } |
2216 | 2216 | ||
2217 | static char **copyw(void) | 2217 | static char **copyw(void) |
@@ -2220,7 +2220,7 @@ static char **copyw(void) | |||
2220 | 2220 | ||
2221 | wd = getwords(wdlist); | 2221 | wd = getwords(wdlist); |
2222 | wdlist = 0; | 2222 | wdlist = 0; |
2223 | return (wd); | 2223 | return wd; |
2224 | } | 2224 | } |
2225 | 2225 | ||
2226 | static void word(char *cp) | 2226 | static void word(char *cp) |
@@ -2234,7 +2234,7 @@ static struct ioword **copyio(void) | |||
2234 | 2234 | ||
2235 | iop = (struct ioword **) getwords(iolist); | 2235 | iop = (struct ioword **) getwords(iolist); |
2236 | iolist = 0; | 2236 | iolist = 0; |
2237 | return (iop); | 2237 | return iop; |
2238 | } | 2238 | } |
2239 | 2239 | ||
2240 | static struct ioword *io(int u, int f, char *cp) | 2240 | static struct ioword *io(int u, int f, char *cp) |
@@ -2246,7 +2246,7 @@ static struct ioword *io(int u, int f, char *cp) | |||
2246 | iop->io_flag = f; | 2246 | iop->io_flag = f; |
2247 | iop->io_name = cp; | 2247 | iop->io_name = cp; |
2248 | iolist = addword((char *) iop, iolist); | 2248 | iolist = addword((char *) iop, iolist); |
2249 | return (iop); | 2249 | return iop; |
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | static void zzerr(void) | 2252 | static void zzerr(void) |
@@ -2274,7 +2274,7 @@ static int yylex(int cf) | |||
2274 | peeksym = 0; | 2274 | peeksym = 0; |
2275 | if (c == '\n') | 2275 | if (c == '\n') |
2276 | startl = 1; | 2276 | startl = 1; |
2277 | return (c); | 2277 | return c; |
2278 | } | 2278 | } |
2279 | 2279 | ||
2280 | 2280 | ||
@@ -2311,14 +2311,14 @@ static int yylex(int cf) | |||
2311 | 2311 | ||
2312 | case 0: | 2312 | case 0: |
2313 | DBGPRINTF5(("YYLEX: return 0, c=%d\n", c)); | 2313 | DBGPRINTF5(("YYLEX: return 0, c=%d\n", c)); |
2314 | return (c); | 2314 | return c; |
2315 | 2315 | ||
2316 | case '$': | 2316 | case '$': |
2317 | DBGPRINTF9(("YYLEX: found $\n")); | 2317 | DBGPRINTF9(("YYLEX: found $\n")); |
2318 | *e.linep++ = c; | 2318 | *e.linep++ = c; |
2319 | if ((c = my_getc(0)) == '{') { | 2319 | if ((c = my_getc(0)) == '{') { |
2320 | if ((c = collect(c, '}')) != '\0') | 2320 | if ((c = collect(c, '}')) != '\0') |
2321 | return (c); | 2321 | return c; |
2322 | goto pack; | 2322 | goto pack; |
2323 | } | 2323 | } |
2324 | break; | 2324 | break; |
@@ -2327,7 +2327,7 @@ static int yylex(int cf) | |||
2327 | case '\'': | 2327 | case '\'': |
2328 | case '"': | 2328 | case '"': |
2329 | if ((c = collect(c, c)) != '\0') | 2329 | if ((c = collect(c, c)) != '\0') |
2330 | return (c); | 2330 | return c; |
2331 | goto pack; | 2331 | goto pack; |
2332 | 2332 | ||
2333 | case '|': | 2333 | case '|': |
@@ -2336,17 +2336,17 @@ static int yylex(int cf) | |||
2336 | startl = 1; | 2336 | startl = 1; |
2337 | /* If more chars process them, else return NULL char */ | 2337 | /* If more chars process them, else return NULL char */ |
2338 | if ((c1 = dual(c)) != '\0') | 2338 | if ((c1 = dual(c)) != '\0') |
2339 | return (c1); | 2339 | return c1; |
2340 | else | 2340 | else |
2341 | return (c); | 2341 | return c; |
2342 | 2342 | ||
2343 | case '^': | 2343 | case '^': |
2344 | startl = 1; | 2344 | startl = 1; |
2345 | return ('|'); | 2345 | return '|'; |
2346 | case '>': | 2346 | case '>': |
2347 | case '<': | 2347 | case '<': |
2348 | diag(c); | 2348 | diag(c); |
2349 | return (c); | 2349 | return c; |
2350 | 2350 | ||
2351 | case '\n': | 2351 | case '\n': |
2352 | nlseen++; | 2352 | nlseen++; |
@@ -2363,12 +2363,12 @@ static int yylex(int cf) | |||
2363 | if (cf & CONTIN) | 2363 | if (cf & CONTIN) |
2364 | goto loop; | 2364 | goto loop; |
2365 | } | 2365 | } |
2366 | return (c); | 2366 | return c; |
2367 | 2367 | ||
2368 | case '(': | 2368 | case '(': |
2369 | case ')': | 2369 | case ')': |
2370 | startl = 1; | 2370 | startl = 1; |
2371 | return (c); | 2371 | return c; |
2372 | } | 2372 | } |
2373 | 2373 | ||
2374 | unget(c); | 2374 | unget(c); |
@@ -2390,11 +2390,11 @@ static int yylex(int cf) | |||
2390 | 2390 | ||
2391 | if (atstart && (c = rlookup(line)) != 0) { | 2391 | if (atstart && (c = rlookup(line)) != 0) { |
2392 | startl = 1; | 2392 | startl = 1; |
2393 | return (c); | 2393 | return c; |
2394 | } | 2394 | } |
2395 | 2395 | ||
2396 | yylval.cp = strsave(line, areanum); | 2396 | yylval.cp = strsave(line, areanum); |
2397 | return (WORD); | 2397 | return WORD; |
2398 | } | 2398 | } |
2399 | 2399 | ||
2400 | 2400 | ||
@@ -2412,7 +2412,7 @@ static int collect(int c, int c1) | |||
2412 | s[1] = 0; | 2412 | s[1] = 0; |
2413 | prs("no closing "); | 2413 | prs("no closing "); |
2414 | yyerror(s); | 2414 | yyerror(s); |
2415 | return (YYERRCODE); | 2415 | return YYERRCODE; |
2416 | } | 2416 | } |
2417 | if (interactive && c == '\n' && e.iop <= iostack) { | 2417 | if (interactive && c == '\n' && e.iop <= iostack) { |
2418 | #ifdef CONFIG_FEATURE_COMMAND_EDITING | 2418 | #ifdef CONFIG_FEATURE_COMMAND_EDITING |
@@ -2448,7 +2448,7 @@ static int dual(int c) | |||
2448 | if (c == 0) | 2448 | if (c == 0) |
2449 | unget(*--cp); /* String is not a shell multiline, put peek char back */ | 2449 | unget(*--cp); /* String is not a shell multiline, put peek char back */ |
2450 | 2450 | ||
2451 | return (c); /* String is multiline, return numeric multiline (restab) code */ | 2451 | return c; /* String is multiline, return numeric multiline (restab) code */ |
2452 | } | 2452 | } |
2453 | 2453 | ||
2454 | static void diag(int ec) | 2454 | static void diag(int ec) |
@@ -2481,7 +2481,7 @@ static char *tree(unsigned size) | |||
2481 | fail(); | 2481 | fail(); |
2482 | /* NOTREACHED */ | 2482 | /* NOTREACHED */ |
2483 | } | 2483 | } |
2484 | return (t); | 2484 | return t; |
2485 | } | 2485 | } |
2486 | 2486 | ||
2487 | /* VARARGS1 */ | 2487 | /* VARARGS1 */ |
@@ -2701,7 +2701,7 @@ static int execute(struct op *t, int *pin, int *pout, int act) | |||
2701 | } | 2701 | } |
2702 | 2702 | ||
2703 | DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv)); | 2703 | DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv)); |
2704 | return (rv); | 2704 | return rv; |
2705 | } | 2705 | } |
2706 | 2706 | ||
2707 | static int | 2707 | static int |
@@ -2759,7 +2759,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) | |||
2759 | if (cp == NULL && t->ioact == NULL) { | 2759 | if (cp == NULL && t->ioact == NULL) { |
2760 | while ((cp = *owp++) != NULL && assign(cp, COPYV)); | 2760 | while ((cp = *owp++) != NULL && assign(cp, COPYV)); |
2761 | DBGPRINTF(("FORKEXEC: returning setstatus()\n")); | 2761 | DBGPRINTF(("FORKEXEC: returning setstatus()\n")); |
2762 | return (setstatus(0)); | 2762 | return setstatus(0); |
2763 | } else if (cp != NULL) { | 2763 | } else if (cp != NULL) { |
2764 | shcom = inbuilt(cp); | 2764 | shcom = inbuilt(cp); |
2765 | } | 2765 | } |
@@ -2864,7 +2864,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) | |||
2864 | if (iosetup(*iopp++, pin != NULL, pout != NULL)) { | 2864 | if (iosetup(*iopp++, pin != NULL, pout != NULL)) { |
2865 | if (forked) | 2865 | if (forked) |
2866 | _exit(rv); | 2866 | _exit(rv); |
2867 | return (rv); | 2867 | return rv; |
2868 | } | 2868 | } |
2869 | } | 2869 | } |
2870 | 2870 | ||
@@ -2873,7 +2873,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) | |||
2873 | if (forked) | 2873 | if (forked) |
2874 | _exit(i); | 2874 | _exit(i); |
2875 | DBGPRINTF(("FORKEXEC: returning i=%d\n", i)); | 2875 | DBGPRINTF(("FORKEXEC: returning i=%d\n", i)); |
2876 | return (i); | 2876 | return i; |
2877 | } | 2877 | } |
2878 | 2878 | ||
2879 | /* should use FIOCEXCL */ | 2879 | /* should use FIOCEXCL */ |
@@ -3005,7 +3005,7 @@ static struct op **find1case(struct op *t, char *w) | |||
3005 | 3005 | ||
3006 | if (t == NULL) { | 3006 | if (t == NULL) { |
3007 | DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n")); | 3007 | DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n")); |
3008 | return ((struct op **) NULL); | 3008 | return NULL; |
3009 | } | 3009 | } |
3010 | 3010 | ||
3011 | DBGPRINTF3(("FIND1CASE: enter, t->type=%d (%s)\n", t->type, | 3011 | DBGPRINTF3(("FIND1CASE: enter, t->type=%d (%s)\n", t->type, |
@@ -3014,7 +3014,7 @@ static struct op **find1case(struct op *t, char *w) | |||
3014 | if (t->type == TLIST) { | 3014 | if (t->type == TLIST) { |
3015 | if ((tp = find1case(t->left, w)) != NULL) { | 3015 | if ((tp = find1case(t->left, w)) != NULL) { |
3016 | DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp)); | 3016 | DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp)); |
3017 | return (tp); | 3017 | return tp; |
3018 | } | 3018 | } |
3019 | t1 = t->right; /* TPAT */ | 3019 | t1 = t->right; /* TPAT */ |
3020 | } else | 3020 | } else |
@@ -3024,18 +3024,19 @@ static struct op **find1case(struct op *t, char *w) | |||
3024 | if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) { | 3024 | if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) { |
3025 | DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n", | 3025 | DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n", |
3026 | &t1->left)); | 3026 | &t1->left)); |
3027 | return (&t1->left); | 3027 | return &t1->left; |
3028 | } | 3028 | } |
3029 | 3029 | ||
3030 | DBGPRINTF(("FIND1CASE: returning NULL\n")); | 3030 | DBGPRINTF(("FIND1CASE: returning NULL\n")); |
3031 | return ((struct op **) NULL); | 3031 | return NULL; |
3032 | } | 3032 | } |
3033 | 3033 | ||
3034 | static struct op *findcase(struct op *t, char *w) | 3034 | static struct op *findcase(struct op *t, char *w) |
3035 | { | 3035 | { |
3036 | struct op **tp; | 3036 | struct op **tp; |
3037 | 3037 | ||
3038 | return ((tp = find1case(t, w)) != NULL ? *tp : (struct op *) NULL); | 3038 | tp = find1case(t, w); |
3039 | return tp != NULL ? *tp : NULL; | ||
3039 | } | 3040 | } |
3040 | 3041 | ||
3041 | /* | 3042 | /* |
@@ -3106,14 +3107,14 @@ static int waitfor(int lastpid, int canintr) | |||
3106 | onintr(0); | 3107 | onintr(0); |
3107 | } | 3108 | } |
3108 | } | 3109 | } |
3109 | return (rv); | 3110 | return rv; |
3110 | } | 3111 | } |
3111 | 3112 | ||
3112 | static int setstatus(int s) | 3113 | static int setstatus(int s) |
3113 | { | 3114 | { |
3114 | exstat = s; | 3115 | exstat = s; |
3115 | setval(lookup("?"), putn(s)); | 3116 | setval(lookup("?"), putn(s)); |
3116 | return (s); | 3117 | return s; |
3117 | } | 3118 | } |
3118 | 3119 | ||
3119 | /* | 3120 | /* |
@@ -3165,20 +3166,20 @@ static char *rexecve(char *c, char **v, char **envp) | |||
3165 | *v = e.linep; | 3166 | *v = e.linep; |
3166 | execve(DEFAULT_SHELL, v, envp); | 3167 | execve(DEFAULT_SHELL, v, envp); |
3167 | *v = tp; | 3168 | *v = tp; |
3168 | return ("no Shell"); | 3169 | return "no Shell"; |
3169 | 3170 | ||
3170 | case ENOMEM: | 3171 | case ENOMEM: |
3171 | return ((char *) bb_msg_memory_exhausted); | 3172 | return (char *) bb_msg_memory_exhausted; |
3172 | 3173 | ||
3173 | case E2BIG: | 3174 | case E2BIG: |
3174 | return ("argument list too long"); | 3175 | return "argument list too long"; |
3175 | 3176 | ||
3176 | case EACCES: | 3177 | case EACCES: |
3177 | eacces++; | 3178 | eacces++; |
3178 | break; | 3179 | break; |
3179 | } | 3180 | } |
3180 | } | 3181 | } |
3181 | return (errno == ENOENT ? "not found" : "cannot execute"); | 3182 | return errno == ENOENT ? "not found" : "cannot execute"; |
3182 | } | 3183 | } |
3183 | 3184 | ||
3184 | /* | 3185 | /* |
@@ -3228,7 +3229,7 @@ static int run(struct ioarg *argp, int (*f) (struct ioarg *)) | |||
3228 | outtree = otree; | 3229 | outtree = otree; |
3229 | freearea(areanum--); | 3230 | freearea(areanum--); |
3230 | 3231 | ||
3231 | return (rv); | 3232 | return rv; |
3232 | } | 3233 | } |
3233 | 3234 | ||
3234 | /* -------- do.c -------- */ | 3235 | /* -------- do.c -------- */ |
@@ -3412,7 +3413,7 @@ static int dodot(struct op *t) | |||
3412 | 3413 | ||
3413 | DBGPRINTF(("DODOT: returning exstat=%d\n", exstat)); | 3414 | DBGPRINTF(("DODOT: returning exstat=%d\n", exstat)); |
3414 | 3415 | ||
3415 | return (exstat); | 3416 | return exstat; |
3416 | } | 3417 | } |
3417 | 3418 | ||
3418 | } /* While */ | 3419 | } /* While */ |
@@ -3458,12 +3459,12 @@ static int doread(struct op *t) | |||
3458 | break; | 3459 | break; |
3459 | setval(lookup(*wp), e.linep); | 3460 | setval(lookup(*wp), e.linep); |
3460 | } | 3461 | } |
3461 | return (nb <= 0); | 3462 | return nb <= 0; |
3462 | } | 3463 | } |
3463 | 3464 | ||
3464 | static int doeval(struct op *t) | 3465 | static int doeval(struct op *t) |
3465 | { | 3466 | { |
3466 | return (RUN(awordlist, t->words + 1, wdchar)); | 3467 | return RUN(awordlist, t->words + 1, wdchar); |
3467 | } | 3468 | } |
3468 | 3469 | ||
3469 | static int dotrap(struct op *t) | 3470 | static int dotrap(struct op *t) |
@@ -3513,7 +3514,7 @@ static int getsig(char *s) | |||
3513 | err("trap: bad signal number"); | 3514 | err("trap: bad signal number"); |
3514 | n = 0; | 3515 | n = 0; |
3515 | } | 3516 | } |
3516 | return (n); | 3517 | return n; |
3517 | } | 3518 | } |
3518 | 3519 | ||
3519 | static void setsig(int n, sighandler_t f) | 3520 | static void setsig(int n, sighandler_t f) |
@@ -3543,17 +3544,17 @@ static int getn(char *as) | |||
3543 | prs(as); | 3544 | prs(as); |
3544 | err(": bad number"); | 3545 | err(": bad number"); |
3545 | } | 3546 | } |
3546 | return (n * m); | 3547 | return n * m; |
3547 | } | 3548 | } |
3548 | 3549 | ||
3549 | static int dobreak(struct op *t) | 3550 | static int dobreak(struct op *t) |
3550 | { | 3551 | { |
3551 | return (brkcontin(t->words[1], 1)); | 3552 | return brkcontin(t->words[1], 1); |
3552 | } | 3553 | } |
3553 | 3554 | ||
3554 | static int docontinue(struct op *t) | 3555 | static int docontinue(struct op *t) |
3555 | { | 3556 | { |
3556 | return (brkcontin(t->words[1], 0)); | 3557 | return brkcontin(t->words[1], 0); |
3557 | } | 3558 | } |
3558 | 3559 | ||
3559 | static int brkcontin(char *cp, int val) | 3560 | static int brkcontin(char *cp, int val) |
@@ -3714,9 +3715,9 @@ static int (*inbuilt(char *s)) (struct op *) { | |||
3714 | 3715 | ||
3715 | for (bp = builtincmds; bp->name != NULL; bp++) | 3716 | for (bp = builtincmds; bp->name != NULL; bp++) |
3716 | if (strcmp(bp->name, s) == 0) | 3717 | if (strcmp(bp->name, s) == 0) |
3717 | return (bp->builtinfunc); | 3718 | return bp->builtinfunc; |
3718 | 3719 | ||
3719 | return (NULL); | 3720 | return NULL; |
3720 | } | 3721 | } |
3721 | 3722 | ||
3722 | /* -------- eval.c -------- */ | 3723 | /* -------- eval.c -------- */ |
@@ -3766,7 +3767,7 @@ static char **eval(char **ap, int f) | |||
3766 | } else | 3767 | } else |
3767 | gflg = 1; | 3768 | gflg = 1; |
3768 | 3769 | ||
3769 | return (gflg ? (char **) NULL : wp); | 3770 | return gflg ? (char **) NULL : wp; |
3770 | } | 3771 | } |
3771 | 3772 | ||
3772 | /* | 3773 | /* |
@@ -3784,7 +3785,7 @@ static char **makenv(int all, struct wdblock *wb) | |||
3784 | if (all || vp->status & EXPORT) | 3785 | if (all || vp->status & EXPORT) |
3785 | wb = addword(vp->name, wb); | 3786 | wb = addword(vp->name, wb); |
3786 | wb = addword((char *) 0, wb); | 3787 | wb = addword((char *) 0, wb); |
3787 | return (getwords(wb)); | 3788 | return getwords(wb); |
3788 | } | 3789 | } |
3789 | 3790 | ||
3790 | static char *evalstr(char *cp, int f) | 3791 | static char *evalstr(char *cp, int f) |
@@ -3801,7 +3802,7 @@ static char *evalstr(char *cp, int f) | |||
3801 | DELETE(wb); | 3802 | DELETE(wb); |
3802 | } else | 3803 | } else |
3803 | cp = NULL; | 3804 | cp = NULL; |
3804 | return (cp); | 3805 | return cp; |
3805 | } | 3806 | } |
3806 | 3807 | ||
3807 | static int expand(char *cp, struct wdblock **wbp, int f) | 3808 | static int expand(char *cp, struct wdblock **wbp, int f) |
@@ -3844,7 +3845,7 @@ static int expand(char *cp, struct wdblock **wbp, int f) | |||
3844 | quitenv(); | 3845 | quitenv(); |
3845 | } else | 3846 | } else |
3846 | gflg = 1; | 3847 | gflg = 1; |
3847 | return (gflg == 0); | 3848 | return gflg == 0; |
3848 | } | 3849 | } |
3849 | 3850 | ||
3850 | /* | 3851 | /* |
@@ -3868,7 +3869,7 @@ static char *blank(int f) | |||
3868 | if (sp == e.linep) | 3869 | if (sp == e.linep) |
3869 | return 0; | 3870 | return 0; |
3870 | *e.linep++ = 0; | 3871 | *e.linep++ = 0; |
3871 | return (sp); | 3872 | return sp; |
3872 | 3873 | ||
3873 | default: | 3874 | default: |
3874 | if (f & DOBLANK && any(c, ifs->value)) | 3875 | if (f & DOBLANK && any(c, ifs->value)) |
@@ -3913,7 +3914,7 @@ static char *blank(int f) | |||
3913 | *e.linep++ = c; | 3914 | *e.linep++ = c; |
3914 | } | 3915 | } |
3915 | *e.linep++ = 0; | 3916 | *e.linep++ = 0; |
3916 | return (sp); | 3917 | return sp; |
3917 | } | 3918 | } |
3918 | 3919 | ||
3919 | /* | 3920 | /* |
@@ -3939,7 +3940,7 @@ static int subgetc(char ec, int quoted) | |||
3939 | goto again; | 3940 | goto again; |
3940 | } | 3941 | } |
3941 | } | 3942 | } |
3942 | return (c); | 3943 | return c; |
3943 | } | 3944 | } |
3944 | 3945 | ||
3945 | /* | 3946 | /* |
@@ -3979,7 +3980,7 @@ static int dollar(int quoted) | |||
3979 | if (c != '}') { | 3980 | if (c != '}') { |
3980 | err("unclosed ${"); | 3981 | err("unclosed ${"); |
3981 | gflg++; | 3982 | gflg++; |
3982 | return (c); | 3983 | return c; |
3983 | } | 3984 | } |
3984 | } | 3985 | } |
3985 | if (e.linep >= elinep) { | 3986 | if (e.linep >= elinep) { |
@@ -4235,7 +4236,7 @@ static char *unquote(char *as) | |||
4235 | if ((s = as) != NULL) | 4236 | if ((s = as) != NULL) |
4236 | while (*s) | 4237 | while (*s) |
4237 | *s++ &= ~QUOTE; | 4238 | *s++ &= ~QUOTE; |
4238 | return (as); | 4239 | return as; |
4239 | } | 4240 | } |
4240 | 4241 | ||
4241 | /* -------- glob.c -------- */ | 4242 | /* -------- glob.c -------- */ |
@@ -4257,7 +4258,7 @@ static struct wdblock *glob(char *cp, struct wdblock *wb) | |||
4257 | char *pp; | 4258 | char *pp; |
4258 | 4259 | ||
4259 | if (cp == 0) | 4260 | if (cp == 0) |
4260 | return (wb); | 4261 | return wb; |
4261 | i = 0; | 4262 | i = 0; |
4262 | for (pp = cp; *pp; pp++) | 4263 | for (pp = cp; *pp; pp++) |
4263 | if (any(*pp, spcl)) | 4264 | if (any(*pp, spcl)) |
@@ -4288,11 +4289,11 @@ static struct wdblock *glob(char *cp, struct wdblock *wb) | |||
4288 | for (i = 0; i < cl->w_nword; i++) | 4289 | for (i = 0; i < cl->w_nword; i++) |
4289 | wb = addword(cl->w_words[i], wb); | 4290 | wb = addword(cl->w_words[i], wb); |
4290 | DELETE(cl); | 4291 | DELETE(cl); |
4291 | return (wb); | 4292 | return wb; |
4292 | } | 4293 | } |
4293 | } | 4294 | } |
4294 | wb = addword(unquote(cp), wb); | 4295 | wb = addword(unquote(cp), wb); |
4295 | return (wb); | 4296 | return wb; |
4296 | } | 4297 | } |
4297 | 4298 | ||
4298 | static void globname(char *we, char *pp) | 4299 | static void globname(char *we, char *pp) |
@@ -4368,7 +4369,7 @@ static char *generate(char *start1, char *end1, char *middle, char *end) | |||
4368 | for (xp = middle; (*op++ = *xp++) != '\0';); | 4369 | for (xp = middle; (*op++ = *xp++) != '\0';); |
4369 | op--; | 4370 | op--; |
4370 | for (xp = end; (*op++ = *xp++) != '\0';); | 4371 | for (xp = end; (*op++ = *xp++) != '\0';); |
4371 | return (p); | 4372 | return p; |
4372 | } | 4373 | } |
4373 | 4374 | ||
4374 | static int anyspcl(struct wdblock *wb) | 4375 | static int anyspcl(struct wdblock *wb) |
@@ -4385,7 +4386,7 @@ static int anyspcl(struct wdblock *wb) | |||
4385 | 4386 | ||
4386 | static int xstrcmp(char *p1, char *p2) | 4387 | static int xstrcmp(char *p1, char *p2) |
4387 | { | 4388 | { |
4388 | return (strcmp(*(char **) p1, *(char **) p2)); | 4389 | return strcmp(*(char **) p1, *(char **) p2); |
4389 | } | 4390 | } |
4390 | 4391 | ||
4391 | /* -------- word.c -------- */ | 4392 | /* -------- word.c -------- */ |
@@ -4397,7 +4398,7 @@ static struct wdblock *newword(int nw) | |||
4397 | wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *)); | 4398 | wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *)); |
4398 | wb->w_bsize = nw; | 4399 | wb->w_bsize = nw; |
4399 | wb->w_nword = 0; | 4400 | wb->w_nword = 0; |
4400 | return (wb); | 4401 | return wb; |
4401 | } | 4402 | } |
4402 | 4403 | ||
4403 | static struct wdblock *addword(char *wd, struct wdblock *wb) | 4404 | static struct wdblock *addword(char *wd, struct wdblock *wb) |
@@ -4416,7 +4417,7 @@ static struct wdblock *addword(char *wd, struct wdblock *wb) | |||
4416 | wb = wb2; | 4417 | wb = wb2; |
4417 | } | 4418 | } |
4418 | wb->w_words[wb->w_nword++] = wd; | 4419 | wb->w_words[wb->w_nword++] = wd; |
4419 | return (wb); | 4420 | return wb; |
4420 | } | 4421 | } |
4421 | 4422 | ||
4422 | static | 4423 | static |
@@ -4426,15 +4427,15 @@ char **getwords(struct wdblock *wb) | |||
4426 | int nb; | 4427 | int nb; |
4427 | 4428 | ||
4428 | if (wb == NULL) | 4429 | if (wb == NULL) |
4429 | return ((char **) NULL); | 4430 | return NULL; |
4430 | if (wb->w_nword == 0) { | 4431 | if (wb->w_nword == 0) { |
4431 | DELETE(wb); | 4432 | DELETE(wb); |
4432 | return ((char **) NULL); | 4433 | return NULL; |
4433 | } | 4434 | } |
4434 | wd = (char **) space(nb = sizeof(*wd) * wb->w_nword); | 4435 | wd = (char **) space(nb = sizeof(*wd) * wb->w_nword); |
4435 | memcpy((char *) wd, (char *) wb->w_words, nb); | 4436 | memcpy((char *) wd, (char *) wb->w_words, nb); |
4436 | DELETE(wb); /* perhaps should done by caller */ | 4437 | DELETE(wb); /* perhaps should done by caller */ |
4437 | return (wd); | 4438 | return wd; |
4438 | } | 4439 | } |
4439 | 4440 | ||
4440 | static int (*func) (char *, char *); | 4441 | static int (*func) (char *, char *); |
@@ -4563,18 +4564,18 @@ static int my_getc(int ec) | |||
4563 | while ((c = readc()) != '\n' && c); | 4564 | while ((c = readc()) != '\n' && c); |
4564 | err("input line too long"); | 4565 | err("input line too long"); |
4565 | gflg++; | 4566 | gflg++; |
4566 | return (c); | 4567 | return c; |
4567 | } | 4568 | } |
4568 | c = readc(); | 4569 | c = readc(); |
4569 | if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) { | 4570 | if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) { |
4570 | if (c == '\\') { | 4571 | if (c == '\\') { |
4571 | c = readc(); | 4572 | c = readc(); |
4572 | if (c == '\n' && ec != '\"') | 4573 | if (c == '\n' && ec != '\"') |
4573 | return (my_getc(ec)); | 4574 | return my_getc(ec); |
4574 | c |= QUOTE; | 4575 | c |= QUOTE; |
4575 | } | 4576 | } |
4576 | } | 4577 | } |
4577 | return (c); | 4578 | return c; |
4578 | } | 4579 | } |
4579 | 4580 | ||
4580 | static void unget(int c) | 4581 | static void unget(int c) |
@@ -4598,7 +4599,7 @@ static int readc(void) | |||
4598 | RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc)); | 4599 | RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc)); |
4599 | if ((c = e.iop->peekc) != '\0') { | 4600 | if ((c = e.iop->peekc) != '\0') { |
4600 | e.iop->peekc = 0; | 4601 | e.iop->peekc = 0; |
4601 | return (c); | 4602 | return c; |
4602 | } else { | 4603 | } else { |
4603 | if (e.iop->prev != 0) { | 4604 | if (e.iop->prev != 0) { |
4604 | if ((c = (*e.iop->iofn) (e.iop->argp, e.iop)) != '\0') { | 4605 | if ((c = (*e.iop->iofn) (e.iop->argp, e.iop)) != '\0') { |
@@ -4722,7 +4723,7 @@ static struct io *setbase(struct io *ip) | |||
4722 | 4723 | ||
4723 | xp = e.iobase; | 4724 | xp = e.iobase; |
4724 | e.iobase = ip; | 4725 | e.iobase = ip; |
4725 | return (xp); | 4726 | return xp; |
4726 | } | 4727 | } |
4727 | 4728 | ||
4728 | /* | 4729 | /* |
@@ -4740,9 +4741,9 @@ static int nlchar(struct ioarg *ap) | |||
4740 | return 0; | 4741 | return 0; |
4741 | if ((c = *ap->aword++) == 0) { | 4742 | if ((c = *ap->aword++) == 0) { |
4742 | ap->aword = NULL; | 4743 | ap->aword = NULL; |
4743 | return ('\n'); | 4744 | return '\n'; |
4744 | } | 4745 | } |
4745 | return (c); | 4746 | return c; |
4746 | } | 4747 | } |
4747 | 4748 | ||
4748 | /* | 4749 | /* |
@@ -4758,12 +4759,12 @@ static int wdchar(struct ioarg *ap) | |||
4758 | return 0; | 4759 | return 0; |
4759 | if (*wl != NULL) { | 4760 | if (*wl != NULL) { |
4760 | if ((c = *(*wl)++) != 0) | 4761 | if ((c = *(*wl)++) != 0) |
4761 | return (c & 0177); | 4762 | return c & 0177; |
4762 | ap->awordlist++; | 4763 | ap->awordlist++; |
4763 | return (' '); | 4764 | return ' '; |
4764 | } | 4765 | } |
4765 | ap->awordlist = NULL; | 4766 | ap->awordlist = NULL; |
4766 | return ('\n'); | 4767 | return '\n'; |
4767 | } | 4768 | } |
4768 | 4769 | ||
4769 | /* | 4770 | /* |
@@ -4789,9 +4790,9 @@ static int xxchar(struct ioarg *ap) | |||
4789 | return 0; | 4790 | return 0; |
4790 | if ((c = *ap->aword++) == '\0') { | 4791 | if ((c = *ap->aword++) == '\0') { |
4791 | ap->aword = NULL; | 4792 | ap->aword = NULL; |
4792 | return (' '); | 4793 | return ' '; |
4793 | } | 4794 | } |
4794 | return (c); | 4795 | return c; |
4795 | } | 4796 | } |
4796 | 4797 | ||
4797 | /* | 4798 | /* |
@@ -4803,7 +4804,7 @@ static int strchar(struct ioarg *ap) | |||
4803 | 4804 | ||
4804 | if (ap->aword == NULL || (c = *ap->aword++) == 0) | 4805 | if (ap->aword == NULL || (c = *ap->aword++) == 0) |
4805 | return 0; | 4806 | return 0; |
4806 | return (c); | 4807 | return c; |
4807 | } | 4808 | } |
4808 | 4809 | ||
4809 | /* | 4810 | /* |
@@ -4815,7 +4816,7 @@ static int qstrchar(struct ioarg *ap) | |||
4815 | 4816 | ||
4816 | if (ap->aword == NULL || (c = *ap->aword++) == 0) | 4817 | if (ap->aword == NULL || (c = *ap->aword++) == 0) |
4817 | return 0; | 4818 | return 0; |
4818 | return (c | QUOTE); | 4819 | return c | QUOTE; |
4819 | } | 4820 | } |
4820 | 4821 | ||
4821 | /* | 4822 | /* |
@@ -4859,13 +4860,13 @@ static int filechar(struct ioarg *ap) | |||
4859 | } | 4860 | } |
4860 | c = mycommand[position]; | 4861 | c = mycommand[position]; |
4861 | position++; | 4862 | position++; |
4862 | return (c); | 4863 | return c; |
4863 | } else | 4864 | } else |
4864 | #endif | 4865 | #endif |
4865 | 4866 | ||
4866 | { | 4867 | { |
4867 | i = safe_read(ap->afile, &c, sizeof(c)); | 4868 | i = safe_read(ap->afile, &c, sizeof(c)); |
4868 | return (i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0)); | 4869 | return i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0); |
4869 | } | 4870 | } |
4870 | } | 4871 | } |
4871 | 4872 | ||
@@ -4881,7 +4882,7 @@ static int herechar(struct ioarg *ap) | |||
4881 | close(ap->afile); | 4882 | close(ap->afile); |
4882 | c = 0; | 4883 | c = 0; |
4883 | } | 4884 | } |
4884 | return (c); | 4885 | return c; |
4885 | 4886 | ||
4886 | } | 4887 | } |
4887 | 4888 | ||
@@ -4895,7 +4896,7 @@ static int gravechar(struct ioarg *ap, struct io *iop) | |||
4895 | 4896 | ||
4896 | if ((c = qgravechar(ap, iop) & ~QUOTE) == '\n') | 4897 | if ((c = qgravechar(ap, iop) & ~QUOTE) == '\n') |
4897 | c = ' '; | 4898 | c = ' '; |
4898 | return (c); | 4899 | return c; |
4899 | } | 4900 | } |
4900 | 4901 | ||
4901 | static int qgravechar(struct ioarg *ap, struct io *iop) | 4902 | static int qgravechar(struct ioarg *ap, struct io *iop) |
@@ -4907,7 +4908,7 @@ static int qgravechar(struct ioarg *ap, struct io *iop) | |||
4907 | if (iop->xchar) { | 4908 | if (iop->xchar) { |
4908 | if (iop->nlcount) { | 4909 | if (iop->nlcount) { |
4909 | iop->nlcount--; | 4910 | iop->nlcount--; |
4910 | return ('\n' | QUOTE); | 4911 | return '\n' | QUOTE; |
4911 | } | 4912 | } |
4912 | c = iop->xchar; | 4913 | c = iop->xchar; |
4913 | iop->xchar = 0; | 4914 | iop->xchar = 0; |
@@ -4917,11 +4918,11 @@ static int qgravechar(struct ioarg *ap, struct io *iop) | |||
4917 | iop->nlcount++; | 4918 | iop->nlcount++; |
4918 | iop->xchar = c; | 4919 | iop->xchar = c; |
4919 | if (c == 0) | 4920 | if (c == 0) |
4920 | return (c); | 4921 | return c; |
4921 | iop->nlcount--; | 4922 | iop->nlcount--; |
4922 | c = '\n'; | 4923 | c = '\n'; |
4923 | } | 4924 | } |
4924 | return (c != 0 ? c | QUOTE : 0); | 4925 | return c != 0 ? c | QUOTE : 0; |
4925 | } | 4926 | } |
4926 | 4927 | ||
4927 | /* | 4928 | /* |
@@ -4937,7 +4938,7 @@ static int linechar(struct ioarg *ap) | |||
4937 | ap->afile = -1; /* illegal value */ | 4938 | ap->afile = -1; /* illegal value */ |
4938 | } | 4939 | } |
4939 | } | 4940 | } |
4940 | return (c); | 4941 | return c; |
4941 | } | 4942 | } |
4942 | 4943 | ||
4943 | static void prs(const char *s) | 4944 | static void prs(const char *s) |
@@ -4996,7 +4997,7 @@ static int remap(int fd) | |||
4996 | err("too many files open in shell"); | 4997 | err("too many files open in shell"); |
4997 | } | 4998 | } |
4998 | 4999 | ||
4999 | return (fd); | 5000 | return fd; |
5000 | } | 5001 | } |
5001 | 5002 | ||
5002 | static int openpipe(int *pv) | 5003 | static int openpipe(int *pv) |
@@ -5005,7 +5006,7 @@ static int openpipe(int *pv) | |||
5005 | 5006 | ||
5006 | if ((i = pipe(pv)) < 0) | 5007 | if ((i = pipe(pv)) < 0) |
5007 | err("can't create pipe - try again"); | 5008 | err("can't create pipe - try again"); |
5008 | return (i); | 5009 | return i; |
5009 | } | 5010 | } |
5010 | 5011 | ||
5011 | static void closepipe(int *pv) | 5012 | static void closepipe(int *pv) |
@@ -5172,9 +5173,9 @@ static int herein(char *hname, int xdoll) | |||
5172 | close(tf); | 5173 | close(tf); |
5173 | tf = open(tname, 0); | 5174 | tf = open(tname, 0); |
5174 | unlink(tname); | 5175 | unlink(tname); |
5175 | return (tf); | 5176 | return tf; |
5176 | } else | 5177 | } else |
5177 | return (hf); | 5178 | return hf; |
5178 | } | 5179 | } |
5179 | 5180 | ||
5180 | static void scraphere(void) | 5181 | static void scraphere(void) |
diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 17f3c4297..64f568aa9 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c | |||
@@ -317,10 +317,10 @@ int getopt_main(int argc, char *argv[]) | |||
317 | s=xmalloc(strlen(argv[1])+1); | 317 | s=xmalloc(strlen(argv[1])+1); |
318 | strcpy(s,argv[1]+strspn(argv[1],"-+")); | 318 | strcpy(s,argv[1]+strspn(argv[1],"-+")); |
319 | argv[1]=argv[0]; | 319 | argv[1]=argv[0]; |
320 | return (generate_output(argv+1,argc-1,s,long_options)); | 320 | return generate_output(argv+1,argc-1,s,long_options); |
321 | } | 321 | } |
322 | 322 | ||
323 | while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) | 323 | while ((opt = getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) |
324 | switch (opt) { | 324 | switch (opt) { |
325 | case 'a': | 325 | case 'a': |
326 | alternative=1; | 326 | alternative=1; |
diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 0e44783b3..8ea9627c1 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c | |||
@@ -71,7 +71,7 @@ static int remove_ids(type_id type, int argc, char **argv) | |||
71 | argv++; | 71 | argv++; |
72 | } | 72 | } |
73 | 73 | ||
74 | return (nb_errors); | 74 | return nb_errors; |
75 | } | 75 | } |
76 | #endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */ | 76 | #endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */ |
77 | 77 | ||