}
}
- return (exit_code);
+ return exit_code;
}
/* trees.c -- output deflated data using Huffman coding
archive_handle->offset += ar_long_name_size;
/* This ar entries data section only contained filenames for other records
* they are stored in the static ar_long_names for future reference */
- return (get_header_ar(archive_handle)); /* Return next header */
+ return get_header_ar(archive_handle); /* Return next header */
} else if (ar.formatted.name[1] == ' ') {
/* This is the index of symbols in the file for compilers */
data_skip(archive_handle);
archive_handle->offset += typed->size;
- return (get_header_ar(archive_handle)); /* Return next header */
+ return get_header_ar(archive_handle); /* Return next header */
} else {
/* The number after the '/' indicates the offset in the ar data section
(saved in variable long_name) that conatains the real filename */
free(file_header->link_name);
- return (EXIT_SUCCESS);
+ return EXIT_SUCCESS;
}
x /= 2;
} while ((x - y) > 1 || (x - y) < -1);
- return (x);
+ return x;
}
static int newcand(int x, int y, int pred)
q->x = x;
q->y = y;
q->pred = pred;
- return (clen++);
+ return clen++;
}
int i, j, l, t;
if (clist[c[k]].y < y) /* quick look for typical case */
- return (k + 1);
+ return k + 1;
i = 0;
j = k + 1;
while (1) {
else if (t < y)
i = l;
else
- return (l);
+ return l;
}
- return (l + 1);
+ return l + 1;
}
}
} while ((y = b[++j]) > 0 && numtries < bound);
}
- return (k);
+ return k;
}
static void unravel(int p)
for (i = 1; (c = getc(f)) != '\n' && c != EOF; i++)
continue;
- return (i);
+ return i;
}
free(file1);
if (file2 != ofile2)
free(file2);
- return (rval);
+ return rval;
}
#if ENABLE_FEATURE_DIFF_DIR
}
} while (*++argv != last);
- return (status);
+ return status;
}
(void) fprintf(stderr,
"getaddrinfo: %s for host %s service %s\n",
gai_strerror(error), hostname, servicename);
- return (-1);
+ return -1;
}
/* Try all returned addresses until one works */
for (aip = res; aip != NULL; aip = aip->ai_next) {
if (sock == -1) {
perror("socket");
freeaddrinfo(res);
- return (-1);
+ return -1;
}
/* Connect to the host. */
iter->magic = DEV_ITERATE_MAGIC;
iter->cache = cache;
iter->p = cache->bic_devs.next;
- return (iter);
+ return iter;
}
/*
if (!cache) {
blkid_put_cache(c);
}
- return (ret);
+ return ret;
}
#ifdef TEST_PROGRAM
iter->magic = TAG_ITERATE_MAGIC;
iter->dev = dev;
iter->p = dev->bid_tags.next;
- return (iter);
+ return iter;
}
/*
retval= ext2fs_bmap(inode->i_ctx->fs, inode->i_ino,
&inode->i_ext2, NULL, 0, block, &pblk);
*phys = pblk;
- return (retval);
+ return retval;
#endif
}
*ret_new_desc_blk = new_desc_blk;
if (ret_meta_bg)
*ret_meta_bg = meta_bg;
- return (numblocks);
+ return numblocks;
}
if ((dirent->rec_len < 8) ||
(dirent->rec_len % 4)) {
ext2fs_free_mem(&buf);
- return (EXT2_ET_DIR_CORRUPTED);
+ return EXT2_ET_DIR_CORRUPTED;
}
p += dirent->rec_len;
if (do_swap) {
}
retval = 0;
errout:
- return (retval);
+ return retval;
}
retval = 0;
errout:
free(buf);
- return (retval);
+ return retval;
}
struct tm ts;
if (strcmp(str, "now") == 0) {
- return (time(0));
+ return time(0);
}
memset(&ts, 0, sizeof(ts));
#ifdef HAVE_STRPTIME
if (ts.tm_mday == 0) {
bb_error_msg_and_die("Cannot parse date/time specifier: %s", str);
}
- return (mktime(&ts));
+ return mktime(&ts);
}
static void parse_tune2fs_options(int argc, char **argv)
if (*q == '\n')
cnt++;
}
- return (cnt);
+ return cnt;
}
static Byte *find_line(int li) // find begining of line #li
for (li = 1; li < ro - 1; li++) {
screen[(li * co) + 0] = '~';
}
- return (screen);
+ return screen;
}
static Byte *new_text(int size)
text = (Byte *) xmalloc(size + 8);
memset(text, '\0', size); // clear new text[]
//text += 4; // leave some room for "oops"
- return (text);
+ return text;
}
#ifdef CONFIG_FEATURE_VI_SEARCH
i = strncasecmp((char *) s1, (char *) s2, len);
}
#endif /* CONFIG_FEATURE_VI_SETOPTS */
- return (i);
+ return i;
}
static Byte *char_search(Byte * p, Byte * pat, int dir, int range) // search for pattern starting at p
stop = next_line(p); // range is to next line
for (start = p; start < stop; start++) {
if (mycmp(start, pat, len) == 0) {
- return (start);
+ return start;
}
}
} else if (dir == BACK) {
stop = prev_line(p); // range is to prev line
for (start = p - len; start >= stop; start--) {
if (mycmp(start, pat, len) == 0) {
- return (start);
+ return start;
}
}
}
// pattern not found
- return (NULL);
+ return NULL;
#else /*REGEX_SEARCH */
char *q;
struct re_pattern_buffer preg;
*stop = p;
}
dot = save_dot;
- return (c);
+ return c;
}
static int st_test(Byte * p, int type, int dir, Byte * tested)
test = ((isalnum(c)) || c == '_');
}
*tested = c;
- return (test);
+ return test;
}
static Byte *skip_thing(Byte * p, int linecnt, int dir, int type)
dest = end = text; // keep pointers valid
file_modified++; // has the file been modified
thd0:
- return (dest);
+ return dest;
}
// copy text into register, then delete text.
c = 'D';
if (YDreg == 27)
c = 'U';
- return (c);
+ return c;
}
static void check_context(Byte cmd)
tv.tv_sec = 0;
tv.tv_usec = hund * 10000;
select(1, &rfds, NULL, NULL, &tv);
- return (FD_ISSET(0, &rfds));
+ return FD_ISSET(0, &rfds);
}
#define readbuffer bb_common_bufsiz1
readed_for_parse -= n;
memmove(readbuffer, readbuffer + n, BUFSIZ - n);
(void) alarm(3); // we are done waiting for input, turn alarm ON
- return (c);
+ return c;
}
//----- IO Routines --------------------------------------------
#else /* CONFIG_FEATURE_VI_DOT_CMD */
c = readit(); // get the users input
#endif /* CONFIG_FEATURE_VI_DOT_CMD */
- return (c); // return the char, where ever it came from
+ return c; // return the char, where ever it came from
}
static Byte *get_input_line(Byte * prompt) // get input line- use "status line"
refresh(FALSE);
free(obufp);
obufp = (Byte *) xstrdup((char *) buf);
- return (obufp);
+ return obufp;
}
static int file_size(const Byte * fn) // what is the byte size of "fn"
if (sr >= 0) {
cnt = (int) st_buf.st_size;
}
- return (cnt);
+ return cnt;
}
static int file_insert(Byte * fn, Byte * p, int size)
if (cnt >= size)
file_modified++;
fi0:
- return (cnt);
+ return cnt;
}
static int file_write(Byte * fn, Byte * first, Byte * last)
if (fn == 0) {
psbs("No current filename");
- return (-2);
+ return -2;
}
charcnt = 0;
// FIXIT- use the correct umask()
charcnt = 0;
}
close(fd);
- return (charcnt);
+ return charcnt;
}
//----- Terminal Drawing ---------------------------------------
if (mygroup==NULL)
bb_error_msg_and_die("unknown group name: %s", name);
- return (mygroup->gr_gid);
+ return mygroup->gr_gid;
}
/* returns a uid given a username */
}
cur_size += bcnt * fu->reps;
}
- return (cur_size);
+ return cur_size;
}
static void rewrite(FS * fs)
*/
if (!bb_dump_length || (ateof && !next((char **) NULL))) {
if (need == bb_dump_blocksize) {
- return ((unsigned char *) NULL);
+ return NULL;
}
if (bb_dump_vflag != ALL && !memcmp(curp, savp, nread)) {
if (bb_dump_vflag != DUP) {
- printf("*\n");
+ puts("*");
}
- return ((unsigned char *) NULL);
+ return NULL;
}
memset((char *) curp + nread, 0, need);
eaddress = address + nread;
- return (curp);
+ return curp;
}
n = fread((char *) curp + nread, sizeof(unsigned char),
bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin);
if (bb_dump_vflag == DUP || bb_dump_vflag == FIRST) {
bb_dump_vflag = WAIT;
}
- return (curp);
+ return curp;
}
if (bb_dump_vflag == WAIT) {
- printf("*\n");
+ puts("*");
}
bb_dump_vflag = DUP;
address = savaddress += bb_dump_blocksize;
next(argv);
display();
- return (exitval);
+ return exitval;
}
void bb_dump_add(const char *fmt)
if ((msg = obscure_msg(old, newval, pwdp))) {
printf("Bad password: %s.\n", msg);
/* If user is root warn only */
- return (getuid())? 1 : 0;
+ return getuid() ? 1 : 0;
}
return 0;
}
static int i64c(int i)
{
if (i <= 0)
- return ('.');
+ return '.';
if (i == 1)
- return ('/');
+ return '/';
if (i >= 2 && i < 12)
return ('0' - 2 + i);
if (i >= 12 && i < 38)
return ('A' - 12 + i);
if (i >= 38 && i < 63)
return ('a' - 38 + i);
- return ('z');
+ return 'z';
}
static char *crypt_make_salt(void)
static unsigned int scan_dev_name_common(const char *d, unsigned int n, int addendum, char *ptr)
{
- if( d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c')
- return (2 + addendum);
- else if( d[n - 2]=='c' && d[n - 1]=='d')
- return (3 + addendum);
- else if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t')
- return (4 + addendum);
- else if( ptr[n - 2]=='m' && ptr[n - 1]=='t')
- return (5 + addendum);
- else
- return 0;
+ if(d[n - 4]=='d' && d[n - 3]=='i' && d[n - 2]=='s' && d[n - 1]=='c')
+ return 2 + addendum;
+ if(d[n - 2]=='c' && d[n - 1]=='d')
+ return 3 + addendum;
+ if(ptr[0]=='p' && ptr[1]=='a' && ptr[2]=='r' && ptr[3]=='t')
+ return 4 + addendum;
+ if(ptr[n - 2]=='m' && ptr[n - 1]=='t')
+ return 5 + addendum;
+ return 0;
}
static unsigned int scan_dev_name(const char *d, unsigned int n, char *ptr)
{
- if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/')
- {
+ if(d[0]=='s' && d[1]=='c' && d[2]=='s' && d[3]=='i' && d[4]=='/') {
if( d[n - 7]=='g' && d[n - 6]=='e' && d[n - 5]=='n' &&
d[n - 4]=='e' && d[n - 3]=='r' && d[n - 2]=='i' &&
d[n - 1]=='c' )
return 1;
return scan_dev_name_common(d, n, 0, ptr);
}
- else if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' &&
+ if(d[0]=='i' && d[1]=='d' && d[2]=='e' && d[3]=='/' &&
d[4]=='h' && d[5]=='o' && d[6]=='s' && d[7]=='t')
- {
return scan_dev_name_common(d, n, 4, ptr);
- }
- else if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/')
- {
+ if(d[0]=='s' && d[1]=='b' && d[2]=='p' && d[3]=='/')
return 10;
- }
- else if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/')
- {
+ if(d[0]=='v' && d[1]=='c' && d[2]=='c' && d[3]=='/')
return 11;
- }
- else if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/')
- {
+ if(d[0]=='p' && d[1]=='t' && d[2]=='y' && d[3]=='/')
return 12;
- }
return 0;
}
caught_signal = FALSE;
caught_sighup = FALSE;
- return (c_sighup);
+ return c_sighup;
}
msg_logger_and_die(LOG_ERR, "read error on control file");
} /* End Function do_servicing */
{
if (( source_len = readlink (sourcepath, source_link, STRING_LENGTH - 1) ) < 0 ||
( dest_len = readlink (destpath , dest_link , STRING_LENGTH - 1) ) < 0 )
- return (FALSE);
+ return FALSE;
source_link[source_len] = '\0';
dest_link[dest_len] = '\0';
if ( (source_len != dest_len) || (strcmp (source_link, dest_link) != 0) )
unlink (destpath);
symlink (source_link, destpath);
}
- return (TRUE);
+ return TRUE;
} /* Else not a symlink */
chmod (destpath, new_mode & ~S_IFMT);
chown (destpath, source_stat->st_uid, source_stat->st_gid);
- return (TRUE);
+ return TRUE;
}
/* Different types: unlink and create */
unlink (destpath);
break;
symlink_val[val] = '\0';
if (symlink (symlink_val, destpath) == 0)
- return (TRUE);
+ return TRUE;
break;
case S_IFREG:
if ( ( fd = open (destpath, O_RDONLY | O_CREAT, new_mode & ~S_IFMT) ) < 0 )
break;
do_chown:
if (chown (destpath, source_stat->st_uid, source_stat->st_gid) == 0)
- return (TRUE);
+ return TRUE;
/*break;*/
}
- return (FALSE);
+ return FALSE;
} /* End Function copy_inode */
static void free_config (void)
msg_logger_and_die(LOG_ERR,"%s: flag != UID && flag != GID", __FUNCTION__);
if ( isdigit (string[0]) || ( (string[0] == '-') && isdigit (string[1]) ) )
- return atoi (string);
+ return atoi(string);
if ( flag == UID && ( pw_ent = getpwnam (string) ) != NULL )
- return (pw_ent->pw_uid);
+ return pw_ent->pw_uid;
if ( flag == GID && ( grp_ent = getgrnam (string) ) != NULL )
- return (grp_ent->gr_gid);
+ return grp_ent->gr_gid;
else if(ENABLE_DEVFSD_VERBOSE)
msg="group";
debug_msg_logger(LOG_INFO, __FUNCTION__);
if ( isdigit (string[0]) )
- return strtoul (string, NULL, 8);
+ return strtoul(string, NULL, 8);
if (strlen (string) != 9)
msg_logger_and_die(LOG_ERR, "bad mode: %s", string);
i=i/2;
string++;
}
- return (mode);
+ return mode;
} /* End Function get_mode */
static void signal_handler (int sig)
i=index_in_str_array(field_names, variable);
if ( i > 6 || i < 0 || (i > 1 && gv_info == NULL))
- return (NULL);
+ return NULL;
if( i >= 0 && i <= 3)
{
debug_msg_logger(LOG_INFO, "%s: i=%d %s", __FUNCTION__, i ,field_names[i+7]);
debug_msg_logger(LOG_INFO, "%s: %s", __FUNCTION__, sbuf);
- return (sbuf);
+ return sbuf;
} /* End Function get_variable */
static void service(struct stat statbuf, char *path)
if (bb_make_directory( dirname((char *)path), -1, FILEUTILS_RECUR )==-1)
{
debug_msg_logger(LOG_ERR, "%s: %s: %m",__FUNCTION__, path);
- return (FALSE);
+ return FALSE;
}
return TRUE;
} /* End Function make_dir_tree */
debug_msg_logger(LOG_INFO, __FUNCTION__);
if ( !st_expr_expand (temp, STRING_LENGTH, input, get_variable_func, info) )
- return (FALSE);
+ return FALSE;
expand_regexp (output, outsize, temp, devname, ex, numexp);
- return (TRUE);
+ return TRUE;
} /* End Function expand_expression */
static void expand_regexp (char *output, size_t outsize, const char *input,
if (strncmp (devname, trans->match, len) == 0)
{
if (trans->format == NULL)
- return (devname + len);
+ return devname + len;
sprintf (buffer, trans->format, devname + len);
- return (buffer);
+ return buffer;
}
}
if(ENABLE_DEBUG && compat_name!=NULL)
msg_logger(LOG_INFO, "%s: compat_name %s", __FUNCTION__, compat_name);
- return (compat_name);
+ return compat_name;
} /* End Function get_old_name */
static char get_old_ide_name (unsigned int major, unsigned int minor)
if (minor > 63)
++letter;
- return (letter);
+ return letter;
} /* End Function get_old_ide_name */
static char *write_old_sd_name (char *buffer,
if (major == 8)
{
sprintf (buffer, "sd%c%s", 'a' + (minor >> 4), part);
- return (buffer);
+ return buffer;
}
if ( (major > 64) && (major < 72) )
{
sprintf (buffer, "sd%c%s", 'a' + disc_index, part);
else
sprintf (buffer, "sd%c%c%s", 'a' + (disc_index / 26) - 1, 'a' + disc_index % 26,part);
- return (buffer);
+ return buffer;
}
- return (NULL);
+ return NULL;
} /* End Function write_old_sd_name */
/* Variable expansion */
input = expand_variable (buffer, length, &out_pos, ++input, get_variable_func, info);
if (input == NULL)
- return (FALSE);
+ return FALSE;
break;
case '~':
/* Home directory expansion */
if ( ( env = getenv ("HOME") ) == NULL )
{
msg_logger(LOG_INFO, bb_msg_variable_not_found, "HOME");
- return (FALSE);
+ return FALSE;
}
len = strlen (env);
if (len + out_pos >= length)
if ( ( pwent = getpwnam (tmp) ) == NULL )
{
msg_logger(LOG_INFO, "no pwent for: %s", tmp);
- return (FALSE);
+ return FALSE;
}
len = strlen (pwent->pw_dir);
if (len + out_pos >= length)
if (ch == '\0')
{
memcpy (output, buffer, out_pos);
- return (TRUE);
+ return TRUE;
}
break;
/* esac */
}
}
- return (FALSE);
+ return FALSE;
st_expr_expand_out:
msg_logger(LOG_INFO, bb_msg_small_buffer);
- return (FALSE);
+ return FALSE;
} /* End Function st_expr_expand */
memcpy (buffer + *out_pos, tmp, len + 1);
out_pos += len;
- return (input);
+ return input;
}
/* Ordinary variable expansion, possibly in braces */
if (ch != '{')
if ( ( env = get_variable_v2 (tmp, func, info) ) == NULL )
{
msg_logger(LOG_INFO, bb_msg_variable_not_found, tmp);
- return (NULL);
+ return NULL;
}
len = strlen (env);
if (len + *out_pos >= length)
memcpy (buffer + *out_pos, env, len + 1);
*out_pos += len;
- return (input);
+ return input;
}
/* Variable in braces: check for ':' tricks */
ch = *++input;
safe_memcpy (tmp, input, len);
ptr = expand_variable (buffer, length, out_pos, tmp, func, info );
if (ptr == NULL)
- return (NULL);
- return (input + len);
+ return NULL;
+ return input + len;
}
if (ch != ':' || ptr[1] != '-' )
{
msg_logger(LOG_INFO, "illegal char in var name");
- return (NULL);
+ return NULL;
}
/* It's that handy "${var:-word}" expression. Check if var is defined */
len = ptr - input;
break;
case '\0':
msg_logger(LOG_INFO,"\"}\" not found in: %s", input);
- return (NULL);
+ return NULL;
default:
break;
}
memcpy (buffer + *out_pos, env, len + 1);
*out_pos += len;
- return (input);
+ return input;
}
/* Environment variable was not found, so process word. Advance input
pointer to start of word in "${var:-word}" */
safe_memcpy (tmp, input, len);
input = ptr;
if ( !st_expr_expand (tmp, STRING_LENGTH, tmp, func, info ) )
- return (NULL);
+ return NULL;
len = strlen (tmp);
if (len + *out_pos >= length)
goto expand_variable_out;
memcpy (buffer + *out_pos, tmp, len + 1);
*out_pos += len;
- return (input);
+ return input;
expand_variable_out:
msg_logger(LOG_INFO, bb_msg_small_buffer);
- return (NULL);
+ return NULL;
} /* End Function expand_variable */
{
value = (*func) (variable, info);
if (value != NULL)
- return (value);
+ return value;
}
- return getenv (variable);
+ return getenv(variable);
} /* End Function get_variable */
/* END OF CODE */
char *fullname = (char *) userdata;
if (fullname[0] == '\0')
- return (FALSE);
+ return FALSE;
else {
char *tmp, *tmp1 = xstrdup(filename);
tmp = bb_get_last_path_component(tmp1);
free(tmp1);
/* Stop searching if we find a match */
m_filename = xstrdup(filename);
- return (FALSE);
+ return FALSE;
}
free(tmp1);
}
- return (TRUE);
+ return TRUE;
}
*ptr++ = val;
} while (++i < ETH_ALEN);
- return (int) (*bufp); /* Error if we don't end at end of string. */
+ return *bufp; /* Error if we don't end at end of string. */
}
#endif
sum = (sum >> 16) + (sum & 0xFFFF);
sum += (sum >> 16);
ans = ~sum;
- return (ans);
+ return ans;
}
#ifndef CONFIG_FEATURE_FANCY_PING
struct alias *ap = *__lookupalias(name);
if (check && ap && (ap->flag & ALIASINUSE))
- return (NULL);
- return (ap);
+ return NULL;
+ return ap;
}
/*
}
}
- return (ret);
+ return ret;
}
static int
}
}
- return (i);
+ return i;
}
static struct alias *
startloc = expdest - (char *)stackblock();
strtodest(home, SQSYNTAX, quotes);
recordregion(startloc, expdest - (char *)stackblock(), 0);
- return (p);
+ return p;
lose:
*p = c;
- return (startp);
+ return startp;
}
else
TRACE(("reread token %s %s\n", tokname(t), t == TWORD ? wordtext : ""));
#endif
- return (t);
+ return t;
}
}
INTON;
- return (result);
+ return result;
}
i = dash_arith(*ap);
}
- return (!i);
+ return !i;
}
#endif /* CONFIG_ASH_MATH_SUPPORT */
char *name = child->argv[1];
if (name == NULL) {
- return (builtin_env(child));
+ return builtin_env(child);
}
name = strdup(name);
status = parse_file_outer(input);
mark_closed(fileno(input));
fclose(input);
- return (status);
+ return status;
}
static int builtin_umask(struct child_prog *child)
struct op *dotnode;
if (head == NULL)
- return (NULL);
+ return NULL;
if (head->left != NULL) {
dotnode = scantree(head->left);
if (dotnode)
- return (dotnode);
+ return dotnode;
}
if (head->right != NULL) {
dotnode = scantree(head->right);
if (dotnode)
- return (dotnode);
+ return dotnode;
}
if (head->words == NULL)
- return (NULL);
+ return NULL;
DBGPRINTF5(("SCANTREE: checking node %p\n", head));
if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) {
DBGPRINTF5(("SCANTREE: dot found in node %p\n", head));
- return (head);
+ return head;
}
- return (NULL);
+ return NULL;
}
static char *putn(int n)
{
- return (itoa(n));
+ return itoa(n);
}
static void next(int f)
if ((cp = getcell(n)) == 0)
err("out of string space");
- return (cp);
+ return cp;
}
static char *strsave(char *s, int a)
if ((cp = space(strlen(s) + 1)) != NULL) {
setarea((char *) cp, a);
for (xp = cp; (*xp++ = *s++) != '\0';);
- return (cp);
+ return cp;
}
- return ("");
+ return "";
}
/*
c = c * 10 + *n - '0';
dummy.status = RONLY;
dummy.value = c <= dolc ? dolv[c] : null;
- return (&dummy);
+ return &dummy;
}
for (vp = vlist; vp; vp = vp->next)
if (eqname(vp->name, n))
- return (vp);
+ return vp;
cp = findeq(n);
vp = (struct var *) space(sizeof(*vp));
if (vp == 0 || (vp->name = space((int) (cp - n) + 2)) == 0) {
dummy.name = dummy.value = "";
- return (&dummy);
+ return &dummy;
}
for (cp = vp->name; (*cp = *n++) && *cp != '='; cp++);
if (*cp == 0)
vp->next = vlist;
vp->status = GETCELL;
vlist = vp;
- return (vp);
+ return vp;
}
/*
for (; *n1 != '=' && *n1 != 0; n1++)
if (*n2++ != *n1)
return 0;
- return (*n2 == 0 || *n2 == '=');
+ return *n2 == 0 || *n2 == '=';
}
static char *findeq(char *cp)
{
while (*cp != '\0' && *cp != '=')
cp++;
- return (cp);
+ return cp;
}
/* -------- gmatch.c -------- */
return 0;
}
}
- return (*s == 0);
+ return *s == 0;
}
static char *cclass(char *p, int sub)
found = not;
do {
if (*p == '\0')
- return ((char *) NULL);
+ return NULL;
c = *p & CMASK;
if (p[1] == '-' && p[2] != ']') {
d = p[2] & CMASK;
if (c == sub || (c <= sub && sub <= d))
found = !not;
} while (*++p != ']');
- return (found ? p + 1 : (char *) NULL);
+ return found ? p + 1 : NULL;
}
i = nregio >= GROWBY ? nregio : GROWBY;
p = (struct region *) sbrk(i * REGSIZE);
if (p == (struct region *) -1)
- return ((char *) NULL);
+ return NULL;
p--;
if (p != areatop) {
puts("not contig");
q->next = areabot;
q->area = BUSY;
areatop = q;
- found:
+ found:
/*
* we found a FREE area big enough, pointed to by 'p', and up to 'q'
*/
p->next = areanxt;
}
p->area = areanum;
- return ((char *) (p + 1));
+ return (char *) (p + 1);
}
static void freecell(char *cp)
}
DBGPRINTF7(("PIPELINE: returning t=%p\n", t));
- return (t);
+ return t;
}
static struct op *andor(void)
}
DBGPRINTF7(("ANDOR: returning t=%p\n", t));
- return (t);
+ return t;
}
static struct op *c_list(void)
|| (multiline && c == '\n')) {
if ((p = andor()) == NULL)
- return (t);
+ return t;
if ((peeksym = yylex(0)) == '&')
p = block(TASYNC, p, NOBLOCK, NOWORDS);
}
/* IF */
DBGPRINTF7(("C_LIST: returning t=%p\n", t));
- return (t);
+ return t;
}
static int synio(int cf)
break;
default:
- return (t);
+ return t;
}
}
}
t = c_list();
musthave(mark, 0);
multiline--;
- return (block(type, t, NOBLOCK, NOWORDS));
+ return block(type, t, NOBLOCK, NOWORDS);
}
static struct op *command(int cf)
peeksym = c;
if ((t = simple()) == NULL) {
if (iolist == NULL)
- return ((struct op *) NULL);
+ return NULL;
t = newtp();
t->type = TCOM;
}
DBGPRINTF(("COMMAND: returning %p\n", t));
- return (t);
+ return t;
}
static struct op *dowholefile(int type, int mark)
multiline--;
t = block(type, t, NOBLOCK, NOWORDS);
DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t));
- return (t);
+ return t;
}
static struct op *dogroup(int onlydone)
c = yylex(CONTIN);
if (c == DONE && onlydone)
- return ((struct op *) NULL);
+ return NULL;
if (c != DO)
SYNTAXERR;
mylist = c_list();
musthave(DONE, 0);
- return (mylist);
+ return mylist;
}
static struct op *thenpart(void)
if ((c = yylex(0)) != THEN) {
peeksym = c;
- return ((struct op *) NULL);
+ return NULL;
}
t = newtp();
t->type = 0;
if (t->left == NULL)
SYNTAXERR;
t->right = elsepart();
- return (t);
+ return t;
}
static struct op *elsepart(void)
case ELSE:
if ((t = c_list()) == NULL)
SYNTAXERR;
- return (t);
+ return t;
case ELIF:
t = newtp();
t->type = TELIF;
t->left = c_list();
t->right = thenpart();
- return (t);
+ return t;
default:
peeksym = c;
- return ((struct op *) NULL);
+ return NULL;
}
}
}
DBGPRINTF(("CASELIST, returning t=%p\n", t));
- return (t);
+ return t;
}
static struct op *casepart(void)
DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t));
- return (t);
+ return t;
}
static char **pattern(void)
peeksym = c;
word(NOWORD);
- return (copyw());
+ return copyw();
}
static char **wordlist(void)
if ((c = yylex(0)) != IN) {
peeksym = c;
- return ((char **) NULL);
+ return NULL;
}
startl = 0;
while ((c = yylex(0)) == WORD)
word(yylval.cp);
word(NOWORD);
peeksym = c;
- return (copyw());
+ return copyw();
}
/*
DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2));
if (t1 == NULL)
- return (t2);
+ return t2;
if (t2 == NULL)
- return (t1);
+ return t1;
- return (block(TLIST, t1, t2, NOWORDS));
+ return block(TLIST, t1, t2, NOWORDS);
}
static struct op *block(int type, struct op *t1, struct op *t2, char **wp)
DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1,
t2));
- return (t);
+ return t;
}
/* See if given string is a shell multiline (FOR, IF, etc) */
for (rp = restab; rp->r_name; rp++)
if (strcmp(rp->r_name, n) == 0) {
DBGPRINTF7(("RLOOKUP: match, returning %d\n", rp->r_val));
- return (rp->r_val); /* Return numeric code for shell multiline */
+ return rp->r_val; /* Return numeric code for shell multiline */
}
DBGPRINTF7(("RLOOKUP: NO match, returning 0\n"));
DBGPRINTF3(("NEWTP: allocated %p\n", t));
- return (t);
+ return t;
}
static struct op *namelist(struct op *t)
t->ioact = t->left->ioact;
t->left->ioact = NULL;
}
- return (t);
+ return t;
}
word(NOWORD);
t->words = copyw();
- return (t);
+ return t;
}
static char **copyw(void)
wd = getwords(wdlist);
wdlist = 0;
- return (wd);
+ return wd;
}
static void word(char *cp)
iop = (struct ioword **) getwords(iolist);
iolist = 0;
- return (iop);
+ return iop;
}
static struct ioword *io(int u, int f, char *cp)
iop->io_flag = f;
iop->io_name = cp;
iolist = addword((char *) iop, iolist);
- return (iop);
+ return iop;
}
static void zzerr(void)
peeksym = 0;
if (c == '\n')
startl = 1;
- return (c);
+ return c;
}
case 0:
DBGPRINTF5(("YYLEX: return 0, c=%d\n", c));
- return (c);
+ return c;
case '$':
DBGPRINTF9(("YYLEX: found $\n"));
*e.linep++ = c;
if ((c = my_getc(0)) == '{') {
if ((c = collect(c, '}')) != '\0')
- return (c);
+ return c;
goto pack;
}
break;
case '\'':
case '"':
if ((c = collect(c, c)) != '\0')
- return (c);
+ return c;
goto pack;
case '|':
startl = 1;
/* If more chars process them, else return NULL char */
if ((c1 = dual(c)) != '\0')
- return (c1);
+ return c1;
else
- return (c);
+ return c;
case '^':
startl = 1;
- return ('|');
+ return '|';
case '>':
case '<':
diag(c);
- return (c);
+ return c;
case '\n':
nlseen++;
if (cf & CONTIN)
goto loop;
}
- return (c);
+ return c;
case '(':
case ')':
startl = 1;
- return (c);
+ return c;
}
unget(c);
if (atstart && (c = rlookup(line)) != 0) {
startl = 1;
- return (c);
+ return c;
}
yylval.cp = strsave(line, areanum);
- return (WORD);
+ return WORD;
}
s[1] = 0;
prs("no closing ");
yyerror(s);
- return (YYERRCODE);
+ return YYERRCODE;
}
if (interactive && c == '\n' && e.iop <= iostack) {
#ifdef CONFIG_FEATURE_COMMAND_EDITING
if (c == 0)
unget(*--cp); /* String is not a shell multiline, put peek char back */
- return (c); /* String is multiline, return numeric multiline (restab) code */
+ return c; /* String is multiline, return numeric multiline (restab) code */
}
static void diag(int ec)
fail();
/* NOTREACHED */
}
- return (t);
+ return t;
}
/* VARARGS1 */
}
DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv));
- return (rv);
+ return rv;
}
static int
if (cp == NULL && t->ioact == NULL) {
while ((cp = *owp++) != NULL && assign(cp, COPYV));
DBGPRINTF(("FORKEXEC: returning setstatus()\n"));
- return (setstatus(0));
+ return setstatus(0);
} else if (cp != NULL) {
shcom = inbuilt(cp);
}
if (iosetup(*iopp++, pin != NULL, pout != NULL)) {
if (forked)
_exit(rv);
- return (rv);
+ return rv;
}
}
if (forked)
_exit(i);
DBGPRINTF(("FORKEXEC: returning i=%d\n", i));
- return (i);
+ return i;
}
/* should use FIOCEXCL */
if (t == NULL) {
DBGPRINTF3(("FIND1CASE: enter, t==NULL, returning.\n"));
- return ((struct op **) NULL);
+ return NULL;
}
DBGPRINTF3(("FIND1CASE: enter, t->type=%d (%s)\n", t->type,
if (t->type == TLIST) {
if ((tp = find1case(t->left, w)) != NULL) {
DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp));
- return (tp);
+ return tp;
}
t1 = t->right; /* TPAT */
} else
if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) {
DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n",
&t1->left));
- return (&t1->left);
+ return &t1->left;
}
DBGPRINTF(("FIND1CASE: returning NULL\n"));
- return ((struct op **) NULL);
+ return NULL;
}
static struct op *findcase(struct op *t, char *w)
{
struct op **tp;
- return ((tp = find1case(t, w)) != NULL ? *tp : (struct op *) NULL);
+ tp = find1case(t, w);
+ return tp != NULL ? *tp : NULL;
}
/*
onintr(0);
}
}
- return (rv);
+ return rv;
}
static int setstatus(int s)
{
exstat = s;
setval(lookup("?"), putn(s));
- return (s);
+ return s;
}
/*
*v = e.linep;
execve(DEFAULT_SHELL, v, envp);
*v = tp;
- return ("no Shell");
+ return "no Shell";
case ENOMEM:
- return ((char *) bb_msg_memory_exhausted);
+ return (char *) bb_msg_memory_exhausted;
case E2BIG:
- return ("argument list too long");
+ return "argument list too long";
case EACCES:
eacces++;
break;
}
}
- return (errno == ENOENT ? "not found" : "cannot execute");
+ return errno == ENOENT ? "not found" : "cannot execute";
}
/*
outtree = otree;
freearea(areanum--);
- return (rv);
+ return rv;
}
/* -------- do.c -------- */
DBGPRINTF(("DODOT: returning exstat=%d\n", exstat));
- return (exstat);
+ return exstat;
}
} /* While */
break;
setval(lookup(*wp), e.linep);
}
- return (nb <= 0);
+ return nb <= 0;
}
static int doeval(struct op *t)
{
- return (RUN(awordlist, t->words + 1, wdchar));
+ return RUN(awordlist, t->words + 1, wdchar);
}
static int dotrap(struct op *t)
err("trap: bad signal number");
n = 0;
}
- return (n);
+ return n;
}
static void setsig(int n, sighandler_t f)
prs(as);
err(": bad number");
}
- return (n * m);
+ return n * m;
}
static int dobreak(struct op *t)
{
- return (brkcontin(t->words[1], 1));
+ return brkcontin(t->words[1], 1);
}
static int docontinue(struct op *t)
{
- return (brkcontin(t->words[1], 0));
+ return brkcontin(t->words[1], 0);
}
static int brkcontin(char *cp, int val)
for (bp = builtincmds; bp->name != NULL; bp++)
if (strcmp(bp->name, s) == 0)
- return (bp->builtinfunc);
+ return bp->builtinfunc;
- return (NULL);
+ return NULL;
}
/* -------- eval.c -------- */
} else
gflg = 1;
- return (gflg ? (char **) NULL : wp);
+ return gflg ? (char **) NULL : wp;
}
/*
if (all || vp->status & EXPORT)
wb = addword(vp->name, wb);
wb = addword((char *) 0, wb);
- return (getwords(wb));
+ return getwords(wb);
}
static char *evalstr(char *cp, int f)
DELETE(wb);
} else
cp = NULL;
- return (cp);
+ return cp;
}
static int expand(char *cp, struct wdblock **wbp, int f)
quitenv();
} else
gflg = 1;
- return (gflg == 0);
+ return gflg == 0;
}
/*
if (sp == e.linep)
return 0;
*e.linep++ = 0;
- return (sp);
+ return sp;
default:
if (f & DOBLANK && any(c, ifs->value))
*e.linep++ = c;
}
*e.linep++ = 0;
- return (sp);
+ return sp;
}
/*
goto again;
}
}
- return (c);
+ return c;
}
/*
if (c != '}') {
err("unclosed ${");
gflg++;
- return (c);
+ return c;
}
}
if (e.linep >= elinep) {
if ((s = as) != NULL)
while (*s)
*s++ &= ~QUOTE;
- return (as);
+ return as;
}
/* -------- glob.c -------- */
char *pp;
if (cp == 0)
- return (wb);
+ return wb;
i = 0;
for (pp = cp; *pp; pp++)
if (any(*pp, spcl))
for (i = 0; i < cl->w_nword; i++)
wb = addword(cl->w_words[i], wb);
DELETE(cl);
- return (wb);
+ return wb;
}
}
wb = addword(unquote(cp), wb);
- return (wb);
+ return wb;
}
static void globname(char *we, char *pp)
for (xp = middle; (*op++ = *xp++) != '\0';);
op--;
for (xp = end; (*op++ = *xp++) != '\0';);
- return (p);
+ return p;
}
static int anyspcl(struct wdblock *wb)
static int xstrcmp(char *p1, char *p2)
{
- return (strcmp(*(char **) p1, *(char **) p2));
+ return strcmp(*(char **) p1, *(char **) p2);
}
/* -------- word.c -------- */
wb = (struct wdblock *) space(sizeof(*wb) + nw * sizeof(char *));
wb->w_bsize = nw;
wb->w_nword = 0;
- return (wb);
+ return wb;
}
static struct wdblock *addword(char *wd, struct wdblock *wb)
wb = wb2;
}
wb->w_words[wb->w_nword++] = wd;
- return (wb);
+ return wb;
}
static
int nb;
if (wb == NULL)
- return ((char **) NULL);
+ return NULL;
if (wb->w_nword == 0) {
DELETE(wb);
- return ((char **) NULL);
+ return NULL;
}
wd = (char **) space(nb = sizeof(*wd) * wb->w_nword);
memcpy((char *) wd, (char *) wb->w_words, nb);
DELETE(wb); /* perhaps should done by caller */
- return (wd);
+ return wd;
}
static int (*func) (char *, char *);
while ((c = readc()) != '\n' && c);
err("input line too long");
gflg++;
- return (c);
+ return c;
}
c = readc();
if ((ec != '\'') && (ec != '`') && (e.iop->task != XGRAVE)) {
if (c == '\\') {
c = readc();
if (c == '\n' && ec != '\"')
- return (my_getc(ec));
+ return my_getc(ec);
c |= QUOTE;
}
}
- return (c);
+ return c;
}
static void unget(int c)
RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc));
if ((c = e.iop->peekc) != '\0') {
e.iop->peekc = 0;
- return (c);
+ return c;
} else {
if (e.iop->prev != 0) {
if ((c = (*e.iop->iofn) (e.iop->argp, e.iop)) != '\0') {
xp = e.iobase;
e.iobase = ip;
- return (xp);
+ return xp;
}
/*
return 0;
if ((c = *ap->aword++) == 0) {
ap->aword = NULL;
- return ('\n');
+ return '\n';
}
- return (c);
+ return c;
}
/*
return 0;
if (*wl != NULL) {
if ((c = *(*wl)++) != 0)
- return (c & 0177);
+ return c & 0177;
ap->awordlist++;
- return (' ');
+ return ' ';
}
ap->awordlist = NULL;
- return ('\n');
+ return '\n';
}
/*
return 0;
if ((c = *ap->aword++) == '\0') {
ap->aword = NULL;
- return (' ');
+ return ' ';
}
- return (c);
+ return c;
}
/*
if (ap->aword == NULL || (c = *ap->aword++) == 0)
return 0;
- return (c);
+ return c;
}
/*
if (ap->aword == NULL || (c = *ap->aword++) == 0)
return 0;
- return (c | QUOTE);
+ return c | QUOTE;
}
/*
}
c = mycommand[position];
position++;
- return (c);
+ return c;
} else
#endif
{
i = safe_read(ap->afile, &c, sizeof(c));
- return (i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0));
+ return i == sizeof(c) ? (c & 0x7f) : (closef(ap->afile), 0);
}
}
close(ap->afile);
c = 0;
}
- return (c);
+ return c;
}
if ((c = qgravechar(ap, iop) & ~QUOTE) == '\n')
c = ' ';
- return (c);
+ return c;
}
static int qgravechar(struct ioarg *ap, struct io *iop)
if (iop->xchar) {
if (iop->nlcount) {
iop->nlcount--;
- return ('\n' | QUOTE);
+ return '\n' | QUOTE;
}
c = iop->xchar;
iop->xchar = 0;
iop->nlcount++;
iop->xchar = c;
if (c == 0)
- return (c);
+ return c;
iop->nlcount--;
c = '\n';
}
- return (c != 0 ? c | QUOTE : 0);
+ return c != 0 ? c | QUOTE : 0;
}
/*
ap->afile = -1; /* illegal value */
}
}
- return (c);
+ return c;
}
static void prs(const char *s)
err("too many files open in shell");
}
- return (fd);
+ return fd;
}
static int openpipe(int *pv)
if ((i = pipe(pv)) < 0)
err("can't create pipe - try again");
- return (i);
+ return i;
}
static void closepipe(int *pv)
close(tf);
tf = open(tname, 0);
unlink(tname);
- return (tf);
+ return tf;
} else
- return (hf);
+ return hf;
}
static void scraphere(void)
s=xmalloc(strlen(argv[1])+1);
strcpy(s,argv[1]+strspn(argv[1],"-+"));
argv[1]=argv[0];
- return (generate_output(argv+1,argc-1,s,long_options));
+ return generate_output(argv+1,argc-1,s,long_options);
}
- while ((opt=getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF)
+ while ((opt = getopt_long(argc,argv,shortopts,longopts,NULL)) != EOF)
switch (opt) {
case 'a':
alternative=1;
argv++;
}
- return (nb_errors);
+ return nb_errors;
}
#endif /* #ifndef CONFIG_IPCRM_DROP_LEGACY */