Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-10-28 04:21:41 +0400
committerChristopher Faylor <me@cgf.cx>2000-10-28 04:21:41 +0400
commit3c952fed3fecfe6aec09d07a5cbad293970da0a0 (patch)
tree5bd5ad093cec4780b27b064350f4c84975f8ed09 /winsup/utils/strace.cc
parenta5cc215f7582ab15d07a6fb5c92d0492ea986188 (diff)
* strace.cc (main): Add a '-b' option.
Diffstat (limited to 'winsup/utils/strace.cc')
-rw-r--r--winsup/utils/strace.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 28067214b..334a148d5 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
@@ -23,6 +23,7 @@ static int numerror = 1;
static int usecs = 1;
static int delta = 1;
static int hhmmss = 0;
+static int bufsize = 0;
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;
if (numerror || !output_winerror (ofile, s))
fputs (s, ofile);
- fflush (ofile);
+ if (!bufsize)
+ fflush (ofile);
}
static void
@@ -575,12 +577,15 @@ main(int argc, char **argv)
else
pgm++;
- while ((opt = getopt (argc, argv, "m:o:fndut")) != EOF)
+ while ((opt = getopt (argc, argv, "b:m:o:fndut")) != EOF)
switch (opt)
{
case 'f':
forkdebug ^= 1;
break;
+ case 'b':
+ bufsize = atoi (optarg);
+ break;
case 'm':
mask = strtoul (optarg, NULL, 16);
break;
@@ -607,6 +612,9 @@ main(int argc, char **argv)
if (!mask)
mask = 1;
+ if (bufsize)
+ setvbuf (ofile, (char *) alloca (bufsize), _IOFBF, bufsize);
+
if (!ofile)
ofile = stdout;