Fixed z80 referneces to BuildCmdLine and my_system
authorjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 May 2001 03:30:34 +0000 (03:30 +0000)
committerjtvolpe <jtvolpe@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 20 May 2001 03:30:34 +0000 (03:30 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@832 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCglobl.h
src/SDCCmain.c

index 8bed6bafc9193d679609a34e03acc94b9268a6ff..6feeb11f92d74fbecc20052a007b3abc7828ec62 100644 (file)
@@ -251,13 +251,14 @@ extern int cNestLevel;            /* block nest level  SDCCval.c      */
 extern int currBlockno;                /* sequentail block number */
 extern struct optimize optimize;
 extern struct options options;
-extern int maxInterrupts;
+extern unsigned maxInterrupts;
 
 /* Visible from SDCCmain.c */
 extern int nrelFiles;
 extern char *relFiles[128];
 extern char *libFiles[128];
 extern int nlibFiles;
+extern bool verboseExec ;
 
 /*
    void buildCmdLine(char *into, char **args, const char **cmds, 
index 48208c70a6ac26c1c487f09214409457417041da..4d5396c2c9b8355c2daf226899457f6d1f114ec5 100644 (file)
@@ -26,6 +26,8 @@
 #include <ctype.h>
 #include "newalloc.h"
 #include "SDCCerr.h"
+#include "BuildCmd.h"
+#include "MySystem.h"
 
 #if NATIVE_WIN32
 #include <process.h>
 
 #else
 // No unistd.h in Borland C++
+/*
 extern int access (const char *, int);
 #define X_OK 1
+*/
 
 #endif
 
@@ -209,68 +213,6 @@ _validatePorts (void)
        }
     }
 }
-
-void
-buildCmdLine (char *into, const char **cmds,
-             const char *p1, const char *p2,
-             const char *p3, const char **list)
-{
-  const char *p, *from;
-
-  *into = '\0';
-
-  while (*cmds)
-    {
-
-      from = *cmds;
-      cmds++;
-
-      /* See if it has a '$' anywhere - if not, just copy */
-      if ((p = strchr (from, '$')))
-       {
-         strncat (into, from, p - from);
-         /* seperate it */
-         strcat (into, " ");
-         from = p + 2;
-         p++;
-         switch (*p)
-           {
-           case '1':
-             if (p1)
-               strcat (into, p1);
-             break;
-           case '2':
-             if (p2)
-               strcat (into, p2);
-             break;
-           case '3':
-             if (p3)
-               strcat (into, p3);
-             break;
-           case 'l':
-             {
-               const char **tmp = list;
-               if (tmp)
-                 {
-                   while (*tmp)
-                     {
-                       strcat (into, *tmp);
-                       strcat (into, " ");
-                       tmp++;
-                     }
-                 }
-               break;
-             }
-           default:
-             assert (0);
-           }
-       }
-      strcat (into, from);     // this includes the ".asm" from "$1.asm"
-
-      strcat (into, " ");
-    }
-}
-
 /*-----------------------------------------------------------------*/
 /* printVersionInfo - prints the version info        */
 /*-----------------------------------------------------------------*/
@@ -1132,70 +1074,6 @@ parseCmdLine (int argc, char **argv)
   return 0;
 }
 
-/*-----------------------------------------------------------------*/
-/* my_system - will call a program with arguments                  */
-/*-----------------------------------------------------------------*/
-
-
-
-
-//char *try_dir[]= {SRCDIR "/bin",PREFIX "/bin", NULL};
-char *try_dir[] =
-{NULL, NULL};                  /* First entry may be overwritten, so use two. */
-
-
-int
-my_system (const char *cmd)
-{
-  int argsStart, e, i = 0;
-  char *cmdLine = NULL;
-
-  argsStart = strstr (cmd, " ") - cmd;
-
-  // try to find the command in predefined path's
-  while (try_dir[i])
-    {
-      cmdLine = (char *) Safe_malloc (strlen (try_dir[i]) + strlen (cmd) + 10);
-      strcpy (cmdLine, try_dir[i]);    // the path
-
-      strcat (cmdLine, DIR_SEPARATOR_STRING);
-      strncat (cmdLine, cmd, argsStart);       // the command
-
-#if NATIVE_WIN32
-      strcat (cmdLine, ".exe");
-#endif
-
-      if (access (cmdLine, X_OK) == 0)
-       {
-         // the arguments
-         strcat (cmdLine, cmd + argsStart);
-         break;
-       }
-      free (cmdLine);
-      cmdLine = NULL;
-      i++;
-    }
-
-  if (verboseExec)
-    {
-      printf ("+ %s\n", cmdLine ? cmdLine : cmd);
-    }
-
-  if (cmdLine)
-    {
-      // command found in predefined path
-      e = system (cmdLine);
-      free (cmdLine);
-    }
-  else
-    {
-      // trust on $PATH
-      e = system (cmd);
-    }
-  return e;
-}
-
-
 /*-----------------------------------------------------------------*/
 /* linkEdit : - calls the linkage editor  with options             */
 /*-----------------------------------------------------------------*/
@@ -1493,7 +1371,7 @@ main (int argc, char **argv, char **envp)
     {
       strcpy (DefaultExePath, argv[0]);
       *(strrchr (DefaultExePath, DIR_SEPARATOR_CHAR)) = 0;
-      try_dir[0] = DefaultExePath;
+      ExePathList[0] = DefaultExePath;
     }