aboutsummaryrefslogtreecommitdiff
path: root/shell
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
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')
-rw-r--r--shell/ash.c153
-rw-r--r--shell/hush.c24
-rw-r--r--shell/msh.c46
3 files changed, 113 insertions, 110 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");
diff --git a/shell/hush.c b/shell/hush.c
index c61607dd3..2d5697269 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -536,11 +536,13 @@ static int done_pipe(struct p_context *ctx, pipe_style type);
536static int redirect_dup_num(struct in_str *input); 536static int redirect_dup_num(struct in_str *input);
537static int redirect_opt_num(o_string *o); 537static int redirect_opt_num(o_string *o);
538#if ENABLE_HUSH_TICK 538#if ENABLE_HUSH_TICK
539static int process_command_subs(o_string *dest, struct p_context *ctx, struct in_str *input, const char *subst_end); 539static int process_command_subs(o_string *dest, /*struct p_context *ctx,*/
540 struct in_str *input, const char *subst_end);
540#endif 541#endif
541static int parse_group(o_string *dest, struct p_context *ctx, struct in_str *input, int ch); 542static int parse_group(o_string *dest, struct p_context *ctx, struct in_str *input, int ch);
542static const char *lookup_param(const char *src); 543static const char *lookup_param(const char *src);
543static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *input); 544static int handle_dollar(o_string *dest, /*struct p_context *ctx,*/
545 struct in_str *input);
544static int parse_stream(o_string *dest, struct p_context *ctx, struct in_str *input0, const char *end_trigger); 546static int parse_stream(o_string *dest, struct p_context *ctx, struct in_str *input0, const char *end_trigger);
545/* setup: */ 547/* setup: */
546static int parse_and_run_stream(struct in_str *inp, int parse_flag); 548static int parse_and_run_stream(struct in_str *inp, int parse_flag);
@@ -741,14 +743,14 @@ static void set_every_sighandler(void (*handler)(int))
741 signal(SIGCHLD, handler); 743 signal(SIGCHLD, handler);
742} 744}
743 745
744static void handler_ctrl_c(int sig) 746static void handler_ctrl_c(int sig ATTRIBUTE_UNUSED)
745{ 747{
746 debug_printf_jobs("got sig %d\n", sig); 748 debug_printf_jobs("got sig %d\n", sig);
747// as usual we can have all kinds of nasty problems with leaked malloc data here 749// as usual we can have all kinds of nasty problems with leaked malloc data here
748 siglongjmp(toplevel_jb, 1); 750 siglongjmp(toplevel_jb, 1);
749} 751}
750 752
751static void handler_ctrl_z(int sig) 753static void handler_ctrl_z(int sig ATTRIBUTE_UNUSED)
752{ 754{
753 pid_t pid; 755 pid_t pid;
754 756
@@ -3257,8 +3259,10 @@ static FILE *generate_stream_from_list(struct pipe *head)
3257} 3259}
3258 3260
3259/* Return code is exit status of the process that is run. */ 3261/* Return code is exit status of the process that is run. */
3260static int process_command_subs(o_string *dest, struct p_context *ctx, 3262static int process_command_subs(o_string *dest,
3261 struct in_str *input, const char *subst_end) 3263 /*struct p_context *ctx,*/
3264 struct in_str *input,
3265 const char *subst_end)
3262{ 3266{
3263 int retcode, ch, eol_cnt; 3267 int retcode, ch, eol_cnt;
3264 o_string result = NULL_O_STRING; 3268 o_string result = NULL_O_STRING;
@@ -3351,7 +3355,7 @@ static const char *lookup_param(const char *src)
3351} 3355}
3352 3356
3353/* return code: 0 for OK, 1 for syntax error */ 3357/* return code: 0 for OK, 1 for syntax error */
3354static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *input) 3358static int handle_dollar(o_string *dest, /*struct p_context *ctx,*/ struct in_str *input)
3355{ 3359{
3356 int ch = b_peek(input); /* first character after the $ */ 3360 int ch = b_peek(input); /* first character after the $ */
3357 unsigned char quote_mask = dest->o_quote ? 0x80 : 0; 3361 unsigned char quote_mask = dest->o_quote ? 0x80 : 0;
@@ -3409,7 +3413,7 @@ static int handle_dollar(o_string *dest, struct p_context *ctx, struct in_str *i
3409#if ENABLE_HUSH_TICK 3413#if ENABLE_HUSH_TICK
3410 case '(': 3414 case '(':
3411 b_getch(input); 3415 b_getch(input);
3412 process_command_subs(dest, ctx, input, ")"); 3416 process_command_subs(dest, /*ctx,*/ input, ")");
3413 break; 3417 break;
3414#endif 3418#endif
3415 case '-': 3419 case '-':
@@ -3507,7 +3511,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
3507 b_addqchr(dest, b_getch(input), dest->o_quote); 3511 b_addqchr(dest, b_getch(input), dest->o_quote);
3508 break; 3512 break;
3509 case '$': 3513 case '$':
3510 if (handle_dollar(dest, ctx, input) != 0) { 3514 if (handle_dollar(dest, /*ctx,*/ input) != 0) {
3511 debug_printf_parse("parse_stream return 1: handle_dollar returned non-0\n"); 3515 debug_printf_parse("parse_stream return 1: handle_dollar returned non-0\n");
3512 return 1; 3516 return 1;
3513 } 3517 }
@@ -3532,7 +3536,7 @@ static int parse_stream(o_string *dest, struct p_context *ctx,
3532 break; 3536 break;
3533#if ENABLE_HUSH_TICK 3537#if ENABLE_HUSH_TICK
3534 case '`': 3538 case '`':
3535 process_command_subs(dest, ctx, input, "`"); 3539 process_command_subs(dest, /*ctx,*/ input, "`");
3536 break; 3540 break;
3537#endif 3541#endif
3538 case '>': 3542 case '>':
diff --git a/shell/msh.c b/shell/msh.c
index 5ed6dfd1d..63f365962 100644
--- a/shell/msh.c
+++ b/shell/msh.c
@@ -589,7 +589,7 @@ static const struct builtincmd builtincmds[] = {
589}; 589};
590 590
591static struct op *scantree(struct op *); 591static struct op *scantree(struct op *);
592static struct op *dowholefile(int, int); 592static struct op *dowholefile(int /*, int*/);
593 593
594 594
595/* Globals */ 595/* Globals */
@@ -1448,7 +1448,7 @@ static void next(int f)
1448 PUSHIO(afile, f, filechar); 1448 PUSHIO(afile, f, filechar);
1449} 1449}
1450 1450
1451static void onintr(int s) /* ANSI C requires a parameter */ 1451static void onintr(int s ATTRIBUTE_UNUSED) /* ANSI C requires a parameter */
1452{ 1452{
1453 signal(SIGINT, onintr); 1453 signal(SIGINT, onintr);
1454 intr = 1; 1454 intr = 1;
@@ -1864,11 +1864,11 @@ static struct op *command(int cf)
1864 return t; 1864 return t;
1865} 1865}
1866 1866
1867static struct op *dowholefile(int type, int mark) 1867static struct op *dowholefile(int type /*, int mark*/)
1868{ 1868{
1869 struct op *t; 1869 struct op *t;
1870 1870
1871 DBGPRINTF(("DOWHOLEFILE: enter, type=%d, mark=%d\n", type, mark)); 1871 DBGPRINTF(("DOWHOLEFILE: enter, type=%d\n", type /*, mark*/));
1872 1872
1873 multiline++; 1873 multiline++;
1874 t = c_list(); 1874 t = c_list();
@@ -2477,7 +2477,7 @@ static int execute(struct op *t, int *pin, int *pout, int no_fork)
2477 2477
2478 newfile(evalstr(t->op_words[0], DOALL)); 2478 newfile(evalstr(t->op_words[0], DOALL));
2479 2479
2480 t->left = dowholefile(TLIST, 0); 2480 t->left = dowholefile(TLIST /*, 0*/);
2481 t->right = NULL; 2481 t->right = NULL;
2482 2482
2483 outtree = outtree_save; 2483 outtree = outtree_save;
@@ -3155,7 +3155,7 @@ static int run(struct ioarg *argp, int (*f) (struct ioarg *))
3155 * built-in commands: doX 3155 * built-in commands: doX
3156 */ 3156 */
3157 3157
3158static int dohelp(struct op *t, char **args) 3158static int dohelp(struct op *t ATTRIBUTE_UNUSED, char **args ATTRIBUTE_UNUSED)
3159{ 3159{
3160 int col; 3160 int col;
3161 const struct builtincmd *x; 3161 const struct builtincmd *x;
@@ -3191,12 +3191,12 @@ static int dohelp(struct op *t, char **args)
3191 return EXIT_SUCCESS; 3191 return EXIT_SUCCESS;
3192} 3192}
3193 3193
3194static int dolabel(struct op *t, char **args) 3194static int dolabel(struct op *t ATTRIBUTE_UNUSED, char **args ATTRIBUTE_UNUSED)
3195{ 3195{
3196 return 0; 3196 return 0;
3197} 3197}
3198 3198
3199static int dochdir(struct op *t, char **args) 3199static int dochdir(struct op *t ATTRIBUTE_UNUSED, char **args)
3200{ 3200{
3201 const char *cp, *er; 3201 const char *cp, *er;
3202 3202
@@ -3217,7 +3217,7 @@ static int dochdir(struct op *t, char **args)
3217 return 1; 3217 return 1;
3218} 3218}
3219 3219
3220static int doshift(struct op *t, char **args) 3220static int doshift(struct op *t ATTRIBUTE_UNUSED, char **args)
3221{ 3221{
3222 int n; 3222 int n;
3223 3223
@@ -3236,7 +3236,7 @@ static int doshift(struct op *t, char **args)
3236/* 3236/*
3237 * execute login and newgrp directly 3237 * execute login and newgrp directly
3238 */ 3238 */
3239static int dologin(struct op *t, char **args) 3239static int dologin(struct op *t ATTRIBUTE_UNUSED, char **args)
3240{ 3240{
3241 const char *cp; 3241 const char *cp;
3242 3242
@@ -3251,7 +3251,7 @@ static int dologin(struct op *t, char **args)
3251 return 1; 3251 return 1;
3252} 3252}
3253 3253
3254static int doumask(struct op *t, char **args) 3254static int doumask(struct op *t ATTRIBUTE_UNUSED, char **args)
3255{ 3255{
3256 int i; 3256 int i;
3257 char *cp; 3257 char *cp;
@@ -3301,7 +3301,7 @@ static int doexec(struct op *t, char **args)
3301 return 1; 3301 return 1;
3302} 3302}
3303 3303
3304static int dodot(struct op *t, char **args) 3304static int dodot(struct op *t ATTRIBUTE_UNUSED, char **args)
3305{ 3305{
3306 int i; 3306 int i;
3307 const char *sp; 3307 const char *sp;
@@ -3355,7 +3355,7 @@ static int dodot(struct op *t, char **args)
3355 return -1; 3355 return -1;
3356} 3356}
3357 3357
3358static int dowait(struct op *t, char **args) 3358static int dowait(struct op *t ATTRIBUTE_UNUSED, char **args)
3359{ 3359{
3360 int i; 3360 int i;
3361 char *cp; 3361 char *cp;
@@ -3371,7 +3371,7 @@ static int dowait(struct op *t, char **args)
3371 return 0; 3371 return 0;
3372} 3372}
3373 3373
3374static int doread(struct op *t, char **args) 3374static int doread(struct op *t ATTRIBUTE_UNUSED, char **args)
3375{ 3375{
3376 char *cp, **wp; 3376 char *cp, **wp;
3377 int nb = 0; 3377 int nb = 0;
@@ -3398,12 +3398,12 @@ static int doread(struct op *t, char **args)
3398 return nb <= 0; 3398 return nb <= 0;
3399} 3399}
3400 3400
3401static int doeval(struct op *t, char **args) 3401static int doeval(struct op *t ATTRIBUTE_UNUSED, char **args)
3402{ 3402{
3403 return RUN(awordlist, args + 1, wdchar); 3403 return RUN(awordlist, args + 1, wdchar);
3404} 3404}
3405 3405
3406static int dotrap(struct op *t, char **args) 3406static int dotrap(struct op *t ATTRIBUTE_UNUSED, char **args)
3407{ 3407{
3408 int n, i; 3408 int n, i;
3409 int resetsig; 3409 int resetsig;
@@ -3484,12 +3484,12 @@ static int getn(char *as)
3484 return n * m; 3484 return n * m;
3485} 3485}
3486 3486
3487static int dobreak(struct op *t, char **args) 3487static int dobreak(struct op *t ATTRIBUTE_UNUSED, char **args)
3488{ 3488{
3489 return brkcontin(args[1], 1); 3489 return brkcontin(args[1], 1);
3490} 3490}
3491 3491
3492static int docontinue(struct op *t, char **args) 3492static int docontinue(struct op *t ATTRIBUTE_UNUSED, char **args)
3493{ 3493{
3494 return brkcontin(args[1], 0); 3494 return brkcontin(args[1], 0);
3495} 3495}
@@ -3517,7 +3517,7 @@ static int brkcontin(char *cp, int val)
3517 /* NOTREACHED */ 3517 /* NOTREACHED */
3518} 3518}
3519 3519
3520static int doexit(struct op *t, char **args) 3520static int doexit(struct op *t ATTRIBUTE_UNUSED, char **args)
3521{ 3521{
3522 char *cp; 3522 char *cp;
3523 3523
@@ -3533,13 +3533,13 @@ static int doexit(struct op *t, char **args)
3533 return 0; 3533 return 0;
3534} 3534}
3535 3535
3536static int doexport(struct op *t, char **args) 3536static int doexport(struct op *t ATTRIBUTE_UNUSED, char **args)
3537{ 3537{
3538 rdexp(args + 1, export, EXPORT); 3538 rdexp(args + 1, export, EXPORT);
3539 return 0; 3539 return 0;
3540} 3540}
3541 3541
3542static int doreadonly(struct op *t, char **args) 3542static int doreadonly(struct op *t ATTRIBUTE_UNUSED, char **args)
3543{ 3543{
3544 rdexp(args + 1, ronly, RONLY); 3544 rdexp(args + 1, ronly, RONLY);
3545 return 0; 3545 return 0;
@@ -3575,7 +3575,7 @@ static void badid(char *s)
3575 err(": bad identifier"); 3575 err(": bad identifier");
3576} 3576}
3577 3577
3578static int doset(struct op *t, char **args) 3578static int doset(struct op *t ATTRIBUTE_UNUSED, char **args)
3579{ 3579{
3580 struct var *vp; 3580 struct var *vp;
3581 char *cp; 3581 char *cp;
@@ -3650,7 +3650,7 @@ static void times_fmt(char *buf, clock_t val, unsigned clk_tck)
3650#endif 3650#endif
3651} 3651}
3652 3652
3653static int dotimes(struct op *t, char **args) 3653static int dotimes(struct op *t ATTRIBUTE_UNUSED, char **args ATTRIBUTE_UNUSED)
3654{ 3654{
3655 struct tms buf; 3655 struct tms buf;
3656 unsigned clk_tck = sysconf(_SC_CLK_TCK); 3656 unsigned clk_tck = sysconf(_SC_CLK_TCK);