From 980001cfc9cfc0582f6d1538e18d391bbd270087 Mon Sep 17 00:00:00 2001 From: DogeyStamp Date: Mon, 2 Aug 2021 13:55:46 -0400 Subject: [PATCH] Add version number --- Makefile | 7 ++++--- minrss.c | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f069425..c04f396 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ +PREFIX = /usr/local +VERSION = 0.1 + SRC = minrss.c util.c net.c xml.c OBJ = $(SRC:.c=.o) CC = cc INCS = LIBS = -lcurl -I/usr/include/libxml2 -lxml2 -lm WARN = -Wall -Wpedantic -Wextra -CFLAGS = $(LIBS) $(INCS) $(WARN) - -PREFIX = /usr/local +CFLAGS = $(LIBS) $(INCS) $(WARN) -DVERSION=\"$(VERSION)\" all: config.h minrss diff --git a/minrss.c b/minrss.c index fd8c44c..cd4f9d7 100644 --- a/minrss.c +++ b/minrss.c @@ -76,8 +76,13 @@ finish(char *url, long responseCode) } int -main() +main(int argc, char *argv[]) { + if (argc == 2 && !strcmp("-v", argv[1])) + logMsg(0, "MinRSS %s\n", VERSION); + else if (argc != 1) + logMsg(0, "Usage: minrss [-v]\n"); + unsigned int i = 0; initCurl();