lint is your friend

This commit is contained in:
tg 2011-03-13 01:20:25 +00:00
parent 5710e78857
commit 2a3d4db123
13 changed files with 45 additions and 45 deletions

12
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.422 2011/03/12 23:06:41 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.423 2011/03/13 01:20:14 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -25,7 +25,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R39 2011/03/08
@(#)MIRBSD KSH R39 2011/03/12
description:
Check version of shell.
stdin:
@ -6945,6 +6945,8 @@ description:
stdin:
echo $(case 1 in (1) echo yes;; (2) echo no;; esac)
echo $(case 1 in 1) echo yes;; 2) echo no;; esac)
echo $(($(case 1 in (1) echo 1;; (*) echo 2;; esac)+10))
echo $(($(case 1 in 1) echo 1;; *) echo 2;; esac)+20))
TEST=1234; echo ${TEST: $(case 1 in (1) echo 1;; (*) echo 2;; esac)}
TEST=5678; echo ${TEST: $(case 1 in 1) echo 1;; *) echo 2;; esac)}
(( a = $(case 1 in (1) echo 1;; (*) echo 2;; esac) )); echo $a.
@ -6952,6 +6954,8 @@ stdin:
expected-stdout:
yes
yes
11
21
234
678
1.
@ -6962,13 +6966,9 @@ description:
COMSUB inside SLETARRAY and SASPAREN/EXPRSUB
expected-fail: yes
stdin:
echo $(($(case 1 in (1) echo 1;; (*) echo 2;; esac)+10))
echo $(($(case 1 in 1) echo 1;; *) echo 2;; esac)+20))
a=($(case 1 in (1) echo 1;; (*) echo 2;; esac)); echo ${a[0]}.
a=($(case 1 in 1) echo 1;; *) echo 2;; esac)); echo ${a[0]}.
expected-stdout:
11
21
1.
1.
---

8
edit.c
View File

@ -25,7 +25,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.205 2011/03/07 20:30:35 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.206 2011/03/13 01:20:16 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -1138,7 +1138,7 @@ x_emacs(char *buf, size_t len)
x_nextcmd = -1;
}
editmode = 1;
while (1) {
while (/* CONSTCOND */ 1) {
x_flush();
if ((c = x_e_getc()) < 0)
return (0);
@ -1797,7 +1797,7 @@ x_search_hist(int c)
unsigned char f;
*p = '\0';
while (1) {
while (/* CONSTCOND */ 1) {
if (offset < 0) {
x_e_puts("\nI-search: ");
x_e_puts(pat);
@ -3474,7 +3474,7 @@ x_vi(char *buf, size_t len)
editmode = 2;
x_flush();
while (1) {
while (/* CONSTCOND */ 1) {
if (macro.p) {
c = *macro.p++;
/* end of current macro? */

4
eval.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.98 2011/03/12 23:06:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.99 2011/03/13 01:20:17 tg Exp $");
/*
* string expansion
@ -246,7 +246,7 @@ expand(const char *cp, /* input word */
memset(&st_head, 0, sizeof(st_head));
st = &st_head;
while (1) {
while (/* CONSTCOND */ 1) {
Xcheck(ds, dp);
switch (type) {

10
exec.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.87 2011/02/18 22:26:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.88 2011/03/13 01:20:18 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL "/bin/sh"
@ -336,7 +336,7 @@ execute(struct op * volatile t,
(const char **)eval((const char **)t->vars,
DOBLANK | DOGLOB | DOTILDE);
e->type = E_LOOP;
while (1) {
while (/* CONSTCOND */ 1) {
i = sigsetjmp(e->jbuf, 0);
if (!i)
break;
@ -374,7 +374,7 @@ execute(struct op * volatile t,
case TWHILE:
case TUNTIL:
e->type = E_LOOP;
while (1) {
while (/* CONSTCOND */ 1) {
i = sigsetjmp(e->jbuf, 0);
if (!i)
break;
@ -958,7 +958,7 @@ define(const char *name, struct op *t)
struct tbl *tp;
bool was_set = false;
while (1) {
while (/* CONSTCOND */ 1) {
tp = findfunc(name, hash(name), true);
if (tp->flag & ISSET)
@ -1491,7 +1491,7 @@ do_selectargs(const char **ap, bool print_menu)
for (argct = 0; ap[argct]; argct++)
;
while (1) {
while (/* CONSTCOND */ 1) {
/*-
* Menu is printed if
* - this is the first time around the select loop

View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.175 2011/03/07 20:30:37 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.176 2011/03/13 01:20:19 tg Exp $");
#if HAVE_KILLPG
/*
@ -2172,7 +2172,7 @@ c_read(const char **wp)
if (c == delim || c == EOF)
break;
/* loop to read one character */
while (1) {
while (/* CONSTCOND */ 1) {
c = shf_getc(shf);
/* we break unless NUL or EOF, so... */
if (c == delim)
@ -3636,7 +3636,7 @@ c_cat(const char **wp)
continue;
}
}
while (1) {
while (/* CONSTCOND */ 1) {
n = blocking_read(fd, (cp = buf), MKSH_CAT_BUFSIZ);
if (n == -1) {
if (errno == EINTR)

8
jobs.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.76 2011/03/06 17:08:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.77 2011/03/13 01:20:20 tg Exp $");
#if HAVE_KILLPG
#define mksh_killpg killpg
@ -293,7 +293,7 @@ j_change(void)
setsig(&sigtraps[SIGTTIN], SIG_DFL,
SS_RESTORE_ORIG|SS_FORCE);
/* wait to be given tty (POSIX.1, B.2, job control) */
while (1) {
while (/* CONSTCOND */ 1) {
pid_t ttypgrp;
if ((ttypgrp = tcgetpgrp(tty_fd)) < 0) {
@ -1310,9 +1310,9 @@ j_sigchld(int sig MKSH_A_UNUSED)
check_job(j);
}
#ifndef MKSH_NOPROSPECTOFWORK
while (1);
while (/* CONSTCOND */ 1);
#else
while (0);
while (/* CONSTCOND */ 0);
#endif
}

6
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.179 2011/03/05 21:43:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.180 2011/03/13 01:20:21 tg Exp $");
extern char **environ;
@ -716,7 +716,7 @@ shell(Source * volatile s, volatile int toplevel)
/* NOTREACHED */
}
}
while (1) {
while (/* CONSTCOND */ 1) {
if (trap)
runtraps(0);
@ -781,7 +781,7 @@ unwind(int i)
--trap_nested;
i = LLEAVE;
}
while (1) {
while (/* CONSTCOND */ 1) {
switch (e->type) {
case E_PARSE:
case E_FUNC:

6
misc.c
View File

@ -29,7 +29,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.153 2011/03/07 20:30:39 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.154 2011/03/13 01:20:21 tg Exp $");
/* type bits for unsigned char */
unsigned char chtypes[UCHAR_MAX + 1];
@ -1594,11 +1594,11 @@ unbksl(bool cstyle, int (*fg)(void), void (*fp)(int))
break;
case 'U':
i = 8;
if (0)
if (/* CONSTCOND */ 0)
/* FALLTHROUGH */
case 'u':
i = 4;
if (0)
if (/* CONSTCOND */ 0)
/* FALLTHROUGH */
case 'x':
i = cstyle ? -1 : 2;

4
sh.h
View File

@ -154,9 +154,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.443 2011/03/12 23:04:47 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.444 2011/03/13 01:20:22 tg Exp $");
#endif
#define MKSH_VERSION "R39 2011/03/08"
#define MKSH_VERSION "R39 2011/03/12"
#ifndef MKSH_INCLUDES_ONLY

4
shf.c
View File

@ -24,7 +24,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.40 2010/09/14 21:26:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/shf.c,v 1.41 2011/03/13 01:20:23 tg Exp $");
/* flags to shf_emptybuf() */
#define EB_READSW 0x01 /* about to switch to reading */
@ -420,7 +420,7 @@ shf_fillbuf(struct shf *shf)
shf->flags |= SHF_READING;
shf->rp = shf->buf;
while (1) {
while (/* CONSTCOND */ 1) {
n = blocking_read(shf->fd, (char *)shf->buf, shf->rbsize);
if (n < 0 && errno == EINTR && !(shf->flags & SHF_INTERRUPT))
continue;

8
syn.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.55 2011/03/12 20:20:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.56 2011/03/13 01:20:24 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -66,7 +66,7 @@ static int symbol; /* yylex value */
#define ACCEPT (reject = false)
#define token(cf) ((reject) ? (ACCEPT, symbol) : (symbol = yylex(cf)))
#define tpeek(cf) ((reject) ? (symbol) : (REJECT, symbol = yylex(cf)))
#define musthave(c,cf) do { if (token(cf) != (c)) syntaxerr(NULL); } while (0)
#define musthave(c,cf) do { if (token(cf) != (c)) syntaxerr(NULL); } while (/* CONSTCOND */ 0)
static void
yyparse(void)
@ -128,7 +128,7 @@ c_list(bool multi)
int c;
bool have_sep;
while (1) {
while (/* CONSTCOND */ 1) {
p = andor();
/*
* Token has always been read/rejected at this point, so
@ -256,7 +256,7 @@ get_command(int cf)
syniocf &= ~(KEYWORD|ALIAS);
t = newtp(TCOM);
t->lineno = source->line;
while (1) {
while (/* CONSTCOND */ 1) {
cf = (t->u.evalflags ? ARRAYVAR : 0) |
(XPsize(args) == 0 ? ALIAS|VARASN : CMDWORD);
switch (tpeek(cf)) {

10
tree.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.39 2011/03/12 23:04:48 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.40 2011/03/13 01:20:24 tg Exp $");
#define INDENT 8
@ -279,7 +279,7 @@ tputS(const char *wp, struct shf *shf)
* OQUOTE ["'] ... CQUOTE ["']
* COMSUB [(`] ...\0 (handle $ ` \ and maybe " in `...` case)
*/
while (1)
while (/* CONSTCOND */ 1)
switch (*wp++) {
case EOS:
return;
@ -515,7 +515,7 @@ wdscan(const char *wp, int c)
{
int nest = 0;
while (1)
while (/* CONSTCOND */ 1)
switch (*wp++) {
case EOS:
return (wp);
@ -590,7 +590,7 @@ wdstrip_internal(struct shf *shf, const char *wp, bool keepq, bool make_magic)
* x${foo:-"hi"} -> x${foo:-hi}
* x${foo:-'hi'} -> x${foo:-hi} unless keepq
*/
while (1)
while (/* CONSTCOND */ 1)
switch (*wp++) {
case EOS:
return;
@ -799,7 +799,7 @@ dumpwdvar(struct shf *shf, const char *wp)
{
int c, quotelevel = 0;
while (1) {
while (/* CONSTCOND */ 1) {
switch(*wp++) {
case EOS:
shf_puts("EOS", shf);

4
var.c
View File

@ -26,7 +26,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.117 2011/03/07 20:30:41 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.118 2011/03/13 01:20:25 tg Exp $");
/*
* Variables
@ -910,7 +910,7 @@ skip_wdvarname(const char *s,
char c;
int depth = 0;
while (1) {
while (/* CONSTCOND */ 1) {
if (p[0] != CHAR)
break;
c = p[1];