string pooling, and more consistent look for error messages
This commit is contained in:
4
expr.c
4
expr.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.92 2017/04/02 15:00:42 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.93 2017/04/02 16:47:41 tg Exp $");
|
||||||
|
|
||||||
#define EXPRTOK_DEFNS
|
#define EXPRTOK_DEFNS
|
||||||
#include "exprtok.h"
|
#include "exprtok.h"
|
||||||
@ -203,7 +203,7 @@ evalerr(Expr_state *es, enum error_type type, const char *str)
|
|||||||
|
|
||||||
case ET_BADLIT:
|
case ET_BADLIT:
|
||||||
warningf(true, Tf_sD_s_qs, es->expression,
|
warningf(true, Tf_sD_s_qs, es->expression,
|
||||||
"bad number", str);
|
Tbadnum, str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ET_RECURSIVE:
|
case ET_RECURSIVE:
|
||||||
|
8
funcs.c
8
funcs.c
@ -38,7 +38,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.333 2017/04/02 15:51:19 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.334 2017/04/02 16:47:41 tg Exp $");
|
||||||
|
|
||||||
#if HAVE_KILLPG
|
#if HAVE_KILLPG
|
||||||
/*
|
/*
|
||||||
@ -73,7 +73,7 @@ bi_getn(const char *as, int *ai)
|
|||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
if (!(rv = getn(as, ai)))
|
if (!(rv = getn(as, ai)))
|
||||||
bi_errorf(Tf_sD_s, as, "bad number");
|
bi_errorf(Tf_sD_s, Tbadnum, as);
|
||||||
return (rv);
|
return (rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1345,7 +1345,7 @@ c_shift(const char **wp)
|
|||||||
/* nothing to do */
|
/* nothing to do */
|
||||||
return (0);
|
return (0);
|
||||||
} else if (n < 0) {
|
} else if (n < 0) {
|
||||||
bi_errorf(Tf_sD_s, arg, "bad number");
|
bi_errorf(Tf_sD_s, Tbadnum, arg);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (l->argc < n) {
|
if (l->argc < n) {
|
||||||
@ -1406,7 +1406,7 @@ c_umask(const char **wp)
|
|||||||
++cp;
|
++cp;
|
||||||
}
|
}
|
||||||
if (*cp) {
|
if (*cp) {
|
||||||
bi_errorf("bad number");
|
bi_errorf(Tbadnum);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
9
sh.h
9
sh.h
@ -175,9 +175,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.801 2017/04/02 15:00:44 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.802 2017/04/02 16:47:42 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R54 2017/03/25"
|
#define MKSH_VERSION "R54 2017/04/02"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@ -873,6 +873,7 @@ EXTERN const char Taugo[] E_INIT("augo");
|
|||||||
EXTERN const char Tbracket[] E_INIT("[");
|
EXTERN const char Tbracket[] E_INIT("[");
|
||||||
#define Tdot (Tsgdot + 2)
|
#define Tdot (Tsgdot + 2)
|
||||||
#define Talias (Tunalias + 2)
|
#define Talias (Tunalias + 2)
|
||||||
|
EXTERN const char Tbadnum[] E_INIT("bad number");
|
||||||
#define Tbadsubst (Tfg_badsubst + 10)
|
#define Tbadsubst (Tfg_badsubst + 10)
|
||||||
EXTERN const char Tbg[] E_INIT("bg");
|
EXTERN const char Tbg[] E_INIT("bg");
|
||||||
EXTERN const char Tbad_bsize[] E_INIT("bad shf/buf/bsize");
|
EXTERN const char Tbad_bsize[] E_INIT("bad shf/buf/bsize");
|
||||||
@ -1021,6 +1022,7 @@ EXTERN const char T_devtty[] E_INIT("/dev/tty");
|
|||||||
#define Tbracket "["
|
#define Tbracket "["
|
||||||
#define Tdot "."
|
#define Tdot "."
|
||||||
#define Talias "alias"
|
#define Talias "alias"
|
||||||
|
#define Tbadnum "bad number"
|
||||||
#define Tbadsubst "bad substitution"
|
#define Tbadsubst "bad substitution"
|
||||||
#define Tbg "bg"
|
#define Tbg "bg"
|
||||||
#define Tbad_bsize "bad shf/buf/bsize"
|
#define Tbad_bsize "bad shf/buf/bsize"
|
||||||
@ -1473,7 +1475,7 @@ struct tbl {
|
|||||||
};
|
};
|
||||||
|
|
||||||
EXTERN struct tbl *vtemp;
|
EXTERN struct tbl *vtemp;
|
||||||
/* set by global() and local() */
|
/* set by isglobal(), global() and local() */
|
||||||
EXTERN bool last_lookup_was_array;
|
EXTERN bool last_lookup_was_array;
|
||||||
|
|
||||||
/* common flag bits */
|
/* common flag bits */
|
||||||
@ -2341,6 +2343,7 @@ void popblock(void);
|
|||||||
void initvar(void);
|
void initvar(void);
|
||||||
struct block *varsearch(struct block *, struct tbl **, const char *, uint32_t);
|
struct block *varsearch(struct block *, struct tbl **, const char *, uint32_t);
|
||||||
struct tbl *global(const char *);
|
struct tbl *global(const char *);
|
||||||
|
struct tbl *isglobal(const char *, bool);
|
||||||
struct tbl *local(const char *, bool);
|
struct tbl *local(const char *, bool);
|
||||||
char *str_val(struct tbl *);
|
char *str_val(struct tbl *);
|
||||||
int setstr(struct tbl *, const char *, int);
|
int setstr(struct tbl *, const char *, int);
|
||||||
|
6
var.c
6
var.c
@ -28,7 +28,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.213 2017/04/02 16:25:23 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.214 2017/04/02 16:47:43 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -1359,7 +1359,7 @@ setspec(struct tbl *vp)
|
|||||||
if (getint(vp, &num, false) == -1) {
|
if (getint(vp, &num, false) == -1) {
|
||||||
s = str_val(vp);
|
s = str_val(vp);
|
||||||
if (st != V_RANDOM)
|
if (st != V_RANDOM)
|
||||||
errorf(Tf_sD_sD_s, vp->name, "bad number", s);
|
errorf(Tf_sD_sD_s, vp->name, Tbadnum, s);
|
||||||
num.u = hash(s);
|
num.u = hash(s);
|
||||||
}
|
}
|
||||||
vp->flag |= SPECIAL;
|
vp->flag |= SPECIAL;
|
||||||
@ -1917,7 +1917,7 @@ c_typeset(const char **wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (fieldstr && !getn(fieldstr, &field)) {
|
if (fieldstr && !getn(fieldstr, &field)) {
|
||||||
bi_errorf(Tf_sD_s, "bad number", fieldstr);
|
bi_errorf(Tf_sD_s, Tbadnum, fieldstr);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
if (basestr) {
|
if (basestr) {
|
||||||
|
Reference in New Issue
Block a user