home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------- Start REXX Source ----------------------------*/
- /* RExxPrint.rexx */
- /* Acts as front end for any Print program */
- /* Will pop up the Arp File Requestor if no file is supplied on */
- /* the command line or will pass the supplied file on to Print */
- /* Can be run from FastMenu1.rexx as a print utility. Substi- */
- /* tute your own favorite print program. */
- /* Can be used as a standalone program. The command line syntax*/
- /* is: RExxPrint [? | filename]. If no arg is supplied on the */
- /* command line, then the Arp FileRequestor will pop up. A ? */
- /* will bring up a short message showing command syntax. */
-
- 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
- cdir = pragma('D')
- parse arg filename .
- if filename = "?" then call banner
- if filename > "" then do
-
- /* Substitute your program between the single quotes */
-
- ADDRESSÂ COMMAND 'sys:PrintUtils/Print' filename
- exit
- end
- name = "df0:||||"
- do forever
- do while(name = "df0:||||")
- name = getfile(340,11,cdir,,'Select File')
- if name = "" then call end_all()
- call parse_dir
- end
- address command
- if index(cdir,":") = 0 then filename = pragma('D') || cdir || "/" || name
- else if right(cdir,1) ~= ":" then filename = cdir || "/" || name
- else filename = cdir || name
- ADDRESSÂ COMMAND 'sys:PrintUtils/Print' filename
- 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
-
- BREAK_C:
- call end_all()
- end_all: procedure
- exit
-
- banner:
- Say "Command Syntax: RExxPrint <?> | <filename>"
- Say " ? displays this message"
- Say " filename - Prints <filename>"
- Say " no argument brings up Arp File Requestor"
- exit 5
-
- /*----------------------------- End REXX Source -----------------------------*/
-