home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / lilith / m2type.mod < prev    next >
Text File  |  2020-01-01  |  2KB  |  59 lines

  1. IMPLEMENTATION MODULE KermType;
  2. (************************************************************************)
  3. (*  Type displays a text file at the screen                             *)
  4. (*  written:            25.02.86     Matthias Aebi                      *)
  5. (*  last modification:  26.02.86     Matthias Aebi                      *)
  6. (************************************************************************)
  7.  
  8. FROM M2Kermit   IMPORT Param1;
  9. FROM Terminal   IMPORT Write, WriteString, WriteLn, Read;
  10. FROM FileSystem IMPORT Lookup, Close, ReadChar, File, Response;
  11.                 IMPORT KermMisc;
  12. FROM String     IMPORT Insert;
  13.  
  14. (************************************************************************)
  15.                             PROCEDURE Type;
  16. (************************************************************************)
  17. CONST
  18.     ESC = 33C;
  19.  
  20. VAR
  21.     theFile : File;
  22.     ch      : CHAR;
  23.  
  24. BEGIN
  25.     IF Param1[0] = "?"
  26.     THEN
  27.         WriteString("Specify the name of the file to be listed");
  28.     ELSE
  29.         WriteLn;
  30.         Insert(Param1, 0, "DK.");
  31.         Lookup(theFile, Param1, FALSE);
  32.         IF theFile.res # done
  33.         THEN
  34.             WriteString("Could not open file");
  35.             WriteLn;
  36.             RETURN;
  37.         END;
  38.  
  39.         ReadChar(theFile, ch);
  40.         Write(ch);
  41.  
  42.         REPEAT
  43.             WHILE (NOT theFile.eof) AND (NOT KermMisc.ReadChar(ch)) DO
  44.                 ReadChar(theFile, ch);
  45.                 Write(ch);
  46.             END;
  47.  
  48.             IF (NOT theFile.eof) AND (ch # ESC)
  49.             THEN (* pause *)
  50.                 Read(ch); (* wait for character *)
  51.             END;
  52.         UNTIL theFile.eof OR (ch = ESC);
  53.  
  54.         Close(theFile);
  55.     END;
  56. END Type;
  57.  
  58. END KermType.
  59.