/* */
/* */
/* */
-/* (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 */
+unsigned char Debug = 0; /* Debug mode enabled? */
+
+
+
/* */
/* */
/* */
-/* (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 */
+extern unsigned char Debug; /* Debug mode enabled? */
+
+
+
/* End of global.h */
#endif
+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 */
/*****************************************************************************/
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) {
*/
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);
}
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;
}