Revision: 56988
          http://sourceforge.net/p/brlcad/code/56988
Author:   tbrowder2
Date:     2013-08-20 13:12:11 +0000 (Tue, 20 Aug 2013)
Log Message:
-----------
prep for auto-man page; simplify usage; hardwire progname

Modified Paths:
--------------
    brlcad/trunk/src/sig/ustats.c

Modified: brlcad/trunk/src/sig/ustats.c
===================================================================
--- brlcad/trunk/src/sig/ustats.c       2013-08-20 13:05:48 UTC (rev 56987)
+++ brlcad/trunk/src/sig/ustats.c       2013-08-20 13:12:11 UTC (rev 56988)
@@ -33,21 +33,11 @@
 
 #include "bu.h"
 
+static const char usage[]     = "Usage: %s [ file ]\n";
+static const char optstring[] = "h?";
+static const char progname[]  = "ustats";
 
-char *options = "h";
-char *progname = "(noname)";
-
 /*
- * U S A G E --- tell user how to invoke this program, then exit
- */
-void
-usage(void)
-{
-    bu_exit(1, "Usage: %s [ file ]\n", progname);
-}
-
-
-/*
  * P A R S E _ A R G S --- Parse through command line flags
  */
 int
@@ -55,19 +45,17 @@
 {
     int c;
 
-    if (!(progname=strrchr(*av, '/')))
-       progname = *av;
-
     /* Turn off bu_getopt's error messages */
     bu_opterr = 0;
 
     /* get all the option flags from the command line */
-    while ((c=bu_getopt(ac, av, options)) != -1)
+    while ((c = bu_getopt(ac, av, optstring)) != -1)
        switch (c) {
            case '?':
            case 'h':
            default:
-               usage(); break;
+               bu_exit(1, usage, progname);
+               break;
        }
 
     return bu_optind;
@@ -133,7 +121,7 @@
        }
        bu_free(ifname, "ifname alloc from bu_realpath");
     } else if (isatty((int)fileno(stdin))) {
-       usage();
+       bu_exit(1, usage, progname);
     }
 
     comp_stats(stdin);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to