Add -l option to enable command logging.
[open-adventure.git] / misc.c
diff --git a/misc.c b/misc.c
index 8f0a2b21680dc11522f1057e02d5d5da501cf442..fafc15c5255d382a8397ff04e72d9b31a52a5d19 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -885,7 +885,12 @@ long I, VAL;
        if(MAP2[1] == 0)MPINIT();
 
        IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED));
-       if (!feof(OPENED)) {
+       if (feof(OPENED)) {
+               if (logfp)
+                       fclose(logfp);
+       } else {
+               if (logfp)
+                       IGNORE(fputs(INLINE+1, logfp));
                LNLENG=0;
                for (I=1; I<=sizeof(INLINE) && INLINE[I]!=0; I++) {
                VAL=INLINE[I]+1;