| 104 |
struct stat sb; |
struct stat sb; |
| 105 |
char *entry_multi; |
char *entry_multi; |
| 106 |
unsigned entry_iter; |
unsigned entry_iter; |
| 107 |
|
enum parser_kwtype entry_type; |
| 108 |
|
|
| 109 |
res = xmalloc(sizeof (struct parser_result)); |
res = xmalloc(sizeof (struct parser_result)); |
| 110 |
CIRCLEQ_INIT(res); |
CIRCLEQ_INIT(res); |
| 218 |
char *np; |
char *np; |
| 219 |
|
|
| 220 |
/* exact match? */ |
/* exact match? */ |
| 221 |
if (!strcasecmp(cp, kwp->kwprefix)) |
if (!strcasecmp(cp, kwp->kwprefix)) { |
| 222 |
/* yepp */ break; |
/* yep */ |
| 223 |
|
entry_type = KWT_NORMAL; |
| 224 |
|
break; |
| 225 |
|
} |
| 226 |
/* prefix match allowed? */ |
/* prefix match allowed? */ |
| 227 |
if (kwp->kwtype == KWT_NORMAL) |
if (kwp->kwtype == KWT_NORMAL) |
| 228 |
/* nope */ continue; |
/* nope */ continue; |
| 233 |
/* same */ continue; |
/* same */ continue; |
| 234 |
/* okay, we got a prefix match, get args */ |
/* okay, we got a prefix match, get args */ |
| 235 |
np = cp + n + 1; |
np = cp + n + 1; |
| 236 |
|
entry_type = kwp->kwtype; |
| 237 |
if (kwp->kwtype == KWT_ITERATED || |
if (kwp->kwtype == KWT_ITERATED || |
| 238 |
(kwp->kwtype == KWT_MULTITOP && |
(kwp->kwtype == KWT_MULTITOP && |
| 239 |
(*np >= '0' && *np <= '9')) || |
(*np >= '0' && *np <= '9')) || |
| 254 |
*zp++ = '\0'; |
*zp++ = '\0'; |
| 255 |
entry_iter = (unsigned)strtoul(np, NULL, 0); |
entry_iter = (unsigned)strtoul(np, NULL, 0); |
| 256 |
np = zp; |
np = zp; |
| 257 |
|
if (kwp->kwtype == KWT_MULTITOP) |
| 258 |
|
entry_type = KWT_MULTITER; |
| 259 |
} |
} |
| 260 |
|
if (kwp->kwtype == KWT_MULTITOP) |
| 261 |
|
entry_type = KWT_MULTI; |
| 262 |
if (kwp->kwtype == KWT_MULTI || |
if (kwp->kwtype == KWT_MULTI || |
| 263 |
kwp->kwtype == KWT_MULTITOP || |
kwp->kwtype == KWT_MULTITOP || |
| 264 |
kwp->kwtype == KWT_MULTITER) |
kwp->kwtype == KWT_MULTITER) |
| 271 |
entry = xmalloc(sizeof (struct parser_res)); |
entry = xmalloc(sizeof (struct parser_res)); |
| 272 |
bzero(entry, sizeof (struct parser_res)); |
bzero(entry, sizeof (struct parser_res)); |
| 273 |
entry->keyword = kwp->kwnum; |
entry->keyword = kwp->kwnum; |
| 274 |
|
entry->itype = entry_type; |
| 275 |
entry->kw_multi = entry_multi; |
entry->kw_multi = entry_multi; |
| 276 |
entry->kw_iter = entry_iter; |
entry->kw_iter = entry_iter; |
| 277 |
entry->value = str_save(tp); |
entry->value = str_save(tp); |