diff src/run.combined.c @ 38:d9f5caa13898

Added support for NetBSD, added command line parsing to provide configuration options
author Ivo Smits <Ivo@UCIS.nl>
date Mon, 06 May 2013 22:53:20 +0200
parents 6f0e6b7dc088
children c8d176154d7c
line wrap: on
line diff
--- a/src/run.combined.c	Mon May 06 21:28:45 2013 +0200
+++ b/src/run.combined.c	Mon May 06 22:53:20 2013 +0200
@@ -42,13 +42,14 @@
 }
 #endif
 
-int main() {
+int main(int argc, char** argv) {
 	print_header();
 #ifdef DEBIAN_BINARY
 	getconf = getenvdeb;
 #else
 	getconf = getenv;
 #endif
+	if (qtprocessargs(argc, argv) < 0) return -1;
 	char* envval;
 	if (envval = getconf("PROTOCOL")) {
 		if (strcmp(envval, "raw") == 0) {
@@ -58,12 +59,13 @@
 		} else if (strcmp(envval, "nacltai") == 0) {
 			return qtrun(&qtproto_nacltai);
 		} else {
-			fprintf(stderr, "Unknown protocol specified: %s\n", envval);
-			return -1;
+			return errorexit("Unknown PROTOCOL specified");
 		}
 	} else if (getconf("PRIVATE_KEY")) {
+		fprintf(stderr, "Warning: PROTOCOL not specified, using insecure nacl0 protocol\n");
 		return qtrun(&qtproto_nacl0);
 	} else {
+		fprintf(stderr, "Warning: PROTOCOL not specified, using insecure raw protocol\n");
 		return qtrun(&qtproto_raw);
 	}
 }