home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume3 / turbo_patch / shell.pas
Pascal/Delphi Source File  |  1986-11-30  |  3KB  |  103 lines

  1. {SHELL.PAS}
  2.  
  3. {
  4.         Copyright (c) 1981
  5.         By:     Bell Telephone Laboratories, Inc. and
  6.                 Whitesmith's Ltd.,
  7.  
  8.         This software is derived from the book
  9.                 "Software Tools in Pascal", by
  10.                 Brian W. Kernighan and P. J. Plauger
  11.                 Addison-Wesley, 1981
  12.                 ISBN 0-201-10342-7
  13.  
  14.         Right is hereby granted to freely distribute or duplicate this
  15.         software, providing distribution or duplication is not for profit
  16.         or other commercial gain and that this copyright notice remains
  17.         intact.
  18. }
  19.  
  20. PROGRAM TOOLS;
  21. {$I TOOLU.PAS}
  22. {$I INITCMD.PAS}
  23. {$I CHAPTER1.PAS}
  24. {$I CHAPTER2.PAS}
  25. {$I CHAPTER3.PAS}
  26. {$I CHAPTER4.PAS}
  27. {$I CHAPTER5.PAS}
  28. {$I CHAPTER6.PAS}
  29. {$I CHAPTER7.PAS}
  30. {$I CHAPTER8.PAS}
  31.  
  32.  
  33.  
  34. VAR
  35.   STR,STR1:STRING80;
  36.   COMMAND:XSTRING;
  37.   DONE:BOOLEAN;
  38.   I:INTEGER;
  39.  
  40.  
  41.  
  42.  
  43.  
  44. BEGIN {SHELL}
  45.  
  46. DONE:=FALSE;
  47. WHILE NOT DONE
  48. DO
  49.     BEGIN
  50.     INITCMD;
  51.     IF GETARG(1,COMMAND,MAXSTR)
  52.     THEN
  53.         BEGIN
  54.         STR:='';
  55.         STR1:='X';
  56.         FOR I:=1 TO XLENGTH(COMMAND)
  57.         DO
  58.             BEGIN
  59.             if COMMAND[I]in[97..122]
  60.             then
  61.                 str1[1]:=chr(command[i]-32)
  62.             ELSE STR1[1]:=chr(COMMAND[I]);
  63.             STR:=CONCAT(STR,STR1)
  64.             END;
  65.         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 = 'KWIC' then kwic
  84.         else if str = 'ROTATE' then writeln('ROTATE not directly supported.')
  85.         else if str = 'UNROTATE' then unrotate
  86.         else if str = 'FIND' then find
  87.         else if str = 'CHANGE' then change
  88.         else if str = 'EDIT' then edit
  89.         else if str = 'FORMAT' then format
  90.         else if str = 'DEFINE' then macro
  91.         else if str = 'MACRO' then macro
  92.         else if str = 'QUIT' then halt
  93.         ELSE
  94.             BEGIN
  95.             WRITELN('?');
  96.             DONE:=FALSE
  97.             END
  98.         END;
  99.     endcmd;
  100.     END;
  101.  
  102. END.
  103.