shell/ash.c

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Mon Jul 6 21:37:23 UTC 2009


Somewhere around line 1000.  I don't think we want shtree to output to
stdout, do we? That would break a few things, and it does.  We might want
it to go to stderr or tracefile, but defintely not stdout.

---8<---
static void
showtree(union node *n)
{
	trace_puts("showtree called\n");
	shtree(n, 1, NULL, stdout);
}

#endif /* DEBUG */
--->8---

And somewhere around line 11847:

---8<---
#if DEBUG
		showtree(n);
#endif
--->8---

We might want to do this instead:

#if DEBUG > 2
		if (debug && (n != NEOF))
			showtree(n);
#endif

Without checking on 'debug', we always get output from showtree.  I don't
think we want that.
Without '(n != NEOF)' we may get segfaults.
And 'DEBUG > 2' could be a good idea too.  What do you say?

The other thing is that there are a few places where %x should read 0x%x,
maybe; at least for consistancy:

->	254:	bb_error_msg("bug on %d: closing %d(%x)", \
	3821:	TRACE(("dowait(0x%x) called\n", wait_flags));
	3828:	TRACE(("wait returns pid=%d, status=0x%x, errno=%d(%s)\n",
	3846:					"from 0x%x to 0x%x\n",
->	3990:	TRACE(("showjobs(%x) called\n", mode));
->	4051:	TRACE(("getstatus: job %d, nproc %d, status %x, retval %x\n",
	5632:	TRACE(("evalbackcmd done: fd=%d buf=0x%x nleft=%d jp=0x%x\n",


Cheers,

-- 
Cristian


More information about the busybox mailing list