X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=b87c76913f6aab68b500979b20adce84fb05d443;hb=31837249f82629048f9010a0bf29112397a036f8;hp=2e68901161d0316bf18dae8ac795b5649b55e061;hpb=65c081a0acc24707915a2abf80ef64ed70e50f45;p=open-adventure.git diff --git a/misc.c b/misc.c index 2e68901..b87c769 100644 --- a/misc.c +++ b/misc.c @@ -855,8 +855,8 @@ void fBUG(long NUM) { #define BUG(NUM) fBUG(NUM) #undef MAPLIN void fMAPLIN(FILE *OPENED) { - signed char *cp; - +long I, VAL; + /* Read a line of input, from the specified input source, * translate the chars to integers in the range 0-126 and store * them in the common array "INLINE". Integer values are as follows: @@ -886,18 +886,21 @@ void fMAPLIN(FILE *OPENED) { if (!oldstyle && SETUP) fputs("> ", stdout); - IGNORE(fgets(raw_input,sizeof(INLINE)-1,OPENED)); + IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED)); if (feof(OPENED)) { if (logfp) fclose(logfp); } else { if (logfp) - IGNORE(fputs(raw_input, logfp)); + IGNORE(fputs(INLINE+1, logfp)); else if (!isatty(0)) - IGNORE(fputs(raw_input, stdout)); - for (cp = raw_input; *cp; cp++) - INLINE[cp - raw_input + 1]=MAP1[*cp + 1]; - LNLENG = (cp - raw_input); + IGNORE(fputs(INLINE+1, stdout)); + LNLENG=0; + for (I=1; I<=sizeof(INLINE) && INLINE[I]!=0; I++) { + VAL=INLINE[I]+1; + INLINE[I]=MAP1[VAL]; + if(INLINE[I] != 0)LNLENG=I; + } /* end loop */ LNPOSN=1; } }