]> git.gag.com Git - fw/sdcc/commitdiff
handling space characters in file path
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 19 Apr 2003 15:24:39 +0000 (15:24 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 19 Apr 2003 15:24:39 +0000 (15:24 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2547 4a8a32a2-be11-0410-ad9d-d568d2c75423

as/mcs51/lklex.c
src/avr/main.c
src/ds390/main.c
src/mcs51/main.c
src/pic/main.c
src/xa51/main.c
src/z80/main.c

index c6f5cd81ddf8244620d5aacec29fa0fcff3be58a..7003ab2de6c07ee50564f828cda022fc128645b5 100644 (file)
@@ -198,9 +198,12 @@ char *str;
                if (p < &str[PATH_MAX-1])
                        *p++ = c;
                c = get();
-       } while (c && ((ctype[c] != SPACE)||(c == ':')||(c == '\\')));
-       while (p < &str[PATH_MAX])
-               *p++ = 0;
+       } while (c);
+        /* trim trailing spaces */
+        while (ctype[*(--p)] == SPACE)
+          ;
+        /* terminate the string */
+        *(++p) = '\0';
 }
 
 /*)Function    char    getnb()
index 9ce3cd8ab26424614859d38fd92aebb0b25a2c51..9b377b50c4e477d2aa7c18d55e8af545a6f5332d 100644 (file)
@@ -138,12 +138,12 @@ _avr_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts)
     MUST be terminated with a NULL.
 */
 static const char *_linkCmd[] = {
-       "linkavr", "", "$1", NULL
+       "linkavr", "", "\"$1\"", NULL
 };
 
 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
 static const char *_asmCmd[] = {
-       "asavr", "$l" , "$3", "$1.s", NULL
+       "asavr", "$l" , "$3", "\"$1.s\"", NULL
 };
 
 /* Globals */
index c7e55f4de2d91c3356f430050898aa365b36125c..2f2822eecbf82f49b5a7b24c371b74835e7e48ae 100644 (file)
@@ -316,12 +316,12 @@ static bool cseCostEstimation (iCode *ic, iCode *pdic)
 */
 static const char *_linkCmd[] =
 {
-  "aslink", "-nf", "$1", NULL
+  "aslink", "-nf", "\"$1\"", NULL
 };
 
 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */   static const char *_asmCmd[] =
 {
-  "asx8051", "$l", "$3", "$1.asm", NULL
+  "asx8051", "$l", "$3", "\"$1.asm\"", NULL
 };
 
 /* Globals */
index aeac05d2a19463acbb8f356cf213cb0a3176ccb4..18c7bb74b8eb5f8f75c249b96b8ca3e5f12c8672 100644 (file)
@@ -216,13 +216,13 @@ static bool cseCostEstimation (iCode *ic, iCode *pdic)
 */
 static const char *_linkCmd[] =
 {
-  "aslink", "-nf", "$1", NULL
+  "aslink", "-nf", "\"$1\"", NULL
 };
 
 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
 static const char *_asmCmd[] =
 {
-  "asx8051", "$l", "$3", "$1.asm", NULL
+  "asx8051", "$l", "$3", "\"$1.asm\"", NULL
 };
 
 /* Globals */
index 5f7511cf856802dfbcd0dccc91168fe4ee73d308..986b9d7488e6ba3a9e659ca241028dcabb1dc964 100644 (file)
@@ -337,8 +337,11 @@ static const char *_linkCmd[] =
  */
 static const char *_asmCmd[] =
 {
-  "gpasm", "-c  -I /usr/local/share/gpasm/header -o $2", "$1.asm", NULL
-
+  /* This should be:
+   * "gpasm", "-c  -I \"{datadir}\" -o \"$2\"", "\"$1.asm\"", NULL
+   * but unfortunately buildCmdLine() doesn't expand {xxx} macros.
+   */
+  "gpasm", "-c  -I \"/usr/local/share/gpasm/header\" -o \"$2\"", "\"$1.asm\"", NULL
 };
 
 /* Globals */
index 330e613e368df9b16bebd3c7f2a0064efa7f654e..d3aaa9ad384c347d3ed5d05b328bcb39e7858b60 100755 (executable)
@@ -43,7 +43,8 @@ static char *_xa51_keywords[] =
 };
 
 extern int rewinds;
-void   _xa51_genAssemblerEnd () {
+void   _xa51_genAssemblerEnd (FILE * of)
+{
   //fprintf (stderr, "Did %d rewind%c for c-line in asm comments\n", rewinds,
   //rewinds==1 ? '\0' : 's');
 }
@@ -195,13 +196,13 @@ static bool cseCostEstimation (iCode *ic, iCode *pdic)
 */
 static const char *_linkCmd[] =
 {
-  "xa_link", "", "$1", NULL
+  "xa_link", "", "\"$1\"", NULL
 };
 
 /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */
 static const char *_asmCmd[] =
 {
-  "xa_rasm", "$l", "$3", "$1.asm", NULL
+  "xa_rasm", "$l", "$3", "\"$1.asm\"", NULL
 };
 
 /* Globals */
index 4c1ae9413f1b8f285b17e86d6f359cc0bc631978..bd3537ea1be99a6e67b09daea96c219b8c417331 100644 (file)
@@ -175,12 +175,12 @@ _process_pragma (const char *sz)
 
 static const char *_gbz80_rgbasmCmd[] =
 {
-  "rgbasm", "-o$1.o", "$1.asm", NULL
+  "rgbasm", "-o\"$1.o\"", "\"$1.asm\"", NULL
 };
 
 static const char *_gbz80_rgblinkCmd[] =
 {
-  "xlink", "-tg", "-n$1.sym", "-m$1.map", "-zFF", "$1.lnk", NULL
+  "xlink", "-tg", "-n\"$1.sym\"", "-m\"$1.map\"", "-zFF", "\"$1.lnk\"", NULL
 };
 
 static void
@@ -287,8 +287,8 @@ _setValues(void)
 {
   if (options.nostdlib == FALSE)
     {
-      setMainValue ("z80libspec", "-k{libdir}{sep}{port} -l{port}.lib");
-      setMainValue ("z80crt0", "{libdir}{sep}{port}{sep}crt0{objext}");
+      setMainValue ("z80libspec", "-k\"{libdir}{sep}{port}\" -l\"{port}.lib\"");
+      setMainValue ("z80crt0", "\"{libdir}{sep}{port}{sep}crt0{objext}\"");
     }
   else
     {
@@ -443,13 +443,13 @@ _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right)
     "link-{port} -n -c -- {z80bases} -m -j" \
     " {z80libspec}" \
     " {z80extralibfiles} {z80extralibpaths}" \
-    " {z80outputtypeflag} {linkdstfilename}" \
+    " {z80outputtypeflag} \"{linkdstfilename}\"" \
     " {z80crt0}" \
-    " {dstfilename}{objext}" \
+    " \"{dstfilename}{objext}\"" \
     " {z80extraobj}"
 
 #define ASMCMD \
-    "as-{port} -plosgff {objdstfilename} {dstfilename}{asmext}"
+    "as-{port} -plosgff \"{objdstfilename}\" \"{dstfilename}{asmext}\""
 
 /* Globals */
 PORT z80_port =