Revision: 55662
          http://sourceforge.net/p/brlcad/code/55662
Author:   carlmoore
Date:     2013-06-04 14:59:42 +0000 (Tue, 04 Jun 2013)
Log Message:
-----------
remove verbose flag and reference to 'mode'; implement -h, -?

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

Modified: brlcad/trunk/src/sig/dstats.c
===================================================================
--- brlcad/trunk/src/sig/dstats.c       2013-06-04 14:51:13 UTC (rev 55661)
+++ brlcad/trunk/src/sig/dstats.c       2013-06-04 14:59:42 UTC (rev 55662)
@@ -36,9 +36,11 @@
 #define IBUFSIZE 1024          /* Max read size */
 double buf[IBUFSIZE];          /* Input buffer */
 
-int verbose = 0;
+void printusage (void)
+{
+       bu_exit(1, "Usage: dstats [file.doubles]\n");
+}
 
-
 int main(int ac, char *av[])
 {
     int i, n;
@@ -49,15 +51,13 @@
     double mean, var;
     FILE *fp;
 
-    /* check for verbose flag */
-    if (ac > 1 && BU_STR_EQUAL(av[1], "-v")) {
-       verbose++;
-       av++;
-       ac--;
-    }
+    if ( ac == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)) )
+       printusage();
 
-    /* look for optional input file */
+    /* look for optional input file, after checking for -h and -? */
     if (ac > 1) {
+       if ( BU_STR_EQUAL(av[1], "-h") ||  BU_STR_EQUAL(av[1], "-?") )
+           printusage();
        if ((fp = fopen(av[1], "r")) == 0) {
            bu_exit(1, "dstats: can't open \"%s\"\n", av[1]);
        }
@@ -66,13 +66,8 @@
     } else
        fp = stdin;
 
-    /* check usage */
-    if (ac > 1 || isatty(fileno(fp))) {
-       bu_exit(1, "Usage: dstats [-v] [file.doubles]\n");
-    }
-
     /*
-     * Find sum, min, max, mode.
+     * Find sum, min, max.
      */
     num_values = 0;
     sum = sum2 = 0;

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


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to