summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2001-12-02 23:15:30 +0000
committerPeter Johnson <peter@tortall.net>2001-12-02 23:15:30 +0000
commit6bbcad2e6c5841e7bb9602e322ac7bebc2801f41 (patch)
tree4a760187cba206eb3a3e96d81dd7cdde90d279b2 /frontends
parentc42294ab0a65b1588bb3cca802478fde5860898e (diff)
downloadyasm-6bbcad2e6c5841e7bb9602e322ac7bebc2801f41.tar.gz
Make extension-replacement a utility function in file.c (as it will need to
be performed for the list file, etc, as well as the object file). svn path=/trunk/yasm/; revision=381
Diffstat (limited to 'frontends')
-rw-r--r--frontends/yasm/yasm.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/frontends/yasm/yasm.c b/frontends/yasm/yasm.c
index 53445b92..e4e3d787 100644
--- a/frontends/yasm/yasm.c
+++ b/frontends/yasm/yasm.c
@@ -27,6 +27,7 @@
#endif
#include "bitvect.h"
+#include "file.h"
#include "globals.h"
#include "options.h"
@@ -139,20 +140,12 @@ main(int argc, char *argv[])
/* open the object file if not specified */
if (!obj) {
/* build the object filename */
- char *exttail;
if (obj_filename)
xfree(obj_filename);
assert(in_filename != NULL);
- /* allocate enough space for full existing name + extension */
- obj_filename = xmalloc(strlen(in_filename)+
- strlen(cur_objfmt->extension)+2);
- strcpy(obj_filename, in_filename);
- exttail = strrchr(obj_filename, '.');
- if (!exttail)
- exttail = strrchr(obj_filename, '\0');
- /*@-nullpass@*/
- sprintf(exttail, ".%s", cur_objfmt->extension);
- /*@=nullpass@*/
+ /* replace (or add) extension */
+ obj_filename = replace_extension(in_filename, cur_objfmt->extension,
+ "yasm.out");
/* open the built filename */
obj = fopen(obj_filename, "wb");