Revision: 57013
http://sourceforge.net/p/brlcad/code/57013
Author: brlcad
Date: 2013-08-21 03:44:11 +0000 (Wed, 21 Aug 2013)
Log Message:
-----------
bu_log() instead of fprintf(stderr where we're already using bu_log() elsewhere
in the file. also make all the globals static as application code tends to
migrate to libraries over time.
Modified Paths:
--------------
brlcad/trunk/src/util/dsp_add.c
Modified: brlcad/trunk/src/util/dsp_add.c
===================================================================
--- brlcad/trunk/src/util/dsp_add.c 2013-08-21 03:40:13 UTC (rev 57012)
+++ brlcad/trunk/src/util/dsp_add.c 2013-08-21 03:44:11 UTC (rev 57013)
@@ -37,9 +37,9 @@
/* declarations to support use of bu_getopt() system call */
-const char optstring[] = "h?";
-const char progname[] = "dsp_add";
-const char usage[] = "Usage: %s dsp_1 dsp_2 > dsp_3\n";
+static const char optstring[] = "h?";
+static const char progname[] = "dsp_add";
+static const char usage[] = "Usage: %s dsp_1 dsp_2 > dsp_3\n";
/* purpose: combine two dsp files
*
@@ -58,8 +58,9 @@
#define ADD_STYLE_INT 0
#define ADD_STYLE_FLOAT 1
-int style = ADD_STYLE_INT;
+static int style = ADD_STYLE_INT;
+
/*
* tell user how to invoke this program, then exit
*/
@@ -68,7 +69,7 @@
{
if (s) (void)fputs(s, stderr);
- (void)fprintf(stderr, usage, progname);
+ bu_log(usage, progname);
bu_exit (1, NULL);
}
@@ -80,7 +81,6 @@
parse_args(int ac, char *av[])
{
int c;
- char *strrchr(const char *, int);
/* get all the option flags from the command line */
while ((c = bu_getopt(ac, av, optstring)) != -1)
@@ -193,7 +193,6 @@
if (next_arg >= ac)
print_usage("No files specified\n");
-
/* Open the files */
in1 = fopen(av[next_arg], "r");
@@ -248,7 +247,6 @@
perror("fread");
fclose(in2);
-
/* Convert from network to host format */
in_cookie = bu_cv_cookie("nus");
out_cookie = bu_cv_cookie("hus");
@@ -259,18 +257,14 @@
swap_bytes(buf2, count);
}
-
/* add the two datasets together */
-
switch (style) {
case ADD_STYLE_FLOAT : add_float(buf1, buf2, count); break;
case ADD_STYLE_INT : add_int(buf1, buf2, count); break;
- default : fprintf(stderr,
- "Error: Unknown add style\n");
+ default : bu_log("Error: Unknown add style\n");
break;
}
-
/* convert back to network format & write out */
if (conv) {
swap_bytes(buf1, count);
@@ -278,7 +272,7 @@
}
if (fwrite(buf1, sizeof(short), count, stdout) != count) {
- fprintf(stderr, "Error writing data\n");
+ bu_log("Error writing data\n");
return -1;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and
AppDynamics. Performance Central is your source for news, insights,
analysis and resources for efficient Application Performance Management.
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits