Mercurial > hg > quicktun
comparison src/common.c @ 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 | 2f4d333f7500 |
children | fa4983c5f7ea |
comparison
equal
deleted
inserted
replaced
60:81dfc3046d62 | 61:66d9d80215f0 |
---|---|
113 perror(text); | 113 perror(text); |
114 return -1; | 114 return -1; |
115 } | 115 } |
116 | 116 |
117 void print_header() { | 117 void print_header() { |
118 fprintf(stderr, "UCIS QuickTun "QT_VERSION" (c) 2010-2013 Ivo Smits <Ivo@UCIS.nl>\n"); | 118 fprintf(stderr, "UCIS QuickTun "QT_VERSION" (c) 2010-2017 Ivo Smits <Ivo@UCIS.nl>\n"); |
119 fprintf(stderr, "More information: http://wiki.ucis.nl/QuickTun\n"); | 119 fprintf(stderr, "More information: http://wiki.ucis.nl/QuickTun\n"); |
120 } | 120 } |
121 | 121 |
122 static int is_all_zero(void* buf, int size) { | 122 static int is_all_zero(void* buf, int size) { |
123 int i; | 123 int i; |
419 int qtprocessargs(int argc, char** argv) { | 419 int qtprocessargs(int argc, char** argv) { |
420 int i; | 420 int i; |
421 for (i = 1; i < argc; i++) { | 421 for (i = 1; i < argc; i++) { |
422 char* a = argv[i]; | 422 char* a = argv[i]; |
423 if (!strcmp(a, "-h") || !strcmp(a, "--help")) { | 423 if (!strcmp(a, "-h") || !strcmp(a, "--help")) { |
424 return errorexit("Please read the documentation at http://wiki.ucis.nl/QuickTun"); | 424 printf("Please read the documentation at http://wiki.ucis.nl/QuickTun\n"); |
425 return 0; | |
425 } else if (!strcmp(a, "-v") || !strcmp(a, "--version")) { | 426 } else if (!strcmp(a, "-v") || !strcmp(a, "--version")) { |
426 return errorexit("UCIS QuickTun "QT_VERSION); | 427 printf("UCIS QuickTun "QT_VERSION"\n"); |
428 return 0; | |
427 } else if (!strcmp(a, "-c")) { | 429 } else if (!strcmp(a, "-c")) { |
428 gargc = argc; | 430 gargc = argc; |
429 gargv = argv; | 431 gargv = argv; |
430 getconf = getconfcmdargs; | 432 getconf = getconfcmdargs; |
431 i += 2; | 433 i += 2; |
432 } else { | 434 } else { |
433 return errorexit("Unexpected command line argument"); | 435 return errorexit("Unexpected command line argument"); |
434 } | 436 } |
435 } | 437 } |
436 return 0; | 438 return 1; |
437 } | 439 } |
438 #endif | 440 #endif |
439 | 441 |