Revision: 55661
          http://sourceforge.net/p/brlcad/code/55661
Author:   carlmoore
Date:     2013-06-04 14:51:13 +0000 (Tue, 04 Jun 2013)
Log Message:
-----------
implement -h and -?, and 'Program continues running:' for no-arguments help

Modified Paths:
--------------
    brlcad/trunk/src/util/dunncolor.c

Modified: brlcad/trunk/src/util/dunncolor.c
===================================================================
--- brlcad/trunk/src/util/dunncolor.c   2013-06-04 13:48:45 UTC (rev 55660)
+++ brlcad/trunk/src/util/dunncolor.c   2013-06-04 14:51:13 UTC (rev 55661)
@@ -28,7 +28,7 @@
 
 #include "common.h"
 
-#include <stdio.h>
+#include "bio.h"
 #include <string.h>
 #include <stdlib.h>
 
@@ -44,15 +44,23 @@
 extern void getexposure(char *title);
 extern int dunnsend(char color, int val);
 
+static char usage[] = "Usage: dunncolor [-p] baseval redval greenval blueval";
 
 int
 main(int argc, char **argv)
 {
 
+    if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)) ) {
+       fprintf(stderr,"%s\n",usage);
+       fprintf(stderr,"       Program continues running:\n");
+    }
+    else if ( BU_STR_EQUAL(argv[1], "-h") ||  BU_STR_EQUAL(argv[1], "-?") )
+       bu_exit(25, "%s\n", usage);
+
     dunnopen();
 
     if (!ready(5)) {
-       bu_exit(50, "dunncolor:  camera not ready\n");
+       bu_exit(50, "dunncolor: camera not ready\n");
     }
 
     if (argc > 2 && BU_STR_EQUAL(argv[1], "-p")) {
@@ -67,7 +75,7 @@
 
     /* check argument */
     if (argc != 5 && argc != 6) {
-       bu_exit(25, "Usage: dunncolor [-p] baseval redval greenval blueval\n");
+       bu_exit(25, "%s\n", usage);
     }
 
     dunnsend('A', atoi(*++argv));

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