X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Fz80%2Fasmain.c;h=50ccb2b22e55cee6ccd5279f8a959521134bcd00;hb=90bdb43b342189fcb94a398855d43f3f47f96738;hp=5f6d6a1ca399b4c002755d479e7d7766af95af92;hpb=aed2b39c46fcdfdd017adbf9e50c254efc5dea42;p=fw%2Fsdcc diff --git a/as/z80/asmain.c b/as/z80/asmain.c index 5f6d6a1c..50ccb2b2 100644 --- a/as/z80/asmain.c +++ b/as/z80/asmain.c @@ -17,16 +17,13 @@ #include #include -//#if !defined(_MSC_VER) -//#include -//#endif - #ifdef SDK #include #include #undef HUGE #endif #include "asm.h" +#include "z80.h" /*)Module asmain.c * @@ -138,7 +135,7 @@ * VOID diag() assubr.c * VOID err() assubr.c * int fprintf() c-library - * int getline() aslex.c + * int as_getline() aslex.c * VOID list() aslist.c * VOID lstsym() aslist.c * VOID minit() ___mch.c @@ -163,6 +160,21 @@ main(int argc, char **argv) register int c, i; struct area *ap; + /* Check to make sure there are the right number of filenames */ + /* before openning any of them */ +#ifdef SDK + inpfil = -2; +#else /* SDK */ + inpfil = -1; +#endif /* SDK */ + for (i=1; i &afn[FILSPC-4]) // truncate filename, if it's too long + p2 = &afn[FILSPC-4]; *p2++ = FSEPX; - if (*p3 == 0) { - if (c == FSEPX) { - p3 = p1; - } else { - p3 = dsft; - } + + // choose a file-extension + if (*p3 == 0) { // extension supplied? + p3 = strrchr (fn, FSEPX); // no: extension in fn? + if (p3) + ++p3; + else + p3 = dsft; // no: default extension } - while ((c = *p3++) != 0) { + + while ((c = *p3++) != 0) { // strncpy if (p2 < &afn[FILSPC-1]) *p2++ = c; } *p2++ = 0; + if ((fp = fopen(afn, wf?"w":"r")) == NULL) { fprintf(stderr, "%s: cannot %s.\n", afn, wf?"create":"open"); asexit(1);