home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
text
/
tex
/
pastex
/
rexx
/
startdviprint.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-08-06
|
2KB
|
79 lines
/*RX
* StartDVIprint.rexx
*
* This is a small hack to run DVIprint through ARexx, so as it may be
* called from ShowDVI or other programs.
INPUTS:
* same as to dviprint, but use long option names. The last argument
* must be the name of an existing file.
*/
IF ~show('Libraries', 'rexxsupport.library') THEN DO
IF ~addlib('rexxsupport.library', 0, -30) THEN DO
say "Sorry, RexxSupport.library required"
EXIT 20 /* for statef() function*/
END
END
/* provides
stringreq("Title","initial string",StringBufSize,VisibleSize)
*/
IF ~SHOW('L','req.library') THEN
IF ~ADDLIB('req.library',-5,-60,2) THEN DO
say "Can't open 'req.library'!"
EXIT 20
END
/* ReqLib is less than ideal for what I want to do...*/
/*OPTIONS RESULTS*/
/* keep it as simple as possible, e.g. the arguments allowed are
passed through to DVIprint */
PARSE ARG arguments
numargs = words(arguments)
/* last arg must be filename...*/
IF word(statef(word(arguments,numargs)),1) ~= "FILE" THEN DO
name = stringreq(".dvi filename",,127,40)
IF name ~= "" THEN arguments = arguments name
ELSE EXIT
END
/* look for 'from' keyword */
reqn = para("from",arguments)
IF 0=reqn THEN DO
reqn = intreq("print from page ?", -100000, +100000)
IF reqn ~= "" THEN arguments = arguments" from "reqn
END
/* look for 'to' keyword */
reqn = para("to",arguments)
IF 0=reqn THEN DO
reqn = intreq("print upto page ?", -100000, +100000)
IF reqn ~= "" THEN arguments = arguments" to "reqn
END
say "executing: DVIprint "arguments
ADDRESS COMMAND DVIprint arguments
EXIT
/* see if specific parameter was given*/
para: PROCEDURE EXPOSE numargs
ARG name, parameters /* all switched to uppercase */
foundat = 0
DO i = 1 for numargs
IF word(parameters,i) = name THEN DO
foundat = i
LEAVE
END
END
RETURN foundat