On Fri, 10 Jul 2009, Denys Vlasenko wrote:
> On Monday 06 July 2009 23:37, Cristian Ionescu-Idbohrn wrote:
> > 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",
>
> Please send it as a patch.
Done.
Cheers,
--
Cristian
diff --git a/shell/ash.c b/shell/ash.c
index 9b40ca3..027dc7c 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -251,7 +251,7 @@ static void trace_vprintf(const char *fmt, va_list va);
# define close(fd) do { \
int dfd = (fd); \
if (close(dfd) < 0) \
- bb_error_msg("bug on %d: closing %d(%x)", \
+ bb_error_msg("bug on %d: closing %d(0x%x)", \
__LINE__, dfd, dfd); \
} while (0)
#else
@@ -997,7 +997,7 @@ static void
showtree(union node *n)
{
trace_puts("showtree called\n");
- shtree(n, 1, NULL, stdout);
+ shtree(n, 1, NULL, stderr);
}
#endif /* DEBUG */
@@ -3987,7 +3987,7 @@ showjobs(FILE *out, int mode)
{
struct job *jp;
- TRACE(("showjobs(%x) called\n", mode));
+ TRACE(("showjobs(0x%x) called\n", mode));
/* Handle all finished jobs */
while (dowait(DOWAIT_NONBLOCK, NULL) > 0)
@@ -4048,7 +4048,7 @@ getstatus(struct job *job)
}
retval += 128;
}
- TRACE(("getstatus: job %d, nproc %d, status %x, retval %x\n",
+ TRACE(("getstatus: job %d, nproc %d, status 0x%x, retval 0x%x\n",
jobno(job), job->nprocs, status, retval));
return retval;
}
@@ -8496,7 +8496,7 @@ poplocalvars(void)
while ((lvp = localvars) != NULL) {
localvars = lvp->next;
vp = lvp->vp;
- TRACE(("poplocalvar %s", vp ? vp->text : "-"));
+ TRACE(("poplocalvar %s\n", vp ? vp->text : "-"));
if (vp == NULL) { /* $- saved */
memcpy(optlist, lvp->text, sizeof(optlist));
free((char*)lvp->text);
@@ -9348,7 +9348,7 @@ preadfd(void)
* 2) If an EOF was pushed back (g_parsefile->left_in_line < -BIGNUM)
* or we are reading from a string so we can't refill the buffer,
* return EOF.
- * 3) If the is more stuff in this buffer, use it else call read to fill it.
+ * 3) If there is more stuff in this buffer, use it else call read to fill it.
* 4) Process input up to the next newline, deleting nul characters.
*/
//#define pgetc_debug(...) bb_error_msg(__VA_ARGS__)
@@ -11843,8 +11843,9 @@ cmdloop(int top)
#endif
}
n = parsecmd(inter);
-#if DEBUG
- showtree(n);
+#if DEBUG > 2
+ if (debug && (n != NEOF))
+ showtree(n);
#endif
if (n == NEOF) {
if (!top || numeof >= 50)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox