From 8381b2492715379f13d71356a509c3bf4dbb3086 Mon Sep 17 00:00:00 2001 From: borutr Date: Sat, 19 Apr 2003 15:24:39 +0000 Subject: [PATCH] handling space characters in file path git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2547 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- as/mcs51/lklex.c | 9 ++++++--- src/avr/main.c | 4 ++-- src/ds390/main.c | 4 ++-- src/mcs51/main.c | 4 ++-- src/pic/main.c | 7 +++++-- src/xa51/main.c | 7 ++++--- src/z80/main.c | 14 +++++++------- 7 files changed, 28 insertions(+), 21 deletions(-) diff --git a/as/mcs51/lklex.c b/as/mcs51/lklex.c index c6f5cd81..7003ab2d 100644 --- a/as/mcs51/lklex.c +++ b/as/mcs51/lklex.c @@ -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() diff --git a/src/avr/main.c b/src/avr/main.c index 9ce3cd8a..9b377b50 100644 --- a/src/avr/main.c +++ b/src/avr/main.c @@ -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 */ diff --git a/src/ds390/main.c b/src/ds390/main.c index c7e55f4d..2f2822ee 100644 --- a/src/ds390/main.c +++ b/src/ds390/main.c @@ -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 */ diff --git a/src/mcs51/main.c b/src/mcs51/main.c index aeac05d2..18c7bb74 100644 --- a/src/mcs51/main.c +++ b/src/mcs51/main.c @@ -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 */ diff --git a/src/pic/main.c b/src/pic/main.c index 5f7511cf..986b9d74 100644 --- a/src/pic/main.c +++ b/src/pic/main.c @@ -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 */ diff --git a/src/xa51/main.c b/src/xa51/main.c index 330e613e..d3aaa9ad 100755 --- a/src/xa51/main.c +++ b/src/xa51/main.c @@ -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 */ diff --git a/src/z80/main.c b/src/z80/main.c index 4c1ae941..bd3537ea 100644 --- a/src/z80/main.c +++ b/src/z80/main.c @@ -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 = -- 2.47.2