8010902b98282a81d0a8417deb43a7c71f129455 — dax 2 months ago e336677
add -v to output version info
4 files changed, 14 insertions(+), 3 deletions(-)

M config.mk
M dw.1
M dw.1.scd
M dw.c
M config.mk => config.mk +1 -1
@@ 11,7 11,7 @@ MANDIR = ${DATAROOTDIR}/man
  
  # flags
- CPPFLAGS = -D_XOPEN_SOURCE=700
+ CPPFLAGS = -D_XOPEN_SOURCE=700 -DVERSION=\"${VERSION}\"
  CFLAGS   = -std=c99 -pedantic -Wall ${CPPFLAGS}
  
  # compiler and linker

M dw.1 => dw.1 +6 -1
@@ 4,7 4,7 @@ .nh
  .ad l
  .\" Begin generated content:
- .TH "dw" "1" "2019-03-08"
+ .TH "dw" "1" "2019-03-26"
  .P
  .SH NAME
  .P


@@ 29,6 29,11 @@ Show help message and exit.
  .P
  .RE
+ \fB-v\fR
+ .RS 4
+ Show version and exit.
+ .P
+ .RE
  \fB-n\fR <passphrase-length>
  .RS 4
  Number of words to generate for the passphrase.

M dw.1.scd => dw.1.scd +3 -0
@@ 21,6 21,9 @@ *-h*
  	Show help message and exit.
  
+ *-v*
+ 	Show version and exit.
+ 
  *-n* <passphrase-length>
  	Number of words to generate for the passphrase.
  	Default is 6.

M dw.c => dw.c +4 -1
@@ 82,11 82,14 @@ int opt;
  	char *usage = "usage: dw [-n passphrase-length] [-s max-words]";
  
- 	while ((opt = getopt(argc, argv, "hs:n:")) >= 0) {
+ 	while ((opt = getopt(argc, argv, "hvs:n:")) >= 0) {
  		switch (opt) {
  		case 'h':
  			printf("%s\n", usage);
  			exit(EXIT_SUCCESS);
+ 		case 'v':
+ 			puts("dw " VERSION);
+ 			exit(EXIT_SUCCESS);
  		case 's':
  			max_words = atoi(optarg);
  			wordlist_size = max_words;