|
@ -326,7 +326,6 @@ PrintHelp ( ) |
|
|
{ |
|
|
{ |
|
|
printf("Usage: node [switches] script.js [arguments] \n" |
|
|
printf("Usage: node [switches] script.js [arguments] \n" |
|
|
" -v, --version print node's version\n" |
|
|
" -v, --version print node's version\n" |
|
|
" --libs print linker flags for modules\n" |
|
|
|
|
|
" --cflags print pre-processor and compiler flags\n" |
|
|
" --cflags print pre-processor and compiler flags\n" |
|
|
" --v8-options print v8 command line options\n"); |
|
|
" --v8-options print v8 command line options\n"); |
|
|
} |
|
|
} |
|
@ -334,18 +333,14 @@ PrintHelp ( ) |
|
|
static void |
|
|
static void |
|
|
ParseArgs (int *argc, char **argv) |
|
|
ParseArgs (int *argc, char **argv) |
|
|
{ |
|
|
{ |
|
|
bool cflags = false, libs = false; |
|
|
|
|
|
for (int i = 1; i < *argc; i++) { |
|
|
for (int i = 1; i < *argc; i++) { |
|
|
const char *arg = argv[i]; |
|
|
const char *arg = argv[i]; |
|
|
if (strcmp(arg, "--version") == 0 || strcmp(arg, "-v") == 0) { |
|
|
if (strcmp(arg, "--version") == 0 || strcmp(arg, "-v") == 0) { |
|
|
printf("%s\n", NODE_VERSION); |
|
|
printf("%s\n", NODE_VERSION); |
|
|
exit(0); |
|
|
exit(0); |
|
|
} else if (strcmp(arg, "--cflags") == 0) { |
|
|
} else if (strcmp(arg, "--cflags") == 0) { |
|
|
cflags = true; |
|
|
printf("%s\n", NODE_CFLAGS); |
|
|
continue; |
|
|
exit(0); |
|
|
} else if (strcmp(arg, "--libs") == 0) { |
|
|
|
|
|
libs = true; |
|
|
|
|
|
continue; |
|
|
|
|
|
} else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { |
|
|
} else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { |
|
|
PrintHelp(); |
|
|
PrintHelp(); |
|
|
exit(0); |
|
|
exit(0); |
|
@ -353,21 +348,6 @@ ParseArgs (int *argc, char **argv) |
|
|
argv[i] = (char*)"--help"; |
|
|
argv[i] = (char*)"--help"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* XXX Wow this is terrible code. */ |
|
|
|
|
|
bool should_exit = false; |
|
|
|
|
|
if (cflags) { |
|
|
|
|
|
should_exit = true; |
|
|
|
|
|
printf("%s ", NODE_CFLAGS); |
|
|
|
|
|
} |
|
|
|
|
|
if (libs) { |
|
|
|
|
|
should_exit = true; |
|
|
|
|
|
printf("%s ", NODE_LIBFLAGS); |
|
|
|
|
|
} |
|
|
|
|
|
if (should_exit) { |
|
|
|
|
|
printf("\n"); |
|
|
|
|
|
exit(0); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int |
|
|
int |
|
|