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

  1. IMPLEMENTATION MODULE KermDir;
  2. (************************************************************************)
  3. (* Display directory information                                        *)
  4. (* written:            11.12.85     Matthias Aebi                       *)
  5. (* last modification:  26.02.85     Matthias Aebi                       *)
  6. (************************************************************************)
  7.  
  8. FROM NameSearch  IMPORT FindNames, NextName;
  9. FROM Terminal    IMPORT WriteString, WriteLn;
  10. FROM OutTerminal IMPORT WriteC;
  11. FROM TextScreen  IMPORT GetPos, SetPos;
  12. FROM M2Kermit    IMPORT Param1;
  13.  
  14. CONST
  15.     UpLowEqual = TRUE;
  16.  
  17. (************************************************************************)
  18.                               PROCEDURE Dir;
  19. (************************************************************************)
  20. VAR
  21.     fileName   : ARRAY[0..31] OF CHAR;
  22.     foundOne   : BOOLEAN;
  23.     fileNo     : CARDINAL;
  24.     versionNo  : CARDINAL;
  25.     counter    : CARDINAL;
  26.     line       : CARDINAL;
  27.     pos        : CARDINAL;
  28.  
  29. BEGIN
  30.     IF Param1[0] = "?"
  31.     THEN
  32.         WriteString("Specify search string (including wildcards)");
  33.     ELSE
  34.         IF Param1[0] = 0C
  35.         THEN
  36.             Param1[0] := "*";
  37.             Param1[1] := 0C;
  38.         END;
  39.  
  40.         counter := 0;
  41.         FindNames("DK", Param1, UpLowEqual);
  42.         WriteLn;
  43.  
  44.         REPEAT
  45.             NextName(foundOne, fileName, fileNo, versionNo);
  46.             IF foundOne
  47.             THEN
  48.                 GetPos(line, pos);  (* Tab to next position *)
  49.                 SetPos(line, (counter MOD 4) * 20);
  50.  
  51.                 WriteString(fileName);
  52.                 INC(counter);
  53.             END;
  54.         UNTIL NOT foundOne;
  55.  
  56.         WriteLn;
  57.         IF counter = 0
  58.         THEN
  59.             WriteString("No files found");
  60.         ELSE
  61.             WriteC(counter,3);
  62.             WriteString(" file(s) found");
  63.         END;
  64.         WriteLn;
  65.  
  66.     END;
  67.  
  68. END Dir;
  69.  
  70. END KermDir.
  71.