#define REGISTER register
-/*#define MSHDEBUG 1*/
+#define MSHDEBUG 1
#ifdef MSHDEBUG
int mshdbg = 0;
};
#ifdef MSHDEBUG
+void print_t(struct op *t);
void print_t(struct op *t)
{
- DBGPRINTF(("T: t=0x%x, type %s, words=0x%x, IOword=0x%x\n", t,
- T_CMD_NAMES[t->type], t->words, t->ioact));
+ DBGPRINTF(("T: t=%p, type %s, words=%p, IOword=%p\n", t,
+ T_CMD_NAMES[t->type], t->words, t->ioact));
if (t->words) {
DBGPRINTF(("T: W1: %s", t->words[0]));
return;
}
+void print_tree(struct op *head);
void print_tree(struct op *head)
{
if (head == NULL) {
return;
}
- DBGPRINTF(("NODE: 0x%x, left 0x%x, right 0x%x\n", head, head->left,
+ DBGPRINTF(("NODE: %p, left %p, right %p\n", head, head->left,
head->right));
if (head->left)
char *name, **ap;
int (*iof) (struct ioarg *);
- DBGPRINTF(("MSH_MAIN: argc %d, environ 0x%x\n", argc, environ));
+ DBGPRINTF(("MSH_MAIN: argc %d, environ %p\n", argc, environ));
initarea();
if ((ap = environ) != NULL) {
}
setval(lookup("#"), putn((--dolc < 0) ? (dolc = 0) : dolc));
- DBGPRINTF(("MSH_MAIN: begin FOR loop, interactive %d, e.iop 0x%x, iostack 0x%x\n", interactive, e.iop, iostack));
+ DBGPRINTF(("MSH_MAIN: begin FOR loop, interactive %d, e.iop %p, iostack %p\n", interactive, e.iop, iostack));
for (;;) {
if (interactive && e.iop <= iostack) {
if (head->words == NULL)
return (NULL);
- DBGPRINTF5(("SCANTREE: checking node 0x%x\n", head));
+ DBGPRINTF5(("SCANTREE: checking node %p\n", head));
if ((head->type != TDOT) && (strcmp(".", head->words[0]) == 0)) {
- DBGPRINTF5(("SCANTREE: dot found in node 0x%x\n", head));
+ DBGPRINTF5(("SCANTREE: dot found in node %p\n", head));
return (head);
}
REGISTER int i;
jmp_buf m1;
- DBGPRINTF(("ONECOMMAND: enter, outtree=0x%x\n", outtree));
+ DBGPRINTF(("ONECOMMAND: enter, outtree=%p\n", outtree));
while (e.oenv)
quitenv();
execflg = 0;
if (!flag['n']) {
- DBGPRINTF(("ONECOMMAND: calling execute, t=outtree=0x%x\n",
+ DBGPRINTF(("ONECOMMAND: calling execute, t=outtree=%p\n",
outtree));
execute(outtree, NOPIPE, NOPIPE, 0);
}
REGISTER struct env *ep;
REGISTER int fd;
- DBGPRINTF(("QUITENV: e.oenv=0x%x\n", e.oenv));
+ DBGPRINTF(("QUITENV: e.oenv=%p\n", e.oenv));
if ((ep = e.oenv) != NULL) {
fd = e.iofd;
t = command(cf);
- DBGPRINTF9(("PIPELINE: t=0x%x\n", t));
+ DBGPRINTF9(("PIPELINE: t=%p\n", t));
if (t != NULL) {
while ((c = yylex(0)) == '|') {
peeksym = c;
}
- DBGPRINTF7(("PIPELINE: returning t=0x%x\n", t));
+ DBGPRINTF7(("PIPELINE: returning t=%p\n", t));
return (t);
}
t = pipeline(0);
- DBGPRINTF9(("ANDOR: t=0x%x\n", t));
+ DBGPRINTF9(("ANDOR: t=%p\n", t));
if (t != NULL) {
while ((c = yylex(0)) == LOGAND || c == LOGOR) {
peeksym = c;
}
- DBGPRINTF7(("ANDOR: returning t=0x%x\n", t));
+ DBGPRINTF7(("ANDOR: returning t=%p\n", t));
return (t);
}
peeksym = c;
}
/* IF */
- DBGPRINTF7(("C_LIST: returning t=0x%x\n", t));
+ DBGPRINTF7(("C_LIST: returning t=%p\n", t));
return (t);
}
t = namelist(t);
iolist = iosave;
- DBGPRINTF(("COMMAND: returning 0x%x\n", t));
+ DBGPRINTF(("COMMAND: returning %p\n", t));
return (t);
}
t = c_list();
multiline--;
t = block(type, t, NOBLOCK, NOWORDS);
- DBGPRINTF(("DOWHOLEFILE: return t=0x%x\n", t));
+ DBGPRINTF(("DOWHOLEFILE: return t=%p\n", t));
return (t);
}
t = list(t, casepart());
}
- DBGPRINTF(("CASELIST, returning t=0x%x\n", t));
+ DBGPRINTF(("CASELIST, returning t=%p\n", t));
return (t);
}
if ((peeksym = yylex(CONTIN)) != ESAC)
musthave(BREAK, CONTIN);
- DBGPRINTF7(("CASEPART: made newtp(TPAT, t=0x%x)\n", t));
+ DBGPRINTF7(("CASEPART: made newtp(TPAT, t=%p)\n", t));
return (t);
}
static struct op *list(t1, t2)
REGISTER struct op *t1, *t2;
{
- DBGPRINTF7(("LIST: enter, t1=0x%x, t2=0x%x\n", t1, t2));
+ DBGPRINTF7(("LIST: enter, t1=%p, t2=%p\n", t1, t2));
if (t1 == NULL)
return (t2);
t->right = t2;
t->words = wp;
- DBGPRINTF7(("BLOCK: inserted 0x%x between 0x%x and 0x%x\n", t, t1,
+ DBGPRINTF7(("BLOCK: inserted %p between %p and %p\n", t, t1,
t2));
return (t);
t->right = NULL;
t->str = NULL;
- DBGPRINTF3(("NEWTP: allocated 0x%x\n", t));
+ DBGPRINTF3(("NEWTP: allocated %p\n", t));
return (t);
}
REGISTER struct op *t;
{
- DBGPRINTF7(("NAMELIST: enter, t=0x%x, type %s, iolist=0x%x\n", t,
+ DBGPRINTF7(("NAMELIST: enter, t=%p, type %s, iolist=%p\n", t,
T_CMD_NAMES[t->type], iolist));
if (iolist) {
return (0);
}
- DBGPRINTF(("EXECUTE: t=0x%x, t->type=%d (%s), t->words is %s\n", t,
+ DBGPRINTF(("EXECUTE: t=%p, t->type=%d (%s), t->words is %s\n", t,
t->type, T_CMD_NAMES[t->type],
((t->words == NULL) ? "NULL" : t->words[0])));
/* Hard to know how many words there are, be careful of garbage pointer values */
/* They are likely to cause "PCI bus fault" errors */
#if 0
- DBGPRINTF(("EXECUTE: t->left=0x%x, t->right=0x%x, t->words[1] is %s\n",
+ DBGPRINTF(("EXECUTE: t->left=%p, t->right=%p, t->words[1] is %s\n",
t->left, t->right,
((t->words[1] == NULL) ? "NULL" : t->words[1])));
DBGPRINTF7(("EXECUTE: t->words[2] is %s, t->words[3] is %s\n",
((cp == NULL) ? "NULL" : cp)));
if ((t1 = findcase(t->left, cp)) != NULL) {
- DBGPRINTF7(("EXECUTE: TCASE, calling execute(t=0x%x, t1=0x%x)...\n", t, t1));
+ DBGPRINTF7(("EXECUTE: TCASE, calling execute(t=%p, t1=%p)...\n", t, t1));
rv = execute(t1, pin, pout, 0);
- DBGPRINTF7(("EXECUTE: TCASE, back from execute(t=0x%x, t1=0x%x)...\n", t, t1));
+ DBGPRINTF7(("EXECUTE: TCASE, back from execute(t=%p, t1=%p)...\n", t, t1));
}
break;
runtrap(i);
}
- DBGPRINTF(("EXECUTE: returning from t=0x%x, rv=%d\n", t, rv));
+ DBGPRINTF(("EXECUTE: returning from t=%p, rv=%d\n", t, rv));
return (rv);
}
(void) &owp;
#endif
- DBGPRINTF(("FORKEXEC: t=0x%x, pin 0x%x, pout 0x%x, act %d\n", t, pin,
+ DBGPRINTF(("FORKEXEC: t=%p, pin %p, pout %p, act %d\n", t, pin,
pout, act));
DBGPRINTF7(("FORKEXEC: t->words is %s\n",
((t->words == NULL) ? "NULL" : t->words[0])));
/* strip all initial assignments */
/* not correct wrt PATH=yyy command etc */
if (flag['x']) {
- DBGPRINTF9(("FORKEXEC: echo'ing, cp=0x%x, wp=0x%x, owp=0x%x\n",
+ DBGPRINTF9(("FORKEXEC: echo'ing, cp=%p, wp=%p, owp=%p\n",
cp, wp, owp));
echo(cp ? wp : owp);
}
((t->words == NULL) ? "NULL" : t->words[0]),
((t->words == NULL) ? "NULL" : t->words[1])));
#endif
- DBGPRINTF(("FORKEXEC: shcom 0x%x, f&FEXEC 0x%x, owp 0x%x\n", shcom,
+ DBGPRINTF(("FORKEXEC: shcom %p, f&FEXEC 0x%x, owp %p\n", shcom,
f & FEXEC, owp));
if (shcom == NULL && (f & FEXEC) == 0) {
}
/* Must be the child process, pid should be 0 */
- DBGPRINTF(("FORKEXEC: child process, shcom=0x%x\n", shcom));
+ DBGPRINTF(("FORKEXEC: child process, shcom=%p\n", shcom));
if (interactive) {
signal(SIGINT, SIG_IGN);
REGISTER int u = -1;
char *cp = NULL, *msg;
- DBGPRINTF(("IOSETUP: iop 0x%x, pipein 0x%x, pipeout 0x%x\n", iop,
+ DBGPRINTF(("IOSETUP: iop %p, pipein %i, pipeout %i\n", iop,
pipein, pipeout));
if (iop->io_unit == IODEFAULT) /* take default */
if (t->type == TLIST) {
if ((tp = find1case(t->left, w)) != NULL) {
- DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=0x%x\n", tp));
+ DBGPRINTF3(("FIND1CASE: found one to the left, returning tp=%p\n", tp));
return (tp);
}
t1 = t->right; /* TPAT */
for (wp = t1->words; *wp;)
if ((cp = evalstr(*wp++, DOSUB)) && gmatch(w, cp)) {
- DBGPRINTF3(("FIND1CASE: returning &t1->left= 0x%x.\n",
+ DBGPRINTF3(("FIND1CASE: returning &t1->left= %p.\n",
&t1->left));
return (&t1->left);
}
}
#endif
- DBGPRINTF(("REXECVE: c=0x%x, v=0x%x, envp=0x%x\n", c, v, envp));
+ DBGPRINTF(("REXECVE: c=%p, v=%p, envp=%p\n", c, v, envp));
sp = any('/', c) ? "" : path->value;
asis = *sp == '\0';
(void) &rv;
#endif
- DBGPRINTF(("RUN: enter, areanum %d, outtree 0x%x, failpt 0x%x\n",
+ DBGPRINTF(("RUN: enter, areanum %d, outtree %p, failpt %p\n",
areanum, outtree, failpt));
areanum++;
char *cp;
int maltmp;
- DBGPRINTF(("DODOT: enter, t=0x%x, tleft 0x%x, tright 0x%x, e.linep is %s\n", t, t->left, t->right, ((e.linep == NULL) ? "NULL" : e.linep)));
+ DBGPRINTF(("DODOT: enter, t=%p, tleft %p, tright %p, e.linep is %s\n", t, t->left, t->right, ((e.linep == NULL) ? "NULL" : e.linep)));
if ((cp = t->words[1]) == NULL) {
DBGPRINTF(("DODOT: bad args, ret 0\n"));
if ((cp = t->words[1]) != NULL)
setstatus(getn(cp));
- DBGPRINTF(("DOEXIT: calling leave(), t=0x%x\n", t));
+ DBGPRINTF(("DOEXIT: calling leave(), t=%p\n", t));
leave();
/* NOTREACHED */
static void rdexp(char **wp, void (*f) (struct var *), int key)
{
- DBGPRINTF6(("RDEXP: enter, wp=0x%x, func=0x%x, key=%d\n", wp, f, key));
+ DBGPRINTF6(("RDEXP: enter, wp=%p, func=%p, key=%d\n", wp, f, key));
DBGPRINTF6(("RDEXP: *wp=%s\n", *wp));
if (*wp != NULL) {
{
struct wdblock *wb;
- DBGPRINTF6(("EVALSTR: enter, cp=0x%x, f=%d\n", cp, f));
+ DBGPRINTF6(("EVALSTR: enter, cp=%p, f=%d\n", cp, f));
wb = NULL;
if (expand(cp, &wb, f)) {
while ((i = vfork()) == -1 && errno == EAGAIN);
- DBGPRINTF3(("GRAVE: i is %d\n", io));
+ DBGPRINTF3(("GRAVE: i is %p\n", io));
if (i < 0) {
closepipe(pf);
{
REGISTER int c;
- RCPRINTF(("READC: e.iop 0x%x, e.iobase 0x%x\n", e.iop, e.iobase));
+ RCPRINTF(("READC: e.iop %p, e.iobase %p\n", e.iop, e.iobase));
for (; e.iop >= e.iobase; e.iop--) {
- RCPRINTF(("READC: e.iop 0x%x, peekc 0x%x\n", e.iop, e.iop->peekc));
+ RCPRINTF(("READC: e.iop %p, peekc 0x%x\n", e.iop, e.iop->peekc));
if ((c = e.iop->peekc) != '\0') {
e.iop->peekc = 0;
return (c);
} /* FOR */
if (e.iop >= iostack) {
- RCPRINTF(("READC: return 0, e.iop 0x%x\n", e.iop));
+ RCPRINTF(("READC: return 0, e.iop %p\n", e.iop));
return (0);
}
static void pushio(struct ioarg *argp, int (*fn) (struct ioarg *))
{
- DBGPRINTF(("PUSHIO: argp 0x%x, argp->afid 0x%x, e.iop 0x%x\n", argp,
+ DBGPRINTF(("PUSHIO: argp %p, argp->afid 0x%x, e.iop %p\n", argp,
argp->afid, e.iop));
/* Set env ptr for io source to next array spot and check for array overflow */
e.iop->argp->afid = bufid; /* assign buffer id */
}
- DBGPRINTF(("PUSHIO: iostack 0x%x, e.iop 0x%x, afbuf 0x%x\n",
+ DBGPRINTF(("PUSHIO: iostack %p, e.iop %p, afbuf %p\n",
iostack, e.iop, e.iop->argp->afbuf));
- DBGPRINTF(("PUSHIO: mbuf 0x%x, sbuf 0x%x, bid %d, e.iop 0x%x\n",
+ DBGPRINTF(("PUSHIO: mbuf %p, sbuf %p, bid %d, e.iop %p\n",
&mainbuf, &sharedbuf, bufid, e.iop));
}
{
REGISTER int c;
- DBGPRINTF3(("QGRAVECHAR: enter, ap=0x%x, iop=0x%x\n", ap, iop));
+ DBGPRINTF3(("QGRAVECHAR: enter, ap=%p, iop=%p\n", ap, iop));
if (iop->xchar) {
if (iop->nlcount) {
{
REGISTER struct here *h, *lh;
- DBGPRINTF7(("MARKHERE: enter, s=0x%x\n", s));
+ DBGPRINTF7(("MARKHERE: enter, s=%p\n", s));
h = (struct here *) space(sizeof(struct here));
if (h == 0)
char myline[LINELIM + 1];
char *thenext;
- DBGPRINTF7(("READHERE: enter, name=0x%x, s=0x%x\n", name, s));
+ DBGPRINTF7(("READHERE: enter, name=%p, s=%p\n", name, s));
tf = mkstemp(tname);
if (tf < 0)