streamline some error messages
This commit is contained in:
parent
e52d30ac2e
commit
bcde17a8fc
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.769 2017/04/03 02:08:57 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.770 2017/04/06 00:41:38 tg Exp $
|
||||
# -*- mode: sh -*-
|
||||
#-
|
||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
@ -7607,7 +7607,7 @@ expected-stdout:
|
||||
After error 2
|
||||
Exit trap
|
||||
expected-stderr-pattern:
|
||||
/syntax error: 'newline' unexpected/
|
||||
/syntax error: unexpected 'newline'/
|
||||
---
|
||||
name: test-stlt-1
|
||||
description:
|
||||
|
7
lex.c
7
lex.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.232 2017/03/26 00:10:24 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.233 2017/04/06 00:41:41 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -885,7 +885,7 @@ yylex(int cf)
|
||||
Xcheck(ws, wp);
|
||||
if (statep != &states[1])
|
||||
/* XXX figure out what is missing */
|
||||
yyerror("no closing quote\n");
|
||||
yyerror("no closing quote");
|
||||
|
||||
/* This done to avoid tests for SHEREDELIM wherever SBASE tested */
|
||||
if (state == SHEREDELIM)
|
||||
@ -1203,6 +1203,7 @@ yyerror(const char *fmt, ...)
|
||||
error_prefix(true);
|
||||
va_start(va, fmt);
|
||||
shf_vfprintf(shl_out, fmt, va);
|
||||
shf_putc('\n', shl_out);
|
||||
va_end(va);
|
||||
errorfz();
|
||||
}
|
||||
@ -1624,7 +1625,7 @@ get_brace_var(XString *wsp, char *wp)
|
||||
char *tmp, *p;
|
||||
|
||||
if (!arraysub(&tmp))
|
||||
yyerror("missing ]\n");
|
||||
yyerror("missing ]");
|
||||
*wp++ = c;
|
||||
for (p = tmp; *p; ) {
|
||||
Xcheck(*wsp, wp);
|
||||
|
14
sh.h
14
sh.h
@ -175,7 +175,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.802 2017/04/02 16:47:42 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.803 2017/04/06 00:41:42 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R54 2017/04/02"
|
||||
|
||||
@ -913,10 +913,11 @@ EXTERN const char T_funny_command[] E_INIT("funny $()-command");
|
||||
EXTERN const char Tgetopts[] E_INIT("getopts");
|
||||
#define Thistory (Tnot_in_history + 7)
|
||||
EXTERN const char Tintovfl[] E_INIT("integer overflow %zu %c %zu prevented");
|
||||
EXTERN const char Tinvname[] E_INIT("%s: invalid %s name");
|
||||
EXTERN const char Tjobs[] E_INIT("jobs");
|
||||
EXTERN const char Tjob_not_started[] E_INIT("job not started");
|
||||
EXTERN const char Tmksh[] E_INIT("mksh");
|
||||
EXTERN const char Tname[] E_INIT("name");
|
||||
#define Tname (Tinvname + 15)
|
||||
EXTERN const char Tno_args[] E_INIT("missing argument");
|
||||
EXTERN const char Tno_OLDPWD[] E_INIT("no OLDPWD");
|
||||
EXTERN const char Tnot_ident[] E_INIT("is not an identifier");
|
||||
@ -980,7 +981,7 @@ EXTERN const char Tf_szs[] E_INIT("%s: %zd %s");
|
||||
EXTERN const char Tf_parm[] E_INIT("%s: parameter not set");
|
||||
EXTERN const char Tf_coproc[] E_INIT("-p: %s");
|
||||
EXTERN const char Tf_cant[] E_INIT("can't %s %s: %s");
|
||||
EXTERN const char Tf_heredoc[] E_INIT("here document '%s' unclosed\n");
|
||||
EXTERN const char Tf_heredoc[] E_INIT("here document '%s' unclosed");
|
||||
#if HAVE_MKNOD
|
||||
EXTERN const char Tf_nonnum[] E_INIT("non-numeric %s %s '%s'");
|
||||
#endif
|
||||
@ -992,7 +993,7 @@ EXTERN const char Tf_ldfailed[] E_INIT("%s %s(%d, %ld) failed: %s");
|
||||
#define Tf_ss (Tf_sss + 2)
|
||||
EXTERN const char Tf_sss[] E_INIT("%s%s%s");
|
||||
EXTERN const char Tf_sD_s_sD_s[] E_INIT("%s: %s %s: %s");
|
||||
EXTERN const char Tf_toomany[] E_INIT("too many %ss\n");
|
||||
EXTERN const char Tf_toomany[] E_INIT("too many %ss");
|
||||
EXTERN const char Tf_sd[] E_INIT("%s %d");
|
||||
#define Tf_s (Tf_temp + 28)
|
||||
EXTERN const char Tft_end[] E_INIT("%;");
|
||||
@ -1062,6 +1063,7 @@ EXTERN const char T_devtty[] E_INIT("/dev/tty");
|
||||
#define Tgetopts "getopts"
|
||||
#define Thistory "history"
|
||||
#define Tintovfl "integer overflow %zu %c %zu prevented"
|
||||
#define Tinvname "%s: invalid %s name"
|
||||
#define Tjobs "jobs"
|
||||
#define Tjob_not_started "job not started"
|
||||
#define Tmksh "mksh"
|
||||
@ -1129,7 +1131,7 @@ EXTERN const char T_devtty[] E_INIT("/dev/tty");
|
||||
#define Tf_parm "%s: parameter not set"
|
||||
#define Tf_coproc "-p: %s"
|
||||
#define Tf_cant "can't %s %s: %s"
|
||||
#define Tf_heredoc "here document '%s' unclosed\n"
|
||||
#define Tf_heredoc "here document '%s' unclosed"
|
||||
#if HAVE_MKNOD
|
||||
#define Tf_nonnum "non-numeric %s %s '%s'"
|
||||
#endif
|
||||
@ -1141,7 +1143,7 @@ EXTERN const char T_devtty[] E_INIT("/dev/tty");
|
||||
#define Tf_ss "%s%s"
|
||||
#define Tf_sss "%s%s%s"
|
||||
#define Tf_sD_s_sD_s "%s: %s %s: %s"
|
||||
#define Tf_toomany "too many %ss\n"
|
||||
#define Tf_toomany "too many %ss"
|
||||
#define Tf_sd "%s %d"
|
||||
#define Tf_s "%s"
|
||||
#define Tft_end "%;"
|
||||
|
10
syn.c
10
syn.c
@ -23,7 +23,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.118 2017/03/19 20:59:29 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.119 2017/04/06 00:41:42 tg Exp $");
|
||||
|
||||
struct nesting_state {
|
||||
int start_token; /* token than began nesting (eg, FOR) */
|
||||
@ -444,7 +444,7 @@ get_command(int cf)
|
||||
t = newtp((c == FOR) ? TFOR : TSELECT);
|
||||
musthave(LWORD, CMDASN);
|
||||
if (!is_wdvarname(yylval.cp, true))
|
||||
yyerror("%s: bad identifier\n",
|
||||
yyerror("%s: bad identifier",
|
||||
c == FOR ? "for" : Tselect);
|
||||
strdupx(t->str, ident, ATEMP);
|
||||
nesting_push(&old_nesting, c);
|
||||
@ -702,7 +702,7 @@ function_body(char *name,
|
||||
*/
|
||||
for (p = sname; *p; p++)
|
||||
if (ctype(*p, C_QUOTE))
|
||||
yyerror("%s: invalid function name\n", sname);
|
||||
yyerror(Tinvname, sname, Tfunction);
|
||||
|
||||
/*
|
||||
* Note that POSIX allows only compound statements after foo(),
|
||||
@ -869,7 +869,7 @@ syntaxerr(const char *what)
|
||||
goto Again;
|
||||
}
|
||||
/* don't quote the EOF */
|
||||
yyerror("%s: unexpected EOF\n", Tsynerr);
|
||||
yyerror("%s: unexpected EOF", Tsynerr);
|
||||
/* NOTREACHED */
|
||||
|
||||
case LWORD:
|
||||
@ -896,7 +896,7 @@ syntaxerr(const char *what)
|
||||
s = redir;
|
||||
}
|
||||
}
|
||||
yyerror("%s: '%s' %s\n", Tsynerr, s, what);
|
||||
yyerror(Tf_sD_s_qs, Tsynerr, what, s);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
x
Reference in New Issue
Block a user