changeset 61:66d9d80215f0

Fixed -h and -v return status, fixed source file permissions (thanks github.com/rotty)
author Ivo Smits <Ivo@UFO-Net.nl>
date Wed, 04 Jan 2017 21:42:38 +0100
parents 81dfc3046d62
children 5b9e742bb704
files src/common.c src/proto.nacl0.c src/proto.nacltai.c src/proto.raw.c src/proto.salty.c src/run.combined.c
diffstat 6 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/common.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/common.c	Wed Jan 04 21:42:38 2017 +0100
@@ -115,7 +115,7 @@
 }
 
 void print_header() {
-	fprintf(stderr, "UCIS QuickTun "QT_VERSION" (c) 2010-2013 Ivo Smits <Ivo@UCIS.nl>\n");
+	fprintf(stderr, "UCIS QuickTun "QT_VERSION" (c) 2010-2017 Ivo Smits <Ivo@UCIS.nl>\n");
 	fprintf(stderr, "More information: http://wiki.ucis.nl/QuickTun\n");
 }
 
@@ -421,9 +421,11 @@
 	for (i = 1; i < argc; i++) {
 		char* a = argv[i];
 		if (!strcmp(a, "-h") || !strcmp(a, "--help")) {
-			return errorexit("Please read the documentation at http://wiki.ucis.nl/QuickTun");
+			printf("Please read the documentation at http://wiki.ucis.nl/QuickTun\n");
+			return 0;
 		} else if (!strcmp(a, "-v") || !strcmp(a, "--version")) {
-			return errorexit("UCIS QuickTun "QT_VERSION);
+			printf("UCIS QuickTun "QT_VERSION"\n");
+			return 0;
 		} else if (!strcmp(a, "-c")) {
 			gargc = argc;
 			gargv = argv;
@@ -433,7 +435,7 @@
 			return errorexit("Unexpected command line argument");
 		}
 	}
-	return 0;
+	return 1;
 }
 #endif
 
--- a/src/proto.nacl0.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/proto.nacl0.c	Wed Jan 04 21:42:38 2017 +0100
@@ -99,7 +99,8 @@
 #ifndef COMBINED_BINARY
 int main(int argc, char** argv) {
 	print_header();
-	if (qtprocessargs(argc, argv) < 0) return -1;
+	int rc = qtprocessargs(argc, argv);
+	if (rc <= 0) return rc;
 	return qtrun(&qtproto_nacl0);
 }
 #endif
--- a/src/proto.nacltai.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/proto.nacltai.c	Wed Jan 04 21:42:38 2017 +0100
@@ -176,7 +176,8 @@
 #ifndef COMBINED_BINARY
 int main(int argc, char** argv) {
 	print_header();
-	if (qtprocessargs(argc, argv) < 0) return -1;
+	int rc = qtprocessargs(argc, argv);
+	if (rc <= 0) return rc;
 	return qtrun(&qtproto_nacltai);
 }
 #endif
--- a/src/proto.raw.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/proto.raw.c	Wed Jan 04 21:42:38 2017 +0100
@@ -50,7 +50,8 @@
 #ifndef COMBINED_BINARY
 int main(int argc, char** argv) {
 	print_header();
-	if (qtprocessargs(argc, argv) < 0) return -1;
+	int rc = qtprocessargs(argc, argv);
+	if (rc <= 0) return rc;
 	return qtrun(&qtproto_raw);
 }
 #endif
--- a/src/proto.salty.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/proto.salty.c	Wed Jan 04 21:42:38 2017 +0100
@@ -464,7 +464,8 @@
 #ifndef COMBINED_BINARY
 int main(int argc, char** argv) {
 	print_header();
-	if (qtprocessargs(argc, argv) < 0) return -1;
+	int rc = qtprocessargs(argc, argv);
+	if (rc <= 0) return rc;
 	return qtrun(&qtproto_salty);
 }
 #endif
--- a/src/run.combined.c	Mon Jul 04 11:59:12 2016 +0200
+++ b/src/run.combined.c	Wed Jan 04 21:42:38 2017 +0100
@@ -50,7 +50,8 @@
 #else
 	getconf = getenv;
 #endif
-	if (qtprocessargs(argc, argv) < 0) return -1;
+	int rc = qtprocessargs(argc, argv);
+	if (rc <= 0) return rc;
 	char* envval;
 	if ((envval = getconf("PROTOCOL"))) {
 		if (strcmp(envval, "raw") == 0) {