diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-23 19:48:58 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-23 19:48:58 +0100 |
commit | f5073ed39f8a244fe70ba2294aa8dec18bac39d0 (patch) | |
tree | e86f82721c0cbab173c0a9aa65e61324969e018e | |
parent | Clean up (diff) | |
download | redshift-ng-f5073ed39f8a244fe70ba2294aa8dec18bac39d0.tar.gz redshift-ng-f5073ed39f8a244fe70ba2294aa8dec18bac39d0.tar.bz2 redshift-ng-f5073ed39f8a244fe70ba2294aa8dec18bac39d0.tar.xz |
Add ; as option delimiter
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r-- | README | 25 | ||||
-rw-r--r-- | TODO | 5 | ||||
-rw-r--r-- | redshift.1 | 59 | ||||
-rw-r--r-- | src/common.h | 1 | ||||
-rw-r--r-- | src/gamma.c | 11 | ||||
-rw-r--r-- | src/location.c | 8 |
6 files changed, 90 insertions, 19 deletions
@@ -135,16 +135,24 @@ OPTIONS -l provider[:options] Select provider for automatic location updates. + options is a colon- (:) and semicolon-separated (;) list. Each + option an option name and value separated by an equals sign (=). + Use "-l list" to see available providers. - Use "-l provider:help" to see available options. + Use "-l provider:help" to see available options, or refer to the + EXTENDED DESCRIPTION section. -m method[:options] Method to use to set colour temperature. + options is a colon- (:) and semicolon-separated (;) list. Each + option an option name and value separated by an equals sign (=). + Use "-m list" to see available methods. - Use "-m method:help" to see available options. + Use "-m method:help" to see available options, or refer to the + EXTENDED DESCRIPTION section. -O temperature This is a synonym for "-O temperature:temperature". @@ -613,6 +621,9 @@ EXTENDED DESCRIPTION X display to apply adjustments to. Default is determined by the environment variable DISPLAY. + The value is expected to contain a colon (:) and can only be + terminated with a semicolon (;). + screen = ordinal Comma-separated (,) list of X screens to apply adjustments to. All available X screens are used if the list is empty or if the @@ -651,6 +662,9 @@ EXTENDED DESCRIPTION X display to apply adjustments to. Default is determined by the environment variable DISPLAY. + The value is expected to contain a colon (:) and can only be + terminated with a semicolon (;). + screen = ordinal list or "all" Comma-separated (,) list of X screens to apply adjustments to. All available X screens are used if the list is empty or if the @@ -860,6 +874,13 @@ RATIONALE Gamma correction is preserved for backwards compatibility and is deprecated (gamma parameters in particular). + ":" was used as the option delimited for -l and -m in the original + redshift, this is preserved for backwards compatbility. However because + some new options are expected to have ":" in their value, ";" has added + as an additional delimiter. Despite this ":" is still the preferred + delimiter as it is more user-friendly and use of options that require + delimiting with ";" is uncommon. + NOTES "Colour temperature", or just "temperature", is actually short for "correlated colour temperature". (Your monitor is not a black-body @@ -142,9 +142,4 @@ Add support for solar time. When disabled, redshift should be periodically set the gamma ramps Add signals for setting location Add signals for responding with sigqueue the state of redshift - -Document option delimiter for -l and -m -The method option "display" requires support for ":", use ";" delimit after "display" - ":" cannot be changed to ";" for all options are this would break backwards - compatibility; however ";" could be supported in addition to ":" for all options print, for use by frontends, what mode redshift was started in @@ -191,23 +191,48 @@ coordinate system. .BI -l\fR\ provider\fR[ : options\fR] Select provider for automatic location updates. +.I options +is a colon- +.RB ( : ) +and semicolon-separated +.RB ( ; ) +list. Each option an option name and value +separated by an equals sign +.RB ( = ). + Use .B -l list to see available providers. Use .BI -l\ provider :help -to see available options. +to see available options, +or refer to the +.B EXTENDED DESCRIPTION +section. .TP .BI -m\fR\ method\fR[ : options\fR] Method to use to set colour temperature. + +.I options +is a colon- +.RB ( : ) +and semicolon-separated +.RB ( ; ) +list. Each option an option name and value +separated by an equals sign +.RB ( = ). + Use .B -m list to see available methods. Use .BI -m\ method :help -to see available options. +to see available options, +or refer to the +.B EXTENDED DESCRIPTION +section. .TP .BI -O\ temperature This is a synonym for @@ -955,6 +980,11 @@ Options for the adjustment method X display to apply adjustments to. Default is determined by the environment variable .IR DISPLAY . + +The value is expected to contain a colon +.RB ( : ) +and can only be terminated with a semicolon +.RB ( ; ). .TP .BI screen\fR\ =\ "ordinal list or " all Comma-separated @@ -1009,6 +1039,12 @@ Options for the adjustment method X display to apply adjustments to. Default is determined by the environment variable .IR DISPLAY . + +The value is expected to contain a colon +.RB ( : ) +and can only be terminated with a semicolon +.RB ( ; ). +.TP .BI screen\fR\ =\ "ordinal list or " all Comma-separated .RB ( , ) @@ -1287,6 +1323,25 @@ level above 1.0 are forbidden. .PP Gamma correction is preserved for backwards compatibility and is deprecated (gamma parameters in particular). +.PP +.RB \(dq : \(dq +was used as the option delimited for +.B -l +and +.B -m +in the original +.BR redshift , +this is preserved for backwards compatbility. However because +some new options are expected to have +.RB \(dq : \(dq +in their value, +.RB \(dq ; \(dq +has added as an additional delimiter. Despite this +.RB \(dq : \(dq +is still the preferred delimiter as it is more user-friendly +and use of options that require delimiting with +.RB \(dq ; \(dq +is uncommon. .SH NOTES \(dqColour temperature\(dq, or just \(dqtemperature\(dq, is actually short for diff --git a/src/common.h b/src/common.h index fa1a0f2..5d3e7a4 100644 --- a/src/common.h +++ b/src/common.h @@ -46,6 +46,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <time.h> #include <unistd.h> #ifdef _POSIX_TIMERS diff --git a/src/gamma.c b/src/gamma.c index a66f2b2..44042d0 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -63,9 +63,12 @@ try_start(const struct gamma_method *method, GAMMA_STATE **state_out, struct con goto set_option_fail; /* Set method options from command line */ - while (args) { - next_arg = strchr(args, ':'); - if (next_arg) + for (; args && *args; args = next_arg) { + if (!strncasecmp(args, "display=", sizeof("display=") - 1U)) + next_arg = &args[strcspn(args, ";")]; + else + next_arg = &args[strcspn(args, ";:")]; + if (*next_arg) *next_arg++ = '\0'; key = args; @@ -78,8 +81,6 @@ try_start(const struct gamma_method *method, GAMMA_STATE **state_out, struct con if (method->set_option(*state_out, key, value) < 0) goto set_option_fail; - - args = next_arg; } /* Start method */ diff --git a/src/location.c b/src/location.c index bd852a1..8ca4374 100644 --- a/src/location.c +++ b/src/location.c @@ -82,9 +82,9 @@ try_start(const struct location_provider *provider, LOCATION_STATE **state_out, goto set_option_fail; /* Set provider options from command line */ - for (i = 0; args; i++) { - next_arg = strchr(args, ':'); - if (next_arg) + for (i = 0; args && *args; i++, args = next_arg) { + next_arg = &args[strcspn(args, ";:")]; + if (*next_arg) *next_arg++ = '\0'; key = args; @@ -107,8 +107,6 @@ try_start(const struct location_provider *provider, LOCATION_STATE **state_out, if (provider->set_option(*state_out, key, value) < 0) goto set_option_fail; - - args = next_arg; } /* Start provider */ |