diff --git a/inc/config.h b/inc/config.h index a5930b2..22f641c 100644 --- a/inc/config.h +++ b/inc/config.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Scoopta + * Copyright (C) 2019-2024 Scoopta * This file is part of Wofi * Wofi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,6 +28,6 @@ void config_load(struct map* map, const char* config); char* config_get(struct map* config, const char* key, char* def_opt); -uint8_t config_get_mnemonic(struct map* config, const char* key, char* def_opt, uint8_t num_choices, ...); +int config_get_mnemonic(struct map* config, const char* key, char* def_opt, int num_choices, ...); #endif diff --git a/man/wofi-config.3 b/man/wofi-config.3 index 5d900ea..75a081e 100644 --- a/man/wofi-config.3 +++ b/man/wofi-config.3 @@ -42,7 +42,7 @@ Gets a config entry, if the entry is not set then it returns \fBdef_opt\fR. \- The default value to be returned if the key does not exist. .TP -.B uint8_t config_get_mnemonic(struct map* config, const char* key, char* def_opt, uint8_t num_choices, ...) +.B int config_get_mnemonic(struct map* config, const char* key, char* def_opt, int num_choices, ...) Gets an enum value from the config. If the value is not set then it returns \fBdef_opt\fR. .B struct map* config @@ -54,7 +54,7 @@ Gets an enum value from the config. If the value is not set then it returns \fBd .B char* def_opt \- The default value to be returned if the key does not exist. -.B uint8_t num_choices +.B int num_choices \- The number of enum options available. .B varargs diff --git a/src/config.c b/src/config.c index 101df8e..3fd6359 100644 --- a/src/config.c +++ b/src/config.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2020 Scoopta + * Copyright (C) 2019-2024 Scoopta * This file is part of Wofi * Wofi is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -81,12 +81,12 @@ char* config_get(struct map* config, const char* key, char* def_opt) { return opt; } -uint8_t config_get_mnemonic(struct map* config, const char* key, char* def_opt, uint8_t num_choices, ...) { +int config_get_mnemonic(struct map* config, const char* key, char* def_opt, int num_choices, ...) { char* opt = config_get(config, key, def_opt); va_list ap; va_start(ap, num_choices); - uint8_t result = 0; - for(uint8_t i = 0; i < num_choices; i++) { + int result = 0; + for(int i = 0; i < num_choices; i++) { char* cmp_str = va_arg(ap, char*); if(strcmp(opt, cmp_str) == 0) { result = i;