From a21e4807aaeb75019e25e5b17cc304fe549691fd Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 24 Jan 2021 01:48:33 +0000 Subject: [PATCH] troubleshooting the appimage --- appimage/ctdlvisor.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/appimage/ctdlvisor.c b/appimage/ctdlvisor.c index a7ae77677..cfeaf290a 100644 --- a/appimage/ctdlvisor.c +++ b/appimage/ctdlvisor.c @@ -26,6 +26,7 @@ #include void main_loop(void); +void run_in_foreground(void); char *data_directory = "/usr/local/citadel"; char *http_port = "80"; @@ -36,7 +37,7 @@ pid_t webcits_pid; void signal_handler(int signal) { - fprintf(stderr, "ctdlvisor: caught signal %d", signal); + fprintf(stderr, "ctdlvisor: caught signal %d\n", signal); int status; pid_t who_exited; @@ -118,6 +119,11 @@ pid_t start_webcits() { } +static char *usage = + "ctdlvisor: usage: ctdlvisor [-h data_directory] [-p http_port] [-s https_port] command\n" + " 'command' must be one of: run, install, start, stop\n" +; + int main(int argc, char **argv) { int c; @@ -132,10 +138,29 @@ int main(int argc, char **argv) { https_port = optarg; break; default: - fprintf(stderr, "ctdlvisor: usage: ctdlvisor [-h data_directory] [-p http_port] [-s https_port]\n"); + fprintf(stderr, "%s", usage); exit(1); } + + if (argc != optind+1) { + fprintf(stderr, "%s", usage); + exit(1); + } + + if (!strcasecmp(argv[optind], "run")) { + run_in_foreground(); + } + else { + fprintf(stderr, "%s", usage); + exit(1); + } + + exit(0); +} + + +void run_in_foreground(void) { fprintf(stderr, "ctdlvisor: Welcome to the Citadel System, brought to you using AppImage.\n"); fprintf(stderr, "ctdlvisor: LD_LIBRARY_PATH = %s\n", getenv("LD_LIBRARY_PATH")); fprintf(stderr, "ctdlvisor: PATH = %s\n", getenv("PATH")); -- 2.30.2