4 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
5 * See the COPYING file in the top-level directory.
15 static char *sskip(char *p)
17 while (*p && isspace(*p))
22 static char *nsskip(char *p)
24 while (*p && !isspace(*p))
29 static int check_token(const char *p, const char *token)
31 int tlen = strlen(token);
32 return strncasecmp(p, token, tlen) == 0 && isspace(p[tlen]);
35 void omapsdl_config(void)
40 f = fopen("omapsdl.cfg", "r");
45 char *p, *line = fgets(buff, sizeof(buff), f);
48 p = line = sskip(line);
52 if (check_token(p, "bind")) {
53 char *key, *key_end, *sdlkey, *sdlkey_end;
55 key_end = nsskip(key);
59 sdlkey = sskip(p + 1);
60 sdlkey_end = nsskip(sdlkey);
61 p = sskip(sdlkey_end);
62 if (*key == 0 || *sdlkey == 0 || *p != 0)
64 *key_end = *sdlkey_end = 0;
66 omapsdl_input_bind(key, sdlkey);
71 err("config: failed to parse: %s", line);