mirror of
https://github.com/sheumann/hush.git
synced 2024-08-20 04:28:57 +00:00
style cleanup: return(a) -> return a, part 2
This commit is contained in:
parent
079f8afa0a
commit
d9e15f2068
@ -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
|
/* trees.c -- output deflated data using Huffman coding
|
||||||
|
@ -68,12 +68,12 @@ char get_header_ar(archive_handle_t *archive_handle)
|
|||||||
archive_handle->offset += ar_long_name_size;
|
archive_handle->offset += ar_long_name_size;
|
||||||
/* This ar entries data section only contained filenames for other records
|
/* This ar entries data section only contained filenames for other records
|
||||||
* they are stored in the static ar_long_names for future reference */
|
* 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] == ' ') {
|
} else if (ar.formatted.name[1] == ' ') {
|
||||||
/* This is the index of symbols in the file for compilers */
|
/* This is the index of symbols in the file for compilers */
|
||||||
data_skip(archive_handle);
|
data_skip(archive_handle);
|
||||||
archive_handle->offset += typed->size;
|
archive_handle->offset += typed->size;
|
||||||
return (get_header_ar(archive_handle)); /* Return next header */
|
return get_header_ar(archive_handle); /* Return next header */
|
||||||
} else {
|
} else {
|
||||||
/* The number after the '/' indicates the offset in the ar data section
|
/* The number after the '/' indicates the offset in the ar data section
|
||||||
(saved in variable long_name) that conatains the real filename */
|
(saved in variable long_name) that conatains the real filename */
|
||||||
|
@ -156,5 +156,5 @@ char get_header_cpio(archive_handle_t *archive_handle)
|
|||||||
|
|
||||||
free(file_header->link_name);
|
free(file_header->link_name);
|
||||||
|
|
||||||
return (EXIT_SUCCESS);
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ static int isqrt(int n)
|
|||||||
x /= 2;
|
x /= 2;
|
||||||
} while ((x - y) > 1 || (x - y) < -1);
|
} while ((x - y) > 1 || (x - y) < -1);
|
||||||
|
|
||||||
return (x);
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int newcand(int x, int y, int pred)
|
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->x = x;
|
||||||
q->y = y;
|
q->y = y;
|
||||||
q->pred = pred;
|
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;
|
int i, j, l, t;
|
||||||
|
|
||||||
if (clist[c[k]].y < y) /* quick look for typical case */
|
if (clist[c[k]].y < y) /* quick look for typical case */
|
||||||
return (k + 1);
|
return k + 1;
|
||||||
i = 0;
|
i = 0;
|
||||||
j = k + 1;
|
j = k + 1;
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -379,9 +379,9 @@ static int search(int *c, int k, int y)
|
|||||||
else if (t < y)
|
else if (t < y)
|
||||||
i = l;
|
i = l;
|
||||||
else
|
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);
|
} while ((y = b[++j]) > 0 && numtries < bound);
|
||||||
}
|
}
|
||||||
return (k);
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unravel(int p)
|
static void unravel(int p)
|
||||||
@ -461,7 +461,7 @@ static int skipline(FILE * f)
|
|||||||
|
|
||||||
for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
|
for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
|
||||||
continue;
|
continue;
|
||||||
return (i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -977,7 +977,7 @@ static int diffreg(char *ofile1, char *ofile2, int flags)
|
|||||||
free(file1);
|
free(file1);
|
||||||
if (file2 != ofile2)
|
if (file2 != ofile2)
|
||||||
free(file2);
|
free(file2);
|
||||||
return (rval);
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_FEATURE_DIFF_DIR
|
#if ENABLE_FEATURE_DIFF_DIR
|
||||||
|
@ -127,5 +127,5 @@ RET_0:
|
|||||||
}
|
}
|
||||||
} while (*++argv != last);
|
} while (*++argv != last);
|
||||||
|
|
||||||
return (status);
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ Modified IPv6-aware C code:
|
|||||||
(void) fprintf(stderr,
|
(void) fprintf(stderr,
|
||||||
"getaddrinfo: %s for host %s service %s\n",
|
"getaddrinfo: %s for host %s service %s\n",
|
||||||
gai_strerror(error), hostname, servicename);
|
gai_strerror(error), hostname, servicename);
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
/* Try all returned addresses until one works */
|
/* Try all returned addresses until one works */
|
||||||
for (aip = res; aip != NULL; aip = aip->ai_next) {
|
for (aip = res; aip != NULL; aip = aip->ai_next) {
|
||||||
@ -187,7 +187,7 @@ Modified IPv6-aware C code:
|
|||||||
if (sock == -1) {
|
if (sock == -1) {
|
||||||
perror("socket");
|
perror("socket");
|
||||||
freeaddrinfo(res);
|
freeaddrinfo(res);
|
||||||
return (-1);
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect to the host. */
|
/* Connect to the host. */
|
||||||
|
@ -117,7 +117,7 @@ blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
|
|||||||
iter->magic = DEV_ITERATE_MAGIC;
|
iter->magic = DEV_ITERATE_MAGIC;
|
||||||
iter->cache = cache;
|
iter->cache = cache;
|
||||||
iter->p = cache->bic_devs.next;
|
iter->p = cache->bic_devs.next;
|
||||||
return (iter);
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -102,7 +102,7 @@ errout:
|
|||||||
if (!cache) {
|
if (!cache) {
|
||||||
blkid_put_cache(c);
|
blkid_put_cache(c);
|
||||||
}
|
}
|
||||||
return (ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_PROGRAM
|
#ifdef TEST_PROGRAM
|
||||||
|
@ -257,7 +257,7 @@ blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev)
|
|||||||
iter->magic = TAG_ITERATE_MAGIC;
|
iter->magic = TAG_ITERATE_MAGIC;
|
||||||
iter->dev = dev;
|
iter->dev = dev;
|
||||||
iter->p = dev->bid_tags.next;
|
iter->p = dev->bid_tags.next;
|
||||||
return (iter);
|
return iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -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,
|
retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino,
|
||||||
&inode->i_ext2, NULL, 0, block, &pblk);
|
&inode->i_ext2, NULL, 0, block, &pblk);
|
||||||
*phys = pblk;
|
*phys = pblk;
|
||||||
return (retval);
|
return retval;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ int ext2fs_super_and_bgd_loc(ext2_filsys fs,
|
|||||||
*ret_new_desc_blk = new_desc_blk;
|
*ret_new_desc_blk = new_desc_blk;
|
||||||
if (ret_meta_bg)
|
if (ret_meta_bg)
|
||||||
*ret_meta_bg = meta_bg;
|
*ret_meta_bg = meta_bg;
|
||||||
return (numblocks);
|
return numblocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ errcode_t ext2fs_write_dir_block2(ext2_filsys fs, blk_t block,
|
|||||||
if ((dirent->rec_len < 8) ||
|
if ((dirent->rec_len < 8) ||
|
||||||
(dirent->rec_len % 4)) {
|
(dirent->rec_len % 4)) {
|
||||||
ext2fs_free_mem(&buf);
|
ext2fs_free_mem(&buf);
|
||||||
return (EXT2_ET_DIR_CORRUPTED);
|
return EXT2_ET_DIR_CORRUPTED;
|
||||||
}
|
}
|
||||||
p += dirent->rec_len;
|
p += dirent->rec_len;
|
||||||
if (do_swap) {
|
if (do_swap) {
|
||||||
|
@ -324,7 +324,7 @@ errcode_t ext2fs_image_bitmap_write(ext2_filsys fs, int fd, int flags)
|
|||||||
}
|
}
|
||||||
retval = 0;
|
retval = 0;
|
||||||
errout:
|
errout:
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -373,5 +373,5 @@ errcode_t ext2fs_image_bitmap_read(ext2_filsys fs, int fd, int flags)
|
|||||||
retval = 0;
|
retval = 0;
|
||||||
errout:
|
errout:
|
||||||
free(buf);
|
free(buf);
|
||||||
return (retval);
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ static time_t parse_time(char *str)
|
|||||||
struct tm ts;
|
struct tm ts;
|
||||||
|
|
||||||
if (strcmp(str, "now") == 0) {
|
if (strcmp(str, "now") == 0) {
|
||||||
return (time(0));
|
return time(0);
|
||||||
}
|
}
|
||||||
memset(&ts, 0, sizeof(ts));
|
memset(&ts, 0, sizeof(ts));
|
||||||
#ifdef HAVE_STRPTIME
|
#ifdef HAVE_STRPTIME
|
||||||
@ -398,7 +398,7 @@ static time_t parse_time(char *str)
|
|||||||
if (ts.tm_mday == 0) {
|
if (ts.tm_mday == 0) {
|
||||||
bb_error_msg_and_die("Cannot parse date/time specifier: %s", str);
|
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)
|
static void parse_tune2fs_options(int argc, char **argv)
|
||||||
|
38
editors/vi.c
38
editors/vi.c
@ -1233,7 +1233,7 @@ static int count_lines(Byte * start, Byte * stop) // count line from start to st
|
|||||||
if (*q == '\n')
|
if (*q == '\n')
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
return (cnt);
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Byte *find_line(int li) // find begining of line #li
|
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++) {
|
for (li = 1; li < ro - 1; li++) {
|
||||||
screen[(li * co) + 0] = '~';
|
screen[(li * co) + 0] = '~';
|
||||||
}
|
}
|
||||||
return (screen);
|
return screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Byte *new_text(int size)
|
static Byte *new_text(int size)
|
||||||
@ -1384,7 +1384,7 @@ static Byte *new_text(int size)
|
|||||||
text = (Byte *) xmalloc(size + 8);
|
text = (Byte *) xmalloc(size + 8);
|
||||||
memset(text, '\0', size); // clear new text[]
|
memset(text, '\0', size); // clear new text[]
|
||||||
//text += 4; // leave some room for "oops"
|
//text += 4; // leave some room for "oops"
|
||||||
return (text);
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_VI_SEARCH
|
#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);
|
i = strncasecmp((char *) s1, (char *) s2, len);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_FEATURE_VI_SETOPTS */
|
#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
|
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
|
stop = next_line(p); // range is to next line
|
||||||
for (start = p; start < stop; start++) {
|
for (start = p; start < stop; start++) {
|
||||||
if (mycmp(start, pat, len) == 0) {
|
if (mycmp(start, pat, len) == 0) {
|
||||||
return (start);
|
return start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (dir == BACK) {
|
} 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
|
stop = prev_line(p); // range is to prev line
|
||||||
for (start = p - len; start >= stop; start--) {
|
for (start = p - len; start >= stop; start--) {
|
||||||
if (mycmp(start, pat, len) == 0) {
|
if (mycmp(start, pat, len) == 0) {
|
||||||
return (start);
|
return start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// pattern not found
|
// pattern not found
|
||||||
return (NULL);
|
return NULL;
|
||||||
#else /*REGEX_SEARCH */
|
#else /*REGEX_SEARCH */
|
||||||
char *q;
|
char *q;
|
||||||
struct re_pattern_buffer preg;
|
struct re_pattern_buffer preg;
|
||||||
@ -1608,7 +1608,7 @@ static Byte find_range(Byte ** start, Byte ** stop, Byte c)
|
|||||||
*stop = p;
|
*stop = p;
|
||||||
}
|
}
|
||||||
dot = save_dot;
|
dot = save_dot;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st_test(Byte * p, int type, int dir, Byte * tested)
|
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 == '_');
|
test = ((isalnum(c)) || c == '_');
|
||||||
}
|
}
|
||||||
*tested = c;
|
*tested = c;
|
||||||
return (test);
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Byte *skip_thing(Byte * p, int linecnt, int dir, int type)
|
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
|
dest = end = text; // keep pointers valid
|
||||||
file_modified++; // has the file been modified
|
file_modified++; // has the file been modified
|
||||||
thd0:
|
thd0:
|
||||||
return (dest);
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy text into register, then delete text.
|
// copy text into register, then delete text.
|
||||||
@ -1968,7 +1968,7 @@ static Byte what_reg(void)
|
|||||||
c = 'D';
|
c = 'D';
|
||||||
if (YDreg == 27)
|
if (YDreg == 27)
|
||||||
c = 'U';
|
c = 'U';
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_context(Byte cmd)
|
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_sec = 0;
|
||||||
tv.tv_usec = hund * 10000;
|
tv.tv_usec = hund * 10000;
|
||||||
select(1, &rfds, NULL, NULL, &tv);
|
select(1, &rfds, NULL, NULL, &tv);
|
||||||
return (FD_ISSET(0, &rfds));
|
return FD_ISSET(0, &rfds);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define readbuffer bb_common_bufsiz1
|
#define readbuffer bb_common_bufsiz1
|
||||||
@ -2214,7 +2214,7 @@ static Byte readit(void) // read (maybe cursor) key from stdin
|
|||||||
readed_for_parse -= n;
|
readed_for_parse -= n;
|
||||||
memmove(readbuffer, readbuffer + n, BUFSIZ - n);
|
memmove(readbuffer, readbuffer + n, BUFSIZ - n);
|
||||||
(void) alarm(3); // we are done waiting for input, turn alarm ON
|
(void) alarm(3); // we are done waiting for input, turn alarm ON
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- IO Routines --------------------------------------------
|
//----- IO Routines --------------------------------------------
|
||||||
@ -2258,7 +2258,7 @@ static Byte get_one_char(void)
|
|||||||
#else /* CONFIG_FEATURE_VI_DOT_CMD */
|
#else /* CONFIG_FEATURE_VI_DOT_CMD */
|
||||||
c = readit(); // get the users input
|
c = readit(); // get the users input
|
||||||
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
|
#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"
|
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);
|
refresh(FALSE);
|
||||||
free(obufp);
|
free(obufp);
|
||||||
obufp = (Byte *) xstrdup((char *) buf);
|
obufp = (Byte *) xstrdup((char *) buf);
|
||||||
return (obufp);
|
return obufp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file_size(const Byte * fn) // what is the byte size of "fn"
|
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) {
|
if (sr >= 0) {
|
||||||
cnt = (int) st_buf.st_size;
|
cnt = (int) st_buf.st_size;
|
||||||
}
|
}
|
||||||
return (cnt);
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file_insert(Byte * fn, Byte * p, int size)
|
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)
|
if (cnt >= size)
|
||||||
file_modified++;
|
file_modified++;
|
||||||
fi0:
|
fi0:
|
||||||
return (cnt);
|
return cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int file_write(Byte * fn, Byte * first, Byte * last)
|
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) {
|
if (fn == 0) {
|
||||||
psbs("No current filename");
|
psbs("No current filename");
|
||||||
return (-2);
|
return -2;
|
||||||
}
|
}
|
||||||
charcnt = 0;
|
charcnt = 0;
|
||||||
// FIXIT- use the correct umask()
|
// FIXIT- use the correct umask()
|
||||||
@ -2401,7 +2401,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
|
|||||||
charcnt = 0;
|
charcnt = 0;
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
return (charcnt);
|
return charcnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----- Terminal Drawing ---------------------------------------
|
//----- Terminal Drawing ---------------------------------------
|
||||||
|
@ -47,7 +47,7 @@ long bb_xgetgrnam(const char *name)
|
|||||||
if (mygroup==NULL)
|
if (mygroup==NULL)
|
||||||
bb_error_msg_and_die("unknown group name: %s", name);
|
bb_error_msg_and_die("unknown group name: %s", name);
|
||||||
|
|
||||||
return (mygroup->gr_gid);
|
return mygroup->gr_gid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns a uid given a username */
|
/* returns a uid given a username */
|
||||||
|
16
libbb/dump.c
16
libbb/dump.c
@ -74,7 +74,7 @@ int bb_dump_size(FS * fs)
|
|||||||
}
|
}
|
||||||
cur_size += bcnt * fu->reps;
|
cur_size += bcnt * fu->reps;
|
||||||
}
|
}
|
||||||
return (cur_size);
|
return cur_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rewrite(FS * fs)
|
static void rewrite(FS * fs)
|
||||||
@ -374,17 +374,17 @@ static unsigned char *get(void)
|
|||||||
*/
|
*/
|
||||||
if (!bb_dump_length || (ateof && !next((char **) NULL))) {
|
if (!bb_dump_length || (ateof && !next((char **) NULL))) {
|
||||||
if (need == bb_dump_blocksize) {
|
if (need == bb_dump_blocksize) {
|
||||||
return ((unsigned char *) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) {
|
if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) {
|
||||||
if (bb_dump_vflag != DUP) {
|
if (bb_dump_vflag != DUP) {
|
||||||
printf("*\n");
|
puts("*");
|
||||||
}
|
}
|
||||||
return ((unsigned char *) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
memset((char *) curp + nread, 0, need);
|
memset((char *) curp + nread, 0, need);
|
||||||
eaddress = address + nread;
|
eaddress = address + nread;
|
||||||
return (curp);
|
return curp;
|
||||||
}
|
}
|
||||||
n = fread((char *) curp + nread, sizeof(unsigned char),
|
n = fread((char *) curp + nread, sizeof(unsigned char),
|
||||||
bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin);
|
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) {
|
if (bb_dump_vflag == DUP || bb_dump_vflag == FIRST) {
|
||||||
bb_dump_vflag = WAIT;
|
bb_dump_vflag = WAIT;
|
||||||
}
|
}
|
||||||
return (curp);
|
return curp;
|
||||||
}
|
}
|
||||||
if (bb_dump_vflag == WAIT) {
|
if (bb_dump_vflag == WAIT) {
|
||||||
printf("*\n");
|
puts("*");
|
||||||
}
|
}
|
||||||
bb_dump_vflag = DUP;
|
bb_dump_vflag = DUP;
|
||||||
address = savaddress += bb_dump_blocksize;
|
address = savaddress += bb_dump_blocksize;
|
||||||
@ -665,7 +665,7 @@ int bb_dump_dump(char **argv)
|
|||||||
next(argv);
|
next(argv);
|
||||||
display();
|
display();
|
||||||
|
|
||||||
return (exitval);
|
return exitval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bb_dump_add(const char *fmt)
|
void bb_dump_add(const char *fmt)
|
||||||
|
@ -164,7 +164,7 @@ int obscure(const char *old, const char *newval, const struct passwd *pwdp)
|
|||||||
if ((msg = obscure_msg(old, newval, pwdp))) {
|
if ((msg = obscure_msg(old, newval, pwdp))) {
|
||||||
printf("Bad password: %s.\n", msg);
|
printf("Bad password: %s.\n", msg);
|
||||||
/* If user is root warn only */
|
/* If user is root warn only */
|
||||||
return (getuid())? 1 : 0;
|
return getuid() ? 1 : 0;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -261,16 +261,16 @@ static int create_backup(const char *backup, FILE * fp)
|
|||||||
static int i64c(int i)
|
static int i64c(int i)
|
||||||
{
|
{
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
return ('.');
|
return '.';
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
return ('/');
|
return '/';
|
||||||
if (i >= 2 && i < 12)
|
if (i >= 2 && i < 12)
|
||||||
return ('0' - 2 + i);
|
return ('0' - 2 + i);
|
||||||
if (i >= 12 && i < 38)
|
if (i >= 12 && i < 38)
|
||||||
return ('A' - 12 + i);
|
return ('A' - 12 + i);
|
||||||
if (i >= 38 && i < 63)
|
if (i >= 38 && i < 63)
|
||||||
return ('a' - 38 + i);
|
return ('a' - 38 + i);
|
||||||
return ('z');
|
return 'z';
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *crypt_make_salt(void)
|
static char *crypt_make_salt(void)
|
||||||
|
@ -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)
|
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')
|
if(d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c')
|
||||||
return (2 + addendum);
|
return 2 + addendum;
|
||||||
else if( d[n - 2]=='c' && d[n - 1]=='d')
|
if(d[n - 2]=='c' && d[n - 1]=='d')
|
||||||
return (3 + addendum);
|
return 3 + addendum;
|
||||||
else if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t')
|
if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t')
|
||||||
return (4 + addendum);
|
return 4 + addendum;
|
||||||
else if( ptr[n - 2]=='m' && ptr[n - 1]=='t')
|
if(ptr[n - 2]=='m' && ptr[n - 1]=='t')
|
||||||
return (5 + addendum);
|
return 5 + addendum;
|
||||||
else
|
return 0;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr)
|
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' &&
|
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 - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' &&
|
||||||
d[n - 1]=='c' )
|
d[n - 1]=='c' )
|
||||||
return 1;
|
return 1;
|
||||||
return scan_dev_name_common(d, n, 0, ptr);
|
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')
|
d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t')
|
||||||
{
|
|
||||||
return scan_dev_name_common(d, n, 4, ptr);
|
return scan_dev_name_common(d, n, 4, ptr);
|
||||||
}
|
if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/')
|
||||||
else if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/')
|
|
||||||
{
|
|
||||||
return 10;
|
return 10;
|
||||||
}
|
if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/')
|
||||||
else if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/')
|
|
||||||
{
|
|
||||||
return 11;
|
return 11;
|
||||||
}
|
if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/')
|
||||||
else if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/')
|
|
||||||
{
|
|
||||||
return 12;
|
return 12;
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,7 +777,7 @@ static int do_servicing (int fd, unsigned long event_mask)
|
|||||||
|
|
||||||
caught_signal = FALSE;
|
caught_signal = FALSE;
|
||||||
caught_sighup = FALSE;
|
caught_sighup = FALSE;
|
||||||
return (c_sighup);
|
return c_sighup;
|
||||||
}
|
}
|
||||||
msg_logger_and_die(LOG_ERR, "read error on control file");
|
msg_logger_and_die(LOG_ERR, "read error on control file");
|
||||||
} /* End Function do_servicing */
|
} /* 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 ||
|
if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 ||
|
||||||
( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 )
|
( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 )
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
source_link[source_len] = '\0';
|
source_link[source_len] = '\0';
|
||||||
dest_link[dest_len] = '\0';
|
dest_link[dest_len] = '\0';
|
||||||
if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 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);
|
unlink (destpath);
|
||||||
symlink (source_link, destpath);
|
symlink (source_link, destpath);
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
} /* Else not a symlink */
|
} /* Else not a symlink */
|
||||||
chmod (destpath, new_mode & ~S_IFMT);
|
chmod (destpath, new_mode & ~S_IFMT);
|
||||||
chown (destpath, source_stat->st_uid, source_stat->st_gid);
|
chown (destpath, source_stat->st_uid, source_stat->st_gid);
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
/* Different types: unlink and create */
|
/* Different types: unlink and create */
|
||||||
unlink (destpath);
|
unlink (destpath);
|
||||||
@ -1165,7 +1155,7 @@ static int copy_inode (const char *destpath, const struct stat *dest_stat,
|
|||||||
break;
|
break;
|
||||||
symlink_val[val] = '\0';
|
symlink_val[val] = '\0';
|
||||||
if (symlink (symlink_val, destpath) == 0)
|
if (symlink (symlink_val, destpath) == 0)
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
if ( ( fd = open (destpath, O_RDONLY | O_CREAT, new_mode & ~S_IFMT) ) < 0 )
|
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;
|
break;
|
||||||
do_chown:
|
do_chown:
|
||||||
if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0)
|
if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0)
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
/*break;*/
|
/*break;*/
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
} /* End Function copy_inode */
|
} /* End Function copy_inode */
|
||||||
|
|
||||||
static void free_config (void)
|
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__);
|
msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__);
|
||||||
|
|
||||||
if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) )
|
if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) )
|
||||||
return atoi (string);
|
return atoi(string);
|
||||||
|
|
||||||
if ( flag == UID && ( pw_ent = getpwnam (string) ) != NULL )
|
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 )
|
if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL )
|
||||||
return (grp_ent->gr_gid);
|
return grp_ent->gr_gid;
|
||||||
else if(ENABLE_DEVFSD_VERBOSE)
|
else if(ENABLE_DEVFSD_VERBOSE)
|
||||||
msg="group";
|
msg="group";
|
||||||
|
|
||||||
@ -1269,7 +1259,7 @@ static mode_t get_mode (const char *string)
|
|||||||
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
||||||
|
|
||||||
if ( isdigit (string[0]) )
|
if ( isdigit (string[0]) )
|
||||||
return strtoul (string, NULL, 8);
|
return strtoul(string, NULL, 8);
|
||||||
if (strlen (string) != 9)
|
if (strlen (string) != 9)
|
||||||
msg_logger_and_die(LOG_ERR, "bad mode: %s", string);
|
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;
|
i=i/2;
|
||||||
string++;
|
string++;
|
||||||
}
|
}
|
||||||
return (mode);
|
return mode;
|
||||||
} /* End Function get_mode */
|
} /* End Function get_mode */
|
||||||
|
|
||||||
static void signal_handler (int sig)
|
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);
|
i=index_in_str_array(field_names, variable);
|
||||||
|
|
||||||
if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL))
|
if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL))
|
||||||
return (NULL);
|
return NULL;
|
||||||
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]);
|
||||||
@ -1333,7 +1323,7 @@ static const char *get_variable (const char *variable, void *info)
|
|||||||
|
|
||||||
debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf);
|
debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf);
|
||||||
|
|
||||||
return (sbuf);
|
return sbuf;
|
||||||
} /* End Function get_variable */
|
} /* End Function get_variable */
|
||||||
|
|
||||||
static void service(struct stat statbuf, char *path)
|
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)
|
if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1)
|
||||||
{
|
{
|
||||||
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 */
|
||||||
@ -1471,9 +1461,9 @@ static int expand_expression(char *output, unsigned int outsize,
|
|||||||
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
debug_msg_logger(LOG_INFO, __FUNCTION__);
|
||||||
|
|
||||||
if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) )
|
if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) )
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
expand_regexp (output, outsize, temp, devname, ex, numexp);
|
expand_regexp (output, outsize, temp, devname, ex, numexp);
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
} /* End Function expand_expression */
|
} /* End Function expand_expression */
|
||||||
|
|
||||||
static void expand_regexp (char *output, size_t outsize, const char *input,
|
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 (strncmp (devname, trans->match, len) == 0)
|
||||||
{
|
{
|
||||||
if (trans->format == NULL)
|
if (trans->format == NULL)
|
||||||
return (devname + len);
|
return devname + len;
|
||||||
sprintf (buffer, trans->format, 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)
|
if(ENABLE_DEBUG && compat_name!=NULL)
|
||||||
msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name);
|
msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name);
|
||||||
|
|
||||||
return (compat_name);
|
return compat_name;
|
||||||
} /* End Function get_old_name */
|
} /* End Function get_old_name */
|
||||||
|
|
||||||
static char get_old_ide_name (unsigned int major, unsigned int minor)
|
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)
|
if (minor > 63)
|
||||||
++letter;
|
++letter;
|
||||||
return (letter);
|
return letter;
|
||||||
} /* End Function get_old_ide_name */
|
} /* End Function get_old_ide_name */
|
||||||
|
|
||||||
static char *write_old_sd_name (char *buffer,
|
static char *write_old_sd_name (char *buffer,
|
||||||
@ -1745,7 +1735,7 @@ static char *write_old_sd_name (char *buffer,
|
|||||||
if (major == 8)
|
if (major == 8)
|
||||||
{
|
{
|
||||||
sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part);
|
sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part);
|
||||||
return (buffer);
|
return buffer;
|
||||||
}
|
}
|
||||||
if ( (major > 64) && (major < 72) )
|
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);
|
sprintf (buffer, "sd%c%s", 'a' + disc_index, part);
|
||||||
else
|
else
|
||||||
sprintf (buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26,part);
|
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 */
|
} /* End Function write_old_sd_name */
|
||||||
|
|
||||||
|
|
||||||
@ -1799,7 +1789,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input,
|
|||||||
/* Variable expansion */
|
/* Variable expansion */
|
||||||
input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info);
|
input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info);
|
||||||
if (input == NULL)
|
if (input == NULL)
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
case '~':
|
case '~':
|
||||||
/* Home directory expansion */
|
/* Home directory expansion */
|
||||||
@ -1810,7 +1800,7 @@ int st_expr_expand (char *output, unsigned int length, const char *input,
|
|||||||
if ( ( env = getenv ("HOME") ) == NULL )
|
if ( ( env = getenv ("HOME") ) == NULL )
|
||||||
{
|
{
|
||||||
msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME");
|
msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME");
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
len = strlen (env);
|
len = strlen (env);
|
||||||
if (len + out_pos >= length)
|
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 )
|
if ( ( pwent = getpwnam (tmp) ) == NULL )
|
||||||
{
|
{
|
||||||
msg_logger(LOG_INFO, "no pwent for: %s", tmp);
|
msg_logger(LOG_INFO, "no pwent for: %s", tmp);
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
len = strlen (pwent->pw_dir);
|
len = strlen (pwent->pw_dir);
|
||||||
if (len + out_pos >= length)
|
if (len + out_pos >= length)
|
||||||
@ -1847,16 +1837,16 @@ int st_expr_expand (char *output, unsigned int length, const char *input,
|
|||||||
if (ch == '\0')
|
if (ch == '\0')
|
||||||
{
|
{
|
||||||
memcpy (output, buffer, out_pos);
|
memcpy (output, buffer, out_pos);
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
/* esac */
|
/* esac */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
st_expr_expand_out:
|
st_expr_expand_out:
|
||||||
msg_logger(LOG_INFO, bb_msg_small_buffer);
|
msg_logger(LOG_INFO, bb_msg_small_buffer);
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
} /* End Function st_expr_expand */
|
} /* 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);
|
memcpy (buffer + *out_pos, tmp, len + 1);
|
||||||
out_pos += len;
|
out_pos += len;
|
||||||
return (input);
|
return input;
|
||||||
}
|
}
|
||||||
/* Ordinary variable expansion, possibly in braces */
|
/* Ordinary variable expansion, possibly in braces */
|
||||||
if (ch != '{')
|
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 )
|
if ( ( env = get_variable_v2 (tmp, func, info) ) == NULL )
|
||||||
{
|
{
|
||||||
msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp);
|
msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp);
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
len = strlen (env);
|
len = strlen (env);
|
||||||
if (len + *out_pos >= length)
|
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);
|
memcpy (buffer + *out_pos, env, len + 1);
|
||||||
*out_pos += len;
|
*out_pos += len;
|
||||||
return (input);
|
return input;
|
||||||
}
|
}
|
||||||
/* Variable in braces: check for ':' tricks */
|
/* Variable in braces: check for ':' tricks */
|
||||||
ch = *++input;
|
ch = *++input;
|
||||||
@ -1940,13 +1930,13 @@ static const char *expand_variable (char *buffer, unsigned int length,
|
|||||||
safe_memcpy (tmp, input, len);
|
safe_memcpy (tmp, input, len);
|
||||||
ptr = expand_variable (buffer, length, out_pos, tmp, func, info );
|
ptr = expand_variable (buffer, length, out_pos, tmp, func, info );
|
||||||
if (ptr == NULL)
|
if (ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
return (input + len);
|
return input + len;
|
||||||
}
|
}
|
||||||
if (ch != ':' || ptr[1] != '-' )
|
if (ch != ':' || ptr[1] != '-' )
|
||||||
{
|
{
|
||||||
msg_logger(LOG_INFO, "illegal char in var name");
|
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 */
|
/* It's that handy "${var:-word}" expression. Check if var is defined */
|
||||||
len = ptr - input;
|
len = ptr - input;
|
||||||
@ -1971,7 +1961,7 @@ static const char *expand_variable (char *buffer, unsigned int length,
|
|||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
msg_logger(LOG_INFO,"\"}\" not found in: %s", input);
|
msg_logger(LOG_INFO,"\"}\" not found in: %s", input);
|
||||||
return (NULL);
|
return NULL;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1989,7 +1979,7 @@ static const char *expand_variable (char *buffer, unsigned int length,
|
|||||||
|
|
||||||
memcpy (buffer + *out_pos, env, len + 1);
|
memcpy (buffer + *out_pos, env, len + 1);
|
||||||
*out_pos += len;
|
*out_pos += len;
|
||||||
return (input);
|
return input;
|
||||||
}
|
}
|
||||||
/* Environment variable was not found, so process word. Advance input
|
/* Environment variable was not found, so process word. Advance input
|
||||||
pointer to start of word in "${var:-word}" */
|
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);
|
safe_memcpy (tmp, input, len);
|
||||||
input = ptr;
|
input = ptr;
|
||||||
if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) )
|
if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) )
|
||||||
return (NULL);
|
return NULL;
|
||||||
len = strlen (tmp);
|
len = strlen (tmp);
|
||||||
if (len + *out_pos >= length)
|
if (len + *out_pos >= length)
|
||||||
goto expand_variable_out;
|
goto expand_variable_out;
|
||||||
|
|
||||||
memcpy (buffer + *out_pos, tmp, len + 1);
|
memcpy (buffer + *out_pos, tmp, len + 1);
|
||||||
*out_pos += len;
|
*out_pos += len;
|
||||||
return (input);
|
return input;
|
||||||
expand_variable_out:
|
expand_variable_out:
|
||||||
msg_logger(LOG_INFO, bb_msg_small_buffer);
|
msg_logger(LOG_INFO, bb_msg_small_buffer);
|
||||||
return (NULL);
|
return NULL;
|
||||||
} /* End Function expand_variable */
|
} /* End Function expand_variable */
|
||||||
|
|
||||||
|
|
||||||
@ -2034,9 +2024,9 @@ static const char *get_variable_v2 (const char *variable,
|
|||||||
{
|
{
|
||||||
value = (*func) (variable, info);
|
value = (*func) (variable, info);
|
||||||
if (value != NULL)
|
if (value != NULL)
|
||||||
return (value);
|
return value;
|
||||||
}
|
}
|
||||||
return getenv (variable);
|
return getenv(variable);
|
||||||
} /* End Function get_variable */
|
} /* End Function get_variable */
|
||||||
|
|
||||||
/* END OF CODE */
|
/* END OF CODE */
|
||||||
|
@ -805,7 +805,7 @@ static int check_module_name_match(const char *filename, struct stat *statbuf,
|
|||||||
char *fullname = (char *) userdata;
|
char *fullname = (char *) userdata;
|
||||||
|
|
||||||
if (fullname[0] == '\0')
|
if (fullname[0] == '\0')
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
else {
|
else {
|
||||||
char *tmp, *tmp1 = xstrdup(filename);
|
char *tmp, *tmp1 = xstrdup(filename);
|
||||||
tmp = bb_get_last_path_component(tmp1);
|
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);
|
free(tmp1);
|
||||||
/* Stop searching if we find a match */
|
/* Stop searching if we find a match */
|
||||||
m_filename = xstrdup(filename);
|
m_filename = xstrdup(filename);
|
||||||
return (FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
free(tmp1);
|
free(tmp1);
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -543,6 +543,6 @@ static int in_ether(const char *bufp, struct sockaddr *sap)
|
|||||||
*ptr++ = val;
|
*ptr++ = val;
|
||||||
} while (++i < ETH_ALEN);
|
} 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
|
#endif
|
||||||
|
@ -65,7 +65,7 @@ static int in_cksum(unsigned short *buf, int sz)
|
|||||||
sum = (sum >> 16) + (sum & 0xFFFF);
|
sum = (sum >> 16) + (sum & 0xFFFF);
|
||||||
sum += (sum >> 16);
|
sum += (sum >> 16);
|
||||||
ans = ~sum;
|
ans = ~sum;
|
||||||
return (ans);
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_FEATURE_FANCY_PING
|
#ifndef CONFIG_FEATURE_FANCY_PING
|
||||||
|
18
shell/ash.c
18
shell/ash.c
@ -2160,8 +2160,8 @@ lookupalias(const char *name, int check)
|
|||||||
struct alias *ap = *__lookupalias(name);
|
struct alias *ap = *__lookupalias(name);
|
||||||
|
|
||||||
if (check && ap && (ap->flag & ALIASINUSE))
|
if (check && ap && (ap->flag & ALIASINUSE))
|
||||||
return (NULL);
|
return NULL;
|
||||||
return (ap);
|
return ap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2196,7 +2196,7 @@ aliascmd(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2217,7 +2217,7 @@ unaliascmd(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct alias *
|
static struct alias *
|
||||||
@ -4831,10 +4831,10 @@ done:
|
|||||||
startloc = expdest - (char *)stackblock();
|
startloc = expdest - (char *)stackblock();
|
||||||
strtodest(home, SQSYNTAX, quotes);
|
strtodest(home, SQSYNTAX, quotes);
|
||||||
recordregion(startloc, expdest - (char *)stackblock(), 0);
|
recordregion(startloc, expdest - (char *)stackblock(), 0);
|
||||||
return (p);
|
return p;
|
||||||
lose:
|
lose:
|
||||||
*p = c;
|
*p = c;
|
||||||
return (startp);
|
return startp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -9969,7 +9969,7 @@ out:
|
|||||||
else
|
else
|
||||||
TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : ""));
|
TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : ""));
|
||||||
#endif
|
#endif
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -12531,7 +12531,7 @@ dash_arith(const char *s)
|
|||||||
}
|
}
|
||||||
INTON;
|
INTON;
|
||||||
|
|
||||||
return (result);
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -12555,7 +12555,7 @@ letcmd(int argc, char **argv)
|
|||||||
i = dash_arith(*ap);
|
i = dash_arith(*ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (!i);
|
return !i;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_ASH_MATH_SUPPORT */
|
#endif /* CONFIG_ASH_MATH_SUPPORT */
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ static int builtin_export(struct child_prog *child)
|
|||||||
char *name = child->argv[1];
|
char *name = child->argv[1];
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
return (builtin_env(child));
|
return builtin_env(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = strdup(name);
|
name = strdup(name);
|
||||||
@ -730,7 +730,7 @@ static int builtin_source(struct child_prog *child)
|
|||||||
status = parse_file_outer(input);
|
status = parse_file_outer(input);
|
||||||
mark_closed(fileno(input));
|
mark_closed(fileno(input));
|
||||||
fclose(input);
|
fclose(input);
|
||||||
return (status);
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int builtin_umask(struct child_prog *child)
|
static int builtin_umask(struct child_prog *child)
|
||||||
|
279
shell/msh.c
279
shell/msh.c
@ -1022,31 +1022,31 @@ struct op *scantree(struct op *head)
|
|||||||
struct op *dotnode;
|
struct op *dotnode;
|
||||||
|
|
||||||
if (head == NULL)
|
if (head == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
if (head->left != NULL) {
|
if (head->left != NULL) {
|
||||||
dotnode = scantree(head->left);
|
dotnode = scantree(head->left);
|
||||||
if (dotnode)
|
if (dotnode)
|
||||||
return (dotnode);
|
return dotnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head->right != NULL) {
|
if (head->right != NULL) {
|
||||||
dotnode = scantree(head->right);
|
dotnode = scantree(head->right);
|
||||||
if (dotnode)
|
if (dotnode)
|
||||||
return (dotnode);
|
return dotnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head->words == NULL)
|
if (head->words == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
DBGPRINTF5(("SCANTREE: checking node %p\n", head));
|
DBGPRINTF5(("SCANTREE: checking node %p\n", head));
|
||||||
|
|
||||||
if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) {
|
if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) {
|
||||||
DBGPRINTF5(("SCANTREE: dot found in node %p\n", head));
|
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)
|
static char *putn(int n)
|
||||||
{
|
{
|
||||||
return (itoa(n));
|
return itoa(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void next(int f)
|
static void next(int f)
|
||||||
@ -1248,7 +1248,7 @@ static char *space(int n)
|
|||||||
|
|
||||||
if ((cp = getcell(n)) == 0)
|
if ((cp = getcell(n)) == 0)
|
||||||
err("out of string space");
|
err("out of string space");
|
||||||
return (cp);
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *strsave(char *s, int a)
|
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) {
|
if ((cp = space(strlen(s) + 1)) != NULL) {
|
||||||
setarea((char *) cp, a);
|
setarea((char *) cp, a);
|
||||||
for (xp = cp; (*xp++ = *s++) != '\0';);
|
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';
|
c = c * 10 + *n - '0';
|
||||||
dummy.status = RONLY;
|
dummy.status = RONLY;
|
||||||
dummy.value = c <= dolc ? dolv[c] : null;
|
dummy.value = c <= dolc ? dolv[c] : null;
|
||||||
return (&dummy);
|
return &dummy;
|
||||||
}
|
}
|
||||||
for (vp = vlist; vp; vp = vp->next)
|
for (vp = vlist; vp; vp = vp->next)
|
||||||
if (eqname(vp->name, n))
|
if (eqname(vp->name, n))
|
||||||
return (vp);
|
return vp;
|
||||||
cp = findeq(n);
|
cp = findeq(n);
|
||||||
vp = (struct var *) space(sizeof(*vp));
|
vp = (struct var *) space(sizeof(*vp));
|
||||||
if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) {
|
if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) {
|
||||||
dummy.name = dummy.value = "";
|
dummy.name = dummy.value = "";
|
||||||
return (&dummy);
|
return &dummy;
|
||||||
}
|
}
|
||||||
for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++);
|
for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++);
|
||||||
if (*cp == 0)
|
if (*cp == 0)
|
||||||
@ -1327,7 +1327,7 @@ static struct var *lookup(char *n)
|
|||||||
vp->next = vlist;
|
vp->next = vlist;
|
||||||
vp->status = GETCELL;
|
vp->status = GETCELL;
|
||||||
vlist = vp;
|
vlist = vp;
|
||||||
return (vp);
|
return vp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1455,14 +1455,14 @@ 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 == '=';
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *findeq(char *cp)
|
static char *findeq(char *cp)
|
||||||
{
|
{
|
||||||
while (*cp != '\0' && *cp != '=')
|
while (*cp != '\0' && *cp != '=')
|
||||||
cp++;
|
cp++;
|
||||||
return (cp);
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- gmatch.c -------- */
|
/* -------- gmatch.c -------- */
|
||||||
@ -1510,7 +1510,7 @@ static int gmatch(char *s, char *p)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (*s == 0);
|
return *s == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *cclass(char *p, int sub)
|
static char *cclass(char *p, int sub)
|
||||||
@ -1522,7 +1522,7 @@ static char *cclass(char *p, int sub)
|
|||||||
found = not;
|
found = not;
|
||||||
do {
|
do {
|
||||||
if (*p == '\0')
|
if (*p == '\0')
|
||||||
return ((char *) NULL);
|
return NULL;
|
||||||
c = *p & CMASK;
|
c = *p & CMASK;
|
||||||
if (p[1] == '-' && p[2] != ']') {
|
if (p[1] == '-' && p[2] != ']') {
|
||||||
d = p[2] & CMASK;
|
d = p[2] & CMASK;
|
||||||
@ -1532,7 +1532,7 @@ static char *cclass(char *p, int sub)
|
|||||||
if (c == sub || (c <= sub && sub <= d))
|
if (c == sub || (c <= sub && sub <= d))
|
||||||
found = !not;
|
found = !not;
|
||||||
} while (*++p != ']');
|
} 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;
|
i = nregio >= GROWBY ? nregio : GROWBY;
|
||||||
p = (struct region *) sbrk(i * REGSIZE);
|
p = (struct region *) sbrk(i * REGSIZE);
|
||||||
if (p == (struct region *) -1)
|
if (p == (struct region *) -1)
|
||||||
return ((char *) NULL);
|
return NULL;
|
||||||
p--;
|
p--;
|
||||||
if (p != areatop) {
|
if (p != areatop) {
|
||||||
puts("not contig");
|
puts("not contig");
|
||||||
@ -1608,7 +1608,7 @@ char *getcell(unsigned nbytes)
|
|||||||
q->next = areabot;
|
q->next = areabot;
|
||||||
q->area = BUSY;
|
q->area = BUSY;
|
||||||
areatop = q;
|
areatop = q;
|
||||||
found:
|
found:
|
||||||
/*
|
/*
|
||||||
* we found a FREE area big enough, pointed to by 'p', and up to 'q'
|
* 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->next = areanxt;
|
||||||
}
|
}
|
||||||
p->area = areanum;
|
p->area = areanum;
|
||||||
return ((char *) (p + 1));
|
return (char *) (p + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void freecell(char *cp)
|
static void freecell(char *cp)
|
||||||
@ -1732,7 +1732,7 @@ static struct op *pipeline(int cf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINTF7(("PIPELINE: returning t=%p\n", t));
|
DBGPRINTF7(("PIPELINE: returning t=%p\n", t));
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *andor(void)
|
static struct op *andor(void)
|
||||||
@ -1760,7 +1760,7 @@ static struct op *andor(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINTF7(("ANDOR: returning t=%p\n", t));
|
DBGPRINTF7(("ANDOR: returning t=%p\n", t));
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *c_list(void)
|
static struct op *c_list(void)
|
||||||
@ -1780,7 +1780,7 @@ static struct op *c_list(void)
|
|||||||
|| (multiline && c == '\n')) {
|
|| (multiline && c == '\n')) {
|
||||||
|
|
||||||
if ((p = andor()) == NULL)
|
if ((p = andor()) == NULL)
|
||||||
return (t);
|
return t;
|
||||||
|
|
||||||
if ((peeksym = yylex(0)) == '&')
|
if ((peeksym = yylex(0)) == '&')
|
||||||
p = block(TASYNC, p, NOBLOCK, NOWORDS);
|
p = block(TASYNC, p, NOBLOCK, NOWORDS);
|
||||||
@ -1792,7 +1792,7 @@ static struct op *c_list(void)
|
|||||||
}
|
}
|
||||||
/* IF */
|
/* IF */
|
||||||
DBGPRINTF7(("C_LIST: returning t=%p\n", t));
|
DBGPRINTF7(("C_LIST: returning t=%p\n", t));
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int synio(int cf)
|
static int synio(int cf)
|
||||||
@ -1852,7 +1852,7 @@ static struct op *simple(void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1867,7 +1867,7 @@ static struct op *nested(int type, int mark)
|
|||||||
t = c_list();
|
t = c_list();
|
||||||
musthave(mark, 0);
|
musthave(mark, 0);
|
||||||
multiline--;
|
multiline--;
|
||||||
return (block(type, t, NOBLOCK, NOWORDS));
|
return block(type, t, NOBLOCK, NOWORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *command(int cf)
|
static struct op *command(int cf)
|
||||||
@ -1894,7 +1894,7 @@ static struct op *command(int cf)
|
|||||||
peeksym = c;
|
peeksym = c;
|
||||||
if ((t = simple()) == NULL) {
|
if ((t = simple()) == NULL) {
|
||||||
if (iolist == NULL)
|
if (iolist == NULL)
|
||||||
return ((struct op *) NULL);
|
return NULL;
|
||||||
t = newtp();
|
t = newtp();
|
||||||
t->type = TCOM;
|
t->type = TCOM;
|
||||||
}
|
}
|
||||||
@ -1980,7 +1980,7 @@ static struct op *command(int cf)
|
|||||||
|
|
||||||
DBGPRINTF(("COMMAND: returning %p\n", t));
|
DBGPRINTF(("COMMAND: returning %p\n", t));
|
||||||
|
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *dowholefile(int type, int mark)
|
static struct op *dowholefile(int type, int mark)
|
||||||
@ -1994,7 +1994,7 @@ static struct op *dowholefile(int type, int mark)
|
|||||||
multiline--;
|
multiline--;
|
||||||
t = block(type, t, NOBLOCK, NOWORDS);
|
t = block(type, t, NOBLOCK, NOWORDS);
|
||||||
DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t));
|
DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t));
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *dogroup(int onlydone)
|
static struct op *dogroup(int onlydone)
|
||||||
@ -2004,12 +2004,12 @@ static struct op *dogroup(int onlydone)
|
|||||||
|
|
||||||
c = yylex(CONTIN);
|
c = yylex(CONTIN);
|
||||||
if (c == DONE && onlydone)
|
if (c == DONE && onlydone)
|
||||||
return ((struct op *) NULL);
|
return NULL;
|
||||||
if (c != DO)
|
if (c != DO)
|
||||||
SYNTAXERR;
|
SYNTAXERR;
|
||||||
mylist = c_list();
|
mylist = c_list();
|
||||||
musthave(DONE, 0);
|
musthave(DONE, 0);
|
||||||
return (mylist);
|
return mylist;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *thenpart(void)
|
static struct op *thenpart(void)
|
||||||
@ -2019,7 +2019,7 @@ static struct op *thenpart(void)
|
|||||||
|
|
||||||
if ((c = yylex(0)) != THEN) {
|
if ((c = yylex(0)) != THEN) {
|
||||||
peeksym = c;
|
peeksym = c;
|
||||||
return ((struct op *) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
t = newtp();
|
t = newtp();
|
||||||
t->type = 0;
|
t->type = 0;
|
||||||
@ -2027,7 +2027,7 @@ static struct op *thenpart(void)
|
|||||||
if (t->left == NULL)
|
if (t->left == NULL)
|
||||||
SYNTAXERR;
|
SYNTAXERR;
|
||||||
t->right = elsepart();
|
t->right = elsepart();
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *elsepart(void)
|
static struct op *elsepart(void)
|
||||||
@ -2039,18 +2039,18 @@ static struct op *elsepart(void)
|
|||||||
case ELSE:
|
case ELSE:
|
||||||
if ((t = c_list()) == NULL)
|
if ((t = c_list()) == NULL)
|
||||||
SYNTAXERR;
|
SYNTAXERR;
|
||||||
return (t);
|
return t;
|
||||||
|
|
||||||
case ELIF:
|
case ELIF:
|
||||||
t = newtp();
|
t = newtp();
|
||||||
t->type = TELIF;
|
t->type = TELIF;
|
||||||
t->left = c_list();
|
t->left = c_list();
|
||||||
t->right = thenpart();
|
t->right = thenpart();
|
||||||
return (t);
|
return t;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
peeksym = c;
|
peeksym = c;
|
||||||
return ((struct op *) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2065,7 +2065,7 @@ static struct op *caselist(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINTF(("CASELIST, returning t=%p\n", t));
|
DBGPRINTF(("CASELIST, returning t=%p\n", t));
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *casepart(void)
|
static struct op *casepart(void)
|
||||||
@ -2084,7 +2084,7 @@ static struct op *casepart(void)
|
|||||||
|
|
||||||
DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t));
|
DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t));
|
||||||
|
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **pattern(void)
|
static char **pattern(void)
|
||||||
@ -2100,7 +2100,7 @@ static char **pattern(void)
|
|||||||
peeksym = c;
|
peeksym = c;
|
||||||
word(NOWORD);
|
word(NOWORD);
|
||||||
|
|
||||||
return (copyw());
|
return copyw();
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **wordlist(void)
|
static char **wordlist(void)
|
||||||
@ -2109,14 +2109,14 @@ static char **wordlist(void)
|
|||||||
|
|
||||||
if ((c = yylex(0)) != IN) {
|
if ((c = yylex(0)) != IN) {
|
||||||
peeksym = c;
|
peeksym = c;
|
||||||
return ((char **) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
startl = 0;
|
startl = 0;
|
||||||
while ((c = yylex(0)) == WORD)
|
while ((c = yylex(0)) == WORD)
|
||||||
word(yylval.cp);
|
word(yylval.cp);
|
||||||
word(NOWORD);
|
word(NOWORD);
|
||||||
peeksym = c;
|
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));
|
DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2));
|
||||||
|
|
||||||
if (t1 == NULL)
|
if (t1 == NULL)
|
||||||
return (t2);
|
return t2;
|
||||||
if (t2 == NULL)
|
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)
|
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,
|
DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1,
|
||||||
t2));
|
t2));
|
||||||
|
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if given string is a shell multiline (FOR, IF, etc) */
|
/* 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++)
|
for (rp = restab; rp->r_name; rp++)
|
||||||
if (strcmp(rp->r_name, n) == 0) {
|
if (strcmp(rp->r_name, n) == 0) {
|
||||||
DBGPRINTF7(("RLOOKUP: match, returning %d\n", rp->r_val));
|
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"));
|
DBGPRINTF7(("RLOOKUP: NO match, returning 0\n"));
|
||||||
@ -2183,7 +2183,7 @@ static struct op *newtp(void)
|
|||||||
|
|
||||||
DBGPRINTF3(("NEWTP: allocated %p\n", t));
|
DBGPRINTF3(("NEWTP: allocated %p\n", t));
|
||||||
|
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *namelist(struct op *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->ioact = t->left->ioact;
|
||||||
t->left->ioact = NULL;
|
t->left->ioact = NULL;
|
||||||
}
|
}
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
word(NOWORD);
|
word(NOWORD);
|
||||||
t->words = copyw();
|
t->words = copyw();
|
||||||
|
|
||||||
|
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char **copyw(void)
|
static char **copyw(void)
|
||||||
@ -2220,7 +2220,7 @@ static char **copyw(void)
|
|||||||
|
|
||||||
wd = getwords(wdlist);
|
wd = getwords(wdlist);
|
||||||
wdlist = 0;
|
wdlist = 0;
|
||||||
return (wd);
|
return wd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void word(char *cp)
|
static void word(char *cp)
|
||||||
@ -2234,7 +2234,7 @@ static struct ioword **copyio(void)
|
|||||||
|
|
||||||
iop = (struct ioword **) getwords(iolist);
|
iop = (struct ioword **) getwords(iolist);
|
||||||
iolist = 0;
|
iolist = 0;
|
||||||
return (iop);
|
return iop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ioword *io(int u, int f, char *cp)
|
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_flag = f;
|
||||||
iop->io_name = cp;
|
iop->io_name = cp;
|
||||||
iolist = addword((char *) iop, iolist);
|
iolist = addword((char *) iop, iolist);
|
||||||
return (iop);
|
return iop;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void zzerr(void)
|
static void zzerr(void)
|
||||||
@ -2274,7 +2274,7 @@ static int yylex(int cf)
|
|||||||
peeksym = 0;
|
peeksym = 0;
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
startl = 1;
|
startl = 1;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2311,14 +2311,14 @@ static int yylex(int cf)
|
|||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
DBGPRINTF5(("YYLEX: return 0, c=%d\n", c));
|
DBGPRINTF5(("YYLEX: return 0, c=%d\n", c));
|
||||||
return (c);
|
return c;
|
||||||
|
|
||||||
case '$':
|
case '$':
|
||||||
DBGPRINTF9(("YYLEX: found $\n"));
|
DBGPRINTF9(("YYLEX: found $\n"));
|
||||||
*e.linep++ = c;
|
*e.linep++ = c;
|
||||||
if ((c = my_getc(0)) == '{') {
|
if ((c = my_getc(0)) == '{') {
|
||||||
if ((c = collect(c, '}')) != '\0')
|
if ((c = collect(c, '}')) != '\0')
|
||||||
return (c);
|
return c;
|
||||||
goto pack;
|
goto pack;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -2327,7 +2327,7 @@ static int yylex(int cf)
|
|||||||
case '\'':
|
case '\'':
|
||||||
case '"':
|
case '"':
|
||||||
if ((c = collect(c, c)) != '\0')
|
if ((c = collect(c, c)) != '\0')
|
||||||
return (c);
|
return c;
|
||||||
goto pack;
|
goto pack;
|
||||||
|
|
||||||
case '|':
|
case '|':
|
||||||
@ -2336,17 +2336,17 @@ static int yylex(int cf)
|
|||||||
startl = 1;
|
startl = 1;
|
||||||
/* If more chars process them, else return NULL char */
|
/* If more chars process them, else return NULL char */
|
||||||
if ((c1 = dual(c)) != '\0')
|
if ((c1 = dual(c)) != '\0')
|
||||||
return (c1);
|
return c1;
|
||||||
else
|
else
|
||||||
return (c);
|
return c;
|
||||||
|
|
||||||
case '^':
|
case '^':
|
||||||
startl = 1;
|
startl = 1;
|
||||||
return ('|');
|
return '|';
|
||||||
case '>':
|
case '>':
|
||||||
case '<':
|
case '<':
|
||||||
diag(c);
|
diag(c);
|
||||||
return (c);
|
return c;
|
||||||
|
|
||||||
case '\n':
|
case '\n':
|
||||||
nlseen++;
|
nlseen++;
|
||||||
@ -2363,12 +2363,12 @@ static int yylex(int cf)
|
|||||||
if (cf & CONTIN)
|
if (cf & CONTIN)
|
||||||
goto loop;
|
goto loop;
|
||||||
}
|
}
|
||||||
return (c);
|
return c;
|
||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
case ')':
|
case ')':
|
||||||
startl = 1;
|
startl = 1;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
unget(c);
|
unget(c);
|
||||||
@ -2390,11 +2390,11 @@ static int yylex(int cf)
|
|||||||
|
|
||||||
if (atstart && (c = rlookup(line)) != 0) {
|
if (atstart && (c = rlookup(line)) != 0) {
|
||||||
startl = 1;
|
startl = 1;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
yylval.cp = strsave(line, areanum);
|
yylval.cp = strsave(line, areanum);
|
||||||
return (WORD);
|
return WORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2412,7 +2412,7 @@ static int collect(int c, int c1)
|
|||||||
s[1] = 0;
|
s[1] = 0;
|
||||||
prs("no closing ");
|
prs("no closing ");
|
||||||
yyerror(s);
|
yyerror(s);
|
||||||
return (YYERRCODE);
|
return YYERRCODE;
|
||||||
}
|
}
|
||||||
if (interactive && c == '\n' && e.iop <= iostack) {
|
if (interactive && c == '\n' && e.iop <= iostack) {
|
||||||
#ifdef CONFIG_FEATURE_COMMAND_EDITING
|
#ifdef CONFIG_FEATURE_COMMAND_EDITING
|
||||||
@ -2448,7 +2448,7 @@ static int dual(int c)
|
|||||||
if (c == 0)
|
if (c == 0)
|
||||||
unget(*--cp); /* String is not a shell multiline, put peek char back */
|
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)
|
static void diag(int ec)
|
||||||
@ -2481,7 +2481,7 @@ static char *tree(unsigned size)
|
|||||||
fail();
|
fail();
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
return (t);
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VARARGS1 */
|
/* 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));
|
DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv));
|
||||||
return (rv);
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2759,7 +2759,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
|
|||||||
if (cp == NULL && t->ioact == NULL) {
|
if (cp == NULL && t->ioact == NULL) {
|
||||||
while ((cp = *owp++) != NULL && assign(cp, COPYV));
|
while ((cp = *owp++) != NULL && assign(cp, COPYV));
|
||||||
DBGPRINTF(("FORKEXEC: returning setstatus()\n"));
|
DBGPRINTF(("FORKEXEC: returning setstatus()\n"));
|
||||||
return (setstatus(0));
|
return setstatus(0);
|
||||||
} else if (cp != NULL) {
|
} else if (cp != NULL) {
|
||||||
shcom = inbuilt(cp);
|
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 (iosetup(*iopp++, pin != NULL, pout != NULL)) {
|
||||||
if (forked)
|
if (forked)
|
||||||
_exit(rv);
|
_exit(rv);
|
||||||
return (rv);
|
return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2873,7 +2873,7 @@ forkexec(struct op *t, int *pin, int *pout, int act, char **wp)
|
|||||||
if (forked)
|
if (forked)
|
||||||
_exit(i);
|
_exit(i);
|
||||||
DBGPRINTF(("FORKEXEC: returning i=%d\n", i));
|
DBGPRINTF(("FORKEXEC: returning i=%d\n", i));
|
||||||
return (i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* should use FIOCEXCL */
|
/* should use FIOCEXCL */
|
||||||
@ -3005,7 +3005,7 @@ static struct op **find1case(struct op *t, char *w)
|
|||||||
|
|
||||||
if (t == NULL) {
|
if (t == NULL) {
|
||||||
DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n"));
|
DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n"));
|
||||||
return ((struct op **) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINTF3(("FIND1CASE: enter, t->type=%d (%s)\n", t->type,
|
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 (t->type == TLIST) {
|
||||||
if ((tp = find1case(t->left, w)) != NULL) {
|
if ((tp = find1case(t->left, w)) != NULL) {
|
||||||
DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp));
|
DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp));
|
||||||
return (tp);
|
return tp;
|
||||||
}
|
}
|
||||||
t1 = t->right; /* TPAT */
|
t1 = t->right; /* TPAT */
|
||||||
} else
|
} else
|
||||||
@ -3024,18 +3024,19 @@ static struct op **find1case(struct op *t, char *w)
|
|||||||
if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) {
|
if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) {
|
||||||
DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n",
|
DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n",
|
||||||
&t1->left));
|
&t1->left));
|
||||||
return (&t1->left);
|
return &t1->left;
|
||||||
}
|
}
|
||||||
|
|
||||||
DBGPRINTF(("FIND1CASE: returning NULL\n"));
|
DBGPRINTF(("FIND1CASE: returning NULL\n"));
|
||||||
return ((struct op **) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct op *findcase(struct op *t, char *w)
|
static struct op *findcase(struct op *t, char *w)
|
||||||
{
|
{
|
||||||
struct op **tp;
|
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);
|
onintr(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (rv);
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int setstatus(int s)
|
static int setstatus(int s)
|
||||||
{
|
{
|
||||||
exstat = s;
|
exstat = s;
|
||||||
setval(lookup("?"), putn(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;
|
*v = e.linep;
|
||||||
execve(DEFAULT_SHELL, v, envp);
|
execve(DEFAULT_SHELL, v, envp);
|
||||||
*v = tp;
|
*v = tp;
|
||||||
return ("no Shell");
|
return "no Shell";
|
||||||
|
|
||||||
case ENOMEM:
|
case ENOMEM:
|
||||||
return ((char *) bb_msg_memory_exhausted);
|
return (char *) bb_msg_memory_exhausted;
|
||||||
|
|
||||||
case E2BIG:
|
case E2BIG:
|
||||||
return ("argument list too long");
|
return "argument list too long";
|
||||||
|
|
||||||
case EACCES:
|
case EACCES:
|
||||||
eacces++;
|
eacces++;
|
||||||
break;
|
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;
|
outtree = otree;
|
||||||
freearea(areanum--);
|
freearea(areanum--);
|
||||||
|
|
||||||
return (rv);
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- do.c -------- */
|
/* -------- do.c -------- */
|
||||||
@ -3412,7 +3413,7 @@ static int dodot(struct op *t)
|
|||||||
|
|
||||||
DBGPRINTF(("DODOT: returning exstat=%d\n", exstat));
|
DBGPRINTF(("DODOT: returning exstat=%d\n", exstat));
|
||||||
|
|
||||||
return (exstat);
|
return exstat;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* While */
|
} /* While */
|
||||||
@ -3458,12 +3459,12 @@ static int doread(struct op *t)
|
|||||||
break;
|
break;
|
||||||
setval(lookup(*wp), e.linep);
|
setval(lookup(*wp), e.linep);
|
||||||
}
|
}
|
||||||
return (nb <= 0);
|
return nb <= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int doeval(struct op *t)
|
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)
|
static int dotrap(struct op *t)
|
||||||
@ -3513,7 +3514,7 @@ static int getsig(char *s)
|
|||||||
err("trap: bad signal number");
|
err("trap: bad signal number");
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
return (n);
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setsig(int n, sighandler_t f)
|
static void setsig(int n, sighandler_t f)
|
||||||
@ -3543,17 +3544,17 @@ static int getn(char *as)
|
|||||||
prs(as);
|
prs(as);
|
||||||
err(": bad number");
|
err(": bad number");
|
||||||
}
|
}
|
||||||
return (n * m);
|
return n * m;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dobreak(struct op *t)
|
static int dobreak(struct op *t)
|
||||||
{
|
{
|
||||||
return (brkcontin(t->words[1], 1));
|
return brkcontin(t->words[1], 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int docontinue(struct op *t)
|
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)
|
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++)
|
for (bp = builtincmds; bp->name != NULL; bp++)
|
||||||
if (strcmp(bp->name, s) == 0)
|
if (strcmp(bp->name, s) == 0)
|
||||||
return (bp->builtinfunc);
|
return bp->builtinfunc;
|
||||||
|
|
||||||
return (NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- eval.c -------- */
|
/* -------- eval.c -------- */
|
||||||
@ -3766,7 +3767,7 @@ static char **eval(char **ap, int f)
|
|||||||
} else
|
} else
|
||||||
gflg = 1;
|
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)
|
if (all || vp->status & EXPORT)
|
||||||
wb = addword(vp->name, wb);
|
wb = addword(vp->name, wb);
|
||||||
wb = addword((char *) 0, wb);
|
wb = addword((char *) 0, wb);
|
||||||
return (getwords(wb));
|
return getwords(wb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *evalstr(char *cp, int f)
|
static char *evalstr(char *cp, int f)
|
||||||
@ -3801,7 +3802,7 @@ static char *evalstr(char *cp, int f)
|
|||||||
DELETE(wb);
|
DELETE(wb);
|
||||||
} else
|
} else
|
||||||
cp = NULL;
|
cp = NULL;
|
||||||
return (cp);
|
return cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int expand(char *cp, struct wdblock **wbp, int f)
|
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();
|
quitenv();
|
||||||
} else
|
} else
|
||||||
gflg = 1;
|
gflg = 1;
|
||||||
return (gflg == 0);
|
return gflg == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3868,7 +3869,7 @@ static char *blank(int f)
|
|||||||
if (sp == e.linep)
|
if (sp == e.linep)
|
||||||
return 0;
|
return 0;
|
||||||
*e.linep++ = 0;
|
*e.linep++ = 0;
|
||||||
return (sp);
|
return sp;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (f & DOBLANK && any(c, ifs->value))
|
if (f & DOBLANK && any(c, ifs->value))
|
||||||
@ -3913,7 +3914,7 @@ static char *blank(int f)
|
|||||||
*e.linep++ = c;
|
*e.linep++ = c;
|
||||||
}
|
}
|
||||||
*e.linep++ = 0;
|
*e.linep++ = 0;
|
||||||
return (sp);
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3939,7 +3940,7 @@ static int subgetc(char ec, int quoted)
|
|||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3979,7 +3980,7 @@ static int dollar(int quoted)
|
|||||||
if (c != '}') {
|
if (c != '}') {
|
||||||
err("unclosed ${");
|
err("unclosed ${");
|
||||||
gflg++;
|
gflg++;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.linep >= elinep) {
|
if (e.linep >= elinep) {
|
||||||
@ -4235,7 +4236,7 @@ static char *unquote(char *as)
|
|||||||
if ((s = as) != NULL)
|
if ((s = as) != NULL)
|
||||||
while (*s)
|
while (*s)
|
||||||
*s++ &= ~QUOTE;
|
*s++ &= ~QUOTE;
|
||||||
return (as);
|
return as;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- glob.c -------- */
|
/* -------- glob.c -------- */
|
||||||
@ -4257,7 +4258,7 @@ static struct wdblock *glob(char *cp, struct wdblock *wb)
|
|||||||
char *pp;
|
char *pp;
|
||||||
|
|
||||||
if (cp == 0)
|
if (cp == 0)
|
||||||
return (wb);
|
return wb;
|
||||||
i = 0;
|
i = 0;
|
||||||
for (pp = cp; *pp; pp++)
|
for (pp = cp; *pp; pp++)
|
||||||
if (any(*pp, spcl))
|
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++)
|
for (i = 0; i < cl->w_nword; i++)
|
||||||
wb = addword(cl->w_words[i], wb);
|
wb = addword(cl->w_words[i], wb);
|
||||||
DELETE(cl);
|
DELETE(cl);
|
||||||
return (wb);
|
return wb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wb = addword(unquote(cp), wb);
|
wb = addword(unquote(cp), wb);
|
||||||
return (wb);
|
return wb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void globname(char *we, char *pp)
|
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';);
|
for (xp = middle; (*op++ = *xp++) != '\0';);
|
||||||
op--;
|
op--;
|
||||||
for (xp = end; (*op++ = *xp++) != '\0';);
|
for (xp = end; (*op++ = *xp++) != '\0';);
|
||||||
return (p);
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int anyspcl(struct wdblock *wb)
|
static int anyspcl(struct wdblock *wb)
|
||||||
@ -4385,7 +4386,7 @@ static int anyspcl(struct wdblock *wb)
|
|||||||
|
|
||||||
static int xstrcmp(char *p1, char *p2)
|
static int xstrcmp(char *p1, char *p2)
|
||||||
{
|
{
|
||||||
return (strcmp(*(char **) p1, *(char **) p2));
|
return strcmp(*(char **) p1, *(char **) p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------- word.c -------- */
|
/* -------- word.c -------- */
|
||||||
@ -4397,7 +4398,7 @@ static struct wdblock *newword(int nw)
|
|||||||
wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *));
|
wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *));
|
||||||
wb->w_bsize = nw;
|
wb->w_bsize = nw;
|
||||||
wb->w_nword = 0;
|
wb->w_nword = 0;
|
||||||
return (wb);
|
return wb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wdblock *addword(char *wd, struct wdblock *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 = wb2;
|
||||||
}
|
}
|
||||||
wb->w_words[wb->w_nword++] = wd;
|
wb->w_words[wb->w_nword++] = wd;
|
||||||
return (wb);
|
return wb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -4426,15 +4427,15 @@ char **getwords(struct wdblock *wb)
|
|||||||
int nb;
|
int nb;
|
||||||
|
|
||||||
if (wb == NULL)
|
if (wb == NULL)
|
||||||
return ((char **) NULL);
|
return NULL;
|
||||||
if (wb->w_nword == 0) {
|
if (wb->w_nword == 0) {
|
||||||
DELETE(wb);
|
DELETE(wb);
|
||||||
return ((char **) NULL);
|
return NULL;
|
||||||
}
|
}
|
||||||
wd = (char **) space(nb = sizeof(*wd) * wb->w_nword);
|
wd = (char **) space(nb = sizeof(*wd) * wb->w_nword);
|
||||||
memcpy((char *) wd, (char *) wb->w_words, nb);
|
memcpy((char *) wd, (char *) wb->w_words, nb);
|
||||||
DELETE(wb); /* perhaps should done by caller */
|
DELETE(wb); /* perhaps should done by caller */
|
||||||
return (wd);
|
return wd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int (*func) (char *, char *);
|
static int (*func) (char *, char *);
|
||||||
@ -4563,18 +4564,18 @@ static int my_getc(int ec)
|
|||||||
while ((c = readc()) != '\n' && c);
|
while ((c = readc()) != '\n' && c);
|
||||||
err("input line too long");
|
err("input line too long");
|
||||||
gflg++;
|
gflg++;
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
c = readc();
|
c = readc();
|
||||||
if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) {
|
if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) {
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
c = readc();
|
c = readc();
|
||||||
if (c == '\n' && ec != '\"')
|
if (c == '\n' && ec != '\"')
|
||||||
return (my_getc(ec));
|
return my_getc(ec);
|
||||||
c |= QUOTE;
|
c |= QUOTE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void unget(int 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));
|
RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc));
|
||||||
if ((c = e.iop->peekc) != '\0') {
|
if ((c = e.iop->peekc) != '\0') {
|
||||||
e.iop->peekc = 0;
|
e.iop->peekc = 0;
|
||||||
return (c);
|
return c;
|
||||||
} else {
|
} else {
|
||||||
if (e.iop->prev != 0) {
|
if (e.iop->prev != 0) {
|
||||||
if ((c = (*e.iop->iofn) (e.iop->argp, e.iop)) != '\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;
|
xp = e.iobase;
|
||||||
e.iobase = ip;
|
e.iobase = ip;
|
||||||
return (xp);
|
return xp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4740,9 +4741,9 @@ static int nlchar(struct ioarg *ap)
|
|||||||
return 0;
|
return 0;
|
||||||
if ((c = *ap->aword++) == 0) {
|
if ((c = *ap->aword++) == 0) {
|
||||||
ap->aword = NULL;
|
ap->aword = NULL;
|
||||||
return ('\n');
|
return '\n';
|
||||||
}
|
}
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4758,12 +4759,12 @@ static int wdchar(struct ioarg *ap)
|
|||||||
return 0;
|
return 0;
|
||||||
if (*wl != NULL) {
|
if (*wl != NULL) {
|
||||||
if ((c = *(*wl)++) != 0)
|
if ((c = *(*wl)++) != 0)
|
||||||
return (c & 0177);
|
return c & 0177;
|
||||||
ap->awordlist++;
|
ap->awordlist++;
|
||||||
return (' ');
|
return ' ';
|
||||||
}
|
}
|
||||||
ap->awordlist = NULL;
|
ap->awordlist = NULL;
|
||||||
return ('\n');
|
return '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4789,9 +4790,9 @@ static int xxchar(struct ioarg *ap)
|
|||||||
return 0;
|
return 0;
|
||||||
if ((c = *ap->aword++) == '\0') {
|
if ((c = *ap->aword++) == '\0') {
|
||||||
ap->aword = NULL;
|
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)
|
if (ap->aword == NULL || (c = *ap->aword++) == 0)
|
||||||
return 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)
|
if (ap->aword == NULL || (c = *ap->aword++) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
return (c | QUOTE);
|
return c | QUOTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4859,13 +4860,13 @@ static int filechar(struct ioarg *ap)
|
|||||||
}
|
}
|
||||||
c = mycommand[position];
|
c = mycommand[position];
|
||||||
position++;
|
position++;
|
||||||
return (c);
|
return c;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
i = safe_read(ap->afile, &c, sizeof(c));
|
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);
|
close(ap->afile);
|
||||||
c = 0;
|
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')
|
if ((c = qgravechar(ap, iop) & ~QUOTE) == '\n')
|
||||||
c = ' ';
|
c = ' ';
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qgravechar(struct ioarg *ap, struct io *iop)
|
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->xchar) {
|
||||||
if (iop->nlcount) {
|
if (iop->nlcount) {
|
||||||
iop->nlcount--;
|
iop->nlcount--;
|
||||||
return ('\n' | QUOTE);
|
return '\n' | QUOTE;
|
||||||
}
|
}
|
||||||
c = iop->xchar;
|
c = iop->xchar;
|
||||||
iop->xchar = 0;
|
iop->xchar = 0;
|
||||||
@ -4917,11 +4918,11 @@ static int qgravechar(struct ioarg *ap, struct io *iop)
|
|||||||
iop->nlcount++;
|
iop->nlcount++;
|
||||||
iop->xchar = c;
|
iop->xchar = c;
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
return (c);
|
return c;
|
||||||
iop->nlcount--;
|
iop->nlcount--;
|
||||||
c = '\n';
|
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 */
|
ap->afile = -1; /* illegal value */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (c);
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void prs(const char *s)
|
static void prs(const char *s)
|
||||||
@ -4996,7 +4997,7 @@ static int remap(int fd)
|
|||||||
err("too many files open in shell");
|
err("too many files open in shell");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (fd);
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int openpipe(int *pv)
|
static int openpipe(int *pv)
|
||||||
@ -5005,7 +5006,7 @@ static int openpipe(int *pv)
|
|||||||
|
|
||||||
if ((i = pipe(pv)) < 0)
|
if ((i = pipe(pv)) < 0)
|
||||||
err("can't create pipe - try again");
|
err("can't create pipe - try again");
|
||||||
return (i);
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void closepipe(int *pv)
|
static void closepipe(int *pv)
|
||||||
@ -5172,9 +5173,9 @@ static int herein(char *hname, int xdoll)
|
|||||||
close(tf);
|
close(tf);
|
||||||
tf = open(tname, 0);
|
tf = open(tname, 0);
|
||||||
unlink(tname);
|
unlink(tname);
|
||||||
return (tf);
|
return tf;
|
||||||
} else
|
} else
|
||||||
return (hf);
|
return hf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void scraphere(void)
|
static void scraphere(void)
|
||||||
|
@ -317,10 +317,10 @@ int getopt_main(int argc, char *argv[])
|
|||||||
s=xmalloc(strlen(argv[1])+1);
|
s=xmalloc(strlen(argv[1])+1);
|
||||||
strcpy(s,argv[1]+strspn(argv[1],"-+"));
|
strcpy(s,argv[1]+strspn(argv[1],"-+"));
|
||||||
argv[1]=argv[0];
|
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) {
|
switch (opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
alternative=1;
|
alternative=1;
|
||||||
|
@ -71,7 +71,7 @@ static int remove_ids(type_id type, int argc, char **argv)
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (nb_errors);
|
return nb_errors;
|
||||||
}
|
}
|
||||||
#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */
|
#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user