• fix one more of the enum arithmetics complaints
• split Xinit into XinitN and Xinit macro, the former not initialising the “xp” argument of the latter, and use this to get rid of two variables that are only assigned but never referenced (gcc doesn’t see this, but MIPSpro and IIRC SUNWcc do) • re-indent while here • bump patchlevel
This commit is contained in:
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.162 2008/03/25 21:34:44 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.163 2008/03/28 13:46:51 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 $
|
||||
@ -7,7 +7,7 @@
|
||||
# http://www.research.att.com/~gsf/public/ifs.sh
|
||||
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R33 2008/03/25
|
||||
@(#)MIRBSD KSH R33 2008/03/28
|
||||
description:
|
||||
Check version of shell.
|
||||
category: pdksh
|
||||
|
11
funcs.c
11
funcs.c
@ -5,7 +5,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.70 2008/03/28 13:28:33 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/funcs.c,v 1.71 2008/03/28 13:46:52 tg Exp $");
|
||||
|
||||
/* A leading = means assignments before command are kept;
|
||||
* a leading * means a POSIX special builtin;
|
||||
@ -136,7 +136,6 @@ c_cd(const char **wp)
|
||||
int rval;
|
||||
struct tbl *pwd_s, *oldpwd_s;
|
||||
XString xs;
|
||||
char *xp;
|
||||
char *dir, *try, *pwd;
|
||||
int phys_path;
|
||||
char *cdpath;
|
||||
@ -215,11 +214,7 @@ c_cd(const char **wp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
Xinit(xs, xp, PATH_MAX, ATEMP);
|
||||
/* xp will have a bogus value after make_path() - set it to 0
|
||||
* so that if it's used, it will cause a dump
|
||||
*/
|
||||
xp = NULL;
|
||||
XinitN(xs, PATH_MAX, ATEMP);
|
||||
|
||||
cdpath = str_val(global("CDPATH"));
|
||||
do {
|
||||
@ -2808,7 +2803,7 @@ test_primary(Test_env *te, int do_eval)
|
||||
(*te->error)(te, 0, "expression expected");
|
||||
return 0;
|
||||
}
|
||||
if ((op = (*te->isa)(te, TM_BINOP))) {
|
||||
if ((op = (*te->isa)(te, TM_BINOP)) != TO_NONOP) {
|
||||
/* binary expression */
|
||||
opnd2 = (*te->getopnd)(te, op, do_eval);
|
||||
if (!opnd2) {
|
||||
|
9
lex.c
9
lex.c
@ -2,7 +2,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.56 2008/03/05 16:49:22 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.57 2008/03/28 13:46:53 tg Exp $");
|
||||
|
||||
/*
|
||||
* states while lexing word
|
||||
@ -1022,10 +1022,9 @@ pushs(int type, Area *areap)
|
||||
s->flags = 0;
|
||||
s->next = NULL;
|
||||
s->areap = areap;
|
||||
if (type == SFILE || type == SSTDIN) {
|
||||
char *dummy;
|
||||
Xinit(s->xs, dummy, 256, s->areap);
|
||||
} else
|
||||
if (type == SFILE || type == SSTDIN)
|
||||
XinitN(s->xs, 256, s->areap);
|
||||
else
|
||||
memset(&s->xs, 0, sizeof(s->xs));
|
||||
return s;
|
||||
}
|
||||
|
21
sh.h
21
sh.h
@ -8,8 +8,8 @@
|
||||
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
|
||||
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
|
||||
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.198 2008/03/25 21:34:45 tg Exp $"
|
||||
#define MKSH_VERSION "R33 2008/03/25"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.199 2008/03/28 13:46:53 tg Exp $"
|
||||
#define MKSH_VERSION "R33 2008/03/28"
|
||||
|
||||
#if HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
@ -1018,12 +1018,15 @@ typedef struct XString {
|
||||
typedef char *XStringP;
|
||||
|
||||
/* initialise expandable string */
|
||||
#define Xinit(xs, xp, length, area) do { \
|
||||
(xs).len = length; \
|
||||
#define XinitN(xs, length, area) do { \
|
||||
(xs).len = (length); \
|
||||
(xs).areap = (area); \
|
||||
(xs).beg = alloc((xs).len + X_EXTRA, (xs).areap); \
|
||||
(xs).end = (xs).beg + (xs).len; \
|
||||
xp = (xs).beg; \
|
||||
} while (0)
|
||||
#define Xinit(xs, xp, length, area) do { \
|
||||
XinitN((xs), (length), (area)); \
|
||||
(xp) = (xs).beg; \
|
||||
} while (0)
|
||||
|
||||
/* stuff char into string */
|
||||
@ -1033,11 +1036,11 @@ typedef char *XStringP;
|
||||
#define XcheckN(xs, xp, n) do { \
|
||||
int more = ((xp) + (n)) - (xs).end; \
|
||||
if (more > 0) \
|
||||
xp = Xcheck_grow_(&xs, xp, more); \
|
||||
(xp) = Xcheck_grow_(&(xs), (xp), more); \
|
||||
} while (0)
|
||||
|
||||
/* check for overflow, expand string */
|
||||
#define Xcheck(xs, xp) XcheckN(xs, xp, 1)
|
||||
#define Xcheck(xs, xp) XcheckN((xs), (xp), 1)
|
||||
|
||||
/* free string */
|
||||
#define Xfree(xs, xp) afree((void*)(xs).beg, (xs).areap)
|
||||
@ -1067,9 +1070,9 @@ typedef struct XPtrV {
|
||||
|
||||
#define XPinit(x, n) do { \
|
||||
void **vp__; \
|
||||
vp__ = (void**) alloc(sizeofN(void*, n), ATEMP); \
|
||||
vp__ = (void**) alloc(sizeofN(void*, (n)), ATEMP); \
|
||||
(x).cur = (x).beg = vp__; \
|
||||
(x).end = vp__ + n; \
|
||||
(x).end = vp__ + (n); \
|
||||
} while (0)
|
||||
|
||||
#define XPput(x, p) do { \
|
||||
|
Reference in New Issue
Block a user