diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/config.c b/src/config.c index bb6f1d5..751b882 100644 --- a/src/config.c +++ b/src/config.c @@ -27,7 +27,7 @@ static void usage(void) { fprintf(stderr, _("usage: %s %s\n"), argv0, - _("[-b brightness] [-c file] [-D | +D] [-g gamma] " + _("[-b brightness] [-c config-file] [-D | +D] [-g gamma] " "[-l latitude:longitude | -l provider[:options]] " "[-m method[:options]] [-P | +P] [-r | +r] [-dv]" "[-O temperature | -o | -p | -t temperature | -x] " @@ -879,11 +879,11 @@ load_from_config_ini(struct settings *settings, const char *key, char *value) settings->elevation_low.value = checked_atof(value, key); } else if (!strcasecmp(key, "dawn-time")) { - if (!set_transition_time(value, &settings->dawn.start, &settings->dawn.end, key)) + if (!set_transition_time(value, &settings->dawn_start, &settings->dawn_end, key)) eprintf(_("Malformed dawn-time setting `%s'."), value); } else if (!strcasecmp(key, "dusk-time")) { - if (!set_transition_time(value, &settings->dusk.start, &settings->dusk.end, key)) + if (!set_transition_time(value, &settings->dusk_start, &settings->dusk_end, key)) eprintf(_("Malformed dusk-time setting `%s'."), value); } else if (!strcasecmp(key, "adjustment-method")) { @@ -922,28 +922,28 @@ load_settings(struct settings *settings, int argc, char *argv[]) load_from_config_ini(settings, setting->name, setting->value); /* Further validate settings */ - n = !!settings->dawn.start.source + !!settings->dawn.end.source; - n += !!settings->dusk.start.source + !!settings->dusk.end.source; + n = !!settings->dawn_start.source + !!settings->dawn_end.source; + n += !!settings->dusk_start.source + !!settings->dusk_end.source; if (n) { scheme.type = CLOCK_SCHEME; if (n != 4) eprintf(_("Partial time-configuration not supported!")); - if (settings->dawn.start.value >= ONE_DAY || settings->dusk.start.value >= ONE_DAY || - labs((long)settings->dawn.end.value - (long)settings->dawn.start.value) > (long)ONE_DAY || - labs((long)settings->dusk.end.value - (long)settings->dusk.start.value) > (long)ONE_DAY) + if (settings->dawn_start.value >= ONE_DAY || settings->dusk_start.value >= ONE_DAY || + labs((long)settings->dawn_end.value - (long)settings->dawn_start.value) > (long)ONE_DAY || + labs((long)settings->dusk_end.value - (long)settings->dusk_start.value) > (long)ONE_DAY) goto invalid_twilight; /* TODO deal with edge-case where one of the twilights last 24 hour */ - settings->dawn.end.value %= ONE_DAY; - settings->dusk.end.value %= ONE_DAY; - if (settings->dawn.start.value <= settings->dawn.end.value) { - if (BETWEEN(settings->dawn.start.value, settings->dusk.start.value, settings->dawn.end.value) || - BETWEEN(settings->dawn.start.value, settings->dusk.end.value, settings->dawn.end.value)) + settings->dawn_end.value %= ONE_DAY; + settings->dusk_end.value %= ONE_DAY; + if (settings->dawn_start.value <= settings->dawn_end.value) { + if (BETWEEN(settings->dawn_start.value, settings->dusk_start.value, settings->dawn_end.value) || + BETWEEN(settings->dawn_start.value, settings->dusk_end.value, settings->dawn_end.value)) goto invalid_twilight; } else { - if (!WITHIN(settings->dawn.end.value, settings->dusk.start.value, settings->dawn.start.value) || - !WITHIN(settings->dawn.end.value, settings->dusk.end.value, settings->dawn.start.value)) + if (!WITHIN(settings->dawn_end.value, settings->dusk_start.value, settings->dawn_start.value) || + !WITHIN(settings->dawn_end.value, settings->dusk_end.value, settings->dawn_start.value)) goto invalid_twilight; } } @@ -984,13 +984,13 @@ load_settings(struct settings *settings, int argc, char *argv[]) scheme.elevation.range = scheme.elevation.high - scheme.elevation.low; } else if (scheme.type == CLOCK_SCHEME) { scheme.time.periods = &scheme.time.periods_array[0]; - scheme.time.periods_array[0].start = settings->dawn.start.value; + scheme.time.periods_array[0].start = settings->dawn_start.value; scheme.time.periods_array[0].day_level = 0.0; - scheme.time.periods_array[1].start = settings->dawn.end.value; + scheme.time.periods_array[1].start = settings->dawn_end.value; scheme.time.periods_array[1].day_level = 1.0; - scheme.time.periods_array[2].start = settings->dusk.start.value; + scheme.time.periods_array[2].start = settings->dusk_start.value; scheme.time.periods_array[2].day_level = 1.0; - scheme.time.periods_array[3].start = settings->dusk.end.value; + scheme.time.periods_array[3].start = settings->dusk_end.value; scheme.time.periods_array[3].day_level = 0.0; for (i = 0; i < 4; i++) { j = (i + 1) % 4; |