diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2014-05-09 22:34:34 +0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-05-09 15:08:28 -0700 |
commit | 13558c1e7cb2a1a2ea1b1c13ff554063de8afaf0 (patch) | |
tree | 9715c7dec93fe8ca6f63060194501c70007129e0 | |
parent | 39aa094f388496a0262e02aee46e14a37b7fab25 (diff) | |
download | nasm-13558c1e7cb2a1a2ea1b1c13ff554063de8afaf0.tar.gz nasm-13558c1e7cb2a1a2ea1b1c13ff554063de8afaf0.tar.bz2 nasm-13558c1e7cb2a1a2ea1b1c13ff554063de8afaf0.zip |
options: Add --v option
It's been requested a long ago to handle '--v' option same was as
a regualar '-v'. From initial report
| NASM and yasm are in many respects compatible but yasm uses --v
| instead of -v for version. As often --v is used for version I
| end up using --v initially in NASM. This patch allows me to compile
| Mozilla apps which use yasm with NASM by merely renaming NASM to yasm
| so that the build environment does not have to be updated (Mozilla
| would not accept changes to allow use of NASM).
Reported-by: Andy Willis <abwillis1@gmail.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | nasm.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -635,6 +635,13 @@ struct textargs textopts[] = { {NULL, 0} }; +static void show_version(void) +{ + printf("NASM version %s compiled on %s%s\n", + nasm_version, nasm_date, nasm_compile_options); + exit(0); +} + static bool stopoptions = false; static bool process_arg(char *p, char *q) { @@ -776,7 +783,7 @@ static bool process_arg(char *p, char *q) ("usage: nasm [-@ response file] [-o outfile] [-f format] " "[-l listfile]\n" " [options...] [--] filename\n" - " or nasm -v for version info\n\n" + " or nasm -v (or --v) for version info\n\n" " -t assemble in SciTech TASM compatible mode\n" " -g generate debug information in selected format\n"); printf @@ -842,9 +849,7 @@ static bool process_arg(char *p, char *q) break; case 'v': - printf("NASM version %s compiled on %s%s\n", - nasm_version, nasm_date, nasm_compile_options); - exit(0); /* never need usage message here */ + show_version(); break; case 'e': /* preprocess only */ @@ -937,6 +942,10 @@ set_warning: stopoptions = 1; break; } + + if (!nasm_stricmp(p, "--v")) + show_version(); + for (s = 0; textopts[s].label; s++) { if (!nasm_stricmp(p + 2, textopts[s].label)) { break; |