diff --git a/makefile b/makefile index 7fe40e19..e5fa5b24 100644 --- a/makefile +++ b/makefile @@ -3,7 +3,7 @@ CC = gcc FLAGS = -std=c99 -pedantic -g FLAGS+= -Wall -Wextra -Werror=vla -Wno-unused-parameter #FLAGS+= -DDEBUG -FLAGS+= -DGIT_VERSION_STRING=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\" +FLAGS+= -DLY_VERSION=\"$(shell git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g')\" LINK = -lpam -lxcb VALGRIND = --show-leak-kinds=all --track-origins=yes --leak-check=full --suppressions=../res/valgrind.supp CMD = ./$(NAME) diff --git a/src/main.c b/src/main.c index 95dc38d2..162aea17 100644 --- a/src/main.c +++ b/src/main.c @@ -19,8 +19,10 @@ #include #define ARG_COUNT 7 -// things you can define: -// GIT_VERSION_STRING + +#ifndef LY_VERSION +#define LY_VERSION "0.6.0" +#endif // global struct lang lang; @@ -30,15 +32,12 @@ struct config config; void arg_help(void* data, char** pars, const int pars_count) { printf("If you want to configure Ly, please check the config file, usually located at /etc/ly/config.ini.\n"); + exit(0); } void arg_version(void* data, char** pars, const int pars_count) { -#ifdef GIT_VERSION_STRING - printf("Ly version %s\n", GIT_VERSION_STRING); -#else - printf("Ly version unknown\n"); -#endif + printf("Ly version %s\n", LY_VERSION); } // low-level error messages @@ -345,8 +344,7 @@ int main(int argc, char** argv) { execl("/bin/sh", "sh", "-c", config.shutdown_cmd, NULL); } - - if (reboot) + else if (reboot) { execl("/bin/sh", "sh", "-c", config.restart_cmd, NULL); }