mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
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>
This commit is contained in:
parent
07f0a8dbc9
commit
e743843d15
17
nasm.c
17
nasm.c
@ -634,6 +634,13 @@ struct textargs textopts[] = {
|
|||||||
{NULL, 0}
|
{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 stopoptions = false;
|
||||||
static bool process_arg(char *p, char *q)
|
static bool process_arg(char *p, char *q)
|
||||||
{
|
{
|
||||||
@ -775,7 +782,7 @@ static bool process_arg(char *p, char *q)
|
|||||||
("usage: nasm [-@ response file] [-o outfile] [-f format] "
|
("usage: nasm [-@ response file] [-o outfile] [-f format] "
|
||||||
"[-l listfile]\n"
|
"[-l listfile]\n"
|
||||||
" [options...] [--] filename\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"
|
" -t assemble in SciTech TASM compatible mode\n"
|
||||||
" -g generate debug information in selected format\n");
|
" -g generate debug information in selected format\n");
|
||||||
printf
|
printf
|
||||||
@ -841,9 +848,7 @@ static bool process_arg(char *p, char *q)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
printf("NASM version %s compiled on %s%s\n",
|
show_version();
|
||||||
nasm_version, nasm_date, nasm_compile_options);
|
|
||||||
exit(0); /* never need usage message here */
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'e': /* preprocess only */
|
case 'e': /* preprocess only */
|
||||||
@ -936,6 +941,10 @@ set_warning:
|
|||||||
stopoptions = 1;
|
stopoptions = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!nasm_stricmp(p, "--v"))
|
||||||
|
show_version();
|
||||||
|
|
||||||
for (s = 0; textopts[s].label; s++) {
|
for (s = 0; textopts[s].label; s++) {
|
||||||
if (!nasm_stricmp(p + 2, textopts[s].label)) {
|
if (!nasm_stricmp(p + 2, textopts[s].label)) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user