Revision: 57235
http://sourceforge.net/p/brlcad/code/57235
Author: tbrowder2
Date: 2013-08-28 20:09:54 +0000 (Wed, 28 Aug 2013)
Log Message:
-----------
use const chars for arg choices
Modified Paths:
--------------
brlcad/trunk/src/libged/attr.c
Modified: brlcad/trunk/src/libged/attr.c
===================================================================
--- brlcad/trunk/src/libged/attr.c 2013-08-28 20:05:46 UTC (rev 57234)
+++ brlcad/trunk/src/libged/attr.c 2013-08-28 20:09:54 UTC (rev 57235)
@@ -102,11 +102,21 @@
struct bu_attribute_value_pair *avpp;
static const char *usage = "{set|get|show|rm|append|sort} object [key
[value] ... ]";
+ /* sub-commands in usage order: */
+ const char SET[] = "set";
+ const char GET[] = "get";
+ const char SHOW[] = "show";
+ const char RM[] = "rm";
+ const char APPEND[] = "append";
+ const char SORT[] = "sort";
+
+ /* sort types */
const char CASE[] = "case";
const char NOCASE[] = "nocase";
const char VALUE[] = "value";
const char VALUE_NOCASE[] = "value-nocase";
+
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
@@ -145,7 +155,7 @@
/* default: sort attribute-value set array by attribute name (case
sensitive) */
qsort(&avs.avp[0], avs.count, sizeof(struct bu_attribute_value_pair),
_ged_cmpattr);
- if (BU_STR_EQUAL(argv[1], "sort")) {
+ if (BU_STR_EQUAL(argv[1], SORT)) {
int max_attr_name_len = 0;
/* pretty print */
@@ -184,7 +194,7 @@
avpp->name, avpp->value);
}
}
- } else if (BU_STR_EQUAL(argv[1], "get")) {
+ } else if (BU_STR_EQUAL(argv[1], GET)) {
if (argc == 3) {
/* just list all the attributes */
for (i = 0, avpp = avs.avp; i < avs.count; i++, avpp++) {
@@ -214,7 +224,7 @@
bu_avs_free(&avs);
- } else if (BU_STR_EQUAL(argv[1], "set")) {
+ } else if (BU_STR_EQUAL(argv[1], SET)) {
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
/* setting attribute/value pairs */
if ((argc - 3) % 2) {
@@ -242,7 +252,7 @@
/* avs is freed by db5_update_attributes() */
- } else if (BU_STR_EQUAL(argv[1], "rm")) {
+ } else if (BU_STR_EQUAL(argv[1], RM)) {
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
i = 3;
while (i < (size_t)argc) {
@@ -261,7 +271,7 @@
/* avs is freed by db5_replace_attributes() */
- } else if (BU_STR_EQUAL(argv[1], "append")) {
+ } else if (BU_STR_EQUAL(argv[1], APPEND)) {
GED_CHECK_READ_ONLY(gedp, GED_ERROR);
if ((argc-3) % 2) {
bu_vls_printf(gedp->ged_result_str,
@@ -298,7 +308,7 @@
/* avs is freed by db5_replace_attributes() */
- } else if (BU_STR_EQUAL(argv[1], "show")) {
+ } else if (BU_STR_EQUAL(argv[1], SHOW)) {
int max_attr_name_len = 0;
int tabs1 = 0;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits