diff --git a/source/app.d b/source/app.d index 2c1f5b3..1b3f160 100644 --- a/source/app.d +++ b/source/app.d @@ -1,6 +1,6 @@ // xasm 3.2.0 by Piotr Fusik // http://xasm.atari.org -// Can be compiled with DMD v2.097.0. +// Can be compiled with DMD v2.101.0. // Poetic License: // @@ -1085,6 +1085,8 @@ File openInputFile(string filename) { } File openOutputFile(string filename, string msg) { + if (filename == "-") + return stdout; if (!getOption('q')) messageStream.writeln(msg); try { @@ -1184,11 +1186,8 @@ void objectByte(ubyte b) { } else { assert(pass2); if (!optionObject) return; - if (!objectStream.isOpen) { - objectStream = objectFilename == "-" - ? stdout - : openOutputFile(objectFilename, "Writing object file..."); - } + if (!objectStream.isOpen) + objectStream = openOutputFile(objectFilename, "Writing object file..."); try { objectStream.write(cast(char) b); } catch (Exception e) { @@ -3007,8 +3006,10 @@ int main(string[] args) { core.stdc.stdio.remove(toStringz(objectFilename)); } } - listingStream.close(); - objectStream.close(); + if (listingStream != stdout) + listingStream.close(); + if (objectStream != stdout) + objectStream.close(); if (exitCode <= 1) { if (!getOption('q')) { messageStream.writefln("%d lines of source assembled", totalLines); diff --git a/xasm.1.asciidoc b/xasm.1.asciidoc index b1765fc..11af650 100644 --- a/xasm.1.asciidoc +++ b/xasm.1.asciidoc @@ -38,6 +38,7 @@ The listing file should exclude included files. *-l* '[LISTING_FILE]':: Generates a listing file. +Using '-' as 'LISTING_FILE' makes *xasm* write to standard output. If 'LISTING_FILE' is omitted, the listing filename is 'SOURCE_FILE' with the extension changed to `.lst`. @@ -47,7 +48,7 @@ First line of the rule lists 'OBJECT_FILE' as the target of the rule and all source files (including the ones specified with `icl` and `ins`) as dependencies. The second line contains the command line with 'OBJECT_FILE' replaced by the *make* macro `$@` and 'SOURCE_FILE' replaced by the macro `$<`. -Dollars in the command line are doubled. +Dollar signs in the command line are doubled. Your *make* or shell may require further escaping. *-o* 'OBJECT_FILE':: @@ -64,6 +65,7 @@ Quiet mode. Prevents *xasm* from printing its banner and compilation summary. *-t* '[LABEL_FILE]':: Generates a label table. +Using '-' as 'LABEL_FILE' makes *xasm* write to standard output. If 'LABEL_FILE' is omitted then the table is appended at the end of the listing. [[new_unlabels]]*-u*::