- int t;
- char*equal = strchr(name,'=');
- if (equal) {
- *equal = 0;
- equal++;
- }
- for(t=0;t<sizeof(options)/sizeof(struct options_t);t++) {
- if(!strcmp(options[t].longoption, name)) {
- char*tmp = (char*)malloc(strlen(name)+(equal?strlen(equal)+2:2));
- tmp[0] = options[t].shortoption;
- tmp[1] = 0;
- if(equal) {
- strcpy(&tmp[1], equal);
- }
- return args_callback_option(tmp,val);
- }
- }
- fprintf(stderr, "Unknown option: --%s\n", name);
- exit(1);