home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------- Start REXX Source ----------------------------*/
-
- /* ****************************/
- /* * RxShell.rexx */
- /* * Execute selector program */
- /* * using ARexx v1.10 */
- /* * by */
- /* * Steven D. Kapplin */
- /* * 05-MAY-90 */
- /* * v 2.10 */
- /* ****************************/
-
- /* Portions adapted from Dan Schenck's print spooler. Thanks, Dan! */
-
- /* Modified by Steven D. Kapplin on 27-NOV-89 and 05-MAY-90 */
-
- if ~show(L,'rexxsupport.library') then
- rc = addlib('rexxsupport.library',0,-30,0)
-
- if ~show(L,'rexxarplib.library') then
- rc = addlib('rexxarplib.library',0,-30,0)
-
- signal on BREAK_C
- true = 1
- false = 0
- name = "df0:||||"
- parse arg cdir .
- if cdir = "?" then call banner
- if cdir = "" then cdir = "VD0:"
- pragma('D',cdir)
-
- /* Command preferences - change strings in double quotes to the command */
- /* string desired. */
-
- textviewer = "Sys:Tools/Type"
- pictureviewer = "Sys:Tools/Superview"
- unzoo = "c:archivers/Zoo"
- unarc = "c:archivers/Arc"
- unlzh = "c:archivers/LHarc"
- arcdir = "VD0:"
- playsound = ""
- player = "Dpaint:Play"
-
- /*----------------------------------------------------------------------*/
-
- do forever
- do while(name = "df0:||||")
- arg_flag = false
- name = getfile(340,11,cdir,,'RxShell 2.0 - Select File')
- if name = "" then call end_all()
- nw = words(name)
- parms = subword(name,2,nw-1)
- name = word(name,1)
- call parse_dir
- end
- address command
- if index(cdir,":") = 0 then file2show = pragma('D') || cdir || "/" || name
- else if right(cdir,1) ~= ":" then file2show = cdir || "/" || name
- else file2show = cdir || name
- call whatis
- if rtc = 0 then ADDRESSÂ COMMAND 'run' cmd || file2show || " " || parms
- name = "df0:||||"
- end
-
- /* parse_dir Procedure */
- /* */
- /* Separate the directory portion of the file name if there is any from */
- /* the file name itself. "cdir" will contain the new directory or be left */
- /* untouched if there is no directory. "name" will be modified to only */
- /* contain the file name itself or "df0:||||" if there is no file name. */
-
- parse_dir: procedure expose cdir name
- if length(name) = 0 then
- do /* No name or directory */
- name = "df0:||||"
- return
- end
- if ~exists(name) then
- do /* Bad directory/file name */
- name = "df0:||||"
- return
- end
- i_colon = lastpos(":",name)
- i_slash = lastpos("/",name)
- if left(statef(name),1) = "F" then
- do /* This a file, not just a directory */
- if i_slash > 0 then
- do /* At least one subdirectory has been given */
- cdir = substr(name,1,i_slash-1)
- name = substr(name,i_slash+1)
- return
- end
- if i_colon > 0 then
- do /* A main directory has been given */
- cdir = substr(name,1,i_colon)
- name = substr(name,i_colon+1)
- return
- end
- return
- end
- if i_slash > 0 then
- do /* A subdirectory with no file has been given */
- cdir = name
- name = "df0:||||"
- return
- end
- /* A main directory or subdirectory only has been given */
- if i_colon = 0 then cdir = cdir || name
- else cdir = name
- name = "df0:||||"
- return
-
- /* WhatIs */
- /* This subroutine inspects the first few bytes of a file */
- /* and determines the filetype from that information. It */
- /* returns a string which can be inserted into the command */
- /* string sent to the Arexx command processor. */
- /* Detects 15 different file types. */
-
- whatis:
- procedure expose file2show cmd player playsound textviewer pictureviewer rtc unarc unzoo unlzh arcdir
-
- /* Filetype identifiers */
-
- EXE = "F3" /* Executable */
- PIC = "494C424D424D4844" /* IFF Picture File */
- XCEL = "4654585450534554" /* Excellence! File */
- PROW = "574F5244464F4E54" /* ProWrite File */
- ADV = "04F404F404F404F4" /* Advantage Worksheet */
- MAXI = "474C424C" /* MaxiPlan Worksheet */
- CAND = "4445434B414E4E4F" /* CanDo Deck */
- LZH = "2D6C68312D" /* LHarc Archive */
- ARC = "1A08" /* Arc Archive */
- ZOO = "2E1A0000DCA7C4FD" /* Zoo Archive */
- SND = "3853565856484452" /* 8SVX Sound File */
- PPG = "0708090D" /* Professional Page 1.3 File */
- PGS = "07231988000D0200" /* PageStream 1.8 File */
- RXX = ".rexx" /* ARexx macro */
- ANIM = "414E494D464F524D" /* Anim File */
-
- /*----------------------------------*/
-
- call open(f,file2show,'R')
- instring = c2x(readch(f,24))
- rtc = 0
- call close(f)
- select
- when pos(RXX,file2show) > 0 then
- cmd = ""
- when substr(instring,7,2) = EXE then
- cmd = ""
- when substr(instring,17,16) = PROW then
- cmd = "ProWrite:Prowrite "
- when substr(instring,17,16) = PIC then
- cmd = pictureviewer || "-c "
- when substr(instring,17,16) = XCEL then
- cmd = "Excellence!:Excellence! "
- when substr(instring,1,16) = ADV then
- cmd = "Advantage:Advantage "
- when substr(instring,1,8) = MAXI then
- cmd = "MaxiPlan:MaxiPlan-III "
- when substr(instring,17,16) = ANIM then
- cmd = player || " "
- when substr(instring,17,16) = CAND then do
- pragma('D','CanDo:')
- cmd = "c:DeckRunner "
- end
- when substr(instring,17,16) = SND then
- cmd = playsound || " "
- when substr(instring,1,8) = PPG then
- cmd = "PPage:PPage "
- when substr(instring,1,16) = PGS then
- cmd = "PageStream:PageStream "
- when substr(instring,5,10) = LZH then do
- pragma('D',arcdir)
- call do_request()
- if result = "OKAY" then cmd = unlzh || " -x x "
- else cmd = unlzh || " l "
- end
- when substr(instring,1,4) = ARC then do
- pragma('D',arcdir)
- call do_request()
- if result = "OKAY" then cmd = unarc || " x "
- else cmd = unarc || " l "
- end
- when substr(instring,33,18) = ZOO then do
- pragma('D',arcdir)
- call do_request()
- if result = "OKAY" then cmd = unzoo || " e// "
- else cmd = unzoo || " l "
- end
- otherwise do
- do i = 1 to 32 by 2
- s = substr(instring,i,2)
- if s ~= "0A" & s ~= "0D" & s < "20" | s > "7F" then do
- rtc = 1
- cmd = ""
- return
- end
- end
- cmd = textviewer || " "
- end
- end
- return
-
-
- do_request: procedure expose result
- message = center('Unarc or List?',30)
- okgad = 'Unarc'
- cancgad = 'List'
-
- result = Request(360,144,message,,okgad,cancgad)
-
- return result
-
- BREAK_C:
- call end_all()
- end_all: procedure
- exit
-
- banner:
- Say "RxShell Ver. 2.1 by Steven D. Kapplin"
- Say "Command Syntax: [Run] RxShell [?] | [<path>]"
- Say " ? displays this message"
- Say " <path> sets login path - default path ==> VD0:"
- exit 5
-
- /*----------------------------- End REXX Source -----------------------------*/
-