home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / ENTERPRS / CPM / UTILS / S / TURBTOOL.ARC / SHELL.PAS < prev    next >
Pascal/Delphi Source File  |  1989-09-27  |  3KB  |  101 lines

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