Browse code

Add version string

John Hawthorn authored on 27/07/2014 04:51:27
Showing 2 changed files

  • Makefile index 8eaeb2e..fe54ee2 100644
  • fzy.c index c30be05..6b638f5 100644
... ...
@@ -1,3 +1,6 @@
1
+VERSION=0.1beta
2
+
3
+CPPFLAGS=-DVERSION=\"${VERSION}\"
1 4
 CFLAGS+=-Wall -Wextra -g -std=c99
2 5
 PREFIX?=/usr/local
3 6
 
... ...
@@ -232,7 +232,10 @@ void usage(const char *argv0){
232 232
 }
233 233
 
234 234
 int main(int argc, char *argv[]){
235
-	if(argc != 1){
235
+	if(argc == 2 && !strcmp(argv[1], "-v")){
236
+		printf("%s " VERSION  " (c) 2014 John Hawthorn\n", argv[0]);
237
+		exit(EXIT_SUCCESS);
238
+	}else if(argc != 1){
236 239
 		usage(argv[0]);
237 240
 	}
238 241
 	atexit(reset_tty);