Several struct members were left uninitialized in some paths of the
code. Fix this by initializing all struct members to 0 in the affected
places.
Also fix an incorrectly sized malloc, where the size of a pointer
instead of the struct size was supplied to malloc.
The XDG Base Directory specification [1] demands that there should be a
"single base directory relative to which user-specific non-essential
(cached) data should be written". Light currently makes use of such a
cache directory, but hardcodes the default "$HOME/.cache".
In order to enable users to specify a custom cache directory, respect
this convention and use the "$XDG_CACHE_HOME" environment variable if it
is set. If it is not set, fall back to "$HOME/.cache".
[1] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Fix #46: Migrate to use ~/.cache/light for unpriviliged operation
When light is installed in the non-SUID root mode it cannot write to
/etc/light anymore, so we set up a ~/.cache/light instead.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Fix #45: Add --with-udev[=PATH] to configure, disables classic SUID root
This patch adds support for installing the 90-backlight.rules to gain
privileges to the kernel sysfs files. By default the classic SUID root
mode is used and the rules file is not installed.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Overhaul and simplify program usage and documentation in README
- Use version from configure script
- Simplify usage text for accessibility, only one command at a time
- Simplify terminology, we have commands and options to commands
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Rearrange and simplify text a bit, also put examples early
Most users want to see the examples as early as possible, so we place
them directly after the new (simplified) introduction. The examples
have been rewritten to separate commands from options and grouping
the command with its value, where applicable.
The rest of the document has just been auto-filled to fit to < 72
columns and sections now use === and ---- for headings to make the
README more accessible from a terminal.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>