From: cuz Date: Thu, 4 Sep 2003 08:25:43 +0000 (+0000) Subject: Output to stdout if no output name given X-Git-Tag: V2.12.0~1340 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=020a583388a40e44a993a795f054ab379fd1796a;p=cc65 Output to stdout if no output name given git-svn-id: svn://svn.cc65.org/cc65/trunk@2429 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/da65/main.c b/src/da65/main.c index 94e535cb3..631e735b9 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -298,7 +298,7 @@ static void OneOpcode (unsigned RemainingBytes) case atAddrTab: AddrTable (); break; - + case atRtsTab: RtsTable (); break; @@ -447,11 +447,6 @@ int main (int argc, char* argv []) AbEnd ("No input file"); } - /* Make the output file name from the input file name if none was given */ - if (OutFile == 0) { - OutFile = MakeFilename (InFile, OutExt); - } - /* If no CPU given, use the default CPU */ if (CPU == CPU_UNKNOWN) { CPU = CPU_6502; diff --git a/src/da65/output.c b/src/da65/output.c index f8a5aeac2..e02f2d99b 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -87,11 +87,17 @@ static void PageHeader (void) void OpenOutput (const char* Name) /* Open the given file for output */ { - /* Open the output file */ - F = fopen (Name, "w"); - if (F == 0) { - Error ("Cannot open `%s': %s", Name, strerror (errno)); + /* If we have a name given, open the output file, otherwise use stdout */ + if (Name != 0) { + F = fopen (Name, "w"); + if (F == 0) { + Error ("Cannot open `%s': %s", Name, strerror (errno)); + } + } else { + F = stdout; } + + /* Output the header and initialize stuff */ PageHeader (); Line = 4; Col = 1; @@ -102,7 +108,7 @@ void OpenOutput (const char* Name) void CloseOutput (void) /* Close the output file */ { - if (fclose (F) != 0) { + if (F != stdout && fclose (F) != 0) { Error ("Error closing output file: %s", strerror (errno)); } }