style cleanup: return(a) -> return a, part 1

This commit is contained in:
Denis Vlasenko 2006-11-27 16:49:31 +00:00
parent 10d0d4eec7
commit 079f8afa0a
36 changed files with 214 additions and 219 deletions

View File

@ -82,5 +82,5 @@ int cpio_main(int argc, char **argv)
while (get_header_cpio(archive_handle) == EXIT_SUCCESS); while (get_header_cpio(archive_handle) == EXIT_SUCCESS);
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }

View File

@ -90,7 +90,7 @@ int dpkg_deb_main(int argc, char **argv)
unpack_ar_archive(ar_archive); unpack_ar_archive(ar_archive);
/* Cleanup */ /* Cleanup */
close (ar_archive->src_fd); close(ar_archive->src_fd);
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }

View File

@ -123,7 +123,7 @@ static unsigned int fill_bitbuffer(unsigned int bitbuffer, unsigned int *current
bytebuffer_offset++; bytebuffer_offset++;
*current += 8; *current += 8;
} }
return(bitbuffer); return bitbuffer;
} }
/* /*

View File

@ -11,9 +11,7 @@
/* Accept any non-null name, its not really a filter at all */ /* Accept any non-null name, its not really a filter at all */
char filter_accept_all(archive_handle_t *archive_handle) char filter_accept_all(archive_handle_t *archive_handle)
{ {
if (archive_handle->file_header->name) { if (archive_handle->file_header->name)
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} else { return EXIT_FAILURE;
return(EXIT_FAILURE);
}
} }

View File

@ -13,9 +13,7 @@
*/ */
char filter_accept_list(archive_handle_t *archive_handle) char filter_accept_list(archive_handle_t *archive_handle)
{ {
if (find_list_entry(archive_handle->accept, archive_handle->file_header->name)) { if (find_list_entry(archive_handle->accept, archive_handle->file_header->name))
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} else { return EXIT_FAILURE;
return(EXIT_FAILURE);
}
} }

View File

@ -30,19 +30,19 @@ char filter_accept_list_reassign(archive_handle_t *archive_handle)
#ifdef CONFIG_FEATURE_DEB_TAR_GZ #ifdef CONFIG_FEATURE_DEB_TAR_GZ
if (strcmp(name_ptr, ".gz") == 0) { if (strcmp(name_ptr, ".gz") == 0) {
archive_handle->action_data_subarchive = get_header_tar_gz; archive_handle->action_data_subarchive = get_header_tar_gz;
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }
#endif #endif
#ifdef CONFIG_FEATURE_DEB_TAR_BZ2 #ifdef CONFIG_FEATURE_DEB_TAR_BZ2
if (strcmp(name_ptr, ".bz2") == 0) { if (strcmp(name_ptr, ".bz2") == 0) {
archive_handle->action_data_subarchive = get_header_tar_bz2; archive_handle->action_data_subarchive = get_header_tar_bz2;
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }
#endif #endif
if (ENABLE_FEATURE_DEB_TAR_LZMA && !strcmp(name_ptr, ".lzma")) { if (ENABLE_FEATURE_DEB_TAR_LZMA && !strcmp(name_ptr, ".lzma")) {
archive_handle->action_data_subarchive = get_header_tar_lzma; archive_handle->action_data_subarchive = get_header_tar_lzma;
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }
} }
return(EXIT_FAILURE); return EXIT_FAILURE;
} }

View File

@ -19,15 +19,15 @@ char filter_accept_reject_list(archive_handle_t *archive_handle)
/* If the key is in a reject list fail */ /* If the key is in a reject list fail */
if (reject_entry) { if (reject_entry) {
return(EXIT_FAILURE); return EXIT_FAILURE;
} }
accept_entry = find_list_entry2(archive_handle->accept, key); accept_entry = find_list_entry2(archive_handle->accept, key);
/* Fail if an accept list was specified and the key wasnt in there */ /* Fail if an accept list was specified and the key wasnt in there */
if ((accept_entry == NULL) && archive_handle->accept) { if ((accept_entry == NULL) && archive_handle->accept) {
return(EXIT_FAILURE); return EXIT_FAILURE;
} }
/* Accepted */ /* Accepted */
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }

View File

@ -30,7 +30,7 @@ char get_header_ar(archive_handle_t *archive_handle)
/* dont use xread as we want to handle the error ourself */ /* dont use xread as we want to handle the error ourself */
if (read(archive_handle->src_fd, ar.raw, 60) != 60) { if (read(archive_handle->src_fd, ar.raw, 60) != 60) {
/* End Of File */ /* End Of File */
return(EXIT_FAILURE); return EXIT_FAILURE;
} }
/* ar header starts on an even byte (2 byte aligned) /* ar header starts on an even byte (2 byte aligned)
@ -108,5 +108,5 @@ char get_header_ar(archive_handle_t *archive_handle)
/* Set the file pointer to the correct spot, we may have been reading a compressed file */ /* Set the file pointer to the correct spot, we may have been reading a compressed file */
lseek(archive_handle->src_fd, archive_handle->offset, SEEK_SET); lseek(archive_handle->src_fd, archive_handle->offset, SEEK_SET);
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }

View File

@ -183,7 +183,7 @@ static int readhash(FILE * f)
for (i = 0; (t = getc(f)) != '\n'; i++) { for (i = 0; (t = getc(f)) != '\n'; i++) {
if (t == EOF) { if (t == EOF) {
if (i == 0) if (i == 0)
return (0); return 0;
break; break;
} }
sum = sum * 127 + t; sum = sum * 127 + t;
@ -191,7 +191,7 @@ static int readhash(FILE * f)
for (i = 0; (t = getc(f)) != '\n'; i++) { for (i = 0; (t = getc(f)) != '\n'; i++) {
if (t == EOF) { if (t == EOF) {
if (i == 0) if (i == 0)
return (0); return 0;
break; break;
} }
sum = sum * 127 + t; sum = sum * 127 + t;
@ -216,7 +216,7 @@ static int readhash(FILE * f)
continue; continue;
case EOF: case EOF:
if (i == 0) if (i == 0)
return (0); return 0;
/* FALLTHROUGH */ /* FALLTHROUGH */
case '\n': case '\n':
break; break;
@ -244,19 +244,19 @@ static int files_differ(FILE * f1, FILE * f2, int flags)
if ((flags & (D_EMPTY1 | D_EMPTY2)) || stb1.st_size != stb2.st_size || if ((flags & (D_EMPTY1 | D_EMPTY2)) || stb1.st_size != stb2.st_size ||
(stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT)) (stb1.st_mode & S_IFMT) != (stb2.st_mode & S_IFMT))
return (1); return 1;
while (1) { while (1) {
i = fread(buf1, 1, sizeof(buf1), f1); i = fread(buf1, 1, sizeof(buf1), f1);
j = fread(buf2, 1, sizeof(buf2), f2); j = fread(buf2, 1, sizeof(buf2), f2);
if (i != j) if (i != j)
return (1); return 1;
if (i == 0 && j == 0) { if (i == 0 && j == 0) {
if (ferror(f1) || ferror(f2)) if (ferror(f1) || ferror(f2))
return (1); return 1;
return (0); return 0;
} }
if (memcmp(buf1, buf2, i) != 0) if (memcmp(buf1, buf2, i) != 0)
return (1); return 1;
} }
} }
@ -333,7 +333,7 @@ static int isqrt(int n)
int y, x = 1; int y, x = 1;
if (n == 0) if (n == 0)
return (0); return 0;
do { do {
y = x; y = x;
@ -610,7 +610,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch)
int i, j, c, lastc, col, nc; int i, j, c, lastc, col, nc;
if (a > b) if (a > b)
return (0); return 0;
for (i = a; i <= b; i++) { for (i = a; i <= b; i++) {
fseek(lb, f[i - 1], SEEK_SET); fseek(lb, f[i - 1], SEEK_SET);
nc = f[i] - f[i - 1]; nc = f[i] - f[i - 1];
@ -623,7 +623,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch)
for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) { for (j = 0, lastc = '\0'; j < nc; j++, lastc = c) {
if ((c = getc(lb)) == EOF) { if ((c = getc(lb)) == EOF) {
puts("\n\\ No newline at end of file"); puts("\n\\ No newline at end of file");
return (0); return 0;
} }
if (c == '\t' && (cmd_flags & FLAG_t)) { if (c == '\t' && (cmd_flags & FLAG_t)) {
do { do {
@ -635,7 +635,7 @@ static int fetch(long *f, int a, int b, FILE * lb, int ch)
} }
} }
} }
return (0); return 0;
} }
static int asciifile(FILE * f) static int asciifile(FILE * f)
@ -646,18 +646,18 @@ static int asciifile(FILE * f)
#endif #endif
if ((cmd_flags & FLAG_a) || f == NULL) if ((cmd_flags & FLAG_a) || f == NULL)
return (1); return 1;
#if ENABLE_FEATURE_DIFF_BINARY #if ENABLE_FEATURE_DIFF_BINARY
rewind(f); rewind(f);
cnt = fread(buf, 1, sizeof(buf), f); cnt = fread(buf, 1, sizeof(buf), f);
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
if (!isprint(buf[i]) && !isspace(buf[i])) { if (!isprint(buf[i]) && !isspace(buf[i])) {
return (0); return 0;
} }
} }
#endif #endif
return (1); return 1;
} }
/* dump accumulated "unified" diff changes */ /* dump accumulated "unified" diff changes */

View File

@ -92,7 +92,7 @@ int install_main(int argc, char **argv)
} }
} while (old_argv_ptr); } while (old_argv_ptr);
} }
return(ret); return ret;
} }
{ {
@ -127,5 +127,5 @@ int install_main(int argc, char **argv)
if(ENABLE_FEATURE_CLEAN_UP && isdir) free(dest); if(ENABLE_FEATURE_CLEAN_UP && isdir) free(dest);
} }
return(ret); return ret;
} }

View File

@ -19,5 +19,5 @@ int sync_main(int argc, char **argv)
sync(); sync();
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }

View File

@ -520,17 +520,17 @@ static int test_eaccess(char *path, int mode)
unsigned int euid = geteuid(); unsigned int euid = geteuid();
if (stat(path, &st) < 0) if (stat(path, &st) < 0)
return (-1); return -1;
if (euid == 0) { if (euid == 0) {
/* Root can read or write any file. */ /* Root can read or write any file. */
if (mode != X_OK) if (mode != X_OK)
return (0); return 0;
/* Root can execute any file that has any one of the execute /* Root can execute any file that has any one of the execute
bits set. */ bits set. */
if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))
return (0); return 0;
} }
if (st.st_uid == euid) /* owner */ if (st.st_uid == euid) /* owner */
@ -539,9 +539,9 @@ static int test_eaccess(char *path, int mode)
mode <<= 3; mode <<= 3;
if (st.st_mode & mode) if (st.st_mode & mode)
return (0); return 0;
return (-1); return -1;
} }
static void initialize_group_array(void) static void initialize_group_array(void)
@ -560,7 +560,7 @@ static int is_a_group_member(gid_t gid)
/* Short-circuit if possible, maybe saving a call to getgroups(). */ /* Short-circuit if possible, maybe saving a call to getgroups(). */
if (gid == getgid() || gid == getegid()) if (gid == getgid() || gid == getegid())
return (1); return 1;
if (ngroups == 0) if (ngroups == 0)
initialize_group_array(); initialize_group_array();
@ -568,9 +568,9 @@ static int is_a_group_member(gid_t gid)
/* Search through the list looking for GID. */ /* Search through the list looking for GID. */
for (i = 0; i < ngroups; i++) for (i = 0; i < ngroups; i++)
if (gid == group_array[i]) if (gid == group_array[i])
return (1); return 1;
return (0); return 0;
} }

View File

@ -249,5 +249,5 @@ int tr_main(int argc, char **argv)
outvec[(GCC4_IS_STUPID)output[i]] = TRUE; outvec[(GCC4_IS_STUPID)output[i]] = TRUE;
} }
convert(); convert();
return (0); return 0;
} }

View File

@ -85,7 +85,7 @@ static int run_parts(char **args, const unsigned char test_mode)
if (entries == -1) { if (entries == -1) {
if (test_mode & 2) { if (test_mode & 2) {
return(2); return 2;
} }
bb_perror_msg_and_die("cannot open '%s'", arg0); bb_perror_msg_and_die("cannot open '%s'", arg0);
} }

View File

@ -209,6 +209,6 @@ int main(int argc, char **argv)
blkid_put_cache(cache); blkid_put_cache(cache);
return (0); return 0;
} }
#endif #endif

View File

@ -363,6 +363,6 @@ int main(int argc, char **argv)
printf("%s: error probing devices\n", argv[0]); printf("%s: error probing devices\n", argv[0]);
blkid_put_cache(cache); blkid_put_cache(cache);
return (0); return 0;
} }
#endif #endif

View File

@ -706,7 +706,7 @@ int main(int argc, char **argv)
dev = blkid_get_dev(cache, argv[1], BLKID_DEV_NORMAL); dev = blkid_get_dev(cache, argv[1], BLKID_DEV_NORMAL);
if (!dev) { if (!dev) {
printf("%s: %s has an unsupported type\n", argv[0], argv[1]); printf("%s: %s has an unsupported type\n", argv[0], argv[1]);
return (1); return 1;
} }
printf("%s is type %s\n", argv[1], dev->bid_type ? printf("%s is type %s\n", argv[1], dev->bid_type ?
dev->bid_type : "(null)"); dev->bid_type : "(null)");
@ -716,6 +716,6 @@ int main(int argc, char **argv)
printf("\tuuid is %s\n", dev->bid_uuid); printf("\tuuid is %s\n", dev->bid_uuid);
blkid_free_dev(dev); blkid_free_dev(dev);
return (0); return 0;
} }
#endif #endif

View File

@ -416,7 +416,7 @@ int main(int argc, char **argv)
printf("Device %s: (%s, %s) %s\n", blkid_dev_devname(dev), printf("Device %s: (%s, %s) %s\n", blkid_dev_devname(dev),
search_type, search_value ? search_value : "NULL", search_type, search_value ? search_value : "NULL",
found ? "FOUND" : "NOT FOUND"); found ? "FOUND" : "NOT FOUND");
return(!found); return !found;
} }
printf("Device %s...\n", blkid_dev_devname(dev)); printf("Device %s...\n", blkid_dev_devname(dev));
@ -427,6 +427,6 @@ int main(int argc, char **argv)
blkid_tag_iterate_end(iter); blkid_tag_iterate_end(iter);
blkid_put_cache(cache); blkid_put_cache(cache);
return (0); return 0;
} }
#endif #endif

View File

@ -739,7 +739,7 @@ static struct dir_info *e2fsck_dir_info_iter(e2fsck_t ctx, int *control)
if (*control >= ctx->dir_info_count) if (*control >= ctx->dir_info_count)
return 0; return 0;
return(ctx->dir_info + (*control)++); return ctx->dir_info + (*control)++;
} }
/* /*
@ -870,7 +870,7 @@ static struct dx_dir_info *e2fsck_dx_dir_info_iter(e2fsck_t ctx, int *control)
if (*control >= ctx->dx_dir_info_count) if (*control >= ctx->dx_dir_info_count)
return 0; return 0;
return(ctx->dx_dir_info + (*control)++); return ctx->dx_dir_info + (*control)++;
} }
#endif /* ENABLE_HTREE */ #endif /* ENABLE_HTREE */
@ -1055,7 +1055,7 @@ static errcode_t ea_refcount_create(int size, ext2_refcount_t *ret)
errout: errout:
ea_refcount_free(refcount); ea_refcount_free(refcount);
return(retval); return retval;
} }
/* /*
@ -4929,7 +4929,7 @@ static int search_dirent_proc(ext2_ino_t dir, int entry,
p->dir = dir; p->dir = dir;
sd->count--; sd->count--;
return(sd->count ? 0 : DIRENT_ABORT); return sd->count ? 0 : DIRENT_ABORT;
} }

View File

@ -139,7 +139,7 @@ errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, unsigned int size,
errout: errout:
ext2fs_free_icount(icount); ext2fs_free_icount(icount);
return(retval); return retval;
} }
errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, errcode_t ext2fs_create_icount(ext2_filsys fs, int flags,

View File

@ -549,7 +549,7 @@ static char *find_fsck(char *type)
free(s); free(s);
} }
free(p); free(p);
return(s); return s;
} }
static int progress_active(void) static int progress_active(void)

View File

@ -38,7 +38,7 @@
#include "uuidP.h" #include "uuidP.h"
#include <string.h> #include <string.h>
#define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1); #define UUCMP(u1,u2) if (u1 != u2) return (u1 < u2) ? -1 : 1;
int uuid_compare(const uuid_t uu1, const uuid_t uu2) int uuid_compare(const uuid_t uu1, const uuid_t uu2)
{ {

View File

@ -43,7 +43,7 @@ static unsigned int copy_lines(FILE *src_stream, FILE *dest_stream, const unsign
i++; i++;
} }
return(i); return i;
} }
/* If patch_level is -1 it will remove all directory names /* If patch_level is -1 it will remove all directory names
@ -67,13 +67,13 @@ static char *extract_filename(char *line, int patch_level)
filename_start_ptr = temp + 1; filename_start_ptr = temp + 1;
} }
return(xstrdup(filename_start_ptr)); return xstrdup(filename_start_ptr);
} }
static int file_doesnt_exist(const char *filename) static int file_doesnt_exist(const char *filename)
{ {
struct stat statbuf; struct stat statbuf;
return(stat(filename, &statbuf)); return stat(filename, &statbuf);
} }
int patch_main(int argc, char **argv) int patch_main(int argc, char **argv)
@ -269,5 +269,5 @@ int patch_main(int argc, char **argv)
* 1 = Some hunks failed * 1 = Some hunks failed
* 2 = More serious problems * 2 = More serious problems
*/ */
return(ret); return ret;
} }

View File

@ -343,7 +343,7 @@ int vi_main(int argc, char **argv)
} }
//----------------------------------------------------------- //-----------------------------------------------------------
return (0); return 0;
} }
static void edit_file(Byte * fn) static void edit_file(Byte * fn)
@ -530,7 +530,7 @@ static Byte *get_one_address(Byte * p, int *addr) // get colon addr, if present
// unrecognised address- assume -1 // unrecognised address- assume -1
*addr = -1; *addr = -1;
} }
return (p); return p;
} }
static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if present static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if present
@ -558,7 +558,7 @@ static Byte *get_address(Byte *p, int *b, int *e) // get two colon addrs, if pre
ga0: ga0:
while (isblnk(*p)) while (isblnk(*p))
p++; // skip over trailing spaces p++; // skip over trailing spaces
return (p); return p;
} }
#ifdef CONFIG_FEATURE_VI_SETOPTS #ifdef CONFIG_FEATURE_VI_SETOPTS
@ -1166,14 +1166,14 @@ static Byte *begin_line(Byte * p) // return pointer to first char cur line
{ {
while (p > text && p[-1] != '\n') while (p > text && p[-1] != '\n')
p--; // go to cur line B-o-l p--; // go to cur line B-o-l
return (p); return p;
} }
static Byte *end_line(Byte * p) // return pointer to NL of cur line line static Byte *end_line(Byte * p) // return pointer to NL of cur line line
{ {
while (p < end - 1 && *p != '\n') while (p < end - 1 && *p != '\n')
p++; // go to cur line E-o-l p++; // go to cur line E-o-l
return (p); return p;
} }
static inline Byte *dollar_line(Byte * p) // return pointer to just before NL line static inline Byte *dollar_line(Byte * p) // return pointer to just before NL line
@ -1183,7 +1183,7 @@ static inline Byte *dollar_line(Byte * p) // return pointer to just before NL li
// Try to stay off of the Newline // Try to stay off of the Newline
if (*p == '\n' && (p - begin_line(p)) > 0) if (*p == '\n' && (p - begin_line(p)) > 0)
p--; p--;
return (p); return p;
} }
static Byte *prev_line(Byte * p) // return pointer first char prev line static Byte *prev_line(Byte * p) // return pointer first char prev line
@ -1192,7 +1192,7 @@ static Byte *prev_line(Byte * p) // return pointer first char prev line
if (p[-1] == '\n' && p > text) if (p[-1] == '\n' && p > text)
p--; // step to prev line p--; // step to prev line
p = begin_line(p); // goto begining of prev line p = begin_line(p); // goto begining of prev line
return (p); return p;
} }
static Byte *next_line(Byte * p) // return pointer first char next line static Byte *next_line(Byte * p) // return pointer first char next line
@ -1200,7 +1200,7 @@ static Byte *next_line(Byte * p) // return pointer first char next line
p = end_line(p); p = end_line(p);
if (*p == '\n' && p < end - 1) if (*p == '\n' && p < end - 1)
p++; // step to next line p++; // step to next line
return (p); return p;
} }
//----- Text Information Routines ------------------------------ //----- Text Information Routines ------------------------------
@ -1214,7 +1214,7 @@ static Byte *end_screen(void)
for (cnt = 0; cnt < rows - 2; cnt++) for (cnt = 0; cnt < rows - 2; cnt++)
q = next_line(q); q = next_line(q);
q = end_line(q); q = end_line(q);
return (q); return q;
} }
static int count_lines(Byte * start, Byte * stop) // count line from start to stop static int count_lines(Byte * start, Byte * stop) // count line from start to stop
@ -1243,7 +1243,7 @@ static Byte *find_line(int li) // find begining of line #li
for (q = text; li > 1; li--) { for (q = text; li > 1; li--) {
q = next_line(q); q = next_line(q);
} }
return (q); return q;
} }
//----- Dot Movement Routines ---------------------------------- //----- Dot Movement Routines ----------------------------------
@ -1285,7 +1285,7 @@ static Byte *move_to_col(Byte * p, int l)
co++; // display as ^X, use 2 columns co++; // display as ^X, use 2 columns
} }
} while (++co <= l && p++ < end); } while (++co <= l && p++ < end);
return (p); return p;
} }
static void dot_next(void) static void dot_next(void)
@ -1344,7 +1344,7 @@ static Byte *bound_dot(Byte * p) // make sure text[0] <= P < "end"
p = text; p = text;
indicate_error('2'); indicate_error('2');
} }
return (p); return p;
} }
//----- Helper Utility Routines -------------------------------- //----- Helper Utility Routines --------------------------------
@ -1489,7 +1489,7 @@ static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for
} else { } else {
p = p - i; p = p - i;
} }
return (p); return p;
#endif /*REGEX_SEARCH */ #endif /*REGEX_SEARCH */
} }
#endif /* CONFIG_FEATURE_VI_SEARCH */ #endif /* CONFIG_FEATURE_VI_SEARCH */
@ -1540,7 +1540,7 @@ static Byte *char_insert(Byte * p, Byte c) // insert the char c at 'p'
} }
#endif /* CONFIG_FEATURE_VI_SETOPTS */ #endif /* CONFIG_FEATURE_VI_SETOPTS */
} }
return (p); return p;
} }
static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p' static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p'
@ -1551,7 +1551,7 @@ static Byte *stupid_insert(Byte * p, Byte c) // stupidly insert the char c at 'p
file_modified++; // has the file been modified file_modified++; // has the file been modified
p++; p++;
} }
return (p); return p;
} }
static Byte find_range(Byte ** start, Byte ** stop, Byte c) static Byte find_range(Byte ** start, Byte ** stop, Byte c)
@ -1659,7 +1659,7 @@ static Byte *skip_thing(Byte * p, int linecnt, int dir, int type)
break; break;
p += dir; // move to next char p += dir; // move to next char
} }
return (p); return p;
} }
// find matching char of pair () [] {} // find matching char of pair () [] {}
@ -1705,7 +1705,7 @@ static Byte *find_pair(Byte * p, Byte c)
} }
if (level != 0) if (level != 0)
q = NULL; // indicate no match q = NULL; // indicate no match
return (q); return q;
} }
#ifdef CONFIG_FEATURE_VI_SETOPTS #ifdef CONFIG_FEATURE_VI_SETOPTS
@ -1748,7 +1748,7 @@ static Byte *text_hole_make(Byte * p, int size) // at "p", make a 'size' byte ho
end = end + size; // adjust the new END end = end + size; // adjust the new END
file_modified++; // has the file been modified file_modified++; // has the file been modified
thm0: thm0:
return (p); return p;
} }
// close a hole in text[] // close a hole in text[]
@ -1805,7 +1805,7 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf)
// we cannot cross NL boundaries // we cannot cross NL boundaries
p = start; p = start;
if (*p == '\n') if (*p == '\n')
return (p); return p;
// dont go past a NewLine // dont go past a NewLine
for (; p + 1 <= stop; p++) { for (; p + 1 <= stop; p++) {
if (p[1] == '\n') { if (p[1] == '\n') {
@ -1821,7 +1821,7 @@ static Byte *yank_delete(Byte * start, Byte * stop, int dist, int yf)
if (yf == YANKDEL) { if (yf == YANKDEL) {
p = text_hole_delete(start, stop); p = text_hole_delete(start, stop);
} // delete lines } // delete lines
return (p); return p;
} }
static void show_help(void) static void show_help(void)
@ -1932,7 +1932,7 @@ static Byte *string_insert(Byte * p, Byte * s) // insert the string at 'p'
#ifdef CONFIG_FEATURE_VI_YANKMARK #ifdef CONFIG_FEATURE_VI_YANKMARK
psb("Put %d lines (%d chars) from [%c]", cnt, i, what_reg()); psb("Put %d lines (%d chars) from [%c]", cnt, i, what_reg());
#endif /* CONFIG_FEATURE_VI_YANKMARK */ #endif /* CONFIG_FEATURE_VI_YANKMARK */
return (p); return p;
} }
#endif /* CONFIG_FEATURE_VI_YANKMARK || CONFIG_FEATURE_VI_COLON || CONFIG_FEATURE_VI_CRASHME */ #endif /* CONFIG_FEATURE_VI_YANKMARK || CONFIG_FEATURE_VI_COLON || CONFIG_FEATURE_VI_CRASHME */
@ -1954,7 +1954,7 @@ static Byte *text_yank(Byte * p, Byte * q, int dest) // copy text into a registe
memset(t, '\0', cnt + 1); // clear new text[] memset(t, '\0', cnt + 1); // clear new text[]
strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer strncpy((char *) t, (char *) p, cnt); // copy text[] into bufer
reg[dest] = t; reg[dest] = t;
return (p); return p;
} }
static Byte what_reg(void) static Byte what_reg(void)
@ -2004,7 +2004,7 @@ static inline Byte *swap_context(Byte * p) // goto new context for '' command ma
context_start = prev_line(prev_line(prev_line(p))); context_start = prev_line(prev_line(prev_line(p)));
context_end = next_line(next_line(next_line(p))); context_end = next_line(next_line(next_line(p)));
} }
return (p); return p;
} }
#endif /* CONFIG_FEATURE_VI_YANKMARK */ #endif /* CONFIG_FEATURE_VI_YANKMARK */
@ -2306,7 +2306,7 @@ static int file_size(const Byte * fn) // what is the byte size of "fn"
int cnt, sr; int cnt, sr;
if (fn == 0 || strlen((char *)fn) <= 0) if (fn == 0 || strlen((char *)fn) <= 0)
return (-1); return -1;
cnt = -1; cnt = -1;
sr = stat((char *) fn, &st_buf); // see if file exists sr = stat((char *) fn, &st_buf); // see if file exists
if (sr >= 0) { if (sr >= 0) {
@ -2391,7 +2391,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
// FIXIT- use the correct umask() // FIXIT- use the correct umask()
fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664); fd = open((char *) fn, (O_WRONLY | O_CREAT | O_TRUNC), 0664);
if (fd < 0) if (fd < 0)
return (-1); return -1;
cnt = last - first + 1; cnt = last - first + 1;
charcnt = write(fd, first, cnt); charcnt = write(fd, first, cnt);
if (charcnt == cnt) { if (charcnt == cnt) {

View File

@ -322,7 +322,7 @@ static int next(char **argv)
if (argv) { if (argv) {
_argv = argv; _argv = argv;
return (1); return 1;
} }
for (;;) { for (;;) {
if (*_argv) { if (*_argv) {
@ -335,7 +335,7 @@ static int next(char **argv)
statok = done = 1; statok = done = 1;
} else { } else {
if (done++) if (done++)
return (0); return 0;
statok = 0; statok = 0;
} }
if (bb_dump_skip) if (bb_dump_skip)
@ -343,7 +343,7 @@ static int next(char **argv)
if (*_argv) if (*_argv)
++_argv; ++_argv;
if (!bb_dump_skip) if (!bb_dump_skip)
return (1); return 1;
} }
/* NOTREACHED */ /* NOTREACHED */
} }

View File

@ -97,7 +97,7 @@ static const char *obscure_msg(const char *old_p, const char *new_p, const struc
/* size */ /* size */
if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN) if (!new_p || (length = strlen(new_p)) < CONFIG_PASSWORD_MINLEN)
return("too short"); return "too short";
/* no username as-is, as sub-string, reversed, capitalized, doubled */ /* no username as-is, as sub-string, reversed, capitalized, doubled */
if (string_checker(new_p, pw->pw_name)) { if (string_checker(new_p, pw->pw_name)) {

View File

@ -1254,7 +1254,7 @@ static int get_uid_gid (int flag, const char *string)
if(ENABLE_DEVFSD_VERBOSE) if(ENABLE_DEVFSD_VERBOSE)
msg_logger(LOG_ERR,"unknown %s: %s, defaulting to %cid=0", msg, string, msg[0]); msg_logger(LOG_ERR,"unknown %s: %s, defaulting to %cid=0", msg, string, msg[0]);
return (0); return 0;
}/* End Function get_uid_gid */ }/* End Function get_uid_gid */
static mode_t get_mode (const char *string) static mode_t get_mode (const char *string)
@ -1321,7 +1321,7 @@ static const char *get_variable (const char *variable, void *info)
if( i >= 0 && i <= 3) if( i >= 0 && i <= 3)
{ {
debug_msg_logger(LOG_INFO, "%s: i=%d %s", __FUNCTION__, i ,field_names[i+7]); debug_msg_logger(LOG_INFO, "%s: i=%d %s", __FUNCTION__, i ,field_names[i+7]);
return(field_names[i+7]); return field_names[i+7];
} }
if(i == 4 ) if(i == 4 )
@ -1417,17 +1417,15 @@ static int mksymlink (const char *oldpath, const char *newpath)
debug_msg_logger(LOG_INFO, __FUNCTION__); debug_msg_logger(LOG_INFO, __FUNCTION__);
if ( !make_dir_tree (newpath) ) if ( !make_dir_tree (newpath) )
return (-1); return -1;
if (symlink (oldpath, newpath) != 0) if (symlink (oldpath, newpath) != 0) {
{ if (errno != EEXIST) {
if (errno != EEXIST)
{
debug_msg_logger(LOG_ERR, "%s: %s to %s: %m", __FUNCTION__, oldpath, newpath); debug_msg_logger(LOG_ERR, "%s: %s to %s: %m", __FUNCTION__, oldpath, newpath);
return (-1); return -1;
} }
} }
return (0); return 0;
} /* End Function mksymlink */ } /* End Function mksymlink */
@ -1444,7 +1442,7 @@ static int make_dir_tree (const char *path)
debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path); debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path);
return (FALSE); return (FALSE);
} }
return(TRUE); return TRUE;
} /* End Function make_dir_tree */ } /* End Function make_dir_tree */
static int expand_expression(char *output, unsigned int outsize, static int expand_expression(char *output, unsigned int outsize,

View File

@ -3632,9 +3632,9 @@ static int obj_gpl_license(struct obj_file *f, const char **license)
*license = value+1; *license = value+1;
for (i = 0; i < sizeof(gpl_licenses)/sizeof(gpl_licenses[0]); ++i) { for (i = 0; i < sizeof(gpl_licenses)/sizeof(gpl_licenses[0]); ++i) {
if (strcmp(value+1, gpl_licenses[i]) == 0) if (strcmp(value+1, gpl_licenses[i]) == 0)
return(0); return 0;
} }
return(2); return 2;
} }
if (strchr(ptr, '\0')) if (strchr(ptr, '\0'))
ptr = strchr(ptr, '\0') + 1; ptr = strchr(ptr, '\0') + 1;
@ -3642,7 +3642,7 @@ static int obj_gpl_license(struct obj_file *f, const char **license)
ptr = endptr; ptr = endptr;
} }
} }
return(1); return 1;
} }
#define TAINT_FILENAME "/proc/sys/kernel/tainted" #define TAINT_FILENAME "/proc/sys/kernel/tainted"
@ -4227,12 +4227,11 @@ out:
if(fp) if(fp)
fclose(fp); fclose(fp);
free(tmp1); free(tmp1);
if(!tmp1) { if(!tmp1)
free(m_name); free(m_name);
}
free(m_filename); free(m_filename);
#endif #endif
return(exit_status); return exit_status;
} }

View File

@ -134,7 +134,7 @@ int lsmod_main(int argc, char **argv)
free(module_names); free(module_names);
#endif #endif
return( 0); return 0;
} }
#else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */ #else /* CONFIG_FEATURE_QUERY_MODULE_INTERFACE */

View File

@ -57,8 +57,8 @@ int rmmod_main(int argc, char **argv)
while (nmod != pnmod) { while (nmod != pnmod) {
if (syscall(__NR_delete_module, NULL, flags) != 0) { if (syscall(__NR_delete_module, NULL, flags) != 0) {
if (errno==EFAULT) if (errno == EFAULT)
return(ret); return ret;
bb_perror_msg_and_die("rmmod"); bb_perror_msg_and_die("rmmod");
} }
pnmod = nmod; pnmod = nmod;
@ -92,5 +92,5 @@ int rmmod_main(int argc, char **argv)
} }
} }
return(ret); return ret;
} }

View File

@ -100,7 +100,7 @@ static FILE *ftp_login(ftp_host_info_t *server)
ftpcmd("TYPE I", NULL, control_stream, buf); ftpcmd("TYPE I", NULL, control_stream, buf);
return(control_stream); return control_stream;
} }
#if !ENABLE_FTPGET #if !ENABLE_FTPGET
@ -187,7 +187,7 @@ int ftp_receive(ftp_host_info_t *server, FILE *control_stream,
} }
ftpcmd("QUIT", NULL, control_stream, buf); ftpcmd("QUIT", NULL, control_stream, buf);
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }
#endif #endif
@ -252,7 +252,7 @@ int ftp_send(ftp_host_info_t *server, FILE *control_stream,
} }
ftpcmd("QUIT", NULL, control_stream, buf); ftpcmd("QUIT", NULL, control_stream, buf);
return(EXIT_SUCCESS); return EXIT_SUCCESS;
} }
#endif #endif
@ -338,5 +338,5 @@ int ftpgetput_main(int argc, char **argv)
/* Connect/Setup/Configure the FTP session */ /* Connect/Setup/Configure the FTP session */
control_stream = ftp_login(server); control_stream = ftp_login(server);
return(ftp_action(server, control_stream, argv[optind + 1], argv[optind + 2])); return ftp_action(server, control_stream, argv[optind + 1], argv[optind + 2]);
} }

View File

@ -2129,10 +2129,10 @@ unalias(const char *name)
INTOFF; INTOFF;
*app = freealias(*app); *app = freealias(*app);
INTON; INTON;
return (0); return 0;
} }
return (1); return 1;
} }
static void static void
@ -2181,7 +2181,7 @@ aliascmd(int argc, char **argv)
for (ap = atab[i]; ap; ap = ap->next) { for (ap = atab[i]; ap; ap = ap->next) {
printalias(ap); printalias(ap);
} }
return (0); return 0;
} }
while ((n = *++argv) != NULL) { while ((n = *++argv) != NULL) {
if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */ if ((v = strchr(n+1, '=')) == NULL) { /* n+1: funny ksh stuff */
@ -2207,7 +2207,7 @@ unaliascmd(int argc, char **argv)
while ((i = nextopt("a")) != '\0') { while ((i = nextopt("a")) != '\0') {
if (i == 'a') { if (i == 'a') {
rmaliases(); rmaliases();
return (0); return 0;
} }
} }
for (i = 0; *argptr; argptr++) { for (i = 0; *argptr; argptr++) {
@ -13420,7 +13420,8 @@ static int arith_apply(operator op, v_n_t *numstack, v_n_t **numstackptr)
/* protect geting var value, is number now */ /* protect geting var value, is number now */
numptr_m1->var = NULL; numptr_m1->var = NULL;
return 0; return 0;
err: return(-1); err:
return -1;
} }
/* longest must first */ /* longest must first */

View File

@ -1180,7 +1180,8 @@ static int get_next_history(void)
if (ch < n_history) { if (ch < n_history) {
get_previous_history(); /* save the current history line */ get_previous_history(); /* save the current history line */
return (cur_history = ch+1); cur_history = ch + 1;
return cur_history;
} else { } else {
beep(); beep();
return 0; return 0;

View File

@ -1225,7 +1225,7 @@ static int checkjobs(struct pipe* fg_pipe)
if (i==fg_pipe->num_progs-1) if (i==fg_pipe->num_progs-1)
rcode=WEXITSTATUS(status); rcode=WEXITSTATUS(status);
(fg_pipe->num_progs)--; (fg_pipe->num_progs)--;
return(rcode); return rcode;
} }
} }
} }
@ -2768,7 +2768,7 @@ int hush_main(int argc, char **argv)
#endif #endif
final_return: final_return:
return(opt?opt:last_return_code); return opt ? opt : last_return_code;
} }
static char *insert_var_value(char *inp) static char *insert_var_value(char *inp)

View File

@ -1007,13 +1007,13 @@ static int newfile(char *s)
if (f < 0) { if (f < 0) {
prs(s); prs(s);
err(": cannot open"); err(": cannot open");
return (1); return 1;
} }
} else } else
f = 0; f = 0;
next(remap(f)); next(remap(f));
return (0); return 0;
} }
@ -1162,7 +1162,7 @@ static int newenv(int f)
if (f) { if (f) {
quitenv(); quitenv();
return (1); return 1;
} }
ep = (struct env *) space(sizeof(*ep)); ep = (struct env *) space(sizeof(*ep));
@ -1175,7 +1175,7 @@ static int newenv(int f)
e.oenv = ep; e.oenv = ep;
e.errpt = errpt; e.errpt = errpt;
return (0); return 0;
} }
static void quitenv(void) static void quitenv(void)
@ -1202,8 +1202,8 @@ static int anys(char *s1, char *s2)
{ {
while (*s1) while (*s1)
if (any(*s1++, s2)) if (any(*s1++, s2))
return (1); return 1;
return (0); return 0;
} }
/* /*
@ -1213,8 +1213,8 @@ static int any(int c, char *s)
{ {
while (*s) while (*s)
if (*s++ == c) if (*s++ == c)
return (1); return 1;
return (0); return 0;
} }
static char *putn(int n) static char *putn(int n)
@ -1396,12 +1396,12 @@ static int isassign(char *s)
DBGPRINTF7(("ISASSIGN: enter, s=%s\n", s)); DBGPRINTF7(("ISASSIGN: enter, s=%s\n", s));
if (!isalpha((int) *s) && *s != '_') if (!isalpha((int) *s) && *s != '_')
return (0); return 0;
for (; *s != '='; s++) for (; *s != '='; s++)
if (*s == 0 || (!isalnum(*s) && *s != '_')) if (*s == 0 || (!isalnum(*s) && *s != '_'))
return (0); return 0;
return (1); return 1;
} }
static int assign(char *s, int cf) static int assign(char *s, int cf)
@ -1412,15 +1412,15 @@ static int assign(char *s, int cf)
DBGPRINTF7(("ASSIGN: enter, s=%s, cf=%d\n", s, cf)); DBGPRINTF7(("ASSIGN: enter, s=%s, cf=%d\n", s, cf));
if (!isalpha(*s) && *s != '_') if (!isalpha(*s) && *s != '_')
return (0); return 0;
for (cp = s; *cp != '='; cp++) for (cp = s; *cp != '='; cp++)
if (*cp == 0 || (!isalnum(*cp) && *cp != '_')) if (*cp == 0 || (!isalnum(*cp) && *cp != '_'))
return (0); return 0;
vp = lookup(s); vp = lookup(s);
nameval(vp, ++cp, cf == COPYV ? (char *) NULL : s); nameval(vp, ++cp, cf == COPYV ? (char *) NULL : s);
if (cf != COPYV) if (cf != COPYV)
vp->status &= ~GETCELL; vp->status &= ~GETCELL;
return (1); return 1;
} }
static int checkname(char *cp) static int checkname(char *cp)
@ -1428,11 +1428,11 @@ static int checkname(char *cp)
DBGPRINTF7(("CHECKNAME: enter, cp=%s\n", cp)); DBGPRINTF7(("CHECKNAME: enter, cp=%s\n", cp));
if (!isalpha(*cp++) && *(cp - 1) != '_') if (!isalpha(*cp++) && *(cp - 1) != '_')
return (0); return 0;
while (*cp) while (*cp)
if (!isalnum(*cp++) && *(cp - 1) != '_') if (!isalnum(*cp++) && *(cp - 1) != '_')
return (0); return 0;
return (1); return 1;
} }
static void putvlist(int f, int out) static void putvlist(int f, int out)
@ -1454,7 +1454,7 @@ static int eqname(char *n1, char *n2)
{ {
for (; *n1 != '=' && *n1 != 0; n1++) for (; *n1 != '=' && *n1 != 0; n1++)
if (*n2++ != *n1) if (*n2++ != *n1)
return (0); return 0;
return (*n2 == 0 || *n2 == '='); return (*n2 == 0 || *n2 == '=');
} }
@ -1483,31 +1483,31 @@ static int gmatch(char *s, char *p)
int sc, pc; int sc, pc;
if (s == NULL || p == NULL) if (s == NULL || p == NULL)
return (0); return 0;
while ((pc = *p++ & CMASK) != '\0') { while ((pc = *p++ & CMASK) != '\0') {
sc = *s++ & QMASK; sc = *s++ & QMASK;
switch (pc) { switch (pc) {
case '[': case '[':
if ((p = cclass(p, sc)) == NULL) if ((p = cclass(p, sc)) == NULL)
return (0); return 0;
break; break;
case '?': case '?':
if (sc == 0) if (sc == 0)
return (0); return 0;
break; break;
case '*': case '*':
s--; s--;
do { do {
if (*p == '\0' || gmatch(s, p)) if (*p == '\0' || gmatch(s, p))
return (1); return 1;
} while (*s++ != '\0'); } while (*s++ != '\0');
return (0); return 0;
default: default:
if (sc != (pc & ~QUOTE)) if (sc != (pc & ~QUOTE))
return (0); return 0;
} }
} }
return (*s == 0); return (*s == 0);
@ -1805,7 +1805,7 @@ static int synio(int cf)
if ((c = yylex(cf)) != '<' && c != '>') { if ((c = yylex(cf)) != '<' && c != '>') {
peeksym = c; peeksym = c;
return (0); return 0;
} }
i = yylval.i; i = yylval.i;
@ -1817,7 +1817,7 @@ static int synio(int cf)
markhere(yylval.cp, iop); markhere(yylval.cp, iop);
DBGPRINTF7(("SYNIO: returning 1\n")); DBGPRINTF7(("SYNIO: returning 1\n"));
return (1); return 1;
} }
static void musthave(int c, int cf) static void musthave(int c, int cf)
@ -2166,7 +2166,7 @@ static int rlookup(char *n)
} }
DBGPRINTF7(("RLOOKUP: NO match, returning 0\n")); DBGPRINTF7(("RLOOKUP: NO match, returning 0\n"));
return (0); /* Not a shell multiline */ return 0; /* Not a shell multiline */
} }
static struct op *newtp(void) static struct op *newtp(void)
@ -2428,7 +2428,7 @@ static int collect(int c, int c1)
DBGPRINTF8(("COLLECT: return 0, line is %s\n", line)); DBGPRINTF8(("COLLECT: return 0, line is %s\n", line));
return (0); return 0;
} }
/* "multiline commands" helper func */ /* "multiline commands" helper func */
@ -2510,7 +2510,7 @@ static int execute(struct op *t, int *pin, int *pout, int act)
if (t == NULL) { if (t == NULL) {
DBGPRINTF4(("EXECUTE: enter, t==null, returning.\n")); DBGPRINTF4(("EXECUTE: enter, t==null, returning.\n"));
return (0); return 0;
} }
DBGPRINTF(("EXECUTE: t=%p, t->type=%d (%s), t->words is %s\n", t, DBGPRINTF(("EXECUTE: t=%p, t->type=%d (%s), t->words is %s\n", t,
@ -2787,7 +2787,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
if (newpid == -1) { if (newpid == -1) {
DBGPRINTF(("FORKEXEC: ERROR, cannot vfork()!\n")); DBGPRINTF(("FORKEXEC: ERROR, cannot vfork()!\n"));
return (-1); return -1;
} }
@ -2804,7 +2804,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
/* moved up /* moved up
if (i == -1) if (i == -1)
return(rv); return rv;
*/ */
if (pin != NULL) if (pin != NULL)
@ -2839,7 +2839,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
err("piping to/from shell builtins not yet done"); err("piping to/from shell builtins not yet done");
if (forked) if (forked)
_exit(-1); _exit(-1);
return (-1); return -1;
} }
#endif #endif
@ -2858,7 +2858,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
err(": cannot redirect shell command"); err(": cannot redirect shell command");
if (forked) if (forked)
_exit(-1); _exit(-1);
return (-1); return -1;
} }
while (*iopp) while (*iopp)
if (iosetup(*iopp++, pin != NULL, pout != NULL)) { if (iosetup(*iopp++, pin != NULL, pout != NULL)) {
@ -2919,23 +2919,23 @@ static int iosetup(struct ioword *iop, int pipein, int pipeout)
iop->io_unit = iop->io_flag & (IOREAD | IOHERE) ? 0 : 1; iop->io_unit = iop->io_flag & (IOREAD | IOHERE) ? 0 : 1;
if (pipein && iop->io_unit == 0) if (pipein && iop->io_unit == 0)
return (0); return 0;
if (pipeout && iop->io_unit == 1) if (pipeout && iop->io_unit == 1)
return (0); return 0;
msg = iop->io_flag & (IOREAD | IOHERE) ? "open" : "create"; msg = iop->io_flag & (IOREAD | IOHERE) ? "open" : "create";
if ((iop->io_flag & IOHERE) == 0) { if ((iop->io_flag & IOHERE) == 0) {
cp = iop->io_name; cp = iop->io_name;
if ((cp = evalstr(cp, DOSUB | DOTRIM)) == NULL) if ((cp = evalstr(cp, DOSUB | DOTRIM)) == NULL)
return (1); return 1;
} }
if (iop->io_flag & IODUP) { if (iop->io_flag & IODUP) {
if (cp[1] || (!isdigit(*cp) && *cp != '-')) { if (cp[1] || (!isdigit(*cp) && *cp != '-')) {
prs(cp); prs(cp);
err(": illegal >& argument"); err(": illegal >& argument");
return (1); return 1;
} }
if (*cp == '-') if (*cp == '-')
iop->io_flag = IOCLOSE; iop->io_flag = IOCLOSE;
@ -2967,20 +2967,20 @@ static int iosetup(struct ioword *iop, int pipein, int pipeout)
case IOCLOSE: case IOCLOSE:
close(iop->io_unit); close(iop->io_unit);
return (0); return 0;
} }
if (u < 0) { if (u < 0) {
prs(cp); prs(cp);
prs(": cannot "); prs(": cannot ");
warn(msg); warn(msg);
return (1); return 1;
} else { } else {
if (u != iop->io_unit) { if (u != iop->io_unit) {
dup2(u, iop->io_unit); dup2(u, iop->io_unit);
close(u); close(u);
} }
} }
return (0); return 0;
} }
static void echo(char **wp) static void echo(char **wp)
@ -3281,7 +3281,7 @@ static int dohelp(struct op *t)
static int dolabel(struct op *t) static int dolabel(struct op *t)
{ {
return (0); return 0;
} }
static int dochdir(struct op *t) static int dochdir(struct op *t)
@ -3293,10 +3293,10 @@ static int dochdir(struct op *t)
else if (chdir(cp) < 0) else if (chdir(cp) < 0)
er = ": bad directory"; er = ": bad directory";
else else
return (0); return 0;
prs(cp != NULL ? cp : "cd"); prs(cp != NULL ? cp : "cd");
err(er); err(er);
return (1); return 1;
} }
static int doshift(struct op *t) static int doshift(struct op *t)
@ -3306,13 +3306,13 @@ static int doshift(struct op *t)
n = t->words[1] ? getn(t->words[1]) : 1; n = t->words[1] ? getn(t->words[1]) : 1;
if (dolc < n) { if (dolc < n) {
err("nothing to shift"); err("nothing to shift");
return (1); return 1;
} }
dolv[n] = dolv[0]; dolv[n] = dolv[0];
dolv += n; dolv += n;
dolc -= n; dolc -= n;
setval(lookup("#"), putn(dolc)); setval(lookup("#"), putn(dolc));
return (0); return 0;
} }
/* /*
@ -3330,7 +3330,7 @@ static int dologin(struct op *t)
prs(t->words[0]); prs(t->words[0]);
prs(": "); prs(": ");
err(cp); err(cp);
return (1); return 1;
} }
static int doumask(struct op *t) static int doumask(struct op *t)
@ -3349,7 +3349,7 @@ static int doumask(struct op *t)
n = n * 8 + (*cp - '0'); n = n * 8 + (*cp - '0');
umask(n); umask(n);
} }
return (0); return 0;
} }
static int doexec(struct op *t) static int doexec(struct op *t)
@ -3361,14 +3361,14 @@ static int doexec(struct op *t)
t->ioact = NULL; t->ioact = NULL;
for (i = 0; (t->words[i] = t->words[i + 1]) != NULL; i++); for (i = 0; (t->words[i] = t->words[i + 1]) != NULL; i++);
if (i == 0) if (i == 0)
return (1); return 1;
execflg = 1; execflg = 1;
ofail = failpt; ofail = failpt;
if (setjmp(failpt = ex) == 0) if (setjmp(failpt = ex) == 0)
execute(t, NOPIPE, NOPIPE, FEXEC); execute(t, NOPIPE, NOPIPE, FEXEC);
failpt = ofail; failpt = ofail;
execflg = 0; execflg = 0;
return (1); return 1;
} }
static int dodot(struct op *t) static int dodot(struct op *t)
@ -3382,7 +3382,7 @@ static int dodot(struct op *t)
if ((cp = t->words[1]) == NULL) { if ((cp = t->words[1]) == NULL) {
DBGPRINTF(("DODOT: bad args, ret 0\n")); DBGPRINTF(("DODOT: bad args, ret 0\n"));
return (0); return 0;
} else { } else {
DBGPRINTF(("DODOT: cp is %s\n", cp)); DBGPRINTF(("DODOT: cp is %s\n", cp));
} }
@ -3420,7 +3420,7 @@ static int dodot(struct op *t)
prs(cp); prs(cp);
err(": not found"); err(": not found");
return (-1); return -1;
} }
static int dowait(struct op *t) static int dowait(struct op *t)
@ -3431,11 +3431,11 @@ static int dowait(struct op *t)
if ((cp = t->words[1]) != NULL) { if ((cp = t->words[1]) != NULL) {
i = getn(cp); i = getn(cp);
if (i == 0) if (i == 0)
return (0); return 0;
} else } else
i = -1; i = -1;
setstatus(waitfor(i, 1)); setstatus(waitfor(i, 1));
return (0); return 0;
} }
static int doread(struct op *t) static int doread(struct op *t)
@ -3446,7 +3446,7 @@ static int doread(struct op *t)
if (t->words[1] == NULL) { if (t->words[1] == NULL) {
err("Usage: read name ..."); err("Usage: read name ...");
return (1); return 1;
} }
for (wp = t->words + 1; *wp; wp++) { for (wp = t->words + 1; *wp; wp++) {
for (cp = e.linep; !nl && cp < elinep - 1; cp++) for (cp = e.linep; !nl && cp < elinep - 1; cp++)
@ -3479,7 +3479,7 @@ static int dotrap(struct op *t)
prs(trap[i]); prs(trap[i]);
prs("\n"); prs("\n");
} }
return (0); return 0;
} }
resetsig = isdigit(*t->words[1]); resetsig = isdigit(*t->words[1]);
for (i = resetsig ? 1 : 2; t->words[i] != NULL; ++i) { for (i = resetsig ? 1 : 2; t->words[i] != NULL; ++i) {
@ -3502,7 +3502,7 @@ static int dotrap(struct op *t)
setsig(n, SIG_DFL); setsig(n, SIG_DFL);
} }
} }
return (0); return 0;
} }
static int getsig(char *s) static int getsig(char *s)
@ -3571,7 +3571,7 @@ static int brkcontin(char *cp, int val)
} while (--nl); } while (--nl);
if (nl) { if (nl) {
err("bad break/continue level"); err("bad break/continue level");
return (1); return 1;
} }
isbreak = val; isbreak = val;
longjmp(bc->brkpt, 1); longjmp(bc->brkpt, 1);
@ -3590,19 +3590,19 @@ static int doexit(struct op *t)
leave(); leave();
/* NOTREACHED */ /* NOTREACHED */
return (0); return 0;
} }
static int doexport(struct op *t) static int doexport(struct op *t)
{ {
rdexp(t->words + 1, export, EXPORT); rdexp(t->words + 1, export, EXPORT);
return (0); return 0;
} }
static int doreadonly(struct op *t) static int doreadonly(struct op *t)
{ {
rdexp(t->words + 1, ronly, RONLY); rdexp(t->words + 1, ronly, RONLY);
return (0); return 0;
} }
static void rdexp(char **wp, void (*f) (struct var *), int key) static void rdexp(char **wp, void (*f) (struct var *), int key)
@ -3643,7 +3643,7 @@ static int doset(struct op *t)
if ((cp = t->words[1]) == NULL) { if ((cp = t->words[1]) == NULL) {
for (vp = vlist; vp; vp = vp->next) for (vp = vlist; vp; vp = vp->next)
varput(vp->name, 1); varput(vp->name, 1);
return (0); return 0;
} }
if (*cp == '-') { if (*cp == '-') {
/* bad: t->words++; */ /* bad: t->words++; */
@ -3674,7 +3674,7 @@ static int doset(struct op *t)
setval(lookup("#"), putn(dolc)); setval(lookup("#"), putn(dolc));
setarea((char *) (dolv - 1), 0); setarea((char *) (dolv - 1), 0);
} }
return (0); return 0;
} }
static void varput(char *s, int out) static void varput(char *s, int out)
@ -3818,7 +3818,7 @@ static int expand(char *cp, struct wdblock **wbp, int f)
gflg = 0; gflg = 0;
if (cp == NULL) if (cp == NULL)
return (0); return 0;
if (!anys("$`'\"", cp) && if (!anys("$`'\"", cp) &&
!anys(ifs->value, cp) && ((f & DOGLOB) == 0 || !anys("[*?", cp))) { !anys(ifs->value, cp) && ((f & DOGLOB) == 0 || !anys("[*?", cp))) {
@ -3826,7 +3826,7 @@ static int expand(char *cp, struct wdblock **wbp, int f)
if (f & DOTRIM) if (f & DOTRIM)
unquote(cp); unquote(cp);
*wbp = addword(cp, *wbp); *wbp = addword(cp, *wbp);
return (1); return 1;
} }
if (newenv(setjmp(errpt = ev)) == 0) { if (newenv(setjmp(errpt = ev)) == 0) {
PUSHIO(aword, cp, strchar); PUSHIO(aword, cp, strchar);
@ -3866,7 +3866,7 @@ static char *blank(int f)
switch (c = subgetc('"', foundequals)) { switch (c = subgetc('"', foundequals)) {
case 0: case 0:
if (sp == e.linep) if (sp == e.linep)
return (0); return 0;
*e.linep++ = 0; *e.linep++ = 0;
return (sp); return (sp);
@ -3930,7 +3930,7 @@ static int subgetc(char ec, int quoted)
if (!INSUB() && ec != '\'') { if (!INSUB() && ec != '\'') {
if (c == '`') { if (c == '`') {
if (grave(quoted) == 0) if (grave(quoted) == 0)
return (0); return 0;
e.iop->task = XGRAVE; e.iop->task = XGRAVE;
goto again; goto again;
} }
@ -4001,7 +4001,7 @@ static int dollar(int quoted)
/* should check dollar */ /* should check dollar */
e.linep = s; e.linep = s;
PUSHIO(awordlist, dolv + 1, dolchar); PUSHIO(awordlist, dolv + 1, dolchar);
return (0); return 0;
} else { /* trap the nasty ${=} */ } else { /* trap the nasty ${=} */
s[0] = '1'; s[0] = '1';
s[1] = 0; s[1] = 0;
@ -4042,7 +4042,7 @@ static int dollar(int quoted)
} }
e.linep = s; e.linep = s;
PUSHIO(aword, dolp, quoted ? qstrchar : strchar); PUSHIO(aword, dolp, quoted ? qstrchar : strchar);
return (0); return 0;
} }
/* /*
@ -4072,7 +4072,7 @@ static int grave(int quoted)
for (cp = e.iop->argp->aword; *cp != '`'; cp++) for (cp = e.iop->argp->aword; *cp != '`'; cp++)
if (*cp == 0) { if (*cp == 0) {
err("no closing `"); err("no closing `");
return (0); return 0;
} }
/* string copy with dollar expansion */ /* string copy with dollar expansion */
@ -4119,7 +4119,7 @@ static int grave(int quoted)
break; break;
default: default:
err("unclosed ${\n"); err("unclosed ${\n");
return (0); return 0;
} }
if (operator) { if (operator) {
src++; src++;
@ -4129,7 +4129,7 @@ static int grave(int quoted)
alt_value[alt_index] = 0; alt_value[alt_index] = 0;
if (*src != '}') { if (*src != '}') {
err("unclosed ${\n"); err("unclosed ${\n");
return (0); return 0;
} }
} }
src++; src++;
@ -4164,7 +4164,7 @@ static int grave(int quoted)
alt_value : vp->value; alt_value : vp->value;
else if (operator == '?') { else if (operator == '?') {
err(alt_value); err(alt_value);
return (0); return 0;
} else if (alt_index && (operator != '+')) { } else if (alt_index && (operator != '+')) {
value = alt_value; value = alt_value;
if (operator == '=') if (operator == '=')
@ -4186,7 +4186,7 @@ static int grave(int quoted)
*dest = '\0'; *dest = '\0';
if (openpipe(pf) < 0) if (openpipe(pf) < 0)
return (0); return 0;
while ((i = vfork()) == -1 && errno == EAGAIN); while ((i = vfork()) == -1 && errno == EAGAIN);
@ -4195,7 +4195,7 @@ static int grave(int quoted)
if (i < 0) { if (i < 0) {
closepipe(pf); closepipe(pf);
err((char *) bb_msg_memory_exhausted); err((char *) bb_msg_memory_exhausted);
return (0); return 0;
} }
if (i != 0) { if (i != 0) {
waitpid(i, NULL, 0); waitpid(i, NULL, 0);
@ -4204,7 +4204,7 @@ static int grave(int quoted)
PUSHIO(afile, remap(pf[0]), PUSHIO(afile, remap(pf[0]),
(int (*)(struct ioarg *)) ((quoted) ? qgravechar : (int (*)(struct ioarg *)) ((quoted) ? qgravechar :
gravechar)); gravechar));
return (1); return 1;
} }
/* allow trapped signals */ /* allow trapped signals */
/* XXX - Maybe this signal stuff should go as well? */ /* XXX - Maybe this signal stuff should go as well? */
@ -4379,8 +4379,8 @@ static int anyspcl(struct wdblock *wb)
wd = wb->w_words; wd = wb->w_words;
for (i = 0; i < wb->w_nword; i++) for (i = 0; i < wb->w_nword; i++)
if (anys(spcl, *wd++)) if (anys(spcl, *wd++))
return (1); return 1;
return (0); return 0;
} }
static int xstrcmp(char *p1, char *p2) static int xstrcmp(char *p1, char *p2)
@ -4634,14 +4634,14 @@ static int readc(void)
if (e.iop >= iostack) { if (e.iop >= iostack) {
RCPRINTF(("READC: return 0, e.iop %p\n", e.iop)); RCPRINTF(("READC: return 0, e.iop %p\n", e.iop));
return (0); return 0;
} }
DBGPRINTF(("READC: leave()...\n")); DBGPRINTF(("READC: leave()...\n"));
leave(); leave();
/* NOTREACHED */ /* NOTREACHED */
return (0); return 0;
} }
static void ioecho(char c) static void ioecho(char c)
@ -4737,7 +4737,7 @@ static int nlchar(struct ioarg *ap)
int c; int c;
if (ap->aword == NULL) if (ap->aword == NULL)
return (0); return 0;
if ((c = *ap->aword++) == 0) { if ((c = *ap->aword++) == 0) {
ap->aword = NULL; ap->aword = NULL;
return ('\n'); return ('\n');
@ -4755,7 +4755,7 @@ static int wdchar(struct ioarg *ap)
char **wl; char **wl;
if ((wl = ap->awordlist) == NULL) if ((wl = ap->awordlist) == NULL)
return (0); return 0;
if (*wl != NULL) { if (*wl != NULL) {
if ((c = *(*wl)++) != 0) if ((c = *(*wl)++) != 0)
return (c & 0177); return (c & 0177);
@ -4776,9 +4776,9 @@ static int dolchar(struct ioarg *ap)
if ((wp = *ap->awordlist++) != NULL) { if ((wp = *ap->awordlist++) != NULL) {
PUSHIO(aword, wp, *ap->awordlist == NULL ? strchar : xxchar); PUSHIO(aword, wp, *ap->awordlist == NULL ? strchar : xxchar);
return (-1); return -1;
} }
return (0); return 0;
} }
static int xxchar(struct ioarg *ap) static int xxchar(struct ioarg *ap)
@ -4786,7 +4786,7 @@ static int xxchar(struct ioarg *ap)
int c; int c;
if (ap->aword == NULL) if (ap->aword == NULL)
return (0); return 0;
if ((c = *ap->aword++) == '\0') { if ((c = *ap->aword++) == '\0') {
ap->aword = NULL; ap->aword = NULL;
return (' '); return (' ');
@ -4802,7 +4802,7 @@ static int strchar(struct ioarg *ap)
int c; int c;
if (ap->aword == NULL || (c = *ap->aword++) == 0) if (ap->aword == NULL || (c = *ap->aword++) == 0)
return (0); return 0;
return (c); return (c);
} }
@ -4814,7 +4814,7 @@ static int qstrchar(struct ioarg *ap)
int c; int c;
if (ap->aword == NULL || (c = *ap->aword++) == 0) if (ap->aword == NULL || (c = *ap->aword++) == 0)
return (0); return 0;
return (c | QUOTE); return (c | QUOTE);
} }
@ -5143,13 +5143,13 @@ static int herein(char *hname, int xdoll)
(void) &tf; (void) &tf;
#endif #endif
if (hname == NULL) if (hname == NULL)
return (-1); return -1;
DBGPRINTF7(("HEREIN: hname is %s, xdoll=%d\n", hname, xdoll)); DBGPRINTF7(("HEREIN: hname is %s, xdoll=%d\n", hname, xdoll));
hf = open(hname, 0); hf = open(hname, 0);
if (hf < 0) if (hf < 0)
return (-1); return -1;
if (xdoll) { if (xdoll) {
char c; char c;
@ -5158,7 +5158,7 @@ static int herein(char *hname, int xdoll)
tf = mkstemp(tname); tf = mkstemp(tname);
if (tf < 0) if (tf < 0)
return (-1); return -1;
if (newenv(setjmp(errpt = ev)) == 0) { if (newenv(setjmp(errpt = ev)) == 0) {
PUSHIO(afile, hf, herechar); PUSHIO(afile, hf, herechar);
setbase(e.iop); setbase(e.iop);

View File

@ -55,7 +55,7 @@ static time_t askremotedate(const char *host)
* Subtract the RFC 868 time to get Linux epoch * Subtract the RFC 868 time to get Linux epoch
*/ */
return(ntohl(nett) - RFC_868_BIAS); return ntohl(nett) - RFC_868_BIAS;
} }
int rdate_main(int argc, char **argv) int rdate_main(int argc, char **argv)