2001-10-21 Michael Hope <michaelh@juju.net.nz>
[fw/sdcc] / src / SDCCmain.c
index e7f5eea422791665b69493d3cbf3819d6e0a79d2..be35a87756efcca74defcbc7ef6003617840badc 100644 (file)
@@ -79,8 +79,8 @@ int ds390_jammed = 0;
 #endif
 
 // Globally accessible scratch buffer for file names.
-char scratchFileName[FILENAME_MAX];
-char buffer[FILENAME_MAX];
+char scratchFileName[PATH_MAX];
+char buffer[PATH_MAX];
 
 // In MSC VC6 default search path for exe's to path for this
 
@@ -1164,7 +1164,9 @@ linkEdit (char **envp)
 
   if (port->linker.cmd)
     {
-      buildCmdLine (buffer, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+      char buffer2[PATH_MAX];
+      buildCmdLine (buffer2, port->linker.cmd, srcFileName, NULL, NULL, NULL);
+      buildCmdLine2 (buffer, buffer2);
     }
   else
     {
@@ -1449,10 +1451,11 @@ initValues (void)
 {
   populateMainValues (_baseValues);
   setMainValue ("port", port->target);
-  setMainValue ("fullsrcfilename", fullSrcFileName);
-  setMainValue ("srcfilename", srcFileName);
   setMainValue ("objext", port->linker.rel_ext);
   setMainValue ("asmext", port->assembler.file_ext);
+
+  setMainValue ("fullsrcfilename", fullSrcFileName ? fullSrcFileName : "fullsrcfilename");
+  setMainValue ("srcfilename", srcFileName ? srcFileName : "srcfilename");
 }
 
 /*
@@ -1505,11 +1508,11 @@ main (int argc, char **argv, char **envp)
       exit (0);
     }
 
+  initValues ();
+  _discoverPaths (argv[0]);
+
   if (srcFileName)
     {
-      initValues ();
-      _discoverPaths (argv[0]);
-
       preProcess (envp);
 
       initMem ();