aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:00:54 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-17 09:00:54 +0000
commit68404f13d4bf4826e3609703dad5375763db28ab (patch)
treeb89ed41daeb3a761ac9416a6eed090023b23e7e2 /shell/ash.c
parenta55bd05f3cea6c7cbfb45d15009cb70570c2a43b (diff)
downloadbusybox-w32-68404f13d4bf4826e3609703dad5375763db28ab.tar.gz
busybox-w32-68404f13d4bf4826e3609703dad5375763db28ab.tar.bz2
busybox-w32-68404f13d4bf4826e3609703dad5375763db28ab.zip
*: add -Wunused-parameter; fix resulting breakage
function old new delta procps_scan 1265 1298 +33 aliascmd 278 283 +5 parse_file_cmd 116 120 +4 dname_enc 373 377 +4 setcmd 90 93 +3 execcmd 57 60 +3 count_lines 72 74 +2 process_command_subs 340 339 -1 test_main 409 407 -2 mknod_main 179 177 -2 handle_incoming_and_exit 2653 2651 -2 argstr 1312 1310 -2 shiftcmd 131 128 -3 exitcmd 46 43 -3 dotcmd 297 294 -3 breakcmd 86 83 -3 evalpipe 353 349 -4 evalcommand 1180 1176 -4 evalcmd 109 105 -4 send_tree 374 369 -5 mkfifo_main 82 77 -5 evalsubshell 152 147 -5 typecmd 75 69 -6 letcmd 61 55 -6 add_cmd 1190 1183 -7 main 891 883 -8 ash_main 1415 1407 -8 parse_stream 1377 1367 -10 alloc_procps_scan 55 - -55 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148) Total: -94 bytes text data bss dec hex filename 797195 658 7428 805281 c49a1 busybox_old 797101 658 7428 805187 c4943 busybox_unstripped
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c153
1 files changed, 76 insertions, 77 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 069909118..580918ceb 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2472,7 +2472,7 @@ docd(const char *dest, int flags)
2472} 2472}
2473 2473
2474static int 2474static int
2475cdcmd(int argc, char **argv) 2475cdcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
2476{ 2476{
2477 const char *dest; 2477 const char *dest;
2478 const char *path; 2478 const char *path;
@@ -2536,7 +2536,7 @@ cdcmd(int argc, char **argv)
2536} 2536}
2537 2537
2538static int 2538static int
2539pwdcmd(int argc, char **argv) 2539pwdcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
2540{ 2540{
2541 int flags; 2541 int flags;
2542 const char *dir = curdir; 2542 const char *dir = curdir;
@@ -3138,19 +3138,20 @@ printalias(const struct alias *ap)
3138 * TODO - sort output 3138 * TODO - sort output
3139 */ 3139 */
3140static int 3140static int
3141aliascmd(int argc, char **argv) 3141aliascmd(int argc ATTRIBUTE_UNUSED, char **argv)
3142{ 3142{
3143 char *n, *v; 3143 char *n, *v;
3144 int ret = 0; 3144 int ret = 0;
3145 struct alias *ap; 3145 struct alias *ap;
3146 3146
3147 if (argc == 1) { 3147 if (!argv[1]) {
3148 int i; 3148 int i;
3149 3149
3150 for (i = 0; i < ATABSIZE; i++) 3150 for (i = 0; i < ATABSIZE; i++) {
3151 for (ap = atab[i]; ap; ap = ap->next) { 3151 for (ap = atab[i]; ap; ap = ap->next) {
3152 printalias(ap); 3152 printalias(ap);
3153 } 3153 }
3154 }
3154 return 0; 3155 return 0;
3155 } 3156 }
3156 while ((n = *++argv) != NULL) { 3157 while ((n = *++argv) != NULL) {
@@ -3172,7 +3173,7 @@ aliascmd(int argc, char **argv)
3172} 3173}
3173 3174
3174static int 3175static int
3175unaliascmd(int argc, char **argv) 3176unaliascmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
3176{ 3177{
3177 int i; 3178 int i;
3178 3179
@@ -3245,7 +3246,7 @@ struct job {
3245static pid_t backgndpid; /* pid of last background process */ 3246static pid_t backgndpid; /* pid of last background process */
3246static smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */ 3247static smallint job_warning; /* user was warned about stopped jobs (can be 2, 1 or 0). */
3247 3248
3248static struct job *makejob(union node *, int); 3249static struct job *makejob(/*union node *,*/ int);
3249static int forkshell(struct job *, union node *, int); 3250static int forkshell(struct job *, union node *, int);
3250static int waitforjob(struct job *); 3251static int waitforjob(struct job *);
3251 3252
@@ -3612,8 +3613,8 @@ setjobctl(int on)
3612static int 3613static int
3613killcmd(int argc, char **argv) 3614killcmd(int argc, char **argv)
3614{ 3615{
3616 int i = 1;
3615 if (argv[1] && strcmp(argv[1], "-l") != 0) { 3617 if (argv[1] && strcmp(argv[1], "-l") != 0) {
3616 int i = 1;
3617 do { 3618 do {
3618 if (argv[i][0] == '%') { 3619 if (argv[i][0] == '%') {
3619 struct job *jp = getjob(argv[i], 0); 3620 struct job *jp = getjob(argv[i], 0);
@@ -3675,7 +3676,7 @@ restartjob(struct job *jp, int mode)
3675} 3676}
3676 3677
3677static int 3678static int
3678fg_bgcmd(int argc, char **argv) 3679fg_bgcmd(int argc ATTRIBUTE_UNUSED, char **argv)
3679{ 3680{
3680 struct job *jp; 3681 struct job *jp;
3681 FILE *out; 3682 FILE *out;
@@ -3962,7 +3963,7 @@ showjobs(FILE *out, int mode)
3962} 3963}
3963 3964
3964static int 3965static int
3965jobscmd(int argc, char **argv) 3966jobscmd(int argc ATTRIBUTE_UNUSED, char **argv)
3966{ 3967{
3967 int mode, m; 3968 int mode, m;
3968 3969
@@ -4015,7 +4016,7 @@ getstatus(struct job *job)
4015} 4016}
4016 4017
4017static int 4018static int
4018waitcmd(int argc, char **argv) 4019waitcmd(int argc ATTRIBUTE_UNUSED, char **argv)
4019{ 4020{
4020 struct job *job; 4021 struct job *job;
4021 int retval; 4022 int retval;
@@ -4121,7 +4122,7 @@ growjobtab(void)
4121 * Called with interrupts off. 4122 * Called with interrupts off.
4122 */ 4123 */
4123static struct job * 4124static struct job *
4124makejob(union node *node, int nprocs) 4125makejob(/*union node *node,*/ int nprocs)
4125{ 4126{
4126 int i; 4127 int i;
4127 struct job *jp; 4128 struct job *jp;
@@ -4156,7 +4157,7 @@ makejob(union node *node, int nprocs)
4156 if (nprocs > 1) { 4157 if (nprocs > 1) {
4157 jp->ps = ckmalloc(nprocs * sizeof(struct procstat)); 4158 jp->ps = ckmalloc(nprocs * sizeof(struct procstat));
4158 } 4159 }
4159 TRACE(("makejob(0x%lx, %d) returns %%%d\n", (long)node, nprocs, 4160 TRACE(("makejob(%d) returns %%%d\n", nprocs,
4160 jobno(jp))); 4161 jobno(jp)));
4161 return jp; 4162 return jp;
4162} 4163}
@@ -4484,7 +4485,7 @@ static void closescript(void);
4484 4485
4485/* Called after fork(), in child */ 4486/* Called after fork(), in child */
4486static void 4487static void
4487forkchild(struct job *jp, union node *n, int mode) 4488forkchild(struct job *jp, /*union node *n,*/ int mode)
4488{ 4489{
4489 int oldlvl; 4490 int oldlvl;
4490 4491
@@ -4584,7 +4585,7 @@ forkshell(struct job *jp, union node *n, int mode)
4584 ash_msg_and_raise_error("cannot fork"); 4585 ash_msg_and_raise_error("cannot fork");
4585 } 4586 }
4586 if (pid == 0) 4587 if (pid == 0)
4587 forkchild(jp, n, mode); 4588 forkchild(jp, /*n,*/ mode);
4588 else 4589 else
4589 forkparent(jp, n, mode, pid); 4590 forkparent(jp, n, mode, pid);
4590 return pid; 4591 return pid;
@@ -5371,7 +5372,7 @@ evalbackcmd(union node *n, struct backcmd *result)
5371 5372
5372 if (pipe(pip) < 0) 5373 if (pipe(pip) < 0)
5373 ash_msg_and_raise_error("pipe call failed"); 5374 ash_msg_and_raise_error("pipe call failed");
5374 jp = makejob(n, 1); 5375 jp = makejob(/*n,*/ 1);
5375 if (forkshell(jp, n, FORK_NOJOB) == 0) { 5376 if (forkshell(jp, n, FORK_NOJOB) == 0) {
5376 FORCE_INT_ON; 5377 FORCE_INT_ON;
5377 close(pip[0]); 5378 close(pip[0]);
@@ -5668,7 +5669,7 @@ argstr(char *p, int flag, struct strlist *var_str_list)
5668} 5669}
5669 5670
5670static char * 5671static char *
5671scanleft(char *startp, char *rmesc, char *rmescend, char *str, int quotes, 5672scanleft(char *startp, char *rmesc, char *rmescend ATTRIBUTE_UNUSED, char *str, int quotes,
5672 int zero) 5673 int zero)
5673{ 5674{
5674 char *loc; 5675 char *loc;
@@ -6407,7 +6408,7 @@ expsort(struct strlist *str)
6407} 6408}
6408 6409
6409static void 6410static void
6410expandmeta(struct strlist *str, int flag) 6411expandmeta(struct strlist *str /*, int flag*/)
6411{ 6412{
6412 static const char metachars[] ALIGN1 = { 6413 static const char metachars[] ALIGN1 = {
6413 '*', '?', '[', 0 6414 '*', '?', '[', 0
@@ -6488,7 +6489,7 @@ expandarg(union node *arg, struct arglist *arglist, int flag)
6488 ifsbreakup(p, &exparg); 6489 ifsbreakup(p, &exparg);
6489 *exparg.lastp = NULL; 6490 *exparg.lastp = NULL;
6490 exparg.lastp = &exparg.list; 6491 exparg.lastp = &exparg.list;
6491 expandmeta(exparg.list, flag); 6492 expandmeta(exparg.list /*, flag*/);
6492 } else { 6493 } else {
6493 if (flag & EXP_REDIR) /*XXX - for now, just remove escapes */ 6494 if (flag & EXP_REDIR) /*XXX - for now, just remove escapes */
6494 rmescapes(p); 6495 rmescapes(p);
@@ -6838,7 +6839,7 @@ addcmdentry(char *name, struct cmdentry *entry)
6838} 6839}
6839 6840
6840static int 6841static int
6841hashcmd(int argc, char **argv) 6842hashcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
6842{ 6843{
6843 struct tblentry **pp; 6844 struct tblentry **pp;
6844 struct tblentry *cmdp; 6845 struct tblentry *cmdp;
@@ -7139,7 +7140,7 @@ describe_command(char *command, int describe_command_verbose)
7139} 7140}
7140 7141
7141static int 7142static int
7142typecmd(int argc, char **argv) 7143typecmd(int argc ATTRIBUTE_UNUSED, char **argv)
7143{ 7144{
7144 int i = 1; 7145 int i = 1;
7145 int err = 0; 7146 int err = 0;
@@ -7150,7 +7151,7 @@ typecmd(int argc, char **argv)
7150 i++; 7151 i++;
7151 verbose = 0; 7152 verbose = 0;
7152 } 7153 }
7153 while (i < argc) { 7154 while (argv[i]) {
7154 err |= describe_command(argv[i++], verbose); 7155 err |= describe_command(argv[i++], verbose);
7155 } 7156 }
7156 return err; 7157 return err;
@@ -7158,7 +7159,7 @@ typecmd(int argc, char **argv)
7158 7159
7159#if ENABLE_ASH_CMDCMD 7160#if ENABLE_ASH_CMDCMD
7160static int 7161static int
7161commandcmd(int argc, char **argv) 7162commandcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
7162{ 7163{
7163 int c; 7164 int c;
7164 enum { 7165 enum {
@@ -7768,7 +7769,7 @@ evalsubshell(union node *n, int flags)
7768 if (!backgnd && flags & EV_EXIT && !trap[0]) 7769 if (!backgnd && flags & EV_EXIT && !trap[0])
7769 goto nofork; 7770 goto nofork;
7770 INT_OFF; 7771 INT_OFF;
7771 jp = makejob(n, 1); 7772 jp = makejob(/*n,*/ 1);
7772 if (forkshell(jp, n, backgnd) == 0) { 7773 if (forkshell(jp, n, backgnd) == 0) {
7773 INT_ON; 7774 INT_ON;
7774 flags |= EV_EXIT; 7775 flags |= EV_EXIT;
@@ -7843,7 +7844,7 @@ evalpipe(union node *n, int flags)
7843 pipelen++; 7844 pipelen++;
7844 flags |= EV_EXIT; 7845 flags |= EV_EXIT;
7845 INT_OFF; 7846 INT_OFF;
7846 jp = makejob(n, pipelen); 7847 jp = makejob(/*n,*/ pipelen);
7847 prevfd = -1; 7848 prevfd = -1;
7848 for (lp = n->npipe.cmdlist; lp; lp = lp->next) { 7849 for (lp = n->npipe.cmdlist; lp; lp = lp->next) {
7849 prehash(lp->n); 7850 prehash(lp->n);
@@ -8098,7 +8099,7 @@ mklocal(char *name)
8098 * The "local" command. 8099 * The "local" command.
8099 */ 8100 */
8100static int 8101static int
8101localcmd(int argc, char **argv) 8102localcmd(int argc ATTRIBUTE_UNUSED, char **argv)
8102{ 8103{
8103 char *name; 8104 char *name;
8104 8105
@@ -8110,21 +8111,21 @@ localcmd(int argc, char **argv)
8110} 8111}
8111 8112
8112static int 8113static int
8113falsecmd(int argc, char **argv) 8114falsecmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
8114{ 8115{
8115 return 1; 8116 return 1;
8116} 8117}
8117 8118
8118static int 8119static int
8119truecmd(int argc, char **argv) 8120truecmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
8120{ 8121{
8121 return 0; 8122 return 0;
8122} 8123}
8123 8124
8124static int 8125static int
8125execcmd(int argc, char **argv) 8126execcmd(int argc ATTRIBUTE_UNUSED, char **argv)
8126{ 8127{
8127 if (argc > 1) { 8128 if (argv[1]) {
8128 iflag = 0; /* exit on error */ 8129 iflag = 0; /* exit on error */
8129 mflag = 0; 8130 mflag = 0;
8130 optschanged(); 8131 optschanged();
@@ -8137,7 +8138,7 @@ execcmd(int argc, char **argv)
8137 * The return command. 8138 * The return command.
8138 */ 8139 */
8139static int 8140static int
8140returncmd(int argc, char **argv) 8141returncmd(int argc ATTRIBUTE_UNUSED, char **argv)
8141{ 8142{
8142 /* 8143 /*
8143 * If called outside a function, do what ksh does; 8144 * If called outside a function, do what ksh does;
@@ -8296,7 +8297,7 @@ isassignment(const char *p)
8296 return *q == '='; 8297 return *q == '=';
8297} 8298}
8298static int 8299static int
8299bltincmd(int argc, char **argv) 8300bltincmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
8300{ 8301{
8301 /* Preserve exitstatus of a previous possible redirection 8302 /* Preserve exitstatus of a previous possible redirection
8302 * as POSIX mandates */ 8303 * as POSIX mandates */
@@ -8466,7 +8467,7 @@ evalcommand(union node *cmd, int flags)
8466 /* Fork off a child process if necessary. */ 8467 /* Fork off a child process if necessary. */
8467 if (!(flags & EV_EXIT) || trap[0]) { 8468 if (!(flags & EV_EXIT) || trap[0]) {
8468 INT_OFF; 8469 INT_OFF;
8469 jp = makejob(cmd, 1); 8470 jp = makejob(/*cmd,*/ 1);
8470 if (forkshell(jp, cmd, FORK_FG) != 0) { 8471 if (forkshell(jp, cmd, FORK_FG) != 0) {
8471 exitstatus = waitforjob(jp); 8472 exitstatus = waitforjob(jp);
8472 INT_ON; 8473 INT_ON;
@@ -8596,9 +8597,9 @@ prehash(union node *n)
8596 * in the standard shell so we don't make it one here. 8597 * in the standard shell so we don't make it one here.
8597 */ 8598 */
8598static int 8599static int
8599breakcmd(int argc, char **argv) 8600breakcmd(int argc ATTRIBUTE_UNUSED, char **argv)
8600{ 8601{
8601 int n = argc > 1 ? number(argv[1]) : 1; 8602 int n = argv[1] ? number(argv[1]) : 1;
8602 8603
8603 if (n <= 0) 8604 if (n <= 0)
8604 ash_msg_and_raise_error(illnum, argv[1]); 8605 ash_msg_and_raise_error(illnum, argv[1]);
@@ -9095,7 +9096,7 @@ chkmail(void)
9095} 9096}
9096 9097
9097static void 9098static void
9098changemail(const char *val) 9099changemail(const char *val ATTRIBUTE_UNUSED)
9099{ 9100{
9100 mail_var_path_changed = 1; 9101 mail_var_path_changed = 1;
9101} 9102}
@@ -9247,13 +9248,13 @@ options(int cmdline)
9247 * The shift builtin command. 9248 * The shift builtin command.
9248 */ 9249 */
9249static int 9250static int
9250shiftcmd(int argc, char **argv) 9251shiftcmd(int argc ATTRIBUTE_UNUSED, char **argv)
9251{ 9252{
9252 int n; 9253 int n;
9253 char **ap1, **ap2; 9254 char **ap1, **ap2;
9254 9255
9255 n = 1; 9256 n = 1;
9256 if (argc > 1) 9257 if (argv[1])
9257 n = number(argv[1]); 9258 n = number(argv[1]);
9258 if (n > shellparam.nparam) 9259 if (n > shellparam.nparam)
9259 ash_msg_and_raise_error("can't shift that many"); 9260 ash_msg_and_raise_error("can't shift that many");
@@ -9308,11 +9309,11 @@ showvars(const char *sep_prefix, int on, int off)
9308 * The set command builtin. 9309 * The set command builtin.
9309 */ 9310 */
9310static int 9311static int
9311setcmd(int argc, char **argv) 9312setcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
9312{ 9313{
9313 int retval; 9314 int retval;
9314 9315
9315 if (argc == 1) 9316 if (!argv[1])
9316 return showvars(nullstr, 0, VUNSET); 9317 return showvars(nullstr, 0, VUNSET);
9317 INT_OFF; 9318 INT_OFF;
9318 retval = 1; 9319 retval = 1;
@@ -11015,20 +11016,19 @@ evalstring(char *s, int mask)
11015 * The eval command. 11016 * The eval command.
11016 */ 11017 */
11017static int 11018static int
11018evalcmd(int argc, char **argv) 11019evalcmd(int argc ATTRIBUTE_UNUSED, char **argv)
11019{ 11020{
11020 char *p; 11021 char *p;
11021 char *concat; 11022 char *concat;
11022 char **ap;
11023 11023
11024 if (argc > 1) { 11024 if (argv[1]) {
11025 p = argv[1]; 11025 p = argv[1];
11026 if (argc > 2) { 11026 argv += 2;
11027 if (argv[0]) {
11027 STARTSTACKSTR(concat); 11028 STARTSTACKSTR(concat);
11028 ap = argv + 2;
11029 for (;;) { 11029 for (;;) {
11030 concat = stack_putstr(p, concat); 11030 concat = stack_putstr(p, concat);
11031 p = *ap++; 11031 p = *argv++;
11032 if (p == NULL) 11032 if (p == NULL)
11033 break; 11033 break;
11034 STPUTC(' ', concat); 11034 STPUTC(' ', concat);
@@ -11139,16 +11139,15 @@ dotcmd(int argc, char **argv)
11139 for (sp = cmdenviron; sp; sp = sp->next) 11139 for (sp = cmdenviron; sp; sp = sp->next)
11140 setvareq(ckstrdup(sp->text), VSTRFIXED | VTEXTFIXED); 11140 setvareq(ckstrdup(sp->text), VSTRFIXED | VTEXTFIXED);
11141 11141
11142 if (argc >= 2) { /* That's what SVR2 does */ 11142 if (argv[1]) { /* That's what SVR2 does */
11143 char *fullname; 11143 char *fullname = find_dot_file(argv[1]);
11144 11144 argv += 2;
11145 fullname = find_dot_file(argv[1]); 11145 argc -= 2;
11146 11146 if (argc) { /* argc > 0, argv[0] != NULL */
11147 if (argc > 2) {
11148 saveparam = shellparam; 11147 saveparam = shellparam;
11149 shellparam.malloced = 0; 11148 shellparam.malloced = 0;
11150 shellparam.nparam = argc - 2; 11149 shellparam.nparam = argc;
11151 shellparam.p = argv + 2; 11150 shellparam.p = argv;
11152 }; 11151 };
11153 11152
11154 setinputfile(fullname, INPUT_PUSH_FILE); 11153 setinputfile(fullname, INPUT_PUSH_FILE);
@@ -11156,7 +11155,7 @@ dotcmd(int argc, char **argv)
11156 cmdloop(0); 11155 cmdloop(0);
11157 popfile(); 11156 popfile();
11158 11157
11159 if (argc > 2) { 11158 if (argc) {
11160 freeparam(&shellparam); 11159 freeparam(&shellparam);
11161 shellparam = saveparam; 11160 shellparam = saveparam;
11162 }; 11161 };
@@ -11166,11 +11165,11 @@ dotcmd(int argc, char **argv)
11166} 11165}
11167 11166
11168static int 11167static int
11169exitcmd(int argc, char **argv) 11168exitcmd(int argc ATTRIBUTE_UNUSED, char **argv)
11170{ 11169{
11171 if (stoppedjobs()) 11170 if (stoppedjobs())
11172 return 0; 11171 return 0;
11173 if (argc > 1) 11172 if (argv[1])
11174 exitstatus = number(argv[1]); 11173 exitstatus = number(argv[1]);
11175 raise_exception(EXEXIT); 11174 raise_exception(EXEXIT);
11176 /* NOTREACHED */ 11175 /* NOTREACHED */
@@ -11404,7 +11403,7 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path)
11404 * The trap builtin. 11403 * The trap builtin.
11405 */ 11404 */
11406static int 11405static int
11407trapcmd(int argc, char **argv) 11406trapcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11408{ 11407{
11409 char *action; 11408 char *action;
11410 char **ap; 11409 char **ap;
@@ -11457,7 +11456,7 @@ trapcmd(int argc, char **argv)
11457 * Lists available builtins 11456 * Lists available builtins
11458 */ 11457 */
11459static int 11458static int
11460helpcmd(int argc, char **argv) 11459helpcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11461{ 11460{
11462 int col, i; 11461 int col, i;
11463 11462
@@ -11492,7 +11491,7 @@ helpcmd(int argc, char **argv)
11492 * The export and readonly commands. 11491 * The export and readonly commands.
11493 */ 11492 */
11494static int 11493static int
11495exportcmd(int argc, char **argv) 11494exportcmd(int argc ATTRIBUTE_UNUSED, char **argv)
11496{ 11495{
11497 struct var *vp; 11496 struct var *vp;
11498 char *name; 11497 char *name;
@@ -11543,7 +11542,7 @@ unsetfunc(const char *name)
11543 * with the same name. 11542 * with the same name.
11544 */ 11543 */
11545static int 11544static int
11546unsetcmd(int argc, char **argv) 11545unsetcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11547{ 11546{
11548 char **ap; 11547 char **ap;
11549 int i; 11548 int i;
@@ -11581,7 +11580,7 @@ static const unsigned char timescmd_str[] ALIGN1 = {
11581}; 11580};
11582 11581
11583static int 11582static int
11584timescmd(int ac, char **av) 11583timescmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11585{ 11584{
11586 long clk_tck, s, t; 11585 long clk_tck, s, t;
11587 const unsigned char *p; 11586 const unsigned char *p;
@@ -11633,17 +11632,16 @@ dash_arith(const char *s)
11633 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru> 11632 * Copyright (C) 2003 Vladimir Oleynik <dzo@simtreas.ru>
11634 */ 11633 */
11635static int 11634static int
11636letcmd(int argc, char **argv) 11635letcmd(int argc ATTRIBUTE_UNUSED, char **argv)
11637{ 11636{
11638 char **ap; 11637 arith_t i;
11639 arith_t i = 0;
11640 11638
11641 ap = argv + 1; 11639 argv++;
11642 if (!*ap) 11640 if (!*argv)
11643 ash_msg_and_raise_error("expression expected"); 11641 ash_msg_and_raise_error("expression expected");
11644 for (ap = argv + 1; *ap; ap++) { 11642 do {
11645 i = dash_arith(*ap); 11643 i = dash_arith(*argv);
11646 } 11644 } while (*++argv);
11647 11645
11648 return !i; 11646 return !i;
11649} 11647}
@@ -11668,7 +11666,7 @@ typedef enum __rlimit_resource rlim_t;
11668 * This uses unbuffered input, which may be avoidable in some cases. 11666 * This uses unbuffered input, which may be avoidable in some cases.
11669 */ 11667 */
11670static int 11668static int
11671readcmd(int argc, char **argv) 11669readcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
11672{ 11670{
11673 char **ap; 11671 char **ap;
11674 int backslash; 11672 int backslash;
@@ -11859,7 +11857,7 @@ readcmd(int argc, char **argv)
11859} 11857}
11860 11858
11861static int 11859static int
11862umaskcmd(int argc, char **argv) 11860umaskcmd(int argc ATTRIBUTE_UNUSED, char **argv)
11863{ 11861{
11864 static const char permuser[3] ALIGN1 = "ugo"; 11862 static const char permuser[3] ALIGN1 = "ugo";
11865 static const char permmode[3] ALIGN1 = "rwx"; 11863 static const char permmode[3] ALIGN1 = "rwx";
@@ -12034,7 +12032,7 @@ printlim(enum limtype how, const struct rlimit *limit,
12034} 12032}
12035 12033
12036static int 12034static int
12037ulimitcmd(int argc, char **argv) 12035ulimitcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
12038{ 12036{
12039 int c; 12037 int c;
12040 rlim_t val = 0; 12038 rlim_t val = 0;
@@ -12868,7 +12866,7 @@ init(void)
12868 * Process the shell command line arguments. 12866 * Process the shell command line arguments.
12869 */ 12867 */
12870static void 12868static void
12871procargs(int argc, char **argv) 12869procargs(char **argv)
12872{ 12870{
12873 int i; 12871 int i;
12874 const char *xminusc; 12872 const char *xminusc;
@@ -12876,7 +12874,7 @@ procargs(int argc, char **argv)
12876 12874
12877 xargv = argv; 12875 xargv = argv;
12878 arg0 = xargv[0]; 12876 arg0 = xargv[0];
12879 if (argc > 0) 12877 /* if (xargv[0]) - mmm, this is always true! */
12880 xargv++; 12878 xargv++;
12881 for (i = 0; i < NOPTS; i++) 12879 for (i = 0; i < NOPTS; i++)
12882 optlist[i] = 2; 12880 optlist[i] = 2;
@@ -12976,7 +12974,7 @@ extern int etext();
12976 * is used to figure out how far we had gotten. 12974 * is used to figure out how far we had gotten.
12977 */ 12975 */
12978int ash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 12976int ash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
12979int ash_main(int argc, char **argv) 12977int ash_main(int argc ATTRIBUTE_UNUSED, char **argv)
12980{ 12978{
12981 char *shinit; 12979 char *shinit;
12982 volatile int state; 12980 volatile int state;
@@ -13039,7 +13037,8 @@ int ash_main(int argc, char **argv)
13039#endif 13037#endif
13040 init(); 13038 init();
13041 setstackmark(&smark); 13039 setstackmark(&smark);
13042 procargs(argc, argv); 13040 procargs(argv);
13041
13043#if ENABLE_FEATURE_EDITING_SAVEHISTORY 13042#if ENABLE_FEATURE_EDITING_SAVEHISTORY
13044 if (iflag) { 13043 if (iflag) {
13045 const char *hp = lookupvar("HISTFILE"); 13044 const char *hp = lookupvar("HISTFILE");