Commit Diff


commit - bb51a5b4af467a42569e19cbeeeeccbb44d946f0
commit + 83cd27f841bd6479abfad4c2e3c4bd870dd8ab7e
blob - c37e7cad2084f68edcbdff9b1085facc2f646043
blob + 3cc5be659be470b6fe6893eb8dc8abbb28cb200c
--- got/got.1
+++ got/got.1
@@ -54,7 +54,7 @@ Global options must precede the command name, and are 
 .Bl -tag -width tenletters
 .It Fl h
 Display usage information and exit immediately.
-.It Fl V
+.It Fl V, -version
 Display program version and exit immediately.
 .El
 .Pp
blob - 9949c5488d778cc0038d5ad03dc24986ac5f059b
blob + 38d9e61d95fa470f8004d97a7c6dc470d5aa747b
--- got/got.c
+++ got/got.c
@@ -36,6 +36,7 @@
 #include <time.h>
 #include <paths.h>
 #include <regex.h>
+#include <getopt.h>
 
 #include "got_version.h"
 #include "got_error.h"
@@ -176,10 +177,14 @@ main(int argc, char *argv[])
 	unsigned int i;
 	int ch;
 	int hflag = 0, Vflag = 0;
+	static struct option longopts[] = {
+	     { "version", no_argument, NULL, 'V' },
+	     { NULL, 0, NULL, 0}
+	};
 
 	setlocale(LC_CTYPE, "");
 
-	while ((ch = getopt(argc, argv, "hV")) != -1) {
+	while ((ch = getopt_long(argc, argv, "hV", longopts, NULL)) != -1) {
 		switch (ch) {
 		case 'h':
 			hflag = 1;
blob - 19ba4d62aa88933b5530a372f17736904a20d1a5
blob + 8bb96582fbce1aebbc2f1d77510544ea3e8ee6b5
--- tog/tog.1
+++ tog/tog.1
@@ -68,7 +68,7 @@ Global options must precede the command name, and are 
 .Bl -tag -width tenletters
 .It Fl h
 Display usage information.
-.It Fl V
+.It Fl V, -version
 Display program version and exit immediately.
 .El
 .Pp
blob - f7433438ed173bf228ef2be0f9ef54cc029464b3
blob + 7c13005b2538bbd85302be4d280fd98ec23a4ac3
--- tog/tog.c
+++ tog/tog.c
@@ -5099,10 +5099,14 @@ main(int argc, char *argv[])
 	struct tog_cmd *cmd = NULL;
 	int ch, hflag = 0, Vflag = 0;
 	char **cmd_argv = NULL;
+	static struct option longopts[] = {
+	     { "version", no_argument, NULL, 'V' },
+	     { NULL, 0, NULL, 0}
+	};
 
 	setlocale(LC_CTYPE, "");
 
-	while ((ch = getopt(argc, argv, "hV")) != -1) {
+	while ((ch = getopt_long(argc, argv, "hV", longopts, NULL)) != -1) {
 		switch (ch) {
 		case 'h':
 			hflag = 1;