ztatus

[discontinued] Status bar for dwm, and simple notification daemon.
git clone https://noxz.tech/git/ztatus.git
Log | Files | LICENSE

commit: 3009d69fd9eccfeb6a7985e46df8bd69119ab88f
parent: 516e7b4867b21892573743ab519a89b479032d06
author: Chris Noxz <chris@noxz.tech>
date:   Mon, 30 Mar 2020 19:22:31 +0200
Aesthetic changes to messages
Mztatus.c9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/ztatus.c b/ztatus.c
@@ -56,7 +56,7 @@ die(const char *format, ...)
 int
 run(void)
 {
-	int rv, count;
+	int rv, count, pid;
 	fd_set rfds;
 	struct timeval tv;
 	char *status_line = NULL;
@@ -64,8 +64,9 @@ run(void)
 	unlink(FIFO_PATH);
 
 	/* setup, or fail */
-	if (get_pid() != -1)
-		return die("error: another instance of %s is already running\n", PNAME);
+	if ((pid = get_pid()) != -1)
+		return die("error: an instance of %s is already running (PID: %d)\n",
+		           PNAME, pid);
 	if ((mknod(FIFO_PATH, S_IFIFO | 0600, 0)) < 0)
 		return die("error: cannot create fifo '%s'\n", FIFO_PATH);
 	if ((fifofd = open(FIFO_PATH, O_RDWR | O_NONBLOCK)) < 0)
@@ -79,7 +80,7 @@ run(void)
 	signal(SIGINT, sigint_handler);
 	signal(SIGTERM, sigint_handler);
 
-	fprintf(stderr, "%s is running as pid: %d\n", PNAME, self_pid);
+	fprintf(stderr, "%s is running as PID: %d\n", PNAME, self_pid);
 
 	running = 1;
 	while (running) {