diff options
author | Mattias Andrée <maandree@kth.se> | 2021-03-05 00:43:38 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2021-03-05 00:43:38 +0100 |
commit | 0ce0d8d6e0c420ccafa79e0203b928c3559a4311 (patch) | |
tree | 88e8228a93691c28811a49898abf86a96dd9d613 /libgamma_method_default_site.c | |
parent | Change license + change style + misc (diff) | |
download | libgamma-0ce0d8d6e0c420ccafa79e0203b928c3559a4311.tar.gz libgamma-0ce0d8d6e0c420ccafa79e0203b928c3559a4311.tar.bz2 libgamma-0ce0d8d6e0c420ccafa79e0203b928c3559a4311.tar.xz |
Split source files, merge public header files, eliminite use gpp, rewrite makefile
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | libgamma_method_default_site.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/libgamma_method_default_site.c b/libgamma_method_default_site.c new file mode 100644 index 0000000..5da2c72 --- /dev/null +++ b/libgamma_method_default_site.c @@ -0,0 +1,31 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +/** + * Return the default site for an adjustment method + * + * @param method The adjustment method (display server and protocol) + * @return The default site, `NULL` if it cannot be determined or + * if multiple sites are not supported by the adjustment + * method + */ +const char * +libgamma_method_default_site(int method) +{ + const char *restrict var = libgamma_method_default_site_variable(method); + const char *restrict env; + + /* Return `NULL` if there is no variable to read */ + if (!var) + return NULL; + + /* Read the variable */ + env = getenv(var); + /* Return `NULL` if it does not exist (or is empty) */ + if (!env || !*env) + return NULL; + + /* Return the variable's value */ + return env; +} |