Commit 1e70621d6183f2a0cfe932867a0ab10416716517

Stefan Sperling 2018-03-27T20:47:51

reset optind in main()

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/got/got.c b/got/got.c
index 40c422e..13b85d1 100644
--- a/got/got.c
+++ b/got/got.c
@@ -85,6 +85,7 @@ main(int argc, char *argv[])
 
 	argc -= optind;
 	argv += optind;
+	optind = 0;
 
 	if (argc <= 0)
 		usage();
@@ -158,7 +159,6 @@ cmd_checkout(int argc, char *argv[])
 	const char *path_prefix = "";
 	int ch;
 
-	optind = 0;
 	while ((ch = getopt(argc, argv, "p:")) != -1) {
 		switch (ch) {
 		case 'p':