# Makefile for the nwho toolkit
-CFLAGS=-O2 -Wall -Wno-parentheses
+VERSION=1.12
+CFLAGS=-O2 -Wall -Wno-parentheses -DVERSION=$(VERSION)
LDFLAGS=-s
ROOT=/
-REL=nwho-1.12
+REL=nwho-$(VERSION)
all: nwhod nwho
nwhod: nwhod.o
-
nwhod.o: nwhod.c nwho.h
nwho: nwho.o
-
nwho.o: nwho.c nwho.h
clean:
int
main(int argc, char **argv)
{
+ if (argc == 2 && !strcmp(argv[1], "--version"))
+ {
+ printf("nwho " STRINGIFY(VERSION) "\n");
+ return 0;
+ }
+
if (strstr(argv[0], "uptime"))
is_uptime = 1;
if (argc != 1)
#define DEFAULT_PRUNE_TIME 30
#define DEFAULT_DOWN_TIME 120
#define DEFAULT_DEAD_TIME 4*86400
+
+#define STRINGIFY(x) STRINGIFY2(x)
+#define STRINGIFY2(x) #x
int
main(int argc, char **argv)
{
+ if (argc == 2 && !strcmp(argv[1], "--version"))
+ {
+ printf("nwho " STRINGIFY(VERSION) "\n");
+ return 0;
+ }
+
if (argc == 2)
client(argv[1]);
else if (argc == 1)