-
-
Save igrr/42ced595140f91c7d5dfd8f98a91a8ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <argtable3.h> | |
int main(int argc, char **argv) | |
{ | |
static struct { | |
struct arg_str *key; | |
struct arg_str *value; | |
struct arg_end *end; | |
} setArgs; | |
setArgs.key = arg_str1(NULL, NULL, "<key>", "Key to update"); | |
setArgs.value = arg_str1(NULL, NULL, "<value>", "Value to set"); | |
setArgs.end = arg_end(2); | |
int nerrors = arg_parse(argc, argv, (void**)&setArgs); | |
if (nerrors > 0) { | |
arg_print_errors(stdout, setArgs.end, argv[0]); | |
return 1; | |
} | |
if (setArgs.key->count > 0 && setArgs.value->count > 0) { | |
printf("key: %s value: %s\n", setArgs.key->sval[0], setArgs.value->sval[0]); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment