From: Andy W. <abw...@gm...> - 2014-01-06 22:01:52
|
Long patch description: 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). The patch is trivial and as such should not affect any other use case that I can see. --- a/nasm.c +++ b/nasm.c @@ -653,6 +653,10 @@ static bool process_arg(char *p, char *q) return advance; } + if (p[1] == '-' && p[2] == 'v') { + p[1] = 'v'; + } + switch (p[1]) { case 's': error_file = stdout; @@ -777,6 +781,7 @@ static bool process_arg(char *p, char *q) "[-l listfile]\n" " [options...] [--] filename\n" " or nasm -v for version info\n\n" + " or nasm --v for version info\n\n" " -t assemble in SciTech TASM compatible mode\n" " -g generate debug information in selected format\n"); printf Signed-off-by: Andy Willis <abw...@gm...> |
From: Cyrill G. <gor...@gm...> - 2014-01-08 15:17:44
|
On Mon, Jan 06, 2014 at 03:01:44PM -0700, Andy Willis wrote: > Long patch description: 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). The patch is trivial > and as such should not affect any other use case that I can see. --- I don't see a reason why can't we. I've udated patch a bit though. Peter? --- From: Cyrill Gorcunov <gor...@gm...> Date: Wed, 8 Jan 2014 19:14:52 +0400 Subject: [PATCH] nasm: Show version for --v option This allows to compile Mozilla apps which use YASM with NASM by merely renaming yasm to nasm, so that the build environment does not have to be updated. Based on patch from Andy Willis <abw...@gm...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- nasm.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/nasm.c b/nasm.c index 2bb3029..5f63b27 100644 --- a/nasm.c +++ b/nasm.c @@ -635,6 +635,12 @@ 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); +} + static bool stopoptions = false; static bool process_arg(char *p, char *q) { @@ -776,7 +782,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|--v) for version info\n\n" " -t assemble in SciTech TASM compatible mode\n" " -g generate debug information in selected format\n"); printf @@ -842,8 +848,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); + show_version(); exit(0); /* never need usage message here */ break; @@ -972,6 +977,10 @@ set_warning: } default: { + if (p[1] == '-' && p[2] == 'v') { + show_version(); + exit(0); + } nasm_error(ERR_NONFATAL | ERR_NOFILE | ERR_USAGE, "unrecognised option `--%s'", p + 2); break; -- 1.8.3.1 |
From: H. P. A. <hp...@zy...> - 2014-01-08 17:40:43
|
On 01/08/2014 07:17 AM, Cyrill Gorcunov wrote: > On Mon, Jan 06, 2014 at 03:01:44PM -0700, Andy Willis wrote: >> Long patch description: 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). The patch is trivial >> and as such should not affect any other use case that I can see. > --- > > I don't see a reason why can't we. I've udated patch a bit though. Peter? Presumably we should handle both --v and --version, but I'd prefer if we actually implemented the second '-' as a separate case clause and did whole string comparisons, for future use. Even better might be to adopt getopt_long(), I think I have a BSD-licensed implementation of getopt_long() sitting around somewhere... -hpa |
From: Cyrill G. <gor...@gm...> - 2014-01-08 17:44:02
|
On Wed, Jan 08, 2014 at 09:40:19AM -0800, H. Peter Anvin wrote: > > > > I don't see a reason why can't we. I've udated patch a bit though. Peter? > > Presumably we should handle both --v and --version, but I'd prefer if we > actually implemented the second '-' as a separate case clause and did > whole string comparisons, for future use. > > Even better might be to adopt getopt_long(), I think I have a > BSD-licensed implementation of getopt_long() sitting around somewhere... Good point! I'll take a look once time permit. (Or if someone beat me on this I won't mind ;) |
From: H. P. A. <hp...@zy...> - 2014-01-08 17:51:10
|
On 01/08/2014 09:43 AM, Cyrill Gorcunov wrote: > On Wed, Jan 08, 2014 at 09:40:19AM -0800, H. Peter Anvin wrote: >>> >>> I don't see a reason why can't we. I've udated patch a bit though. Peter? >> >> Presumably we should handle both --v and --version, but I'd prefer if we >> actually implemented the second '-' as a separate case clause and did >> whole string comparisons, for future use. >> >> Even better might be to adopt getopt_long(), I think I have a >> BSD-licensed implementation of getopt_long() sitting around somewhere... > > Good point! I'll take a look once time permit. (Or if someone beat me > on this I won't mind ;) > So yes... I do have a copy of getopt_long() in klibc, which is MIT-licensed (equivalent to 2-BSD) and thus we can just use it. I'm the copyright holder anyway, so if I say we can use it we can. -hpa |
From: Cyrill G. <gor...@gm...> - 2014-01-08 17:59:38
|
On Wed, Jan 08, 2014 at 09:50:55AM -0800, H. Peter Anvin wrote: > > > > Good point! I'll take a look once time permit. (Or if someone beat me > > on this I won't mind ;) > > > > So yes... I do have a copy of getopt_long() in klibc, which is > MIT-licensed (equivalent to 2-BSD) and thus we can just use it. I'm the > copyright holder anyway, so if I say we can use it we can. Cool! This simplifies all the things. Once I finish conversion I'll poke. |