38 lines
734 B
C
38 lines
734 B
C
/*
|
|
*
|
|
* Copyright 2023 Oleg Borodin <borodin@unix7.org>
|
|
*
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <fcntl.h>
|
|
#include <clconfig.h>
|
|
#include <massert.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
(void)argc;
|
|
(void)argv;
|
|
|
|
char*_argv[] = { argv[0], "--strkey=num5678", "--intkey=12345" };
|
|
int _argc = 2;
|
|
|
|
clconfig_t clconfig;
|
|
clconfig_init(&clconfig, _argc, _argv);
|
|
|
|
int intkey = 0;
|
|
char* strkey = NULL;
|
|
|
|
clconfig_bind(&clconfig, GCONF_INT, "intkey", &intkey);
|
|
clconfig_bind(&clconfig, GCONF_STR, "strkey", &strkey);
|
|
|
|
int res = clconfig_parse(&clconfig);
|
|
MASSERT(res == 0);
|
|
|
|
clconfig_destroy(&clconfig);
|
|
|
|
printf("int key = %d\n", intkey);
|
|
printf("str key = %s\n", strkey);
|
|
|
|
return 0;
|
|
}
|