Revision: 55760
          http://sourceforge.net/p/brlcad/code/55760
Author:   carlmoore
Date:     2013-06-13 19:01:06 +0000 (Thu, 13 Jun 2013)
Log Message:
-----------
change old h option to H; implement h,? help; run-with-no-arguments too but 
'Program continues running'

Modified Paths:
--------------
    brlcad/trunk/src/fb/fbcmrot.c

Modified: brlcad/trunk/src/fb/fbcmrot.c
===================================================================
--- brlcad/trunk/src/fb/fbcmrot.c       2013-06-13 18:57:43 UTC (rev 55759)
+++ brlcad/trunk/src/fb/fbcmrot.c       2013-06-13 19:01:06 UTC (rev 55760)
@@ -50,16 +50,16 @@
 FBIO *fbp;
 
 static char usage[] = "\
-Usage: fbcmrot [-h] [-i increment] steps_per_second\n";
+Usage: fbcmrot [-i increment] steps_per_second\n";
 
 int
 get_args(int argc, char **argv)
 {
     int c;
 
-    while ((c = bu_getopt(argc, argv, "hi:")) != -1) {
+    while ((c = bu_getopt(argc, argv, "Hi:h?")) != -1) {
        switch (c) {
-           case 'h':
+           case 'H':
                /* high-res */
                size = 1024;
                break;
@@ -73,10 +73,8 @@
        }
     }
 
-    if (bu_optind >= argc) {
-       /* no fps specified */
-       fps = 0;
-    } else {
+       /* if bu_optind >= argc , then no fps specified (and stays 0) */
+    if (bu_optind < argc) {
        fps = atof(argv[bu_optind]);
        if (NEAR_ZERO(fps, VDIVIDE_TOL))
            onestep++;
@@ -88,6 +86,11 @@
     return 1;          /* OK */
 }
 
+void
+printusage(void)
+{
+       (void)fputs(usage, stderr);
+}
 
 int
 main(int argc, char **argv)
@@ -95,8 +98,13 @@
     int i;
     struct timeval tv;
 
+    if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout))) {
+       printusage();
+       fprintf(stderr, "       Program continues running:\n");
+    }
+       
     if (!get_args(argc, argv)) {
-       (void)fputs(usage, stderr);
+       printusage();
        bu_exit(1, NULL);
     }
 

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


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to