[hackers] [slstatus] Add back version flag to prepare for release || drkhsh

From: <git_AT_suckless.org>
Date: Mon, 15 May 2023 19:17:33 +0200 (CEST)

commit 86c7a84c2397e5bbdcebe2a06bada7ee48f0d480
Author: drkhsh <me_AT_drkhsh.at>
AuthorDate: Mon May 15 19:14:52 2023 +0200
Commit: drkhsh <me_AT_drkhsh.at>
CommitDate: Mon May 15 19:16:12 2023 +0200

    Add back version flag to prepare for release

diff --git a/config.mk b/config.mk
index ead1859..2ba2911 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -11,7 +11,7 @@ X11INC = /usr/X11R6/include
 X11LIB = /usr/X11R6/lib
 
 # flags
-CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE
+CPPFLAGS = -I$(X11INC) -D_DEFAULT_SOURCE -DVERSION=\"${VERSION}\"
 CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -Os
 LDFLAGS = -L$(X11LIB) -s
 # OpenBSD: add -lsndio
diff --git a/slstatus.1 b/slstatus.1
index bea2a8c..73e7a60 100644
--- a/slstatus.1
+++ b/slstatus.1
_AT_@ -22,6 +22,8 @@ By default,
 outputs to WM_NAME.
 .Sh OPTIONS
 .Bl -tag -width Ds
+.It Fl v
+Print version information to stderr, then exit.
 .It Fl s
 Write to stdout instead of WM_NAME.
 .It Fl 1
diff --git a/slstatus.c b/slstatus.c
index cb54f29..fd31313 100644
--- a/slstatus.c
+++ b/slstatus.c
_AT_@ -41,7 +41,7 @@ difftimespec(struct timespec *res, struct timespec *a, struct timespec *b)
 static void
 usage(void)
 {
- die("usage: %s [-s] [-1]", argv0);
+ die("usage: %s [-v] [-s] [-1]", argv0);
 }
 
 int
_AT_@ -56,6 +56,8 @@ main(int argc, char *argv[])
 
         sflag = 0;
         ARGBEGIN {
+ case 'v':
+ die("slstatus-"VERSION);
         case '1':
                 done = 1;
                 /* FALLTHROUGH */
Received on Mon May 15 2023 - 19:17:33 CEST

This archive was generated by hypermail 2.3.0 : Mon May 15 2023 - 19:24:37 CEST