home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / cpm86 / trbtol86.lbr / SHELL.PQS / shell.pas
Pascal/Delphi Source File  |  1985-10-16  |  3KB  |  102 lines

  1.  
  2. {
  3.         Copyright (c) 1981
  4.         By:     Bell Telephone Laboratories, Inc. and
  5.                 Whitesmith's Ltd.,
  6.  
  7.         This software is derived from the book
  8.                 "Software Tools in Pascal", by
  9.                 Brian W. Kernighan and P. J. Plauger
  10.                 Addison-Wesley, 1981
  11.                 ISBN 0-201-10342-7
  12.  
  13.         Right is hereby granted to freely distribute or duplicate this
  14.         software, providing distribution or duplication is not for profit
  15.         or other commercial gain and that this copyright notice remains
  16.         intact.
  17. }
  18.  
  19. PROGRAM TOOLS;
  20. {$I TOOLU.PAS}
  21. {$I INITCMD.PAS}
  22. {$I CHAPTER1.PAS}
  23. {$I CHAPTER2.PAS}
  24. {$I CHAPTER3.PAS}
  25. {$I CHAPTER4.PAS}
  26. {$I CHAPTER5.PAS}
  27. {$I CHAPTER6.PAS}
  28. {$I CHAPTER7.PAS}
  29. {$I CHAPTER8.PAS}
  30.  
  31.  
  32.  
  33. VAR
  34.   STR,STR1:STRING80;
  35.   COMMAND:XSTRING;
  36.   DONE:BOOLEAN;
  37.   I:INTEGER;
  38.  
  39.  
  40.  
  41.  
  42.  
  43. BEGIN {SHELL}
  44.  
  45. DONE:=FALSE;
  46. WHILE NOT DONE
  47. DO
  48.     BEGIN
  49.     INITCMD;
  50.     IF GETARG(1,COMMAND,MAXSTR)
  51.     THEN
  52.         BEGIN
  53.         STR:='';
  54.         STR1:='X';
  55.         FOR I:=1 TO XLENGTH(COMMAND)
  56.         DO
  57.             BEGIN
  58.             if COMMAND[I]in[97..122]
  59.             then
  60.                 str1[1]:=chr(command[i]-32)
  61.             ELSE STR1[1]:=chr(COMMAND[I]);
  62.             STR:=CONCAT(STR,STR1);
  63.             END;
  64.         if str = 'CHARCOUNT' then charcount
  65.         else if str = 'COPY' then copy
  66.         else if str = 'LINECOUNT' then linecount
  67.         else if str = 'WORDCOUNT' then wordcount
  68.         else if str = 'DETAB' then detab
  69.         else if str = 'ENTAB' then entab
  70.         else if str = 'OVERSTRIKE' then overstrike
  71.         else if str = 'COMPRESS' then compress
  72.         else if str = 'EXPAND' then expand
  73.         else if str = 'ECHO' then echo
  74.         else if str = 'TRANSLIT' then translit
  75.         else if str = 'COMPARE' then compare
  76.         else if str = 'INCLUDE' then include
  77.         else if str = 'CONCAT' then concat
  78.         else if str = 'PRINT' then print
  79.         else if str = 'MAKECOPY' then makecopy
  80.         else if str = 'ARCHIVE' then archive
  81.         else if str = 'SORT' then sort
  82.         else if str = 'UNIQUE' then unique
  83.         else if str = 'EDIT' then edit
  84.         else if str = 'FORMAT' then format
  85.         else if str = 'DEFINE' then macro
  86.         else if str = 'MACRO' then macro
  87.         else if str = 'QUIT' then halt
  88.         ELSE
  89.             BEGIN
  90.             WRITELN('?');
  91.             DONE:=FALSE
  92.             END
  93.         END;
  94.     endcmd;
  95.     END;
  96.  
  97. END.
  98.  
  99.  
  100.  
  101. 
  102.