about summary refs log tree commit diff
path: root/debug/pcprofiledump.c
diff options
context:
space:
mode:
Diffstat (limited to 'debug/pcprofiledump.c')
-rw-r--r--debug/pcprofiledump.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/debug/pcprofiledump.c b/debug/pcprofiledump.c
index 858fed2b85..6d3a2c7354 100644
--- a/debug/pcprofiledump.c
+++ b/debug/pcprofiledump.c
@@ -1,5 +1,5 @@
 /* Dump information generated by PC profiling.
-   Copyright (C) 1999 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
 
@@ -18,7 +18,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* This is mainly and example.  It shows how programs which want to use
+/* This is mainly an example.  It shows how programs which want to use
    the information should read the file.  */
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -49,6 +49,7 @@
 /* Definitions of arguments for argp functions.  */
 static const struct argp_option options[] =
 {
+  { "unbuffered", 'u', NULL, 0, N_("Don't buffer output") },
   { NULL, 0, NULL, 0, NULL }
 };
 
@@ -61,10 +62,13 @@ static const char args_doc[] = N_("[FILE]");
 /* Function to print some extra text in the help message.  */
 static char *more_help (int key, const char *text, void *input);
 
+/* Prototype for option handler.  */
+static error_t parse_opt (int key, char *arg, struct argp_state *state);
+
 /* Data structure to communicate with argp functions.  */
 static struct argp argp =
 {
-  options, NULL, args_doc, doc, NULL, more_help
+  options, parse_opt, args_doc, doc, NULL, more_help
 };
 
 
@@ -171,6 +175,20 @@ main (int argc, char *argv[])
   return 0;
 }
 
+static error_t
+parse_opt (int key, char *arg, struct argp_state *state)
+{
+  switch (key)
+    {
+    case 'u':
+      setbuf (stdout, NULL);
+      break;
+    default:
+      return ARGP_ERR_UNKNOWN;
+    }
+  return 0;
+}
+
 static char *
 more_help (int key, const char *text, void *input)
 {