Merge remote-tracking branch 'mksh/master'

This commit is contained in:
KO Myung-Hun 2016-01-24 16:43:45 +09:00
commit 36ea6b5f88
16 changed files with 107 additions and 95 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.695 2016/01/02 20:11:31 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.696 2016/01/21 18:24:33 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016
@ -2347,7 +2347,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c
addsrcs USE_PRINTF_BUILTIN printf.c
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
add_cppflags -DMKSH_BUILD_R=521
add_cppflags -DMKSH_BUILD_R=522
$e $bi$me: Finished configuration testing, now producing output.$ao

View File

@ -1,7 +1,7 @@
# $MirOS: src/bin/mksh/Makefile,v 1.145 2015/12/12 22:25:11 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.146 2016/01/21 18:24:34 tg Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015
# 2011, 2012, 2013, 2014, 2015, 2016
# mirabilos <m@mirbsd.org>
#
# Provided that these terms and disclaimer and all copyright notices
@ -57,7 +57,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=521
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=522
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
CPPFLAGS+= -I.
COPTS+= -std=c89 -Wall

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.721 2016/01/20 21:34:09 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.722 2016/01/21 18:24:35 tg Exp $
# -*- mode: sh -*-
#-
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
@ -30,7 +30,7 @@
# (2013/12/02 20:39:44) http://openbsd.cs.toronto.edu/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
expected-stdout:
@(#)MIRBSD KSH R52 2016/01/20
@(#)MIRBSD KSH R52 2016/01/21
description:
Check version of shell.
stdin:
@ -39,7 +39,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R52 2016/01/20
@(#)LEGACY KSH R52 2016/01/21
description:
Check version of legacy shell.
stdin:

12
edit.c
View File

@ -5,7 +5,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013, 2014, 2015
* 2011, 2012, 2013, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -28,7 +28,7 @@
#ifndef MKSH_NO_CMDLINE_EDITING
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.292 2015/10/09 16:11:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.293 2016/01/21 18:24:37 tg Exp $");
/*
* in later versions we might use libtermcap for this, but since external
@ -385,7 +385,7 @@ x_file_glob(int *flagsp, char *toglob, char ***wordsp)
source = s;
if (yylex(ONEWORD | LQCHAR) != LWORD) {
source = sold;
internal_warningf("%s: %s", "fileglob", "bad substitution");
internal_warningf(Tfg_badsubst);
return (0);
}
source = sold;
@ -2520,7 +2520,7 @@ x_bind(const char *a1, const char *a2,
m1 = msg;
while (*c && (size_t)(m1 - msg) < sizeof(msg) - 3)
x_mapout2(*c++, &m1);
bi_errorf("%s: %s", "too long key sequence", msg);
bi_errorf("too long key sequence: %s", msg);
return (1);
}
#ifndef MKSH_SMALL
@ -2544,7 +2544,7 @@ x_bind(const char *a1, const char *a2,
if (!strcmp(x_ftab[f].xf_name, a2))
break;
if (f == NELEM(x_ftab) || x_ftab[f].xf_flags & XF_NOBIND) {
bi_errorf("%s: %s %s", a2, "no such", Tfunction);
bi_errorf("%s: no such function", a2);
return (1);
}
}
@ -5055,7 +5055,7 @@ grabhist(int save, int n)
}
(void)histnum(n);
if ((hptr = *histpos()) == NULL) {
internal_warningf("%s: %s", "grabhist", "bad history array");
internal_warningf("grabhist: bad history array");
return (-1);
}
if (save)

10
eval.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.180 2016/01/19 23:12:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.181 2016/01/21 18:24:38 tg Exp $");
/*
* string expansion
@ -120,7 +120,7 @@ substitute(const char *cp, int f)
s->start = s->str = cp;
source = s;
if (yylex(ONEWORD) != LWORD)
internal_errorf("bad substitution");
internal_errorf(Tbadsubst);
source = sold;
afree(s, ATEMP);
return (evalstr(yylval.cp, f));
@ -382,7 +382,7 @@ expand(
*end = EOS;
str = snptreef(NULL, 64, "%S", beg);
afree(beg, ATEMP);
errorf("%s: %s", str, "bad substitution");
errorf("%s: %s", str, Tbadsubst);
}
if (f & DOBLANK)
doblank++;
@ -1133,7 +1133,7 @@ varsub(Expand *xp, const char *sp, const char *word,
}
}
if (Flag(FNOUNSET) && c == 0 && !zero_ok)
errorf("%s: %s", sp, "parameter not set");
errorf("%s: parameter not set", sp);
/* unqualified variable/string substitution */
*stypep = 0;
xp->str = shf_smprintf("%d", c);
@ -1287,7 +1287,7 @@ varsub(Expand *xp, const char *sp, const char *word,
state = XBASE;
if (Flag(FNOUNSET) && xp->str == null && !zero_ok &&
(ctype(c, C_SUBOP2) || (state != XBASE && c != '+')))
errorf("%s: %s", sp, "parameter not set");
errorf("%s: parameter not set", sp);
return (state);
}

8
exec.c
View File

@ -2,7 +2,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013, 2014, 2015
* 2011, 2012, 2013, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.170 2015/12/31 21:03:47 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.171 2016/01/21 18:24:39 tg Exp $");
#ifndef MKSH_DEFAULT_EXECSHELL
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
@ -1601,7 +1601,7 @@ hereinval(struct ioword *iop, int sub, char **resbuf, struct shf *shf)
s->start = s->str = ccp;
source = s;
if (yylex(sub) != LWORD)
internal_errorf("%s: %s", "herein", "yylex");
internal_errorf("herein: yylex");
source = osource;
ccp = evalstr(yylval.cp, DOSCALAR | DOHEREDOC);
}
@ -1625,7 +1625,7 @@ herein(struct ioword *iop, char **resbuf)
/* ksh -c 'cat <<EOF' can cause this... */
if (iop->heredoc == NULL && !(iop->ioflag & IOHERESTR)) {
warningf(true, "%s missing", "here document");
warningf(true, Tmissinghere);
/* special to iosetup(): don't print error */
return (-2);
}

39
funcs.c
View File

@ -38,7 +38,7 @@
#endif
#endif
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.293 2016/01/20 21:34:11 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.294 2016/01/21 18:24:39 tg Exp $");
#if HAVE_KILLPG
/*
@ -594,9 +594,8 @@ c_whence(const char **wp)
break;
case CALIAS:
if (vflag)
shprintf("n %s%s for ",
(tp->flag & EXPORT) ? "exported " : null,
Talias);
shprintf("n %salias for ",
(tp->flag & EXPORT) ? "exported " : null);
if (!iam_whence && !vflag)
shprintf("%s %s=", Talias, id);
print_value_quoted(shl_stdout, tp->val.s);
@ -988,27 +987,27 @@ c_typeset_vardump(struct tbl *vp, uint32_t flag, int thing, bool pflag,
*/
shprintf("%s %s", Ttypeset, "");
if (((vp->flag & (ARRAY | ASSOC)) == ASSOC))
shprintf("%s ", "-n");
shprintf("-%c ", 'n');
if ((vp->flag & INTEGER))
shprintf("%s ", "-i");
shprintf("-%c ", 'i');
if ((vp->flag & EXPORT))
shprintf("%s ", "-x");
shprintf("-%c ", 'x');
if ((vp->flag & RDONLY))
shprintf("%s ", "-r");
shprintf("-%c ", 'r');
if ((vp->flag & TRACE))
shprintf("%s ", "-t");
shprintf("-%c ", 't');
if ((vp->flag & LJUST))
shprintf("-L%d ", vp->u2.field);
if ((vp->flag & RJUST))
shprintf("-R%d ", vp->u2.field);
if ((vp->flag & ZEROFIL))
shprintf("%s ", "-Z");
shprintf("-%c ", 'Z');
if ((vp->flag & LCASEV))
shprintf("%s ", "-l");
shprintf("-%c ", 'l');
if ((vp->flag & UCASEV_AL))
shprintf("%s ", "-u");
shprintf("-%c ", 'u');
if ((vp->flag & INT_U))
shprintf("%s ", "-U");
shprintf("-%c ", 'U');
} else if (pflag) {
shprintf("%s %s", istset ? Ttypeset :
(flag & EXPORT) ? Texport : Treadonly, "");
@ -1904,7 +1903,7 @@ c_read(const char **wp)
break;
case 'p':
if ((fd = coproc_getfd(R_OK, &ccp)) < 0) {
bi_errorf("%s: %s", "-p", ccp);
bi_errorf("-p: %s", ccp);
return (2);
}
break;
@ -2369,8 +2368,8 @@ c_trap(const char **wp)
i = 0;
while (*wp)
if (!(p = gettrap(*wp++, true, true))) {
warningf(true, "%s: %s '%s'", builtin_argv0,
"bad signal", wp[-1]);
warningf(true, "%s: bad signal '%s'",
builtin_argv0, wp[-1]);
i = 1;
} else
settrap(p, s);
@ -2437,7 +2436,7 @@ c_brkcont(const char **wp)
goto c_brkcont_err;
if (n <= 0) {
/* AT&T ksh does this for non-interactive shells only - weird */
bi_errorf("%s: %s", arg, "bad value");
bi_errorf("%s: bad value", arg);
goto c_brkcont_err;
}
quit = (unsigned int)n;
@ -2458,7 +2457,7 @@ c_brkcont(const char **wp)
* scripts, but don't generate an error (ie, keep going).
*/
if ((unsigned int)n == quit) {
warningf(true, "%s: %s %s", wp[0], "can't", wp[0]);
warningf(true, "%s: can't %s", wp[0], wp[0]);
return (0);
}
/*
@ -2821,8 +2820,8 @@ c_mknod(const char **wp)
umask(oldmode);
return (rv);
c_mknod_usage:
bi_errorf("%s: %s", "usage", "mknod [-m mode] name b|c major minor");
bi_errorf("%s: %s", "usage", "mknod [-m mode] name p");
bi_errorf("usage: mknod [-m mode] name %s", "b|c major minor");
bi_errorf("usage: mknod [-m mode] name %s", "p");
return (1);
}
#endif

View File

@ -27,7 +27,7 @@
#include <sys/file.h>
#endif
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.152 2016/01/14 23:18:08 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.153 2016/01/21 18:24:40 tg Exp $");
Trap sigtraps[ksh_NSIG + 1];
static struct sigaction Sigact_ign;
@ -217,7 +217,7 @@ c_fc(const char **wp)
xp += rep_len;
}
if (!any_subst) {
bi_errorf("bad substitution");
bi_errorf(Tbadsubst);
return (1);
}
len = strlen(s) + 1;

53
jobs.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.117 2016/01/14 23:18:09 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/jobs.c,v 1.118 2016/01/21 18:24:41 tg Exp $");
#if HAVE_KILLPG
#define mksh_killpg killpg
@ -238,11 +238,11 @@ j_suspend(void)
mksh_tcset(tty_fd, &tty_state);
if (restore_ttypgrp >= 0) {
if (tcsetpgrp(tty_fd, restore_ttypgrp) < 0) {
warningf(false, "%s: %s %s: %s", "j_suspend",
"tcsetpgrp", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s",
"j_suspend", "tcsetpgrp", cstrerror(errno));
} else if (setpgid(0, restore_ttypgrp) < 0) {
warningf(false, "%s: %s %s: %s", "j_suspend",
"setpgid", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s",
"j_suspend", "setpgid", cstrerror(errno));
}
}
}
@ -259,12 +259,12 @@ j_suspend(void)
if (ttypgrp_ok) {
if (restore_ttypgrp >= 0) {
if (setpgid(0, kshpid) < 0) {
warningf(false, "%s: %s %s: %s", "j_suspend",
"setpgid", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s",
"j_suspend", "setpgid", cstrerror(errno));
ttypgrp_ok = false;
} else if (tcsetpgrp(tty_fd, kshpid) < 0) {
warningf(false, "%s: %s %s: %s", "j_suspend",
"tcsetpgrp", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s",
"j_suspend", "tcsetpgrp", cstrerror(errno));
ttypgrp_ok = false;
}
}
@ -349,8 +349,8 @@ j_change(void)
pid_t ttypgrp;
if ((ttypgrp = tcgetpgrp(tty_fd)) < 0) {
warningf(false, "%s: %s %s: %s",
"j_init", "tcgetpgrp", "failed",
warningf(false, "%s: %s failed: %s",
"j_init", "tcgetpgrp",
cstrerror(errno));
ttypgrp_ok = false;
break;
@ -365,13 +365,13 @@ j_change(void)
SS_RESTORE_DFL|SS_FORCE);
if (ttypgrp_ok && kshpgrp != kshpid) {
if (setpgid(0, kshpid) < 0) {
warningf(false, "%s: %s %s: %s", "j_init",
"setpgid", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s",
"j_init", "setpgid", cstrerror(errno));
ttypgrp_ok = false;
} else {
if (tcsetpgrp(tty_fd, kshpid) < 0) {
warningf(false, "%s: %s %s: %s",
"j_init", "tcsetpgrp", "failed",
warningf(false, "%s: %s failed: %s",
"j_init", "tcsetpgrp",
cstrerror(errno));
ttypgrp_ok = false;
} else
@ -467,8 +467,7 @@ exchild(struct op *t, int flags,
if (flags & XPIPEI) {
/* continuing with a pipe */
if (!last_job)
internal_errorf("%s %d",
"exchild: XPIPEI and no last_job - pid",
internal_errorf("exchild: XPIPEI and no last_job - pid %d",
(int)procpid);
j = last_job;
if (last_proc)
@ -601,7 +600,7 @@ exchild(struct op *t, int flags,
#ifndef MKSH_SMALL
if (t->type == TPIPE)
unwind(LLEAVE);
internal_warningf("%s: %s", "exchild", "execute() returned");
internal_warningf("%s: execute() returned", "exchild");
fptreef(shl_out, 8, "%s: tried to execute {\n\t%T\n}\n",
"exchild", t);
shf_flush(shl_out);
@ -862,10 +861,10 @@ j_resume(const char *cp, int bg)
if (j->flags & JF_SAVEDTTY)
mksh_tcset(tty_fd, &tty_state);
sigprocmask(SIG_SETMASK, &omask, NULL);
bi_errorf("%s %s(%d, %ld) %s: %s",
"1st", "tcsetpgrp", tty_fd,
bi_errorf("%s %s(%d, %ld) failed: %s",
"fg: 1st", "tcsetpgrp", tty_fd,
(long)((j->flags & JF_SAVEDTTYPGRP) ?
j->saved_ttypgrp : j->pgrp), "failed",
j->saved_ttypgrp : j->pgrp),
cstrerror(rv));
return (1);
}
@ -884,9 +883,9 @@ j_resume(const char *cp, int bg)
if (ttypgrp_ok && (j->flags & JF_SAVEDTTY))
mksh_tcset(tty_fd, &tty_state);
if (ttypgrp_ok && tcsetpgrp(tty_fd, kshpgrp) < 0)
warningf(true, "%s %s(%d, %ld) %s: %s",
warningf(true, "%s %s(%d, %ld) failed: %s",
"fg: 2nd", "tcsetpgrp", tty_fd,
(long)kshpgrp, "failed", cstrerror(errno));
(long)kshpgrp, cstrerror(errno));
}
sigprocmask(SIG_SETMASK, &omask, NULL);
bi_errorf("%s %s: %s", "can't continue job",
@ -1176,9 +1175,9 @@ j_waitj(Job *j,
(j->saved_ttypgrp = tcgetpgrp(tty_fd)) >= 0)
j->flags |= JF_SAVEDTTYPGRP;
if (tcsetpgrp(tty_fd, kshpgrp) < 0)
warningf(true, "%s %s(%d, %ld) %s: %s",
warningf(true, "%s %s(%d, %ld) failed: %s",
"j_waitj:", "tcsetpgrp", tty_fd,
(long)kshpgrp, "failed", cstrerror(errno));
(long)kshpgrp, cstrerror(errno));
if (j->state == PSTOPPED) {
j->flags |= JF_SAVEDTTY;
mksh_tcget(tty_fd, &j->ttystat);
@ -1904,8 +1903,8 @@ tty_init_talking(void)
#endif
break;
case 3:
warningf(false, "%s: %s %s: %s", "j_ttyinit",
"dup of tty fd", "failed", cstrerror(errno));
warningf(false, "%s: %s failed: %s", "j_ttyinit",
"dup of tty fd", cstrerror(errno));
break;
case 4:
warningf(false, "%s: %s: %s", "j_ttyinit",

4
lex.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.218 2016/01/20 21:34:12 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.219 2016/01/21 18:24:41 tg Exp $");
/*
* states while lexing word
@ -1173,7 +1173,7 @@ readhere(struct ioword *iop)
while (c != '\n') {
if (!c)
/* oops, reached EOF */
yyerror("%s '%s' unclosed\n", "here document", eof);
yyerror("%s '%s' unclosed\n", Theredoc, eof);
/* store character */
Xcheck(xs, xp);
Xput(xs, xp, c);

10
main.c
View File

@ -5,7 +5,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013, 2014, 2015
* 2011, 2012, 2013, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.306 2015/10/09 21:36:57 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.307 2016/01/21 18:24:42 tg Exp $");
extern char **environ;
@ -435,7 +435,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
} else if (Flag(FCOMMAND)) {
s = pushs(SSTRINGCMDLINE, ATEMP);
if (!(s->start = s->str = argv[argi++]))
errorf("%s %s", "-c", "requires an argument");
errorf("-c %s", "requires an argument");
while (*s->str) {
if (*s->str != ' ' && ctype(*s->str, C_QUOTE))
break;
@ -708,7 +708,7 @@ include(const char *name, int argc, const char **argv, bool intr_ok)
unwind(i);
/* NOTREACHED */
default:
internal_errorf("%s %d", "include", i);
internal_errorf("include %d", i);
/* NOTREACHED */
}
}
@ -800,7 +800,7 @@ shell(Source * volatile s, volatile bool toplevel)
default:
source = old_source;
quitenv(NULL);
internal_errorf("%s %d", "shell", i);
internal_errorf("shell %d", i);
/* NOTREACHED */
}
while (/* CONSTCOND */ 1) {

6
misc.c
View File

@ -3,7 +3,7 @@
/*-
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
* 2011, 2012, 2013, 2014, 2015
* 2011, 2012, 2013, 2014, 2015, 2016
* mirabilos <m@mirbsd.org>
*
* Provided that these terms and disclaimer and all copyright notices
@ -30,7 +30,7 @@
#include <grp.h>
#endif
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.240 2015/10/09 16:11:17 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.241 2016/01/21 18:24:43 tg Exp $");
#define KSH_CHVT_FLAG
#ifdef MKSH_SMALL
@ -1873,7 +1873,7 @@ c_cd(const char **wp)
* we don't
*/
if ((cp = strstr(current_wd, wp[0])) == NULL) {
bi_errorf("bad substitution");
bi_errorf(Tbadsubst);
return (2);
}
/*-

22
sh.h
View File

@ -175,9 +175,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.757 2016/01/20 21:34:13 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.760 2016/01/21 19:58:13 tg Exp $");
#endif
#define MKSH_VERSION "R52 2016/01/20"
#define MKSH_VERSION "R52 2016/01/21"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES
@ -578,7 +578,7 @@ char *ucstrstr(char *, const char *);
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
#endif
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 521)
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 522)
#error Must run Build.sh to compile this.
extern void thiswillneverbedefinedIhope(void);
int
@ -831,13 +831,15 @@ EXTERN struct {
#define OF_FIRSTTIME 0x10 /* as early as possible, once */
#define OF_ANY (OF_CMDLINE | OF_SET | OF_SPECIAL | OF_INTERNAL)
/* trust GCC to have string pooling; -Wformat bitches otherwise */
/*XXX TODO: make this with a .gen file plus not imake-style */
/* null value for variable; comparison pointer for unset */
EXTERN char null[] E_INIT("");
/* helpers for string pooling */
EXTERN const char Tintovfl[] E_INIT("integer overflow %zu %c %zu prevented");
EXTERN const char Toomem[] E_INIT("can't allocate %zu data bytes");
#if defined(__GNUC__)
/* trust this to have string pooling; -Wformat bitches otherwise */
#define Tsynerr "syntax error"
#else
EXTERN const char Tsynerr[] E_INIT("syntax error");
@ -866,6 +868,18 @@ EXTERN const char T_function[] E_INIT(" function");
#define Tfunction (T_function + 1) /* "function" */
EXTERN const char T_funny_command[] E_INIT("funny $() command");
#define Tcommand (T_funny_command + 10) /* "command" */
#if defined(__GNUC__)
#define Tfg_badsubst "fileglob: bad substitution"
#else
EXTERN const char Tfg_badsubst[] E_INIT("fileglob: bad substitution");
#endif
#define Tbadsubst (Tfg_badsubst + 10) /* "bad substitution" */
#if defined(__GNUC__)
#define Tmissinghere "missing here document"
#else
EXTERN const char Tmissinghere[] E_INIT("missing here document");
#endif
#define Theredoc (Tmissinghere + 8) /* "here document" */
EXTERN const char TC_LEX1[] E_INIT("|&;<>() \t\n");
#define TC_IFSWS (TC_LEX1 + 7) /* space tab newline */

10
syn.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.109 2016/01/19 23:12:15 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.110 2016/01/21 18:24:44 tg Exp $");
struct nesting_state {
int start_token; /* token than began nesting (eg, FOR) */
@ -447,8 +447,8 @@ get_command(int cf)
t = newtp((c == FOR) ? TFOR : TSELECT);
musthave(LWORD, CMDASN);
if (!is_wdvarname(yylval.cp, true))
yyerror("%s: %s\n", c == FOR ? "for" : Tselect,
"bad identifier");
yyerror("%s: bad identifier\n",
c == FOR ? "for" : Tselect);
strdupx(t->str, ident, ATEMP);
nesting_push(&old_nesting, c);
t->vars = wordlist();
@ -705,7 +705,7 @@ function_body(char *name,
*/
for (p = sname; *p; p++)
if (ctype(*p, C_QUOTE))
yyerror("%s: %s\n", sname, "invalid function name");
yyerror("%s: invalid function name\n", sname);
/*
* Note that POSIX allows only compound statements after foo(),
@ -872,7 +872,7 @@ syntaxerr(const char *what)
goto Again;
}
/* don't quote the EOF */
yyerror("%s: %s %s\n", Tsynerr, "unexpected", "EOF");
yyerror("%s: unexpected EOF\n", Tsynerr);
/* NOTREACHED */
case LWORD:

4
tree.c
View File

@ -23,7 +23,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.80 2016/01/14 22:30:43 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/tree.c,v 1.81 2016/01/21 18:24:45 tg Exp $");
#define INDENT 8
@ -1095,7 +1095,7 @@ dumptree(struct shf *shf, struct op *t)
goto dumpleftandout;
OPEN(TFUNCT)
shf_fprintf(shf, " str<%s> ksh<%s>", t->str,
t->u.ksh_func ? "yes" : "no");
t->u.ksh_func ? "true" : "false");
goto dumpleftandout;
OPEN(TTIME)
goto dumpleftandout;

4
var.c
View File

@ -28,7 +28,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.197 2016/01/14 22:49:33 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.198 2016/01/21 18:24:45 tg Exp $");
/*-
* Variables
@ -241,7 +241,7 @@ global(const char *n)
c = (unsigned char)vn[0];
if (!ksh_isalphx(c)) {
if (array)
errorf("bad substitution");
errorf(Tbadsubst);
vp = &vtemp;
vp->flag = DEFINED;
vp->type = 0;