diff --git a/.gitignore b/.gitignore index 607be09..cb55977 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ build -qnaplcd +qnapd diff --git a/Makefile b/Makefile index 17fb142..83a9ed9 100644 --- a/Makefile +++ b/Makefile @@ -7,9 +7,9 @@ PID_DIR = /var/run # ############################ SRC = $(wildcard *.c) -TARGET = qnaplcd +TARGET = qnapd BUILD_DIR = build -CFLAGS = -O2 -g -pipe -Wall -Wno-unused-result +CFLAGS = -O2 -g -pipe -Wall -Wno-unused-result -DPROGNAME='"$(TARGET)"' CFLAGS += -MMD -MF $(BUILD_DIR)/$(*D)/$(*F).d LDFLAGS = diff --git a/qnaplcd.c b/qnapd.c similarity index 93% rename from qnaplcd.c rename to qnapd.c index 90d05d1..5e82257 100644 --- a/qnaplcd.c +++ b/qnapd.c @@ -35,11 +35,11 @@ #include "signals.h" #define LCD_DEVICE "/dev/ttyS0" -#define LCD_TIMEOUT 10 +#define LCD_TIMEOUT 15 -#define DEFAULT_CONFIG "qnaplcd.conf" -#define DEFAULT_LOGFILE "qnaplcd.log" -#define DEFAULT_PIDFILE "qnaplcd.pid" +#define DEFAULT_CONFIG PROGNAME".conf" +#define DEFAULT_LOGFILE PROGNAME".log" +#define DEFAULT_PIDFILE PROGNAME".pid" static struct option opts[] = { {"config", 1, 0, 'c'}, @@ -132,7 +132,7 @@ int main(int argc, char *argv[]) break; case 'h': /* help */ - printf("Usage: qnaplcd [options]\n" + printf("Usage: "PROGNAME" [options]\n" "Options: \n" " --config -c configfile use this configfile\n" " --debug -d do not fork and log to stderr\n" @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) /* check pidfile */ const char *pidfile = config_get_string("global", "pidfile", DEFAULT_PIDFILE); if (pidfile_check(pidfile, 1) != 0) { - log_print(LOG_ERROR, "qnaplcd already running"); + log_print(LOG_ERROR, PROGNAME" already running"); exit(1); } @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) signal_init(); signal_add_callback(SIGHUP, trigger_restart, (void *)&restart_var); - log_print(LOG_EVERYTIME, "qnaplcd started (pid:%d)", getpid()); + log_print(LOG_EVERYTIME, PROGNAME" started (pid:%d)", getpid()); while (1) { struct lcddev *dev = lcd_init(LCD_DEVICE, &button_callback, NULL); @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) if (!debug && log_init(logfile) < 0) break; - log_print(LOG_EVERYTIME, "bcastfwd restarted (pid:%d) ", getpid()); + log_print(LOG_EVERYTIME, PROGNAME" restarted (pid:%d) ", getpid()); } return 0; diff --git a/qnapd.conf b/qnapd.conf new file mode 100644 index 0000000..e69de29