2022-06-19 16:04:51 +00:00
|
|
|
#include <gargoyle/codex.h>
|
2022-06-19 05:13:49 +00:00
|
|
|
#include <gargoyle/sleuth.h>
|
|
|
|
#include <gargoyle/twine.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
struct gargoyle_opt *gargoyle_find_brand(uint16_t optc, struct gargoyle_opt *optv, const char *brand) {
|
|
|
|
for(; optc; optc -= 1, optv += 1) {
|
2022-06-19 07:55:16 +00:00
|
|
|
const char *idx = brand;
|
2022-06-19 06:38:20 +00:00
|
|
|
|
2022-06-19 16:28:59 +00:00
|
|
|
if(optv->type & GARGOYLE_TYPE_BOOL && gargoyle_cmp(idx, "no-", 3, GARGOYLE_CMP_ICASE)) {
|
2022-06-19 07:55:16 +00:00
|
|
|
idx += 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint8_t end = !*(idx + optv->brand_sz);
|
|
|
|
uint8_t eql = *(idx + optv->brand_sz) == '=';
|
|
|
|
|
|
|
|
if(gargoyle_cmp(idx, optv->brand, optv->brand_sz, GARGOYLE_CMP_ICASE) && (end || eql)) {
|
2022-06-19 05:13:49 +00:00
|
|
|
return optv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2022-06-19 05:56:39 +00:00
|
|
|
|
|
|
|
struct gargoyle_opt *gargoyle_find_emblem(uint16_t optc, struct gargoyle_opt *optv, const char emblem) {
|
|
|
|
for(; optc; optc -= 1, optv += 1) {
|
|
|
|
if(emblem == optv->emblem) {
|
|
|
|
return optv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|