home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------- Start REXX Source ----------------------------*/
-
- /* *************************/
- /* * Printit program */
- /* * using ARexx v1.06 */
- /* * by */
- /* * Dan Schenck */
- /* * 22-SEP-88 */
- /* * v 1.00 */
- /* **********************/
- spool_names = 'vd0:$$spooler'
-
- parse arg file2print orig_file cc
-
- cc = translate(cc,' ','15'X)
- schar = '/f'
- rchar = '0C'X
- call look4spec_char
- schar = '/n'
- rchar = '0A'X
- call look4spec_char
-
- if file2print = "" then
- do
- call check4more()
- address "SPOOLER" "DONE"
- exit
- end
- call printit()
- call check4more()
- address "SPOOLER" "DONE"
- exit
-
- check4more: procedure expose spool_names cc
- offset = 0
- endofin = 0
- do forever
- if (~exists(spool_names)) then return
- instring = statef(spool_names)
- parse VAR instring file ' ' bytes ' ' rest
- do while(~open('in',spool_names,'Read'))
- call delay(500)
- end
- if offset > 0 then
- do
- if offset < bytes then call seek('in',offset,'B')
- else endofin = 1
- end
- if (~endofin) then
- do
- instring = readln('in')
- parse VAR instring file2print ' ' orig_file ' ' rest
- call close('in')
- call printit
- offset = offset + length(file2print) + length(orig_file) + 2
- end
- else
- do
- call close('in')
- call delay(100)
- address command
- 'delete' spool_names "quiet"
- return
- end
- end
-
- printit: procedure expose file2print orig_file cc
- address command
- if ~exists(file2print) then
- do
- say '"' || file2print || '" Does Not Exist"'
- return
- end
- do while(~open('out','PRT:','Write'))
- call delay(300)
- end
- call writech('out',cc)
- call writeln('out','Date: ' || date() || ' Time: ' || Time())
- call writeln('out','File: ' || orig_file)
- call writeln('out',' ')
- prntfile = 'pfile'
- call open(prntfile,file2print,'Read')
- do while(~eof(prntfile))
- instring = readln(prntfile)
- call writeln('out',instring)
- end
- call close(prntfile)
- call close('out')
- if (index(upper(file2print),"$$RXSPOOL/$$") > 0) then
- 'delete' file2print || " Quiet"
- return
-
- look4spec_char: procedure expose cc schar rchar
-
- spec_char = index(cc,schar)
- do while(spec_char > 0)
- if (spec_char + 2) > length(cc) then cc_rest = ""
- else cc_rest = substr(cc,spec_char+2)
- if spec_char = 1 then cc = ""
- else cc = substr(cc,1,spec_char-1)
- cc = cc || rchar || cc_rest
- spec_char = index(cc,schar)
- end
- return
-
- /*----------------------------- End REXX Source -----------------------------*/
-