28 lines
593 B
C
28 lines
593 B
C
#include <gargoyle/codex.h>
|
|
#include <gargoyle/scribe.h>
|
|
#include <gargoyle/twine.h>
|
|
#include <stdlib.h>
|
|
|
|
uint8_t gargoyle_from_bool(struct gargoyle_opt *opt, const char *brand) {
|
|
if(opt->val) {
|
|
uint8_t *val = opt->val;
|
|
*val = !gargoyle_cmp(brand, "no-", 3, GARGOYLE_CMP_ICASE);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
uint8_t gargoyle_from_rope(struct gargoyle_opt *opt, const char *brand) {
|
|
if(opt->type & GARGOYLE_TYPE_UINT) {
|
|
char *end = NULL;
|
|
uint64_t *val = opt->val;
|
|
*val = strtoull(brand, &end, 10);
|
|
|
|
if(*end) {
|
|
return GARGOYLE_ERR_INVALID_UINT;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|