From: cuz Date: Thu, 11 Jul 2002 19:46:11 +0000 (+0000) Subject: Output the command line for sub-processes when -d is given X-Git-Tag: V2.12.0~2277 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=30f4bc52f7005d875ea9fac51386c6dc3ec99276;p=cc65 Output the command line for sub-processes when -d is given git-svn-id: svn://svn.cc65.org/cc65/trunk@1348 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cl65/global.c b/src/cl65/global.c index b0017c82a..9962c9c7e 100644 --- a/src/cl65/global.c +++ b/src/cl65/global.c @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1999 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2002 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -43,3 +43,7 @@ +unsigned char Debug = 0; /* Debug mode enabled? */ + + + diff --git a/src/cl65/global.h b/src/cl65/global.h index d23d05ee8..011c8d0b1 100644 --- a/src/cl65/global.h +++ b/src/cl65/global.h @@ -6,10 +6,10 @@ /* */ /* */ /* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ +/* (C) 1998-2002 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -44,6 +44,10 @@ +extern unsigned char Debug; /* Debug mode enabled? */ + + + /* End of global.h */ #endif diff --git a/src/cl65/main.c b/src/cl65/main.c index f00f3962e..234afadf5 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -282,8 +282,19 @@ static void CmdSetTarget (CmdDesc* Cmd, target_t Target) +static void CmdPrint (CmdDesc* Cmd, FILE* F) +/* Output the command line encoded in the command desc */ +{ + unsigned I; + for (I = 0; I < Cmd->ArgCount && Cmd->Args[I] != 0; ++I) { + fprintf (F, "%s ", Cmd->Args[I]); + } +} + + + /*****************************************************************************/ -/* Target handling */ +/* Target handling */ /*****************************************************************************/ @@ -322,8 +333,17 @@ static void SetTargetFiles (void) static void ExecProgram (CmdDesc* Cmd) /* Execute a subprocess with the given name/parameters. Exit on errors. */ { + int Status; + + /* If in debug mode, output the command line we will execute */ + if (Debug) { + printf ("Executing: "); + CmdPrint (Cmd, stdout); + printf ("\n"); + } + /* Call the program */ - int Status = spawnvp (P_WAIT, Cmd->Name, Cmd->Args); + Status = spawnvp (P_WAIT, Cmd->Name, Cmd->Args); /* Check the result code */ if (Status < 0) { @@ -366,15 +386,13 @@ static void Link (void) */ if (OutputName) { - CmdAddArg (&LD65, "-o"); - CmdAddArg (&LD65, OutputName); + CmdSetOutput (&LD65, OutputName); } else if (FirstInput && FindExt (FirstInput)) { /* Only if ext present! */ const char* Extension = Module? MODULE_EXT : ""; char* Output = MakeFilename (FirstInput, Extension); - CmdAddArg (&LD65, "-o"); - CmdAddArg (&LD65, Output); + CmdSetOutput (&LD65, Output); xfree (Output); } @@ -699,10 +717,11 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg) static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) -/* Debug mode (compiler) */ + const char* Arg attribute ((unused))) +/* Debug mode (compiler and cl65 utility) */ { CmdAddArg (&CC65, "-d"); + Debug = 1; }