OSDN Git Service

* strace.cc (main): Add a '-b' option.
authorcgf <cgf>
Sat, 28 Oct 2000 00:21:41 +0000 (00:21 +0000)
committercgf <cgf>
Sat, 28 Oct 2000 00:21:41 +0000 (00:21 +0000)
winsup/utils/ChangeLog
winsup/utils/strace.cc

index ccecec9..8896bcb 100644 (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>
 
        * ssp.c: new
index 2806721..334a148 100644 (file)
@@ -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;