aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils
diff options
context:
space:
mode:
authorMark Geisert <mark@maxrnd.com>2021-08-02 02:25:53 -0700
committerCorinna Vinschen <corinna@vinschen.de>2021-08-03 10:00:56 +0200
commit99a4b087d41b71ccb2d39900c74ef4b8cf0320fc (patch)
tree172034f2c937f58cdd2add0314da6b199335cf87 /winsup/utils
parent15c53a34bc944346fde129700a020647095b1b7d (diff)
downloadnewlib-99a4b087d41b71ccb2d39900c74ef4b8cf0320fc.zip
newlib-99a4b087d41b71ccb2d39900c74ef4b8cf0320fc.tar.gz
newlib-99a4b087d41b71ccb2d39900c74ef4b8cf0320fc.tar.bz2
Cygwin: Make gmondump conform to its doc + adjust doc
The doc for gmondump says 1 or more FILENAME are expected, but 0 is handled. That's an oversight. Make invocation with 0 FILENAMEs print a one-line help message. Reword the beginning of profiler's description doc to clarify target's child processes are run but only optionally profiled.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/gmondump.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/winsup/utils/gmondump.c b/winsup/utils/gmondump.c
index e469f01..ec9db05 100644
--- a/winsup/utils/gmondump.c
+++ b/winsup/utils/gmondump.c
@@ -46,6 +46,14 @@ OPTIONS are:\n\
exit (where == stderr ? 1 : 0 );
}
+void __attribute__ ((__noreturn__))
+usage1 (FILE *where)
+{
+ fprintf (where, "Usage: %s [OPTIONS] FILENAME...\n", pgm);
+
+ exit (where == stderr ? 1 : 0 );
+}
+
void
note (const char *fmt, ...)
{
@@ -248,6 +256,10 @@ main(int argc, char **argv)
;
}
+ if (optind >= argc)
+ /* Print one-line help and exit. */
+ usage1 (ofile);
+
for (int i = optind; i < argc; i++)
gmondump1 (argv[i]);