From d9e15f206840219bb0f39c912a42fdcf8cbcaed6 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Mon, 27 Nov 2006 16:49:55 +0000 Subject: [PATCH] style cleanup: return(a) -> return a, part 2 --- archival/gzip.c | 2 +- archival/libunarchive/get_header_ar.c | 4 +- archival/libunarchive/get_header_cpio.c | 2 +- coreutils/diff.c | 16 +- coreutils/mv.c | 2 +- docs/ipv4_ipv6.txt | 4 +- e2fsprogs/blkid/dev.c | 2 +- e2fsprogs/blkid/resolve.c | 2 +- e2fsprogs/blkid/tag.c | 2 +- e2fsprogs/e2fsck.c | 2 +- e2fsprogs/ext2fs/closefs.c | 2 +- e2fsprogs/ext2fs/dirblock.c | 2 +- e2fsprogs/ext2fs/imager.c | 4 +- e2fsprogs/tune2fs.c | 4 +- editors/vi.c | 38 ++-- libbb/bb_pwd.c | 2 +- libbb/dump.c | 16 +- libbb/obscure.c | 2 +- loginutils/passwd.c | 6 +- miscutils/devfsd.c | 124 +++++------ modutils/insmod.c | 6 +- networking/ifconfig.c | 2 +- networking/ping.c | 2 +- shell/ash.c | 18 +- shell/hush.c | 4 +- shell/msh.c | 279 ++++++++++++------------ util-linux/getopt.c | 4 +- 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) } } - return (exit_code); + return exit_code; } /* 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) archive_handle->offset += ar_long_name_size; /* This ar entries data section only contained filenames for other records * they are stored in the static ar_long_names for future reference */ - return (get_header_ar(archive_handle)); /* Return next header */ + return get_header_ar(archive_handle); /* Return next header */ } else if (ar.formatted.name[1] == ' ') { /* This is the index of symbols in the file for compilers */ data_skip(archive_handle); archive_handle->offset += typed->size; - return (get_header_ar(archive_handle)); /* Return next header */ + return get_header_ar(archive_handle); /* Return next header */ } else { /* The number after the '/' indicates the offset in the ar data section (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) free(file_header->link_name); - return (EXIT_SUCCESS); + return EXIT_SUCCESS; } 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) x /= 2; } while ((x - y) > 1 || (x - y) < -1); - return (x); + return x; } static int newcand(int x, int y, int pred) @@ -357,7 +357,7 @@ static int newcand(int x, int y, int pred) q->x = x; q->y = y; q->pred = pred; - return (clen++); + return clen++; } @@ -366,7 +366,7 @@ static int search(int *c, int k, int y) int i, j, l, t; if (clist[c[k]].y < y) /* quick look for typical case */ - return (k + 1); + return k + 1; i = 0; j = k + 1; while (1) { @@ -379,9 +379,9 @@ static int search(int *c, int k, int y) else if (t < y) i = l; else - return (l); + return l; } - return (l + 1); + return l + 1; } @@ -428,7 +428,7 @@ static int stone(int *a, int n, int *b, int *c) } } while ((y = b[++j]) > 0 && numtries < bound); } - return (k); + return k; } static void unravel(int p) @@ -461,7 +461,7 @@ static int skipline(FILE * f) for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++) continue; - return (i); + return i; } @@ -977,7 +977,7 @@ static int diffreg(char *ofile1, char *ofile2, int flags) free(file1); if (file2 != ofile2) free(file2); - return (rval); + return rval; } #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: } } while (*++argv != last); - return (status); + return status; } 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: (void) fprintf(stderr, "getaddrinfo: %s for host %s service %s\n", gai_strerror(error), hostname, servicename); - return (-1); + return -1; } /* Try all returned addresses until one works */ for (aip = res; aip != NULL; aip = aip->ai_next) { @@ -187,7 +187,7 @@ Modified IPv6-aware C code: if (sock == -1) { perror("socket"); freeaddrinfo(res); - return (-1); + return -1; } /* 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) iter->magic = DEV_ITERATE_MAGIC; iter->cache = cache; iter->p = cache->bic_devs.next; - return (iter); + return iter; } /* 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: if (!cache) { blkid_put_cache(c); } - return (ret); + return ret; } #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) iter->magic = TAG_ITERATE_MAGIC; iter->dev = dev; iter->p = dev->bid_tags.next; - return (iter); + return iter; } /* 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) retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino, &inode->i_ext2, NULL, 0, block, &pblk); *phys = pblk; - return (retval); + return retval; #endif } 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, *ret_new_desc_blk = new_desc_blk; if (ret_meta_bg) *ret_meta_bg = meta_bg; - return (numblocks); + return numblocks; } 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, if ((dirent->rec_len < 8) || (dirent->rec_len % 4)) { ext2fs_free_mem(&buf); - return (EXT2_ET_DIR_CORRUPTED); + return EXT2_ET_DIR_CORRUPTED; } p += dirent->rec_len; 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) } retval = 0; errout: - return (retval); + return retval; } @@ -373,5 +373,5 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags) retval = 0; errout: free(buf); - return (retval); + return retval; } 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) struct tm ts; if (strcmp(str, "now") == 0) { - return (time(0)); + return time(0); } memset(&ts, 0, sizeof(ts)); #ifdef HAVE_STRPTIME @@ -398,7 +398,7 @@ static time_t parse_time(char *str) if (ts.tm_mday == 0) { bb_error_msg_and_die("Cannot parse date/time specifier: %s", str); } - return (mktime(&ts)); + return mktime(&ts); } 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 if (*q == '\n') cnt++; } - return (cnt); + return cnt; } static Byte *find_line(int li) // find begining of line #li @@ -1373,7 +1373,7 @@ static Byte *new_screen(int ro, int co) for (li = 1; li < ro - 1; li++) { screen[(li * co) + 0] = '~'; } - return (screen); + return screen; } static Byte *new_text(int size) @@ -1384,7 +1384,7 @@ static Byte *new_text(int size) text = (Byte *) xmalloc(size + 8); memset(text, '\0', size); // clear new text[] //text += 4; // leave some room for "oops" - return (text); + return text; } #ifdef CONFIG_FEATURE_VI_SEARCH @@ -1398,7 +1398,7 @@ static int mycmp(Byte * s1, Byte * s2, int len) i = strncasecmp((char *) s1, (char *) s2, len); } #endif /* CONFIG_FEATURE_VI_SETOPTS */ - return (i); + return i; } 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 stop = next_line(p); // range is to next line for (start = p; start < stop; start++) { if (mycmp(start, pat, len) == 0) { - return (start); + return start; } } } else if (dir == BACK) { @@ -1423,12 +1423,12 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for stop = prev_line(p); // range is to prev line for (start = p - len; start >= stop; start--) { if (mycmp(start, pat, len) == 0) { - return (start); + return start; } } } // pattern not found - return (NULL); + return NULL; #else /*REGEX_SEARCH */ char *q; struct re_pattern_buffer preg; @@ -1608,7 +1608,7 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c) *stop = p; } dot = save_dot; - return (c); + return c; } 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) test = ((isalnum(c)) || c == '_'); } *tested = c; - return (test); + return test; } 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 dest = end = text; // keep pointers valid file_modified++; // has the file been modified thd0: - return (dest); + return dest; } // copy text into register, then delete text. @@ -1968,7 +1968,7 @@ static Byte what_reg(void) c = 'D'; if (YDreg == 27) c = 'U'; - return (c); + return c; } static void check_context(Byte cmd) @@ -2086,7 +2086,7 @@ static int mysleep(int hund) // sleep for 'h' 1/100 seconds tv.tv_sec = 0; tv.tv_usec = hund * 10000; select(1, &rfds, NULL, NULL, &tv); - return (FD_ISSET(0, &rfds)); + return FD_ISSET(0, &rfds); } #define readbuffer bb_common_bufsiz1 @@ -2214,7 +2214,7 @@ static Byte readit(void) // read (maybe cursor) key from stdin readed_for_parse -= n; memmove(readbuffer, readbuffer + n, BUFSIZ - n); (void) alarm(3); // we are done waiting for input, turn alarm ON - return (c); + return c; } //----- IO Routines -------------------------------------------- @@ -2258,7 +2258,7 @@ static Byte get_one_char(void) #else /* CONFIG_FEATURE_VI_DOT_CMD */ c = readit(); // get the users input #endif /* CONFIG_FEATURE_VI_DOT_CMD */ - return (c); // return the char, where ever it came from + return c; // return the char, where ever it came from } 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" refresh(FALSE); free(obufp); obufp = (Byte *) xstrdup((char *) buf); - return (obufp); + return obufp; } 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" if (sr >= 0) { cnt = (int) st_buf.st_size; } - return (cnt); + return cnt; } static int file_insert(Byte * fn, Byte * p, int size) @@ -2376,7 +2376,7 @@ static int file_insert(Byte * fn, Byte * p, int size) if (cnt >= size) file_modified++; fi0: - return (cnt); + return cnt; } static int file_write(Byte * fn, Byte * first, Byte * last) @@ -2385,7 +2385,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) if (fn == 0) { psbs("No current filename"); - return (-2); + return -2; } charcnt = 0; // FIXIT- use the correct umask() @@ -2401,7 +2401,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last) charcnt = 0; } close(fd); - return (charcnt); + return charcnt; } //----- 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) if (mygroup==NULL) bb_error_msg_and_die("unknown group name: %s", name); - return (mygroup->gr_gid); + return mygroup->gr_gid; } /* 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) } cur_size += bcnt * fu->reps; } - return (cur_size); + return cur_size; } static void rewrite(FS * fs) @@ -374,17 +374,17 @@ static unsigned char *get(void) */ if (!bb_dump_length || (ateof && !next((char **) NULL))) { if (need == bb_dump_blocksize) { - return ((unsigned char *) NULL); + return NULL; } if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) { if (bb_dump_vflag != DUP) { - printf("*\n"); + puts("*"); } - return ((unsigned char *) NULL); + return NULL; } memset((char *) curp + nread, 0, need); eaddress = address + nread; - return (curp); + return curp; } n = fread((char *) curp + nread, sizeof(unsigned char), bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin); @@ -405,10 +405,10 @@ static unsigned char *get(void) if (bb_dump_vflag == DUP || bb_dump_vflag == FIRST) { bb_dump_vflag = WAIT; } - return (curp); + return curp; } if (bb_dump_vflag == WAIT) { - printf("*\n"); + puts("*"); } bb_dump_vflag = DUP; address = savaddress += bb_dump_blocksize; @@ -665,7 +665,7 @@ int bb_dump_dump(char **argv) next(argv); display(); - return (exitval); + return exitval; } 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) if ((msg = obscure_msg(old, newval, pwdp))) { printf("Bad password: %s.\n", msg); /* If user is root warn only */ - return (getuid())? 1 : 0; + return getuid() ? 1 : 0; } return 0; } 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) static int i64c(int i) { if (i <= 0) - return ('.'); + return '.'; if (i == 1) - return ('/'); + return '/'; if (i >= 2 && i < 12) return ('0' - 2 + i); if (i >= 12 && i < 38) return ('A' - 12 + i); if (i >= 38 && i < 63) return ('a' - 38 + i); - return ('z'); + return 'z'; } 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) static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr) { - if( d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c') - return (2 + addendum); - else if( d[n - 2]=='c' && d[n - 1]=='d') - return (3 + addendum); - else if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t') - return (4 + addendum); - else if( ptr[n - 2]=='m' && ptr[n - 1]=='t') - return (5 + addendum); - else - return 0; + if(d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c') + return 2 + addendum; + if(d[n - 2]=='c' && d[n - 1]=='d') + return 3 + addendum; + if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t') + return 4 + addendum; + if(ptr[n - 2]=='m' && ptr[n - 1]=='t') + return 5 + addendum; + return 0; } static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr) { - if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') - { + if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') { if( d[n - 7]=='g' && d[n - 6]=='e' && d[n - 5]=='n' && d[n - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' && d[n - 1]=='c' ) return 1; return scan_dev_name_common(d, n, 0, ptr); } - else if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' && + if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' && d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t') - { return scan_dev_name_common(d, n, 4, ptr); - } - else if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/') - { + if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/') return 10; - } - else if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/') - { + if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/') return 11; - } - else if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/') - { + if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/') return 12; - } return 0; } @@ -787,7 +777,7 @@ static int do_servicing (int fd, unsigned long event_mask) caught_signal = FALSE; caught_sighup = FALSE; - return (c_sighup); + return c_sighup; } msg_logger_and_die(LOG_ERR, "read error on control file"); } /* End Function do_servicing */ @@ -1132,7 +1122,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, { if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 || ( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 ) - return (FALSE); + return FALSE; source_link[source_len] = '\0'; dest_link[dest_len] = '\0'; 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, unlink (destpath); symlink (source_link, destpath); } - return (TRUE); + return TRUE; } /* Else not a symlink */ chmod (destpath, new_mode & ~S_IFMT); chown (destpath, source_stat->st_uid, source_stat->st_gid); - return (TRUE); + return TRUE; } /* Different types: unlink and create */ unlink (destpath); @@ -1165,7 +1155,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat, break; symlink_val[val] = '\0'; if (symlink (symlink_val, destpath) == 0) - return (TRUE); + return TRUE; break; case S_IFREG: 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, break; do_chown: if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0) - return (TRUE); + return TRUE; /*break;*/ } - return (FALSE); + return FALSE; } /* End Function copy_inode */ static void free_config (void) @@ -1242,13 +1232,13 @@ static int get_uid_gid (int flag, const char *string) msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__); if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) ) - return atoi (string); + return atoi(string); if ( flag == UID && ( pw_ent = getpwnam (string) ) != NULL ) - return (pw_ent->pw_uid); + return pw_ent->pw_uid; if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL ) - return (grp_ent->gr_gid); + return grp_ent->gr_gid; else if(ENABLE_DEVFSD_VERBOSE) msg="group"; @@ -1269,7 +1259,7 @@ static mode_t get_mode (const char *string) debug_msg_logger(LOG_INFO, __FUNCTION__); if ( isdigit (string[0]) ) - return strtoul (string, NULL, 8); + return strtoul(string, NULL, 8); if (strlen (string) != 9) msg_logger_and_die(LOG_ERR, "bad mode: %s", string); @@ -1282,7 +1272,7 @@ static mode_t get_mode (const char *string) i=i/2; string++; } - return (mode); + return mode; } /* End Function get_mode */ static void signal_handler (int sig) @@ -1317,7 +1307,7 @@ static const char *get_variable (const char *variable, void *info) i=index_in_str_array(field_names, variable); if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL)) - return (NULL); + return NULL; if( i >= 0 && i <= 3) { 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) debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf); - return (sbuf); + return sbuf; } /* End Function get_variable */ static void service(struct stat statbuf, char *path) @@ -1440,7 +1430,7 @@ static int make_dir_tree (const char *path) if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1) { debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path); - return (FALSE); + return FALSE; } return TRUE; } /* End Function make_dir_tree */ @@ -1471,9 +1461,9 @@ static int expand_expression(char *output, unsigned int outsize, debug_msg_logger(LOG_INFO, __FUNCTION__); if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) ) - return (FALSE); + return FALSE; expand_regexp (output, outsize, temp, devname, ex, numexp); - return (TRUE); + return TRUE; } /* End Function expand_expression */ 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, if (strncmp (devname, trans->match, len) == 0) { if (trans->format == NULL) - return (devname + len); + return devname + len; sprintf (buffer, trans->format, devname + len); - return (buffer); + return buffer; } } @@ -1689,7 +1679,7 @@ const char *get_old_name (const char *devname, unsigned int namelen, if(ENABLE_DEBUG && compat_name!=NULL) msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name); - return (compat_name); + return compat_name; } /* End Function get_old_name */ 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) if (minor > 63) ++letter; - return (letter); + return letter; } /* End Function get_old_ide_name */ static char *write_old_sd_name (char *buffer, @@ -1745,7 +1735,7 @@ static char *write_old_sd_name (char *buffer, if (major == 8) { sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part); - return (buffer); + return buffer; } if ( (major > 64) && (major < 72) ) { @@ -1754,9 +1744,9 @@ static char *write_old_sd_name (char *buffer, sprintf (buffer, "sd%c%s", 'a' + disc_index, part); else sprintf (buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26,part); - return (buffer); + return buffer; } - return (NULL); + return NULL; } /* End Function write_old_sd_name */ @@ -1799,7 +1789,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, /* Variable expansion */ input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info); if (input == NULL) - return (FALSE); + return FALSE; break; case '~': /* Home directory expansion */ @@ -1810,7 +1800,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, if ( ( env = getenv ("HOME") ) == NULL ) { msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME"); - return (FALSE); + return FALSE; } len = strlen (env); if (len + out_pos >= length) @@ -1830,7 +1820,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input, if ( ( pwent = getpwnam (tmp) ) == NULL ) { msg_logger(LOG_INFO, "no pwent for: %s", tmp); - return (FALSE); + return FALSE; } len = strlen (pwent->pw_dir); if (len + out_pos >= length) @@ -1847,16 +1837,16 @@ int st_expr_expand (char *output, unsigned int length, const char *input, if (ch == '\0') { memcpy (output, buffer, out_pos); - return (TRUE); + return TRUE; } break; /* esac */ } } - return (FALSE); + return FALSE; st_expr_expand_out: msg_logger(LOG_INFO, bb_msg_small_buffer); - return (FALSE); + return FALSE; } /* End Function st_expr_expand */ @@ -1899,7 +1889,7 @@ static const char *expand_variable (char *buffer, unsigned int length, memcpy (buffer + *out_pos, tmp, len + 1); out_pos += len; - return (input); + return input; } /* Ordinary variable expansion, possibly in braces */ if (ch != '{') @@ -1916,7 +1906,7 @@ static const char *expand_variable (char *buffer, unsigned int length, if ( ( env = get_variable_v2 (tmp, func, info) ) == NULL ) { msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp); - return (NULL); + return NULL; } len = strlen (env); if (len + *out_pos >= length) @@ -1924,7 +1914,7 @@ static const char *expand_variable (char *buffer, unsigned int length, memcpy (buffer + *out_pos, env, len + 1); *out_pos += len; - return (input); + return input; } /* Variable in braces: check for ':' tricks */ ch = *++input; @@ -1940,13 +1930,13 @@ static const char *expand_variable (char *buffer, unsigned int length, safe_memcpy (tmp, input, len); ptr = expand_variable (buffer, length, out_pos, tmp, func, info ); if (ptr == NULL) - return (NULL); - return (input + len); + return NULL; + return input + len; } if (ch != ':' || ptr[1] != '-' ) { msg_logger(LOG_INFO, "illegal char in var name"); - return (NULL); + return NULL; } /* It's that handy "${var:-word}" expression. Check if var is defined */ len = ptr - input; @@ -1971,7 +1961,7 @@ static const char *expand_variable (char *buffer, unsigned int length, break; case '\0': msg_logger(LOG_INFO,"\"}\" not found in: %s", input); - return (NULL); + return NULL; default: break; } @@ -1989,7 +1979,7 @@ static const char *expand_variable (char *buffer, unsigned int length, memcpy (buffer + *out_pos, env, len + 1); *out_pos += len; - return (input); + return input; } /* Environment variable was not found, so process word. Advance input pointer to start of word in "${var:-word}" */ @@ -2001,17 +1991,17 @@ static const char *expand_variable (char *buffer, unsigned int length, safe_memcpy (tmp, input, len); input = ptr; if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) ) - return (NULL); + return NULL; len = strlen (tmp); if (len + *out_pos >= length) goto expand_variable_out; memcpy (buffer + *out_pos, tmp, len + 1); *out_pos += len; - return (input); + return input; expand_variable_out: msg_logger(LOG_INFO, bb_msg_small_buffer); - return (NULL); + return NULL; } /* End Function expand_variable */ @@ -2034,9 +2024,9 @@ static const char *get_variable_v2 (const char *variable, { value = (*func) (variable, info); if (value != NULL) - return (value); + return value; } - return getenv (variable); + return getenv(variable); } /* End Function get_variable */ /* 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, char *fullname = (char *) userdata; if (fullname[0] == '\0') - return (FALSE); + return FALSE; else { char *tmp, *tmp1 = xstrdup(filename); tmp = bb_get_last_path_component(tmp1); @@ -813,11 +813,11 @@ static int check_module_name_match(const char *filename, struct stat *statbuf, free(tmp1); /* Stop searching if we find a match */ m_filename = xstrdup(filename); - return (FALSE); + return FALSE; } free(tmp1); } - return (TRUE); + return TRUE; } 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) *ptr++ = val; } while (++i < ETH_ALEN); - return (int) (*bufp); /* Error if we don't end at end of string. */ + return *bufp; /* Error if we don't end at end of string. */ } #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) sum = (sum >> 16) + (sum & 0xFFFF); sum += (sum >> 16); ans = ~sum; - return (ans); + return ans; } #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) struct alias *ap = *__lookupalias(name); if (check && ap && (ap->flag & ALIASINUSE)) - return (NULL); - return (ap); + return NULL; + return ap; } /* @@ -2196,7 +2196,7 @@ aliascmd(int argc, char **argv) } } - return (ret); + return ret; } static int @@ -2217,7 +2217,7 @@ unaliascmd(int argc, char **argv) } } - return (i); + return i; } static struct alias * @@ -4831,10 +4831,10 @@ done: startloc = expdest - (char *)stackblock(); strtodest(home, SQSYNTAX, quotes); recordregion(startloc, expdest - (char *)stackblock(), 0); - return (p); + return p; lose: *p = c; - return (startp); + return startp; } @@ -9969,7 +9969,7 @@ out: else TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : "")); #endif - return (t); + return t; } @@ -12531,7 +12531,7 @@ dash_arith(const char *s) } INTON; - return (result); + return result; } @@ -12555,7 +12555,7 @@ letcmd(int argc, char **argv) i = dash_arith(*ap); } - return (!i); + return !i; } #endif /* CONFIG_ASH_MATH_SUPPORT */ 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) char *name = child->argv[1]; if (name == NULL) { - return (builtin_env(child)); + return builtin_env(child); } name = strdup(name); @@ -730,7 +730,7 @@ static int builtin_source(struct child_prog *child) status = parse_file_outer(input); mark_closed(fileno(input)); fclose(input); - return (status); + return status; } 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) struct op *dotnode; if (head == NULL) - return (NULL); + return NULL; if (head->left != NULL) { dotnode = scantree(head->left); if (dotnode) - return (dotnode); + return dotnode; } if (head->right != NULL) { dotnode = scantree(head->right); if (dotnode) - return (dotnode); + return dotnode; } if (head->words == NULL) - return (NULL); + return NULL; DBGPRINTF5(("SCANTREE: checking node %p\n", head)); if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) { DBGPRINTF5(("SCANTREE: dot found in node %p\n", head)); - return (head); + return head; } - return (NULL); + return NULL; } @@ -1219,7 +1219,7 @@ static int any(int c, char *s) static char *putn(int n) { - return (itoa(n)); + return itoa(n); } static void next(int f) @@ -1248,7 +1248,7 @@ static char *space(int n) if ((cp = getcell(n)) == 0) err("out of string space"); - return (cp); + return cp; } static char *strsave(char *s, int a) @@ -1258,9 +1258,9 @@ static char *strsave(char *s, int a) if ((cp = space(strlen(s) + 1)) != NULL) { setarea((char *) cp, a); for (xp = cp; (*xp++ = *s++) != '\0';); - return (cp); + return cp; } - return (""); + return ""; } /* @@ -1306,16 +1306,16 @@ static struct var *lookup(char *n) c = c * 10 + *n - '0'; dummy.status = RONLY; dummy.value = c <= dolc ? dolv[c] : null; - return (&dummy); + return &dummy; } for (vp = vlist; vp; vp = vp->next) if (eqname(vp->name, n)) - return (vp); + return vp; cp = findeq(n); vp = (struct var *) space(sizeof(*vp)); if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) { dummy.name = dummy.value = ""; - return (&dummy); + return &dummy; } for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++); if (*cp == 0) @@ -1327,7 +1327,7 @@ static struct var *lookup(char *n) vp->next = vlist; vp->status = GETCELL; vlist = vp; - return (vp); + return vp; } /* @@ -1455,14 +1455,14 @@ static int eqname(char *n1, char *n2) for (; *n1 != '=' && *n1 != 0; n1++) if (*n2++ != *n1) return 0; - return (*n2 == 0 || *n2 == '='); + return *n2 == 0 || *n2 == '='; } static char *findeq(char *cp) { while (*cp != '\0' && *cp != '=') cp++; - return (cp); + return cp; } /* -------- gmatch.c -------- */ @@ -1510,7 +1510,7 @@ static int gmatch(char *s, char *p) return 0; } } - return (*s == 0); + return *s == 0; } static char *cclass(char *p, int sub) @@ -1522,7 +1522,7 @@ static char *cclass(char *p, int sub) found = not; do { if (*p == '\0') - return ((char *) NULL); + return NULL; c = *p & CMASK; if (p[1] == '-' && p[2] != ']') { d = p[2] & CMASK; @@ -1532,7 +1532,7 @@ static char *cclass(char *p, int sub) if (c == sub || (c <= sub && sub <= d)) found = !not; } while (*++p != ']'); - return (found ? p + 1 : (char *) NULL); + return found ? p + 1 : NULL; } @@ -1596,7 +1596,7 @@ char *getcell(unsigned nbytes) i = nregio >= GROWBY ? nregio : GROWBY; p = (struct region *) sbrk(i * REGSIZE); if (p == (struct region *) -1) - return ((char *) NULL); + return NULL; p--; if (p != areatop) { puts("not contig"); @@ -1608,7 +1608,7 @@ char *getcell(unsigned nbytes) q->next = areabot; q->area = BUSY; areatop = q; - found: + found: /* * we found a FREE area big enough, pointed to by 'p', and up to 'q' */ @@ -1626,7 +1626,7 @@ char *getcell(unsigned nbytes) p->next = areanxt; } p->area = areanum; - return ((char *) (p + 1)); + return (char *) (p + 1); } static void freecell(char *cp) @@ -1732,7 +1732,7 @@ static struct op *pipeline(int cf) } DBGPRINTF7(("PIPELINE: returning t=%p\n", t)); - return (t); + return t; } static struct op *andor(void) @@ -1760,7 +1760,7 @@ static struct op *andor(void) } DBGPRINTF7(("ANDOR: returning t=%p\n", t)); - return (t); + return t; } static struct op *c_list(void) @@ -1780,7 +1780,7 @@ static struct op *c_list(void) || (multiline && c == '\n')) { if ((p = andor()) == NULL) - return (t); + return t; if ((peeksym = yylex(0)) == '&') p = block(TASYNC, p, NOBLOCK, NOWORDS); @@ -1792,7 +1792,7 @@ static struct op *c_list(void) } /* IF */ DBGPRINTF7(("C_LIST: returning t=%p\n", t)); - return (t); + return t; } static int synio(int cf) @@ -1852,7 +1852,7 @@ static struct op *simple(void) break; default: - return (t); + return t; } } } @@ -1867,7 +1867,7 @@ static struct op *nested(int type, int mark) t = c_list(); musthave(mark, 0); multiline--; - return (block(type, t, NOBLOCK, NOWORDS)); + return block(type, t, NOBLOCK, NOWORDS); } static struct op *command(int cf) @@ -1894,7 +1894,7 @@ static struct op *command(int cf) peeksym = c; if ((t = simple()) == NULL) { if (iolist == NULL) - return ((struct op *) NULL); + return NULL; t = newtp(); t->type = TCOM; } @@ -1980,7 +1980,7 @@ static struct op *command(int cf) DBGPRINTF(("COMMAND: returning %p\n", t)); - return (t); + return t; } static struct op *dowholefile(int type, int mark) @@ -1994,7 +1994,7 @@ static struct op *dowholefile(int type, int mark) multiline--; t = block(type, t, NOBLOCK, NOWORDS); DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t)); - return (t); + return t; } static struct op *dogroup(int onlydone) @@ -2004,12 +2004,12 @@ static struct op *dogroup(int onlydone) c = yylex(CONTIN); if (c == DONE && onlydone) - return ((struct op *) NULL); + return NULL; if (c != DO) SYNTAXERR; mylist = c_list(); musthave(DONE, 0); - return (mylist); + return mylist; } static struct op *thenpart(void) @@ -2019,7 +2019,7 @@ static struct op *thenpart(void) if ((c = yylex(0)) != THEN) { peeksym = c; - return ((struct op *) NULL); + return NULL; } t = newtp(); t->type = 0; @@ -2027,7 +2027,7 @@ static struct op *thenpart(void) if (t->left == NULL) SYNTAXERR; t->right = elsepart(); - return (t); + return t; } static struct op *elsepart(void) @@ -2039,18 +2039,18 @@ static struct op *elsepart(void) case ELSE: if ((t = c_list()) == NULL) SYNTAXERR; - return (t); + return t; case ELIF: t = newtp(); t->type = TELIF; t->left = c_list(); t->right = thenpart(); - return (t); + return t; default: peeksym = c; - return ((struct op *) NULL); + return NULL; } } @@ -2065,7 +2065,7 @@ static struct op *caselist(void) } DBGPRINTF(("CASELIST, returning t=%p\n", t)); - return (t); + return t; } static struct op *casepart(void) @@ -2084,7 +2084,7 @@ static struct op *casepart(void) DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t)); - return (t); + return t; } static char **pattern(void) @@ -2100,7 +2100,7 @@ static char **pattern(void) peeksym = c; word(NOWORD); - return (copyw()); + return copyw(); } static char **wordlist(void) @@ -2109,14 +2109,14 @@ static char **wordlist(void) if ((c = yylex(0)) != IN) { peeksym = c; - return ((char **) NULL); + return NULL; } startl = 0; while ((c = yylex(0)) == WORD) word(yylval.cp); word(NOWORD); peeksym = c; - return (copyw()); + return copyw(); } /* @@ -2127,11 +2127,11 @@ static struct op *list(struct op *t1, struct op *t2) DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2)); if (t1 == NULL) - return (t2); + return t2; if (t2 == NULL) - return (t1); + return t1; - return (block(TLIST, t1, t2, NOWORDS)); + return block(TLIST, t1, t2, NOWORDS); } 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) DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1, t2)); - return (t); + return t; } /* See if given string is a shell multiline (FOR, IF, etc) */ @@ -2162,7 +2162,7 @@ static int rlookup(char *n) for (rp = restab; rp->r_name; rp++) if (strcmp(rp->r_name, n) == 0) { DBGPRINTF7(("RLOOKUP: match, returning %d\n", rp->r_val)); - return (rp->r_val); /* Return numeric code for shell multiline */ + return rp->r_val; /* Return numeric code for shell multiline */ } DBGPRINTF7(("RLOOKUP: NO match, returning 0\n")); @@ -2183,7 +2183,7 @@ static struct op *newtp(void) DBGPRINTF3(("NEWTP: allocated %p\n", t)); - return (t); + return t; } static struct op *namelist(struct op *t) @@ -2204,14 +2204,14 @@ static struct op *namelist(struct op *t) t->ioact = t->left->ioact; t->left->ioact = NULL; } - return (t); + return t; } word(NOWORD); t->words = copyw(); - return (t); + return t; } static char **copyw(void) @@ -2220,7 +2220,7 @@ static char **copyw(void) wd = getwords(wdlist); wdlist = 0; - return (wd); + return wd; } static void word(char *cp) @@ -2234,7 +2234,7 @@ static struct ioword **copyio(void) iop = (struct ioword **) getwords(iolist); iolist = 0; - return (iop); + return iop; } static struct ioword *io(int u, int f, char *cp) @@ -2246,7 +2246,7 @@ static struct ioword *io(int u, int f, char *cp) iop->io_flag = f; iop->io_name = cp; iolist = addword((char *) iop, iolist); - return (iop); + return iop; } static void zzerr(void) @@ -2274,7 +2274,7 @@ static int yylex(int cf) peeksym = 0; if (c == '\n') startl = 1; - return (c); + return c; } @@ -2311,14 +2311,14 @@ static int yylex(int cf) case 0: DBGPRINTF5(("YYLEX: return 0, c=%d\n", c)); - return (c); + return c; case '$': DBGPRINTF9(("YYLEX: found $\n")); *e.linep++ = c; if ((c = my_getc(0)) == '{') { if ((c = collect(c, '}')) != '\0') - return (c); + return c; goto pack; } break; @@ -2327,7 +2327,7 @@ static int yylex(int cf) case '\'': case '"': if ((c = collect(c, c)) != '\0') - return (c); + return c; goto pack; case '|': @@ -2336,17 +2336,17 @@ static int yylex(int cf) startl = 1; /* If more chars process them, else return NULL char */ if ((c1 = dual(c)) != '\0') - return (c1); + return c1; else - return (c); + return c; case '^': startl = 1; - return ('|'); + return '|'; case '>': case '<': diag(c); - return (c); + return c; case '\n': nlseen++; @@ -2363,12 +2363,12 @@ static int yylex(int cf) if (cf & CONTIN) goto loop; } - return (c); + return c; case '(': case ')': startl = 1; - return (c); + return c; } unget(c); @@ -2390,11 +2390,11 @@ static int yylex(int cf) if (atstart && (c = rlookup(line)) != 0) { startl = 1; - return (c); + return c; } yylval.cp = strsave(line, areanum); - return (WORD); + return WORD; } @@ -2412,7 +2412,7 @@ static int collect(int c, int c1) s[1] = 0; prs("no closing "); yyerror(s); - return (YYERRCODE); + return YYERRCODE; } if (interactive && c == '\n' && e.iop <= iostack) { #ifdef CONFIG_FEATURE_COMMAND_EDITING @@ -2448,7 +2448,7 @@ static int dual(int c) if (c == 0) unget(*--cp); /* String is not a shell multiline, put peek char back */ - return (c); /* String is multiline, return numeric multiline (restab) code */ + return c; /* String is multiline, return numeric multiline (restab) code */ } static void diag(int ec) @@ -2481,7 +2481,7 @@ static char *tree(unsigned size) fail(); /* NOTREACHED */ } - return (t); + return t; } /* VARARGS1 */ @@ -2701,7 +2701,7 @@ static int execute(struct op *t, int *pin, int *pout, int act) } DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv)); - return (rv); + return rv; } static int @@ -2759,7 +2759,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) if (cp == NULL && t->ioact == NULL) { while ((cp = *owp++) != NULL && assign(cp, COPYV)); DBGPRINTF(("FORKEXEC: returning setstatus()\n")); - return (setstatus(0)); + return setstatus(0); } else if (cp != NULL) { shcom = inbuilt(cp); } @@ -2864,7 +2864,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) if (iosetup(*iopp++, pin != NULL, pout != NULL)) { if (forked) _exit(rv); - return (rv); + return rv; } } @@ -2873,7 +2873,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp) if (forked) _exit(i); DBGPRINTF(("FORKEXEC: returning i=%d\n", i)); - return (i); + return i; } /* should use FIOCEXCL */ @@ -3005,7 +3005,7 @@ static struct op **find1case(struct op *t, char *w) if (t == NULL) { DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n")); - return ((struct op **) NULL); + return NULL; } DBGPRINTF3(("FIND1CASE: enter, t->type=%d (%s)\n", t->type, @@ -3014,7 +3014,7 @@ static struct op **find1case(struct op *t, char *w) if (t->type == TLIST) { if ((tp = find1case(t->left, w)) != NULL) { DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp)); - return (tp); + return tp; } t1 = t->right; /* TPAT */ } else @@ -3024,18 +3024,19 @@ static struct op **find1case(struct op *t, char *w) if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) { DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n", &t1->left)); - return (&t1->left); + return &t1->left; } DBGPRINTF(("FIND1CASE: returning NULL\n")); - return ((struct op **) NULL); + return NULL; } static struct op *findcase(struct op *t, char *w) { struct op **tp; - return ((tp = find1case(t, w)) != NULL ? *tp : (struct op *) NULL); + tp = find1case(t, w); + return tp != NULL ? *tp : NULL; } /* @@ -3106,14 +3107,14 @@ static int waitfor(int lastpid, int canintr) onintr(0); } } - return (rv); + return rv; } static int setstatus(int s) { exstat = s; setval(lookup("?"), putn(s)); - return (s); + return s; } /* @@ -3165,20 +3166,20 @@ static char *rexecve(char *c, char **v, char **envp) *v = e.linep; execve(DEFAULT_SHELL, v, envp); *v = tp; - return ("no Shell"); + return "no Shell"; case ENOMEM: - return ((char *) bb_msg_memory_exhausted); + return (char *) bb_msg_memory_exhausted; case E2BIG: - return ("argument list too long"); + return "argument list too long"; case EACCES: eacces++; break; } } - return (errno == ENOENT ? "not found" : "cannot execute"); + return errno == ENOENT ? "not found" : "cannot execute"; } /* @@ -3228,7 +3229,7 @@ static int run(struct ioarg *argp, int (*f) (struct ioarg *)) outtree = otree; freearea(areanum--); - return (rv); + return rv; } /* -------- do.c -------- */ @@ -3412,7 +3413,7 @@ static int dodot(struct op *t) DBGPRINTF(("DODOT: returning exstat=%d\n", exstat)); - return (exstat); + return exstat; } } /* While */ @@ -3458,12 +3459,12 @@ static int doread(struct op *t) break; setval(lookup(*wp), e.linep); } - return (nb <= 0); + return nb <= 0; } static int doeval(struct op *t) { - return (RUN(awordlist, t->words + 1, wdchar)); + return RUN(awordlist, t->words + 1, wdchar); } static int dotrap(struct op *t) @@ -3513,7 +3514,7 @@ static int getsig(char *s) err("trap: bad signal number"); n = 0; } - return (n); + return n; } static void setsig(int n, sighandler_t f) @@ -3543,17 +3544,17 @@ static int getn(char *as) prs(as); err(": bad number"); } - return (n * m); + return n * m; } static int dobreak(struct op *t) { - return (brkcontin(t->words[1], 1)); + return brkcontin(t->words[1], 1); } static int docontinue(struct op *t) { - return (brkcontin(t->words[1], 0)); + return brkcontin(t->words[1], 0); } static int brkcontin(char *cp, int val) @@ -3714,9 +3715,9 @@ static int (*inbuilt(char *s)) (struct op *) { for (bp = builtincmds; bp->name != NULL; bp++) if (strcmp(bp->name, s) == 0) - return (bp->builtinfunc); + return bp->builtinfunc; - return (NULL); + return NULL; } /* -------- eval.c -------- */ @@ -3766,7 +3767,7 @@ static char **eval(char **ap, int f) } else gflg = 1; - return (gflg ? (char **) NULL : wp); + return gflg ? (char **) NULL : wp; } /* @@ -3784,7 +3785,7 @@ static char **makenv(int all, struct wdblock *wb) if (all || vp->status & EXPORT) wb = addword(vp->name, wb); wb = addword((char *) 0, wb); - return (getwords(wb)); + return getwords(wb); } static char *evalstr(char *cp, int f) @@ -3801,7 +3802,7 @@ static char *evalstr(char *cp, int f) DELETE(wb); } else cp = NULL; - return (cp); + return cp; } static int expand(char *cp, struct wdblock **wbp, int f) @@ -3844,7 +3845,7 @@ static int expand(char *cp, struct wdblock **wbp, int f) quitenv(); } else gflg = 1; - return (gflg == 0); + return gflg == 0; } /* @@ -3868,7 +3869,7 @@ static char *blank(int f) if (sp == e.linep) return 0; *e.linep++ = 0; - return (sp); + return sp; default: if (f & DOBLANK && any(c, ifs->value)) @@ -3913,7 +3914,7 @@ static char *blank(int f) *e.linep++ = c; } *e.linep++ = 0; - return (sp); + return sp; } /* @@ -3939,7 +3940,7 @@ static int subgetc(char ec, int quoted) goto again; } } - return (c); + return c; } /* @@ -3979,7 +3980,7 @@ static int dollar(int quoted) if (c != '}') { err("unclosed ${"); gflg++; - return (c); + return c; } } if (e.linep >= elinep) { @@ -4235,7 +4236,7 @@ static char *unquote(char *as) if ((s = as) != NULL) while (*s) *s++ &= ~QUOTE; - return (as); + return as; } /* -------- glob.c -------- */ @@ -4257,7 +4258,7 @@ static struct wdblock *glob(char *cp, struct wdblock *wb) char *pp; if (cp == 0) - return (wb); + return wb; i = 0; for (pp = cp; *pp; pp++) if (any(*pp, spcl)) @@ -4288,11 +4289,11 @@ static struct wdblock *glob(char *cp, struct wdblock *wb) for (i = 0; i < cl->w_nword; i++) wb = addword(cl->w_words[i], wb); DELETE(cl); - return (wb); + return wb; } } wb = addword(unquote(cp), wb); - return (wb); + return wb; } static void globname(char *we, char *pp) @@ -4368,7 +4369,7 @@ static char *generate(char *start1, char *end1, char *middle, char *end) for (xp = middle; (*op++ = *xp++) != '\0';); op--; for (xp = end; (*op++ = *xp++) != '\0';); - return (p); + return p; } static int anyspcl(struct wdblock *wb) @@ -4385,7 +4386,7 @@ static int anyspcl(struct wdblock *wb) static int xstrcmp(char *p1, char *p2) { - return (strcmp(*(char **) p1, *(char **) p2)); + return strcmp(*(char **) p1, *(char **) p2); } /* -------- word.c -------- */ @@ -4397,7 +4398,7 @@ static struct wdblock *newword(int nw) wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *)); wb->w_bsize = nw; wb->w_nword = 0; - return (wb); + return wb; } static struct wdblock *addword(char *wd, struct wdblock *wb) @@ -4416,7 +4417,7 @@ static struct wdblock *addword(char *wd, struct wdblock *wb) wb = wb2; } wb->w_words[wb->w_nword++] = wd; - return (wb); + return wb; } static @@ -4426,15 +4427,15 @@ char **getwords(struct wdblock *wb) int nb; if (wb == NULL) - return ((char **) NULL); + return NULL; if (wb->w_nword == 0) { DELETE(wb); - return ((char **) NULL); + return NULL; } wd = (char **) space(nb = sizeof(*wd) * wb->w_nword); memcpy((char *) wd, (char *) wb->w_words, nb); DELETE(wb); /* perhaps should done by caller */ - return (wd); + return wd; } static int (*func) (char *, char *); @@ -4563,18 +4564,18 @@ static int my_getc(int ec) while ((c = readc()) != '\n' && c); err("input line too long"); gflg++; - return (c); + return c; } c = readc(); if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) { if (c == '\\') { c = readc(); if (c == '\n' && ec != '\"') - return (my_getc(ec)); + return my_getc(ec); c |= QUOTE; } } - return (c); + return c; } static void unget(int c) @@ -4598,7 +4599,7 @@ static int readc(void) RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc)); if ((c = e.iop->peekc) != '\0') { e.iop->peekc = 0; - return (c); + return c; } else { if (e.iop->prev != 0) { if ((c = (*e.iop->iofn) (e.iop->argp, e.iop)) != '\0') { @@ -4722,7 +4723,7 @@ static struct io *setbase(struct io *ip) xp = e.iobase; e.iobase = ip; - return (xp); + return xp; } /* @@ -4740,9 +4741,9 @@ static int nlchar(struct ioarg *ap) return 0; if ((c = *ap->aword++) == 0) { ap->aword = NULL; - return ('\n'); + return '\n'; } - return (c); + return c; } /* @@ -4758,12 +4759,12 @@ static int wdchar(struct ioarg *ap) return 0; if (*wl != NULL) { if ((c = *(*wl)++) != 0) - return (c & 0177); + return c & 0177; ap->awordlist++; - return (' '); + return ' '; } ap->awordlist = NULL; - return ('\n'); + return '\n'; } /* @@ -4789,9 +4790,9 @@ static int xxchar(struct ioarg *ap) return 0; if ((c = *ap->aword++) == '\0') { ap->aword = NULL; - return (' '); + return ' '; } - return (c); + return c; } /* @@ -4803,7 +4804,7 @@ static int strchar(struct ioarg *ap) if (ap->aword == NULL || (c = *ap->aword++) == 0) return 0; - return (c); + return c; } /* @@ -4815,7 +4816,7 @@ static int qstrchar(struct ioarg *ap) if (ap->aword == NULL || (c = *ap->aword++) == 0) return 0; - return (c | QUOTE); + return c | QUOTE; } /* @@ -4859,13 +4860,13 @@ static int filechar(struct ioarg *ap) } c = mycommand[position]; position++; - return (c); + return c; } else #endif { i = safe_read(ap->afile, &c, sizeof(c)); - return (i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0)); + return i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0); } } @@ -4881,7 +4882,7 @@ static int herechar(struct ioarg *ap) close(ap->afile); c = 0; } - return (c); + return c; } @@ -4895,7 +4896,7 @@ static int gravechar(struct ioarg *ap, struct io *iop) if ((c = qgravechar(ap, iop) & ~QUOTE) == '\n') c = ' '; - return (c); + return c; } static int qgravechar(struct ioarg *ap, struct io *iop) @@ -4907,7 +4908,7 @@ static int qgravechar(struct ioarg *ap, struct io *iop) if (iop->xchar) { if (iop->nlcount) { iop->nlcount--; - return ('\n' | QUOTE); + return '\n' | QUOTE; } c = iop->xchar; iop->xchar = 0; @@ -4917,11 +4918,11 @@ static int qgravechar(struct ioarg *ap, struct io *iop) iop->nlcount++; iop->xchar = c; if (c == 0) - return (c); + return c; iop->nlcount--; c = '\n'; } - return (c != 0 ? c | QUOTE : 0); + return c != 0 ? c | QUOTE : 0; } /* @@ -4937,7 +4938,7 @@ static int linechar(struct ioarg *ap) ap->afile = -1; /* illegal value */ } } - return (c); + return c; } static void prs(const char *s) @@ -4996,7 +4997,7 @@ static int remap(int fd) err("too many files open in shell"); } - return (fd); + return fd; } static int openpipe(int *pv) @@ -5005,7 +5006,7 @@ static int openpipe(int *pv) if ((i = pipe(pv)) < 0) err("can't create pipe - try again"); - return (i); + return i; } static void closepipe(int *pv) @@ -5172,9 +5173,9 @@ static int herein(char *hname, int xdoll) close(tf); tf = open(tname, 0); unlink(tname); - return (tf); + return tf; } else - return (hf); + return hf; } 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[]) s=xmalloc(strlen(argv[1])+1); strcpy(s,argv[1]+strspn(argv[1],"-+")); argv[1]=argv[0]; - return (generate_output(argv+1,argc-1,s,long_options)); + return generate_output(argv+1,argc-1,s,long_options); } - while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) + while ((opt = getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF) switch (opt) { case 'a': 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) argv++; } - return (nb_errors); + return nb_errors; } #endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */