4 static void parse_option(config_ptr config
, char *s1
, char *s2
)
6 if (!strcmp(s1
, "showmoves")) {
7 config
->showmoves
= atoi(s2
);
9 if (!strcmp(s1
, "fontsize")) {
10 config
->fontsize
= atoi(s2
);
12 if (!strcmp(s1
, "font")) {
13 config
->fontname
= clonestr(s2
);
15 if (!strcmp(s1
, "hiscores")) {
16 config
->hsfile
= clonestr(s2
);
20 static int is_whitespace(char c
)
22 if (strchr(" \t\r\n", c
)) return -1;
26 static void skip_whitespace(FILE *fp
)
32 if (!is_whitespace(c
)) {
40 static void read_word(char *s, FILE *fp)
51 if (is_whitespace(c)) {
57 if (i >= 128 - 1) break;
63 static void read_line(char *s
, FILE *fp
)
81 if (i
>= 1024 - 1) break;
86 void config_load(config_ptr config
)
111 if (is_whitespace(s1
[i
])) {
115 if (!s1
[i
] || !is_whitespace(s1
[i
])) {
125 parse_option(config
, s1
, s2
);