home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------- Start REXX Source ----------------------------*/
-
- /* **************************/
- /* * Print selector program */
- /* * using ARexx v1.06 */
- /* * by */
- /* * Dan Schenck */
- /* * 22-SEP-88 */
- /* * v 1.00 */
- /* **********************/
-
- signal on BREAK_C
- true = 1
- false = 0
- address command
- cdir = pragma('D')
-
- arg name .
- call parse_dir
- do forever
- do while(name = "df0:||||")
- name = getfile(200,200,cdir,,'Select File to Print or CANCEL to EXIT')
- if name = "" then call end_all()
- 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
- if ~showlist("P","SPOOLER") then
- do
- 'rx' "rexx:spooler_utility INSTALL"
- do while(~showlist("P","SPOOLER"))
- call delay(150)
- end
- end
- address "SPOOLER" "PRINT " || file2show
- 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
-
- /*----------------------------- End REXX Source -----------------------------*/
-