-#define BUG(NUM) fBUG(NUM)
-#undef MAPLIN
-void fMAPLIN(long FIL) {
-long I, VAL; static FILE *OPENED = NULL;
-
-/* Read a line of input, either from a file (if FIL=true) or from the
- * keyboard, translate the chars to integers in the range 0-126 and store
- * them in the common array "INLINE". Integer values are as follows:
- * 0 = space [ASCII CODE 40 octal, 32 decimal]
- * 1-2 = !" [ASCII 41-42 octal, 33-34 decimal]
- * 3-10 = '()*+,-. [ASCII 47-56 octal, 39-46 decimal]
- * 11-36 = upper-case letters
- * 37-62 = lower-case letters
- * 63 = percent (%) [ASCII 45 octal, 37 decimal]
- * 64-73 = digits, 0 through 9
- * Remaining characters can be translated any way that is convenient;
- * The "TYPE" routine below is used to map them back to characters when
- * necessary. The above mappings are required so that certain special
- * characters are known to fit in 6 bits and/or can be easily spotted.
- * Array elements beyond the end of the line should be filled with 0,
- * and LNLENG should be set to the index of the last character.
- *
- * If the data file uses a character other than space (e.g., tab) to
- * separate numbers, that character should also translate to 0.
- *
- * This procedure may use the map1,map2 arrays to maintain static data for
- * the mapping. MAP2(1) is set to 0 when the program starts
- * and is not changed thereafter unless the routines on this page choose
- * to do so.
- *
- * Note that MAPLIN is expected to open the file the first time it is
- * asked to read a line from it. that is, there is no other place where
- * the data file is opened. */
-
-
- if(MAP2[1] == 0)MPINIT();
-
- if(FIL) goto L15;
- IGNORE(fgets(INLINE+1, sizeof(INLINE)-1, stdin));
- if(feof(stdin)) score(1);
- goto L20;
-
-L15: if(!OPENED){
- OPENED=fopen("adventure.text","r" /* NOT binary */);
- if(!OPENED){printf("Can't read adventure.text!\n"); exit(0);}
- }
- IGNORE(fgets(INLINE+1,sizeof(INLINE)-1,OPENED));
-
-L20: LNLENG=0;
- /* 25 */ for (I=1; I<=sizeof(INLINE) && INLINE[I]!=0; I++) {
- VAL=INLINE[I]+1;
- INLINE[I]=MAP1[VAL];
-L25: if(INLINE[I] != 0)LNLENG=I;
+void MAPLIN(FILE *OPENED)
+{
+ 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:
+ * 0 = space [ASCII CODE 40 octal, 32 decimal]
+ * 1-2 = !" [ASCII 41-42 octal, 33-34 decimal]
+ * 3-10 = '()*+,-. [ASCII 47-56 octal, 39-46 decimal]
+ * 11-36 = upper-case letters
+ * 37-62 = lower-case letters
+ * 63 = percent (%) [ASCII 45 octal, 37 decimal]
+ * 64-73 = digits, 0 through 9
+ * Remaining characters can be translated any way that is convenient;
+ * The "TYPE" routine below is used to map them back to characters when
+ * necessary. The above mappings are required so that certain special
+ * characters are known to fit in 6 bits and/or can be easily spotted.
+ * Array elements beyond the end of the line should be filled with 0,
+ * and LNLENG should be set to the index of the last character.
+ *
+ * If the data file uses a character other than space (e.g., tab) to
+ * separate numbers, that character should also translate to 0.
+ *
+ * This procedure may use the map1,map2 arrays to maintain static data for
+ * the mapping. MAP2(1) is set to 0 when the program starts
+ * and is not changed thereafter unless the routines on this page choose
+ * to do so. */
+
+ if(MAP2[1] == 0)MPINIT();
+
+ if (!oldstyle && OPENED == stdin)
+ fputs("> ", stdout);
+ do {
+ IGNORE(fgets(rawbuf,sizeof(rawbuf)-1,OPENED));
+ } while
+ (!feof(OPENED) && rawbuf[0] == '#');
+ if (feof(OPENED)) {
+ if (logfp && OPENED == stdin)
+ fclose(logfp);
+ } else {
+ if (logfp && OPENED == stdin)
+ IGNORE(fputs(rawbuf, logfp));
+ else if (!isatty(0))
+ IGNORE(fputs(rawbuf, stdout));
+ strcpy(INLINE+1, rawbuf);
+ LNLENG=0;
+ for (I=1; I<=(long)sizeof(INLINE) && INLINE[I]!=0; I++) {
+ VAL=INLINE[I]+1;
+ INLINE[I]=MAP1[VAL];
+ if(INLINE[I] != 0)LNLENG=I;