>enum mi_cmd_result
>mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc)
>{
> struct symtab_and_line st;
See:
http://sources.redhat.com/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gdb&pr=783
Even though there are no arguments it will want to discard any "--". A
mi_getopt() call to strip off any leading "--". I think you'll want to
tweak that function so that calling it is easier - allow NULL OPT and
OPTARG?
Ok, I've got all the changes down but this one.
Instead of changing mi_getopt, I wrote a wrapper function called
extern int mi_valid_noargs (const char *prefix, int argc, char **argv);
and put it in mi_getopt.[ch].
This function basically returns 1 if the arguments are valid for a
function that takes no arguments, and 0 otherwise.
What do you think?
The reason I like this solution is because the caller doesn't need to concern
itself with mi_getopt. So if the interface ever changes to mi_getopt,
there will be less spots to fix. Also, It keeps the client smaller and
less confusing.
Bob Rossi
The body looks something like this.
extern int mi_valid_noargs(const char *prefix, int argc, char **argv) {
int optind = 0;
char *optarg;
static struct mi_opt opts[] =
{
0
};
int opt = mi_getopt(prefix, argc, argv, opts, &optind, &optarg);
/* The end of the list was reached first try */
if ( opt == -1 )
return 1;
else
return 0;
}