* strace.cc (main): Add a '-b' option.

This commit is contained in:
Christopher Faylor 2000-10-28 00:21:41 +00:00
parent a5cc215f75
commit 3c952fed3f
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,7 @@
Fri Oct 27 20:20:29 2000 Christopher Faylor <cgf@cygnus.com>
* strace.cc (main): Add a '-b' option.
2000-10-18 DJ Delorie <dj@redhat.com> 2000-10-18 DJ Delorie <dj@redhat.com>
* ssp.c: new * ssp.c: new

View File

@ -23,6 +23,7 @@ static int numerror = 1;
static int usecs = 1; static int usecs = 1;
static int delta = 1; static int delta = 1;
static int hhmmss = 0; static int hhmmss = 0;
static int bufsize = 0;
static BOOL close_handle (HANDLE h, DWORD ok); static BOOL close_handle (HANDLE h, DWORD ok);
@ -492,7 +493,8 @@ handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
child->last_usecs = usecs; child->last_usecs = usecs;
if (numerror || !output_winerror (ofile, s)) if (numerror || !output_winerror (ofile, s))
fputs (s, ofile); fputs (s, ofile);
fflush (ofile); if (!bufsize)
fflush (ofile);
} }
static void static void
@ -575,12 +577,15 @@ main(int argc, char **argv)
else else
pgm++; pgm++;
while ((opt = getopt (argc, argv, "m:o:fndut")) != EOF) while ((opt = getopt (argc, argv, "b:m:o:fndut")) != EOF)
switch (opt) switch (opt)
{ {
case 'f': case 'f':
forkdebug ^= 1; forkdebug ^= 1;
break; break;
case 'b':
bufsize = atoi (optarg);
break;
case 'm': case 'm':
mask = strtoul (optarg, NULL, 16); mask = strtoul (optarg, NULL, 16);
break; break;
@ -607,6 +612,9 @@ main(int argc, char **argv)
if (!mask) if (!mask)
mask = 1; mask = 1;
if (bufsize)
setvbuf (ofile, (char *) alloca (bufsize), _IOFBF, bufsize);
if (!ofile) if (!ofile)
ofile = stdout; ofile = stdout;