aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/config.c b/src/config.c
index 56d6bac..d841739 100644
--- a/src/config.c
+++ b/src/config.c
@@ -14,14 +14,14 @@
static void usage(char const *name) {
printf("Usage: %s [-c <carts>] [-S <mode>] [-v[v[v]]]\n"
- " -c <carts> Carts directory. Defaults to 'carts'.\n"
+ " -c <carts> Carts directory.\n"
" -S <mode> Scale mode: 'pp' (default), 'fill' or 'stretch'.\n"
" -v[v[v]] Increasingly verbose logging.\n",
pw_basename(name));
}
static void print_err(char const *name, char const *err) {
- if (err) {
+ if (err && *err) {
fprintf(stderr, "%s: %s\n", pw_basename(name), err);
}
}
@@ -100,8 +100,12 @@ static void parse_config_ini(struct pw_config *config) {
}
pos += n;
- if (SDL_sscanf(line, " %31[^= \t] = %991s", key, value) != 2) {
- SDL_LogWarn(0, "invalid configuation line '%s'", line);
+ if (*line == '#') {
+ continue;
+ }
+
+ if (SDL_sscanf(line, " %31[^= \t] = %991[^\r\n]", key, value) != 2) {
+ SDL_LogWarn(0, "invalid configuration line '%s'", line);
continue;
}
@@ -128,7 +132,7 @@ static void parse_config_ini(struct pw_config *config) {
error:
// We are very permissive with configuration loading, where we just log a
- // warning and continue without propogating an error.
+ // warning and continue without propagating an error.
SDL_LogWarn(0, "failed to read config.ini: %s", SDL_GetError());
SDL_ClearError();
return;
@@ -163,6 +167,7 @@ struct pw_config *pw_config_load(int argc, char **argv) {
#if defined(_POSIX_VERSION)
int c;
+ optind = 1;
while ((c = getopt(argc, argv, ":hc:S:v")) != -1) {
switch (c) {
case 'h':