Remove defaults from utility functions
This commit is contained in:
parent
9f4a7f2bd0
commit
cb257baec0
3 changed files with 3 additions and 13 deletions
|
@ -32,7 +32,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg
|
||||||
|
|
||||||
if(*(arg + 1) == '-') {
|
if(*(arg + 1) == '-') {
|
||||||
const char *brand = arg + 2;
|
const char *brand = arg + 2;
|
||||||
optn = gargoyle_find_brand(optc, optv, brand, NULL, 0, flags);
|
optn = gargoyle_find_brand(optc, optv, brand, "no-", 3, flags);
|
||||||
|
|
||||||
if(!optn) {
|
if(!optn) {
|
||||||
if(flags & GARGOYLE_FLG_STRCT) {
|
if(flags & GARGOYLE_FLG_STRCT) {
|
||||||
|
@ -50,7 +50,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg
|
||||||
const char *val = NULL;
|
const char *val = NULL;
|
||||||
|
|
||||||
if(optn->type & GARGOYLE_TYPE_BOOL) {
|
if(optn->type & GARGOYLE_TYPE_BOOL) {
|
||||||
res = gargoyle_from_bool(optn, brand, NULL, 0, flags);
|
res = gargoyle_from_bool(optn, brand, "no-", 3, flags);
|
||||||
} else if(*(brand + optn->brand_sz) == '=') {
|
} else if(*(brand + optn->brand_sz) == '=') {
|
||||||
val = brand + optn->brand_sz + 1;
|
val = brand + optn->brand_sz + 1;
|
||||||
res = gargoyle_from_rope(optn, val, flags);
|
res = gargoyle_from_rope(optn, val, flags);
|
||||||
|
@ -95,7 +95,7 @@ uint8_t gargoyle_digest_argv(uint16_t optc, struct gargoyle_optn *optv, int *arg
|
||||||
const char *val = NULL;
|
const char *val = NULL;
|
||||||
|
|
||||||
if(optn->type & GARGOYLE_TYPE_BOOL) {
|
if(optn->type & GARGOYLE_TYPE_BOOL) {
|
||||||
res = gargoyle_from_bool(optn, "", NULL, 0, flags);
|
res = gargoyle_from_bool(optn, "", "*", 1, flags);
|
||||||
} else if(*(idx + 1)) {
|
} else if(*(idx + 1)) {
|
||||||
val = idx + 1;
|
val = idx + 1;
|
||||||
res = gargoyle_from_rope(optn, val, flags);
|
res = gargoyle_from_rope(optn, val, flags);
|
||||||
|
|
|
@ -4,11 +4,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
uint8_t gargoyle_from_bool(struct gargoyle_optn *opt, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) {
|
uint8_t gargoyle_from_bool(struct gargoyle_optn *opt, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) {
|
||||||
if(!neg) {
|
|
||||||
neg = "no-";
|
|
||||||
neg_sz = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(opt->val) {
|
if(opt->val) {
|
||||||
uint8_t *val = opt->val;
|
uint8_t *val = opt->val;
|
||||||
*val = !gargoyle_cmp(brand, neg, neg_sz, flags);
|
*val = !gargoyle_cmp(brand, neg, neg_sz, flags);
|
||||||
|
|
|
@ -5,11 +5,6 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
struct gargoyle_optn *gargoyle_find_brand(uint16_t optc, struct gargoyle_optn *optv, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) {
|
struct gargoyle_optn *gargoyle_find_brand(uint16_t optc, struct gargoyle_optn *optv, const char *brand, const char *neg, uint16_t neg_sz, gargoyle_flag_type flags) {
|
||||||
if(!neg) {
|
|
||||||
neg = "no-";
|
|
||||||
neg_sz = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(; optc; optc -= 1, optv += 1) {
|
for(; optc; optc -= 1, optv += 1) {
|
||||||
const char *idx = brand;
|
const char *idx = brand;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue