Revision: 65181
          http://sourceforge.net/p/brlcad/code/65181
Author:   starseeker
Date:     2015-06-04 19:50:49 +0000 (Thu, 04 Jun 2015)
Log Message:
-----------
Switch to just a plain argv array in the bu_opt_data struct to hold option 
arguments.

Modified Paths:
--------------
    brlcad/trunk/include/bu/opt.h
    brlcad/trunk/src/conv/gcv/gcv.cpp
    brlcad/trunk/src/libbu/opt.c
    brlcad/trunk/src/libbu/tests/opt.c
    brlcad/trunk/src/util/dsp_add_opt.c

Modified: brlcad/trunk/include/bu/opt.h
===================================================================
--- brlcad/trunk/include/bu/opt.h       2015-06-04 18:35:06 UTC (rev 65180)
+++ brlcad/trunk/include/bu/opt.h       2015-06-04 19:50:49 UTC (rev 65181)
@@ -107,7 +107,8 @@
     struct bu_opt_desc *desc;
     unsigned int valid;
     const char *name;
-    struct bu_ptbl *args;
+    int argc;
+    const char **argv;
     void *user_data;  /* place for arg_process to stash data */
 };
 #define BU_OPT_DATA_NULL {NULL, 0, NULL, NULL, NULL}
@@ -122,18 +123,6 @@
 BU_EXPORT extern void bu_opt_data_print(bu_opt_data_t *data, const char 
*title);
 
 /**
- * Convenience function for extracting args from a bu_opt_data container.
- * Provided as an easy way to get either the first arg:
- *
- * bu_opt_data_arg(d, 0)
- *
- * when it is known that there is only one argument while also allowing
- * for extraction of other args when multiples are present
- *
- * Returns NULL if the specified arg is not present. index starts from 0. */
-BU_EXPORT extern const char *bu_opt_data_arg(struct bu_opt_data *d, size_t 
ind);
-
-/**
  * Find and return a specific option from a bu_opt_data_t of options using an 
option
  * string as the lookup key.  Will only return an option if its valid entry
  * is set to 1. A NULL value passed in for name retrieves the bu_opt_data 
struct with the
@@ -141,8 +130,6 @@
  */
 BU_EXPORT extern struct bu_opt_data *bu_opt_find(const char *name, 
bu_opt_data_t *results);
 
-
-
 /**
  * Parse argv array using option descs.
  *

Modified: brlcad/trunk/src/conv/gcv/gcv.cpp
===================================================================
--- brlcad/trunk/src/conv/gcv/gcv.cpp   2015-06-04 18:35:06 UTC (rev 65180)
+++ brlcad/trunk/src/conv/gcv/gcv.cpp   2015-06-04 19:50:49 UTC (rev 65181)
@@ -75,7 +75,7 @@
     bu_opt_validate(results);
     d = bu_opt_find("u", results);
     if (d) {
-       bu_log("STL opt found: %s:%s\n", d->name, bu_opt_data_arg(d, 0));
+       bu_log("STL opt found: %s:%s\n", d->name, d->argv[0]);
     }
 
     bu_opt_data_print(results, "STL option parsing results:");
@@ -224,11 +224,11 @@
 file_stat(struct bu_vls *UNUSED(msg), struct bu_opt_data *data)
 {
     if (!data) return 0;
-    if (!data->args) {
+    if (!data->argv || data->argc == 0) {
        data->valid = 0;
        return 0;
     }
-    if (!bu_file_exists(bu_opt_data_arg(data, 0), NULL)){
+    if (!bu_file_exists(data->argv[0], NULL)){
        data->valid = 0;
     }
     return 0;
@@ -238,13 +238,13 @@
 file_null(struct bu_vls *msg, struct bu_opt_data *data)
 {
     if (!data) return 0;
-    if (!data->args) {
+    if (!data->argv || data->argc == 0) {
        data->valid = 0;
        return 0;
     }
-    if (!bu_file_exists(bu_opt_data_arg(data, 0), NULL)){
+    if (!bu_file_exists(data->argv[0], NULL)){
        data->valid = 0;
-       if (msg) bu_vls_sprintf(msg, "Error - file %s already exists!\n", 
bu_opt_data_arg(data, 0));
+       if (msg) bu_vls_sprintf(msg, "Error - file %s already exists!\n", 
data->argv[0]);
     }
     return 0;
 }
@@ -255,11 +255,11 @@
     int type_int;
     mime_model_t type = MIME_MODEL_UNKNOWN;
     if (!data) return 0;
-    if (!data->args) {
+    if (!data->argv || data->argc == 0) {
        data->valid = 0;
        return 0;
     }
-    type_int = bu_file_mime(bu_opt_data_arg(data, 0), MIME_MODEL);
+    type_int = bu_file_mime(data->argv[0], MIME_MODEL);
     type = (type_int < 0) ? MIME_MODEL_UNKNOWN : (mime_model_t)type_int;
     if (type == MIME_MODEL_UNKNOWN) {
        data->valid = 0;
@@ -304,7 +304,6 @@
     struct bu_vls input_opts = BU_VLS_INIT_ZERO;
     struct bu_vls output_opts = BU_VLS_INIT_ZERO;
     struct bu_opt_data *d = NULL;
-    struct bu_ptbl *unknown_tbl = NULL;
     bu_opt_data_t *results = NULL;
 
     ac-=(ac>0); av+=(ac>0); // skip program name argv[0] if present
@@ -323,7 +322,7 @@
     /* First, see if help was supplied */
     d = bu_opt_find("h", results);
     if (d) {
-       const char *help_fmt = bu_opt_data_arg(d, 0);
+       const char *help_fmt = d->argv[0];
        if (help_fmt) {
            // TODO - generate some help based on format
        } else {
@@ -362,28 +361,27 @@
 
     /* Did we get explicit options for an input and/or output file? */
     d = bu_opt_find("i", results);
-    if (d) bu_vls_sprintf(&in_path_raw, "%s", bu_opt_data_arg(d, 0));
+    if (d) bu_vls_sprintf(&in_path_raw, "%s", d->argv[0]);
     d = bu_opt_find("o", results);
-    if (d) bu_vls_sprintf(&out_path_raw, "%s", bu_opt_data_arg(d, 0));
+    if (d) bu_vls_sprintf(&out_path_raw, "%s", d->argv[0]);
 
     /* If not specified explicitly with -i or -o, the input and output paths 
must always
      * be the last two arguments supplied */
     d = bu_opt_find(NULL, results);
     if (d) {
-       unknown_tbl = d->args;
-       if (unknown_tbl && BU_PTBL_LEN(unknown_tbl) > 1)
-           bu_vls_sprintf(&in_path_raw, "%s", (const char 
*)BU_PTBL_GET(unknown_tbl, BU_PTBL_LEN(unknown_tbl) - 2));
-       if (unknown_tbl && BU_PTBL_LEN(unknown_tbl) > 0)
-           bu_vls_sprintf(&out_path_raw, "%s", (const char 
*)BU_PTBL_GET(unknown_tbl, BU_PTBL_LEN(unknown_tbl) - 1));
+       if (d->argv && d->argc > 1)
+           bu_vls_sprintf(&in_path_raw, "%s", d->argv[d->argc - 2]);
+       if (d->argv && d->argc > 0)
+           bu_vls_sprintf(&out_path_raw, "%s", d->argv[d->argc - 1]);
     }
 
     /* Any unknown strings not otherwise processed are passed to both input 
and output.
      * These are deliberately placed at the beginning of the input strings, so 
any
      * input/output specific options have a chance to override them. */
-    if (unknown_tbl && BU_PTBL_LEN(unknown_tbl) > 2) {
-       for (i = 0; i < BU_PTBL_LEN(unknown_tbl) - 2; i++) {
-           bu_vls_printf(&input_opts, " %s ", (const char 
*)BU_PTBL_GET(unknown_tbl, i));
-           bu_vls_printf(&output_opts, " %s ", (const char 
*)BU_PTBL_GET(unknown_tbl, i));
+    if (d && d->argc > 2) {
+       for (i = 0; i < (size_t)d->argc - 2; i++) {
+           bu_vls_printf(&input_opts, " %s ", d->argv[i]);
+           bu_vls_printf(&output_opts, " %s ", d->argv[i]);
        }
        if (bu_vls_strlen(&input_opts) > 0) bu_log("Unknown options (input): 
%s\n", bu_vls_addr(&input_opts));
        if (bu_vls_strlen(&output_opts) > 0) bu_log("Unknown options (output): 
%s\n", bu_vls_addr(&output_opts));
@@ -393,7 +391,7 @@
     d = bu_opt_find("I", results);
     if (d) {
        struct bu_vls o_tmp = BU_VLS_INIT_ZERO;
-       bu_vls_sprintf(&o_tmp, "%s", bu_opt_data_arg(d, 0));
+       bu_vls_sprintf(&o_tmp, "%s", d->argv[0]);
        if (bu_vls_addr(&o_tmp)[0] == '[') bu_vls_nibble(&o_tmp, 1);
        if (bu_vls_addr(&o_tmp)[strlen(bu_vls_addr(&o_tmp)) - 1] == ']') 
bu_vls_trunc(&o_tmp, -1);
        bu_vls_printf(&input_opts, "%s", bu_vls_addr(&o_tmp));
@@ -403,7 +401,7 @@
     d = bu_opt_find("O", results);
     if (d) {
        struct bu_vls o_tmp = BU_VLS_INIT_ZERO;
-       bu_vls_sprintf(&o_tmp, "%s", bu_opt_data_arg(d, 0));
+       bu_vls_sprintf(&o_tmp, "%s", d->argv[0]);
        if (bu_vls_addr(&o_tmp)[0] == '[') bu_vls_nibble(&o_tmp, 1);
        if (bu_vls_addr(&o_tmp)[strlen(bu_vls_addr(&o_tmp)) - 1] == ']') 
bu_vls_trunc(&o_tmp, -1);
        bu_vls_printf(&output_opts, "%s", bu_vls_addr(&o_tmp));
@@ -441,7 +439,7 @@
     /* If we have input and/or output specific options, append them now */
     d = bu_opt_find("input-format", results);
     if (d) {
-       in_fmt = bu_opt_data_arg(d, 0);
+       in_fmt = d->argv[0];
     } else {
        /* If we aren't overridden by an option, it's worth doing file
         * introspection to see if the file contents identify the input
@@ -456,7 +454,7 @@
 
     /* Identify output file type */
     d = bu_opt_find("output-format", results);
-    if (d) out_fmt = bu_opt_data_arg(d, 0);
+    if (d) out_fmt = d->argv[0];
     fmt = parse_model_string(&out_format, &log, out_fmt, 
bu_vls_addr(&out_path_raw));
     out_type = (fmt < 0) ? MIME_MODEL_UNKNOWN : (mime_model_t)fmt;
     out_fmt = NULL;

Modified: brlcad/trunk/src/libbu/opt.c
===================================================================
--- brlcad/trunk/src/libbu/opt.c        2015-06-04 18:35:06 UTC (rev 65180)
+++ brlcad/trunk/src/libbu/opt.c        2015-06-04 19:50:49 UTC (rev 65181)
@@ -39,25 +39,30 @@
     (*d)->desc = NULL;
     (*d)->valid = 1;
     (*d)->name = name;
-    (*d)->args = NULL;
+    (*d)->argc = 0;
+    (*d)->argv = NULL;
     (*d)->user_data = NULL;
 }
 
 HIDDEN void
+bu_opt_free_argv(int ac, char **av)
+{
+    if (av) {
+       int i = 0;
+       for (i = 0; i < ac; i++) {
+           bu_free((char *)av[i], "free argv[i]");
+       }
+       bu_free((char *)av, "free argv");
+    }
+}
+
+HIDDEN void
 bu_opt_data_free_entry(struct bu_opt_data *d)
 {
     if (!d) return;
     if (d->name) bu_free((char *)d->name, "free data name");
     if (d->user_data) bu_free(d->user_data, "free user data");
-    if (d->args) {
-       size_t i;
-       for (i = 0; i < BU_PTBL_LEN(d->args); i++) {
-           char *arg = (char *)BU_PTBL_GET(d->args, i);
-           bu_free(arg, "free arg");
-       }
-       bu_ptbl_free(d->args);
-       BU_PUT(d->args, struct bu_ptbl);
-    }
+    bu_opt_free_argv(d->argc, (char **)d->argv);
 }
 
 
@@ -74,24 +79,11 @@
     BU_PUT(tbl, struct bu_ptbl);
 }
 
-
-
-const char *
-bu_opt_data_arg(struct bu_opt_data *d, size_t ind)
-{
-    if (!d) return NULL;
-    if (d->args) {
-       if (ind > (BU_PTBL_LEN(d->args) - 1)) return NULL;
-       return (const char *)BU_PTBL_GET(d->args, ind);
-    }
-    return NULL;
-}
-
 void
 bu_opt_data_print(struct bu_ptbl *data, const char *title)
 {
     size_t i = 0;
-    size_t j = 0;
+    int j = 0;
     int offset_1 = 3;
     struct bu_vls log = BU_VLS_INIT_ZERO;
     if (!data || BU_PTBL_LEN(data) == 0) return;
@@ -110,12 +102,12 @@
                bu_vls_printf(&log, "\t(invalid)");
            }
            if (d->desc && d->desc->arg_cnt_max > 0) {
-               if (d->args && BU_PTBL_LEN(d->args) > 0) {
+               if (d->argc > 0 && d->argv) {
                    bu_vls_printf(&log, ": ");
-                   for (j = 0; j < BU_PTBL_LEN(d->args) - 1; j++) {
-                       bu_vls_printf(&log, "%s, ", bu_opt_data_arg(d, j));
+                   for (j = 0; j < d->argc - 1; j++) {
+                       bu_vls_printf(&log, "%s, ", d->argv[j]);
                    }
-                   bu_vls_printf(&log, "%s\n", bu_opt_data_arg(d, 
BU_PTBL_LEN(d->args) - 1));
+                   bu_vls_printf(&log, "%s\n", d->argv[d->argc - 1]);
                } else {
                    bu_vls_printf(&log, "\n");
                }
@@ -124,11 +116,11 @@
            }
        } else {
            bu_vls_printf(&log, "%*s(unknown): ", offset_1, " ", d->name);
-           if (d->args && BU_PTBL_LEN(d->args) > 0) {
-               for (j = 0; j < BU_PTBL_LEN(d->args) - 1; j++) {
-                   bu_vls_printf(&log, "%s ", bu_opt_data_arg(d, j));
+           if (d->argc > 0 && d->argv) {
+               for (j = 0; j < d->argc - 1; j++) {
+                   bu_vls_printf(&log, "%s ", d->argv[j]);
                }
-               bu_vls_printf(&log, "%s\n", bu_opt_data_arg(d, 
BU_PTBL_LEN(d->args) - 1));
+               bu_vls_printf(&log, "%s\n", d->argv[d->argc-1]);
            }
        }
     }
@@ -453,6 +445,21 @@
     return 1;
 }
 
+HIDDEN int
+ptbl_to_argv(const char ***argv, struct bu_ptbl *tbl) {
+    int i;
+    const char **av;
+    int ac;
+    if (!argv || !tbl || BU_PTBL_LEN(tbl) == 0) return 0;
+    ac = BU_PTBL_LEN(tbl);
+    av = (const char **)bu_calloc(ac, sizeof(char *), "argv");
+    for (i = 0; i < ac; i++) {
+       av[i] = (const char *)BU_PTBL_GET(tbl, i);
+    }
+    (*argv) = av;
+    return ac;
+}
+
 int
 bu_opt_parse(struct bu_ptbl **tbl, struct bu_vls *UNUSED(msgs), int argc, 
const char **argv, struct bu_opt_desc *ds)
 {
@@ -460,7 +467,8 @@
     int offset = 0;
     const char *ns = NULL;
     struct bu_ptbl *opt_data;
-    struct bu_opt_data *unknowns = NULL;
+    struct bu_ptbl unknown_args = BU_PTBL_INIT_ZERO;
+    struct bu_opt_data *unknown = NULL;
     if (!argv || !ds) return 1;
 
     BU_GET(opt_data, struct bu_ptbl);
@@ -475,20 +483,16 @@
        char *eq_arg = NULL;
        struct bu_opt_data *data = NULL;
        struct bu_opt_desc *desc = NULL;
+       struct bu_ptbl data_args = BU_PTBL_INIT_ZERO;
        /* If 'opt' isn't an option, make a container for non-option values and 
build it up until
         * we reach an option */
        if (!is_opt(argv[i], ds)) {
-           if (!unknowns) {
-               bu_opt_data_init_entry(&unknowns, NULL);
-               BU_GET(unknowns->args, struct bu_ptbl);
-               bu_ptbl_init(unknowns->args, 8, "args init");
-           }
            ns = bu_strdup(argv[i]);
-           bu_ptbl_ins(unknowns->args, (long *)ns);
+           bu_ptbl_ins(&unknown_args, (long *)ns);
            i++;
            while (i < argc && !is_opt(argv[i], ds)) {
                ns = bu_strdup(argv[i]);
-               bu_ptbl_ins(unknowns->args, (long *)ns);
+               bu_ptbl_ins(&unknown_args, (long *)ns);
                i++;
            }
            continue;
@@ -513,21 +517,16 @@
        /* If we don't know what we're dealing with, keep going */
        if (!desc_found) {
            struct bu_vls rebuilt_opt = BU_VLS_INIT_ZERO;
-           if (!unknowns) {
-               bu_opt_data_init_entry(&unknowns, NULL);
-               BU_GET(unknowns->args, struct bu_ptbl);
-               bu_ptbl_init(unknowns->args, 8, "args init");
-           }
            if (strlen(opt) == 1) {
                bu_vls_sprintf(&rebuilt_opt, "-%s", opt);
            } else {
                bu_vls_sprintf(&rebuilt_opt, "--%s", opt);
            }
-           bu_ptbl_ins(unknowns->args, (long 
*)bu_strdup(bu_vls_addr(&rebuilt_opt)));
+           bu_ptbl_ins(&unknown_args, (long 
*)bu_strdup(bu_vls_addr(&rebuilt_opt)));
            bu_free(opt, "free opt");
            bu_vls_free(&rebuilt_opt);
            if (eq_arg)
-               bu_ptbl_ins(unknowns->args, (long *)eq_arg);
+               bu_ptbl_ins(&unknown_args, (long *)eq_arg);
            i++;
            continue;
        }
@@ -536,10 +535,7 @@
        bu_opt_data_init_entry(&data, opt);
        data->desc = desc;
        if (eq_arg) {
-           /* Okay, we actually need it - initialize the arg table */
-           BU_GET(data->args, struct bu_ptbl);
-           bu_ptbl_init(data->args, 8, "args init");
-           bu_ptbl_ins(data->args, (long *)eq_arg);
+           bu_ptbl_ins(&data_args, (long *)eq_arg);
            arg_cnt = 1;
        }
 
@@ -554,12 +550,7 @@
        if (desc->arg_cnt_max > 0) {
            while (arg_cnt < desc->arg_cnt_max && i < argc && !is_opt(argv[i], 
ds)) {
                ns = bu_strdup(argv[i]);
-               if (!data->args) {
-                   /* Okay, we actually need it - initialize the arg table */
-                   BU_GET(data->args, struct bu_ptbl);
-                   bu_ptbl_init(data->args, 8, "args init");
-               }
-               bu_ptbl_ins(data->args, (long *)ns);
+               bu_ptbl_ins(&data_args, (long *)ns);
                i++;
                arg_cnt++;
            }
@@ -570,7 +561,9 @@
 
        /* Now see if we need to validate the arg(s) */
        if (desc->arg_process) {
-           int arg_offset = (*desc->arg_process)(NULL, data);
+           int arg_offset;
+           data->argc = ptbl_to_argv(&(data->argv), &data_args);
+           arg_offset = (*desc->arg_process)(NULL, data);
            if (arg_offset < 0) {
                /* arg(s) present but not associated with opt, back them out of 
data
                 *
@@ -584,20 +577,34 @@
                 *  for the second case all three are necessary
                 *
                 * */
-               int len = BU_PTBL_LEN(data->args);
+               int len = BU_PTBL_LEN(&data_args);
                int j = 0;
                i = i + arg_offset;
                while (j > arg_offset) {
-                   bu_free((void *)BU_PTBL_GET(data->args, len + j - 1), "free 
str");
+                   bu_free((void *)BU_PTBL_GET(&data_args, len + j - 1), "free 
str");
                    j--;
                }
-               bu_ptbl_trunc(data->args, len + arg_offset);
+               bu_ptbl_trunc(&data_args, len + arg_offset);
+               bu_opt_free_argv(data->argc, (char **)data->argv);
+               data->argv = NULL;
            }
        }
+       if (!data->argv) {
+           data->argc = ptbl_to_argv(&(data->argv), &data_args);
+       }
+       bu_ptbl_free(&data_args);
        bu_ptbl_ins(opt_data, (long *)data);
     }
-    if (unknowns) bu_ptbl_ins(opt_data, (long *)unknowns);
 
+    /* Make an argv array and data entry for the unknown, if any */
+    if (BU_PTBL_LEN(&unknown_args) > 0){
+       bu_opt_data_init_entry(&unknown, NULL);
+       unknown->argc = ptbl_to_argv(&(unknown->argv), &unknown_args);
+       bu_ptbl_free(&unknown_args);
+       bu_ptbl_ins(opt_data, (long *)unknown);
+    }
+
+
     (*tbl) = opt_data;
     return 0;
 }

Modified: brlcad/trunk/src/libbu/tests/opt.c
===================================================================
--- brlcad/trunk/src/libbu/tests/opt.c  2015-06-04 18:35:06 UTC (rev 65180)
+++ brlcad/trunk/src/libbu/tests/opt.c  2015-06-04 19:50:49 UTC (rev 65181)
@@ -28,9 +28,9 @@
 d1_verbosity(struct bu_vls *msg, struct bu_opt_data *data)
 {
     int verb;
-    if (!data) return -1;
+    if (!data || data->argc == 0) return -1;
     if (msg) bu_vls_sprintf(msg, "d1");
-    sscanf((const char *)BU_PTBL_GET(data->args, 0), "%d", &verb);
+    sscanf(data->argv[0], "%d", &verb);
     if (verb < 0 || verb > 3) data->valid = 0;
     return 0;
 }
@@ -49,7 +49,7 @@
 {
     unsigned int *rgb;
     if (!data) return 0;
-    if (!data->args) {
+    if (!data->argv || data->argc == 0) {
        data->valid = 0;
        return 0;
     }
@@ -58,16 +58,16 @@
     rgb = (unsigned int *)bu_calloc(3, sizeof(unsigned int), "fastf_t array");
 
     /* First, see if the first string converts to rgb */
-    if (!bu_str_to_rgb((char *)BU_PTBL_GET(data->args, 0), (unsigned char 
*)&rgb)) {
-       /* nope - maybe we have 3 args? */
-       if (BU_PTBL_LEN(data->args) == 3) {
+    if (!bu_str_to_rgb((char *)data->argv[0], (unsigned char *)&rgb)) {
+       /* nope - maybe we have 3 argv? */
+       if (data->argc == 3) {
            int rn = 0, gn = 0, bn = 0;
-           if (isnum((const char *)BU_PTBL_GET(data->args, 0)))
-               rn = sscanf((const char *)BU_PTBL_GET(data->args, 0), "%02x", 
&rgb[0]);
-           if (isnum((const char *)BU_PTBL_GET(data->args, 1)))
-               gn = sscanf((const char *)BU_PTBL_GET(data->args, 1), "%02x", 
&rgb[1]);
-           if (isnum((const char *)BU_PTBL_GET(data->args, 2)))
-               bn = sscanf((const char *)BU_PTBL_GET(data->args, 2), "%02x", 
&rgb[2]);
+           if (isnum(data->argv[0]))
+               rn = sscanf(data->argv[0], "%02x", &rgb[0]);
+           if (isnum(data->argv[1]))
+               gn = sscanf(data->argv[1], "%02x", &rgb[1]);
+           if (isnum(data->argv[2]))
+               bn = sscanf(data->argv[2], "%02x", &rgb[2]);
            if (rn != 1 || gn != 1 || bn != 1) {
                data->valid = 0;
                bu_free(rgb, "free rgb");
@@ -81,7 +81,7 @@
     } else {
        /* yep - if we've got more args, tell the option parser we don't need 
them */
        data->user_data = (void *)rgb;
-       if (BU_PTBL_LEN(data->args) > 1) return 1 - BU_PTBL_LEN(data->args);
+       if (data->argc > 1) return 1 - data->argc;
     }
 
     return 0;
@@ -95,12 +95,11 @@
     for (i = 0; i < BU_PTBL_LEN(results); i++) {
        data = (struct bu_opt_data *)BU_PTBL_GET(results, i);
        bu_log("option name: %s\n", data->name);
-       if (data->args) {
-           size_t j = 0;
+       if (data->argv && data->argc != 0) {
+           int j = 0;
            bu_log("option args: ");
-           for (j = 0; j < BU_PTBL_LEN(data->args); j++) {
-               char *arg = (char *)BU_PTBL_GET(data->args, j);
-               bu_log("%s ", arg);
+           for (j = 0; j < data->argc; j++) {
+               bu_log("%s ", data->argv[j]);
            }
            bu_log("\n");
        }

Modified: brlcad/trunk/src/util/dsp_add_opt.c
===================================================================
--- brlcad/trunk/src/util/dsp_add_opt.c 2015-06-04 18:35:06 UTC (rev 65180)
+++ brlcad/trunk/src/util/dsp_add_opt.c 2015-06-04 19:50:49 UTC (rev 65181)
@@ -214,14 +214,14 @@
     results = parse_args(ac, av);
     non_opts = bu_opt_find(NULL, results);
 
-    if (!non_opts->args || BU_PTBL_LEN(non_opts->args) < 2) {
+    if (!non_opts->argv || non_opts->argc < 2) {
        bu_log("Error: No files specified\n");
        print_usage();
     }
 
     /* Open the files */
-    f1 = bu_opt_data_arg(non_opts, 0);
-    f2 = bu_opt_data_arg(non_opts, 1);
+    f1 = non_opts->argv[0];
+    f2 = non_opts->argv[1];
 
     in1 = fopen(f1, "r");
     if (!in1) {

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


------------------------------------------------------------------------------
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to