diff options
author | Peter Johnson <peter@tortall.net> | 2010-02-19 07:07:51 +0000 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2010-02-19 07:07:51 +0000 |
commit | d28f2a03a7bfc15d9e783d9421eb759a2ad3e197 (patch) | |
tree | 31b8acd776d578a914f801eee415c59d8db233c9 | |
parent | 03de198f0905cffabd58b5f09cd68ede38fcc63c (diff) | |
download | yasm-d28f2a03a7bfc15d9e783d9421eb759a2ad3e197.tar.gz |
vsyasm: More gracefully handle single input file by using output name as-is.
Patch by: Brian Gladman
svn path=/trunk/yasm/; revision=2291
-rw-r--r-- | frontends/vsyasm/vsyasm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/frontends/vsyasm/vsyasm.c b/frontends/vsyasm/vsyasm.c index 5983a954..cde023bd 100644 --- a/frontends/vsyasm/vsyasm.c +++ b/frontends/vsyasm/vsyasm.c @@ -45,8 +45,7 @@ #include "license.c" /*@null@*/ /*@only@*/ static char *objdir_pathname = NULL; -/*@null@*/ /*@only@*/ static char *global_prefix = NULL, *global_suffix = -NULL; +/*@null@*/ /*@only@*/ static char *global_prefix = NULL, *global_suffix = NULL; /*@null@*/ /*@only@*/ static char *listdir_pathname = NULL; /*@null@*/ /*@only@*/ static char *mapdir_pathname = NULL; /*@null@*/ /*@only@*/ static char *machine_name = NULL; @@ -238,6 +237,7 @@ typedef struct constcharparam { static constcharparam_head preproc_options; static constcharparam_head input_files; +static int num_input_files = 0; static int do_assemble(const char *in_filename) @@ -659,17 +659,20 @@ main(int argc, char *argv[]) /* If not already specified, output to the current directory. */ if (!objdir_pathname) objdir_pathname = yasm__xstrdup("./"); - else if((i = yasm__createpath(objdir_pathname)) > 0) { + else if ((i = yasm__createpath(objdir_pathname)) > 0 && + num_input_files > 1) { objdir_pathname[i] = '/'; objdir_pathname[i+1] = '\0'; } /* Create other output directories if necessary */ - if (listdir_pathname && (i = yasm__createpath(listdir_pathname)) > 0) { + if (listdir_pathname && (i = yasm__createpath(listdir_pathname)) > 0 && + num_input_files > 1) { listdir_pathname[i] = '/'; listdir_pathname[i+1] = '\0'; } - if (mapdir_pathname && (i = yasm__createpath(mapdir_pathname)) > 0) { + if (mapdir_pathname && (i = yasm__createpath(mapdir_pathname)) > 0 && + num_input_files > 1) { mapdir_pathname[i] = '/'; mapdir_pathname[i+1] = '\0'; } @@ -780,6 +783,7 @@ not_an_option_handler(char *param) cp->param = param; cp->id = 0; STAILQ_INSERT_TAIL(&input_files, cp, link); + ++num_input_files; return 0; } |