X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=8ea3db40c6cde454344abef1f86fa9b338f1530c;hb=196a9e1a4960e01dcf4af9aef01a8daf3b5cbbc8;hp=b6ca80e3094dd7373802b7014c6314e32e4819fc;hpb=6ba9a7de7fe7c829a2215f254bfbbbd2a5686584;p=open-adventure.git diff --git a/misc.c b/misc.c index b6ca80e..8ea3db4 100644 --- a/misc.c +++ b/misc.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "main.h" #include "share.h" /* for SETUP */ #include "misc.h" @@ -887,17 +888,18 @@ long I, VAL; if (!oldstyle && SETUP && OPENED == stdin) fputs("> ", stdout); do { - IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED)); + IGNORE(fgets(rawbuf,sizeof(INLINE)-1,OPENED)); } while (!feof(OPENED) && INLINE[1] == '#'); if (feof(OPENED)) { if (logfp && OPENED == stdin) fclose(logfp); } else { - if (logfp) - IGNORE(fputs(INLINE+1, logfp)); + if (logfp && OPENED == stdin) + IGNORE(fputs(rawbuf, logfp)); else if (!isatty(0)) - IGNORE(fputs(INLINE+1, stdout)); + IGNORE(fputs(rawbuf, stdout)); + strcpy(INLINE+1, rawbuf); LNLENG=0; for (I=1; I<=sizeof(INLINE) && INLINE[I]!=0; I++) { VAL=INLINE[I]+1;