static char *options[] = {
"-opt1", "-opt2", "-opt3",NULL
};
static enum optsIdx {
opt1Idx, opt2Idx, opt3Idx
};
gint idx;
/* obtain idx from an array of strings */
Tcl_GetIndexFromObj ( interp, objv[1], options, "option", TCL_EXACT, &idx );
/* obtain idx from array of structures, not an array of strings */
Tcl_GetIndexFromObjStruct ( interp, objv[1], ( char ** ) &commands[0].cmdName, sizeof ( GnoclCommand ), "command", TCL_EXACT, &idx );
Comments