1
0
mirror of https://github.com/cc65/cc65.git synced 2025-03-13 15:32:09 +00:00

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
This commit is contained in:
cuz 2002-07-11 19:46:11 +00:00
parent 4fd0da1635
commit 30f4bc52f7
3 changed files with 43 additions and 16 deletions

View File

@ -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? */

View File

@ -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

View File

@ -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;
}