version 1.193.2.1, 2007/03/23 21:53:56
|
version 1.193.2.2, 2007/04/23 21:41:22
|
|
|
| |
static int _extractExecutorSockOpt(int& argc, char**& argv) | static int _extractExecutorSockOpt(int& argc, char**& argv) |
{ | { |
// Extract the "-x <sock>" option if any. This indicates that the |
// Extract the "--executor-socket <sock>" option if any. This indicates |
// e[x]ecutor is running. The option argument is the socket used |
// that the e[x]ecutor is running. The option argument is the socket used |
// to communicate with the executor. Remove the option from the | // to communicate with the executor. Remove the option from the |
// argv list and decrease argc by two. | // argv list and decrease argc by two. |
| |
int sock = -1; | int sock = -1; |
|
const char OPT[] = "--executor-socket"; |
| |
for (int i = 1; i < argc; i++) | for (int i = 1; i < argc; i++) |
{ | { |
if (strcmp(argv[i], "-x") == 0) |
if (strcmp(argv[i], OPT) == 0) |
{ | { |
// Check for missing option argument. | // Check for missing option argument. |
| |
if (i + 1 == argc) | if (i + 1 == argc) |
{ | { |
fprintf(stderr, | fprintf(stderr, |
"%s: missing option argument for -x\n", argv[0]); |
"%s: missing option argument for %s option\n", |
|
argv[0], OPT); |
exit(1); | exit(1); |
} | } |
| |
|
|
| |
if (*end != '\0' || x > 2147483647) | if (*end != '\0' || x > 2147483647) |
{ | { |
fprintf(stderr, |
fprintf(stderr, "%s: bad %s option argument: %s\n", |
"%s: bad -x option argument: %s\n", argv[0], argv[i+1]); |
argv[0], OPT, argv[i+1]); |
exit(1); | exit(1); |
} | } |
| |