Mercurial > hg > quicktun
comparison 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 |
comparison
equal
deleted
inserted
replaced
37:bb4bbf380938 | 38:d9f5caa13898 |
---|---|
40 strcat(tmp, name); | 40 strcat(tmp, name); |
41 return getenv(tmp); | 41 return getenv(tmp); |
42 } | 42 } |
43 #endif | 43 #endif |
44 | 44 |
45 int main() { | 45 int main(int argc, char** argv) { |
46 print_header(); | 46 print_header(); |
47 #ifdef DEBIAN_BINARY | 47 #ifdef DEBIAN_BINARY |
48 getconf = getenvdeb; | 48 getconf = getenvdeb; |
49 #else | 49 #else |
50 getconf = getenv; | 50 getconf = getenv; |
51 #endif | 51 #endif |
52 if (qtprocessargs(argc, argv) < 0) return -1; | |
52 char* envval; | 53 char* envval; |
53 if (envval = getconf("PROTOCOL")) { | 54 if (envval = getconf("PROTOCOL")) { |
54 if (strcmp(envval, "raw") == 0) { | 55 if (strcmp(envval, "raw") == 0) { |
55 return qtrun(&qtproto_raw); | 56 return qtrun(&qtproto_raw); |
56 } else if (strcmp(envval, "nacl0") == 0) { | 57 } else if (strcmp(envval, "nacl0") == 0) { |
57 return qtrun(&qtproto_nacl0); | 58 return qtrun(&qtproto_nacl0); |
58 } else if (strcmp(envval, "nacltai") == 0) { | 59 } else if (strcmp(envval, "nacltai") == 0) { |
59 return qtrun(&qtproto_nacltai); | 60 return qtrun(&qtproto_nacltai); |
60 } else { | 61 } else { |
61 fprintf(stderr, "Unknown protocol specified: %s\n", envval); | 62 return errorexit("Unknown PROTOCOL specified"); |
62 return -1; | |
63 } | 63 } |
64 } else if (getconf("PRIVATE_KEY")) { | 64 } else if (getconf("PRIVATE_KEY")) { |
65 fprintf(stderr, "Warning: PROTOCOL not specified, using insecure nacl0 protocol\n"); | |
65 return qtrun(&qtproto_nacl0); | 66 return qtrun(&qtproto_nacl0); |
66 } else { | 67 } else { |
68 fprintf(stderr, "Warning: PROTOCOL not specified, using insecure raw protocol\n"); | |
67 return qtrun(&qtproto_raw); | 69 return qtrun(&qtproto_raw); |
68 } | 70 } |
69 } | 71 } |
70 | 72 |