Revision: 64369
          http://sourceforge.net/p/brlcad/code/64369
Author:   carlmoore
Date:     2015-03-11 20:40:55 +0000 (Wed, 11 Mar 2015)
Log Message:
-----------
implement run-with-no-arguments-gets-help; we don't expect the input or output 
to be user-readable

Modified Paths:
--------------
    brlcad/trunk/src/util/plot3-hpgl.c

Modified: brlcad/trunk/src/util/plot3-hpgl.c
===================================================================
--- brlcad/trunk/src/util/plot3-hpgl.c  2015-03-11 16:51:28 UTC (rev 64368)
+++ brlcad/trunk/src/util/plot3-hpgl.c  2015-03-11 20:40:55 UTC (rev 64369)
@@ -32,6 +32,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include "bio.h"
 
 #include "bu/log.h"
 #include "bu/str.h"
@@ -42,6 +43,10 @@
 #define geti(x) { (x) = getchar(); (x) |= (short)(getchar()<<8); }
 #define getb(x)        ((x) = getchar())
 
+void printusage (const char *name)
+{
+       bu_exit(1, "Usage: %s < infile > outfile\n", name);
+}
 
 int
 main(int argc, char **argv)
@@ -51,9 +56,13 @@
     int c, i, x, y, x1, x2, y1, y2, r, g, b;
 
     if (argc != 1) {
-       bu_exit(1, "Usage: %s < infile > outfile\n", argv[0]);
+       printusage(argv[0]);
     }
 
+    if (isatty(fileno(stdin)) || isatty(fileno(stdout))) {
+       printusage(argv[0]);
+    }
+
     getb(c);
     do {
        switch (c) {

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


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to