home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Guide / c-cplusplus-interactive-guide.iso / c_ref / csource3 / 121_01 / sh.doc < prev    next >
Encoding:
Text File  |  1985-08-21  |  6.9 KB  |  200 lines

  1.  
  2.  
  3.      SH (1)                    BDS C Users' Group                    SH (1)
  4.  
  5.  
  6.  
  7.  
  8.      NAME   
  9.      NAME 
  10.           sh - a 'little shell' command interpreter 
  11.  
  12.  
  13.      SYNOPSIS   
  14.      SYNOPSIS 
  15.           sh   
  16.           sh 
  17.  
  18.  
  19.      DESCRIPTION   
  20.      DESCRIPTION 
  21.           The Little Shell is designed to cover the uglier part of 
  22.           CP/M with a somewhat more pleasant interface.  This is 
  23.           accomplished at a cost.  The shell is written in BDS C and 
  24.           is five times the size of the CP/M CCP.  Hence it takes 
  25.           somewhat longer to load into memory at warm boots.  Also, 
  26.           since the shell clobbers the CCP, submit does not work when 
  27.           the shell is invoked.  Nevertheless, the shell provides 
  28.           features not otherwise available to CP/M users.  
  29.  
  30.  
  31.           CP/M offers no mechanism for chaining except for the kludgey 
  32.           and inconvenient submit mechanism.  The shell offers two 
  33.           more desirable techniques.  Multiple commands may be typed 
  34.           on a single command line as follows: 
  35.  
  36.  
  37.                $ command [args...] ; command [args...] ; ...
  38.  
  39.  
  40.           The commands are executed in sequential order from left to 
  41.           right as on Unix.  The amount of stuff on the command line 
  42.           is limited to the command buffer size which is defined in 
  43.           the CBIOS and in the shell source.  
  44.  
  45.  
  46.           Alternatively, files of commands called Shell Scripts may be 
  47.           used.  These files contain multiple command lines to be 
  48.           executed.  The present version of the Shell limits the 
  49.           length of command files to the size of the command line 
  50.           buffer.  
  51.  
  52.  
  53.           The CP/M operating environment does not lend itself to the 
  54.           use of frequently invoked commands in the form of executable 
  55.           files.  Consequently, the shell has an assortment of 
  56.           built-in commands.  The current list is as follows: 
  57.  
  58.  
  59.                cat file file...     - print named files on console
  60.                ccp                  - invoke the CP/M command processor
  61.                cd disk              - select named CP/M disk
  62.                clr                  - clear the screen
  63.                echo [args...]       - echo command line arguments
  64.                exit                 - exit from the shell (warm boot)
  65.                lock file file...    - set named files to readonly
  66.                logout               - (also ^D) invoke a login program
  67.                ls disk              - list dir (default is current disk)
  68.                pwd                  - print current CP/M disk
  69.                ren file1 file2      - rename file1 to file2
  70.                rm file file...      - remove named files
  71.                sleep n              - suspend execution for n seconds
  72.                unlock file file...  - set named files to readwrite
  73.                #                    - comment (ignore command line)
  74.                ^\                   - quit, like exit for now
  75.  
  76.  
  77.  
  78.  
  79.  
  80.                                       -1-
  81.  
  82.  
  83.  
  84.      SH (1)                    BDS C Users' Group                    SH (1)
  85.  
  86.  
  87.  
  88.      CAVEATS   
  89.      CAVEATS 
  90.           This program has not been tested by the librarian, due to 
  91.           lack of time.  No bug reports have been received.  
  92.  
  93.  
  94.      EXAMPLES   
  95.      EXAMPLES 
  96.           A sample shell script follows: 
  97.  
  98.  
  99.                c1 $1.c
  100.                l2 $1
  101.                if -r $1.crl rm $1.crl
  102.                if $2 == -o ren $1.com a.out
  103.                exit
  104.  
  105.  
  106.           Command line argument substitutions occur exactly as on the 
  107.           V6 Unix shell.  
  108.  
  109.  
  110.      SEE ALSO   
  111.      SEE ALSO 
  112.           The Unix Programmers Manual Sixth Edition, 
  113.           Software Tools Programmers Manual, 
  114.           BD Software C Compiler Manual v1.50 
  115.  
  116.  
  117.      BUGS   
  118.      BUGS 
  119.           Shell Scripts must be limited to size of the Command line 
  120.           buffer.  Programs cannot return a status.  There are not yet 
  121.           any Shell Variables.  
  122.  
  123.  
  124.      NOTES   
  125.      NOTES 
  126.           The following hackers' guide was written by the author, 
  127.           Steve Blasingame.  
  128.  
  129.  
  130.  
  131.           Getting the shell running...  
  132.  
  133.  
  134.           (This thing runs only on CP/M 2.2) 
  135.  
  136.  
  137.           First hack your CBIOS to include storage for the structure 
  138.           the shell calls iop.  The address in the CBIOS listing of 
  139.           this structure is the SHBUF define in the Shell source.  
  140.           This kluge allows us to save data for the shell between warm 
  141.           boots.  The structure of the buffer in the CBIOS is as 
  142.           follows: 
  143.  
  144.  
  145.                bufsiz:     equ     1030     ;default in bdscio.h
  146.  
  147.  
  148.                iop:
  149.                shdsk:      db      0
  150.                shsav:      dw      0
  151.                nocli:      db      0
  152.                shbuf:      ds      BUFSIZ
  153.  
  154.  
  155.           The CBIOS MUST also be modified to check the entry 
  156.           iop->_nocli at warm boots and zero it at cold boots.  When 
  157.           this flag is low the CCP should be modified at the following 
  158.           addresses: 
  159.  
  160.  
  161.                CCP+7 = 02h
  162.                CCP+8 = 'S'
  163.                CCP+9 = 'H'
  164.  
  165.  
  166.  
  167.                                       -2-
  168.  
  169.  
  170.  
  171.      SH (1)                    BDS C Users' Group                    SH (1)
  172.  
  173.  
  174.  
  175.           This modification should occur AFTER the CCP has been loaded 
  176.           at warmboot.  To make matters more complicated, there are 
  177.           two entrypoints (undocumented) to the CCP.  One, CCP+0, 
  178.           checks the buffer we have just munged and if it contains a 
  179.           filename, runs the .com file of the same name.  Entrypoint 
  180.           two, CCP+3, zeros the buffer.  Hence, if we save a CP/M 
  181.           image with the buffer modified and our CBIOS uses the first 
  182.           entrypoint CP/M will attempt to run SH.COM at every bootup 
  183.           (I have taken advantage of this on my own system, you may 
  184.           wish to do the same).  Whichever method one uses to chain 
  185.           the shell, the CBIOS must check the iop->_nocli flag before 
  186.           warmboots and act on the CCP accordingly if the 
  187.           shell-builtin, CCP is to work.  
  188.  
  189.  
  190.           If you are not an experienced CP/M hacker you should either 
  191.           get help in installing the shell or not attempt it at all.  
  192.           Likewise, if your CBIOS is not accessible at source level, 
  193.           forget it.  Be sure to send useful mods and repair jobs 
  194.           (there are certainly some bugs) to the librarian or to me 
  195.           directly.  
  196.  
  197.  
  198.                Addresses:
  199.                USPS    Steve Blasingame
  200.                        4121 Hidden Hill
  201.                        Norman, OK 73069
  202.  
  203.  
  204.                Usenet  duke!uok!bsteve
  205.  
  206.  
  207.  
  208.           As a last resort you can call me at (405) 360-2336 after 
  209.           hours and BEFORE MIDNIGHT.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.                                       -3-
  241.  
  242.  
  243. ystem, you may 
  244.           wish to do the sa