Revision: 55124
http://brlcad.svn.sourceforge.net/brlcad/?rev=55124&view=rev
Author: carlmoore
Date: 2013-04-11 20:32:07 +0000 (Thu, 11 Apr 2013)
Log Message:
-----------
use av[0]; provide for no-argument case (program continues running) and -?;
shift 'make sure..' comment; reverse sense of '!bu_file_exists (looked stupid
before the change
Modified Paths:
--------------
brlcad/trunk/src/shapes/coil.c
Modified: brlcad/trunk/src/shapes/coil.c
===================================================================
--- brlcad/trunk/src/shapes/coil.c 2013-04-11 19:31:58 UTC (rev 55123)
+++ brlcad/trunk/src/shapes/coil.c 2013-04-11 20:32:07 UTC (rev 55124)
@@ -335,6 +335,10 @@
bu_opterr = 0;
+ if (argc == 1) {
+ usage();
+ bu_log(" Program continues running:\n");
+ }
while ((c=bu_getopt(argc, argv, options)) != -1) {
switch (c) {
case 'd' :
@@ -388,6 +392,9 @@
}
BU_LIST_INSERT(&(*sections), &((*coil_data).l));
break;
+ case '?':
+ usage();
+ break;
default:
/* since c (bu_getopt() return value) holds '?',
* instead print bu_optopt global which holds the
@@ -443,7 +450,7 @@
}
if (mean_outer_diameter < 0 || wire_diameter < 0 || helix_angle < 0 ||
pitch < 0 || nt < 0 || start_cap_type < 0 || end_cap_type < 0)
- bu_exit(1, "ERROR: negative value in one or more arguments supplied
to coil");
+ bu_exit(1, "%s: negative value in one or more arguments supplied to
coil\n",av[0]);
if (ZERO(wire_diameter) && ZERO(mean_outer_diameter)) {
mean_outer_diameter = 1000;
@@ -540,18 +547,18 @@
}
}
- /* make sure file doesn't already exist and opens for writing */
if (av[bu_optind]) {
filename = av[bu_optind];
} else {
filename = DEFAULT_COIL_FILENAME;
}
- if (!bu_file_exists(filename, NULL)) {
- bu_exit(2, "ERROR: refusing to overwrite pre-existing file %s",
filename);
+/* make sure file doesn't already exist and opens for writing */
+ if (bu_file_exists(filename, NULL)) {
+ bu_exit(2, "%s: refusing to overwrite pre-existing file
%s\n",av[0],filename);
}
db_fp = wdb_fopen(filename);
if (!db_fp) {
- bu_exit(2, "ERROR: unable to open %s for writing", filename);
+ bu_exit(2, "%s: unable to open %s for writing\n",av[0],filename);
}
/* do it. */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits