File: caseinsensitive.c

package info (click to toggle)
dotconf 1.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 488 kB
  • sloc: ansic: 2,265; makefile: 186; sh: 39
file content (35 lines) | stat: -rw-r--r-- 666 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio.h>
#include <dotconf.h>

/*
	tabsize: 4
	shiftwidth: 4
*/

DOTCONF_CB(cb_strncasecmp);

static configoption_t options[] = {
	{"StrNCAseCMp", ARG_STR, cb_strncasecmp, NULL, 0},
	LAST_OPTION
};

DOTCONF_CB(cb_strncasecmp)
{
	printf("[StrNCAseCMp] %s\n", cmd->data.str);
	return NULL;
}

int main(int argc, char **argv)
{
	configfile_t *configfile;

	printf("Reading the configuration with CASE_INSENSITIVE enabled\n");

	configfile =
	    dotconf_create("caseinsensitive.conf", options, 0,
			   CASE_INSENSITIVE);
	if (dotconf_command_loop(configfile) == 0)
		fprintf(stderr, "Error reading config file\n");
	dotconf_cleanup(configfile);
	return 0;
}