Revision: 55558
          http://sourceforge.net/p/brlcad/code/55558
Author:   carlmoore
Date:     2013-05-23 18:37:17 +0000 (Thu, 23 May 2013)
Log Message:
-----------
implement -h, -?

Modified Paths:
--------------
    brlcad/trunk/src/sig/bw-d.c

Modified: brlcad/trunk/src/sig/bw-d.c
===================================================================
--- brlcad/trunk/src/sig/bw-d.c 2013-05-23 16:22:16 UTC (rev 55557)
+++ brlcad/trunk/src/sig/bw-d.c 2013-05-23 18:37:17 UTC (rev 55558)
@@ -40,6 +40,11 @@
 unsigned char  ibuf[512];
 double obuf[512];
 
+void
+printusage(void)
+{
+       bu_exit(1, "Usage: bw-d [-n || scale] < unsigned_chars > doubles\n");
+}
 
 int main(int argc, char **argv)
 {
@@ -47,6 +52,9 @@
     double     scale;
     size_t ret;
 
+    if ( BU_STR_EQUAL( argv[1], "-h" ) || BU_STR_EQUAL( argv[1], "-?" ) )
+       printusage();
+
     scale = 1.0;
 
     if ( argc > 1 ) {
@@ -57,9 +65,8 @@
        argc--;
     }
 
-    if ( argc > 1 || ZERO(scale) || isatty(fileno(stdin)) ) {
-       bu_exit(1, "Usage: bw-d [-n || scale] < unsigned_chars > doubles\n");
-    }
+    if ( argc > 1 || ZERO(scale) || isatty(fileno(stdin)) )
+       printusage();
 
     while ( (num = fread( &ibuf[0], sizeof( ibuf[0] ), 512, stdin)) > 0 ) {
        if ( EQUAL(scale, 1.0) ) {

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


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to