]> git.sur5r.net Git - cc65/commitdiff
Output the command line for sub-processes when -d is given
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 11 Jul 2002 19:46:11 +0000 (19:46 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 11 Jul 2002 19:46:11 +0000 (19:46 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@1348 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cl65/global.c
src/cl65/global.h
src/cl65/main.c

index b0017c82adae9e67d491a47eada74822538088ef..9962c9c7e91ac86a062d41de2cc939669065d12b 100644 (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? */
+
+
+
index d23d05ee86eff430ed0b06c9c62ab37a68e2338b..011c8d0b1699cfcf60f98497a59472c046b8df35 100644 (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       */
 
 
 
+extern unsigned char Debug;            /* Debug mode enabled? */
+
+
+
 /* End of global.h */
 
 #endif
index f00f3962ecaa279e9fbc98237787edd680c913d2..234afadf54b9e1b30b402f9345cfd1f83efe530f 100644 (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;
 }