home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / hdutl / hdisk.shl < prev    next >
Internet Message Format  |  1985-02-05  |  4KB

  1. Date: Saturday, 2 February 1985  19:10-MST
  2. From: Ruben Ramirez-Mitchell <ruben@ut-ngp.uucp>
  3. To:   net.micro.cpm
  4. Re:   Example of simple Microshell script.
  5.  
  6. Somebody asked me for an example of microshell scripts, the following
  7. includes a few of the commands and does not make use of any of the
  8. microtools.  What I needed is a script to make the output of 'SD
  9. $SDALNP' more readable.  I needed to set the printer margins,etc; form
  10. feed in between drive listings, I wanted the date, and the option to
  11. specify system and library files.
  12.  
  13. I 'FILTER'ed the file to eliminate control chars (like ESC G4, ESC G8,
  14. ESC [ 1;96s, etc I use for my Televideo 950 and Qantex printer).
  15.  
  16. The script is in a file called 'hdisk.shl' and it is invoked by the
  17. name 'hdisk <parameters>'
  18.  
  19. :--------------------------------------------------------------------
  20. :  PROGRAM      hdisk 
  21. :  USAGE        hdisk [options]
  22. :               <option>: <all| d1 [d2 [d3 [d4]]]>
  23. :  DESCRIPTION  Print hard disk directories using 'SD' with parameters
  24. :              '$APN' (all users, print, no pause)
  25. :  EXAMPLES     hdisk all
  26. :               hdisk b a d
  27. :----------------------------------------------------------------------
  28. %B$ = "" 
  29. %#args %A
  30.   %if %A LT 1 then goto help
  31. %printdir
  32.    %erase
  33.    %print 
  34.    %print "               G4  ----HARD DISK DIRECTORY-----G0 "
  35.    %print "               G4        ALL USER AREAS        G0 "
  36.    %print ;%print    
  37.    %print  "                  G4 FILE SPECIFICATION  G0 "
  38.    %print  "                  G8    <CR> for '*.*'   G0 "
  39.    %print  "                  G8   (e.g. asm*.?q?)   G0 "
  40.    %print  "                  G8                     G0 "
  41.    %print
  42.    %print -n  "                  G8 FILES: G0 "
  43.    %getstr %E$ <con: ;   %upcase %E$
  44.    %if %E$ NE ""  then goto checksys ;  %E$ = "*.* "
  45. %checksys
  46.    %print; %print
  47.    %print -n "                  G8 SYSTEM FILES (Y/N): G0 "
  48.    %getstr %8 <con: ;   %upcase %8
  49.    %if %8 = "Y" then goto setsys 
  50.    %8 = ""
  51. %checklib
  52.    %print; %print
  53.    %print -n "                  G8 LIBRARY FILES (Y/N): G0 "
  54.    %getstr %9 <con: ;   %upcase %9
  55.    %if %9 = "Y" then goto setlib
  56.    %9 = ""
  57. %checkdate
  58.    %print; %print
  59.    %print -n "                  G8 DATE: G0 "
  60.    %getstr %B$ <con: ;  %upcase %B$
  61. :  BUILD PARAMETER LIST FOR SD.COM
  62.     %D$ = " $ANP"
  63.     %D$ = %D$ + %8 + %9
  64.     %15 = %E$
  65. : CHECK IF ALL DRIVES SPECIFIED
  66.     %C$ = %1
  67.     %upcase %C$
  68.     %if %C$ = "ALL" then goto alldisks
  69. : MESSAGE BEFORE PRINTING
  70.     %print; %print
  71.     %print "                  G4   Turn Printer ON LINE G0"
  72.     %print "                  G4    SET to TOP-OF-FORM  G0"
  73.     %print; %print
  74.     %print -n "                  G8   Press any key to continue: G0 "
  75.     %getchr %A$ <con:; %erase; %print
  76. : RESET QUANTEX PRINTER TO DEFAULTS
  77. :   / LEFT MARGIN 8 / TOP_MARGIN 5 / BOTTOM_MARGIN 6 + PADDING
  78.     %P$ = " [5;60r   [8;96s      "
  79.     %print -n %P$  > lst:;   %print >lst:
  80. : PRINT HEADING AND DATE
  81.     %print "                ====   Q540 - HARD DISK DIRECTORY  ======">lst:
  82.     %print -n  "                             "  >lst:
  83.     %print %B$ >lst: ;  %print > lst:
  84. : PRINT DIRECTORY WITH THE SELECTED OPTIONS  
  85. %loop
  86.     %15 = %E$ + %D$   
  87.     SD $1:$15 
  88.     %print "" > lst:
  89.     %shift
  90.     %A = %A - 1
  91.     %if %A GT 0 then goto loop
  92.     %erase
  93.     %print
  94.     %print "           G4   ---HARD DISK DIRECTORIES PRINTED----   G0"
  95. : RESET THE PRINTER TO DEFAULTS
  96.     %print -n "c" > lst:
  97.     %exit
  98. %alldisks
  99.     %A = 5
  100.     %1=A  ; %2=B ; %3=C ; %4=D ; %5=E
  101.     %goto loop
  102. %help
  103.     %erase
  104.     %print
  105.     %print "  NAME:        hdisk      
  106.     %print
  107.     %print "  DESCRIPTION: Print contents of hard disk, all user"
  108.     %print "               areas. Prompts for a) a file mask, b) "
  109.     %print "               the inclusion of system and library "
  110.     %print "               files and c) for the current date    "
  111.     %print 
  112.     %print "  USAGE:       Hdisk [<option>]"
  113.     %print "               <option>: 'all' | d1 [d2 [d3 [d4]]]"
  114.     %print 
  115.     %print "  EXAMPLES:    hdisk all"
  116.     %print "               hdisk d a c"
  117.     %print 
  118.     %print "  NOTES:       Drives scanned under the 'all' option:"
  119.     %print "               A:, B:, C:, D:, and E: "
  120.     %print 
  121.     %exit
  122. %setsys
  123.     %8 = "S"
  124.     %goto checklib
  125. %setlib
  126.     %9 = "L"
  127.     %goto checkdate
  128.