~kennylevinsen/wlsunset

53d19e4c763b462c9dd56194f085d9d39773e6eb — Kenny Levinsen 26 days ago 1111811 master
Add version command line flag
2 files changed, 7 insertions(+), 1 deletions(-)

M main.c
M meson.build
M main.c => main.c +5 -1
@@ 713,6 713,7 @@ static int parse_time_of_day(const char *s, time_t *time) {

static const char usage[] = "usage: %s [options]\n"
"  -h             show this help message\n"
"  -v             show the version number\n"
"  -t <temp>      set low temperature (default: 4000)\n"
"  -T <temp>      set high temperature (default: 6500)\n"
"  -l <lat>       set latitude (e.g. 39.9)\n"


@@ 737,7 738,7 @@ int main(int argc, char *argv[]) {
	};

	int opt;
	while ((opt = getopt(argc, argv, "ht:T:l:L:S:s:d:g:")) != -1) {
	while ((opt = getopt(argc, argv, "hvt:T:l:L:S:s:d:g:")) != -1) {
		switch (opt) {
			case 't':
				config.low_temp = strtol(optarg, NULL, 10);


@@ 771,6 772,9 @@ int main(int argc, char *argv[]) {
			case 'g':
				config.gamma = strtod(optarg, NULL);
				break;
			case 'v':
				printf("wlsunset version %s\n", WLSUNSET_VERSION);
				return EXIT_SUCCESS;
			case 'h':
			default:
				fprintf(stderr, usage, argv[0]);

M meson.build => meson.build +2 -0
@@ 1,6 1,7 @@
project(
	'wlsunset',
	'c',
	version: '0.1.0',
	license: 'MIT',
	meson_version: '>=0.53.0',
	default_options: [


@@ 27,6 28,7 @@ add_project_arguments(
		'-Wl,--exclude-libs=ALL',
		'-D_USE_MATH_DEFINES',
		'-D_XOPEN_SOURCE=700',
		'-DWLSUNSET_VERSION="@0@"'.format(meson.project_version()),
	],
	language: 'c',
)