snoopy@sopwith.UUCP (Snoopy) (06/29/89)
Ghostscript 1.3 goes into an infinite loop if you specify a filename
on the command line that does not exist (e.g. you make a typo).
There are a couple of ways (at least) to fix this. Way number one is to
add e_undefinedfilename to the list of errors that the interpreter doesn't
attempt to retry. This gets you the "Interp returns -22" message, along
with stack dumps. Not pretty, but much better than an infinite loop.
(I believe this is what version 1.2 did.) You could add a printf to the
file_open() function in zfile.c telling what filename couldn't be opened.
(I have mine exit if it is using a hardcopy device.)
Another way, which doesn't require hacking the source and recompiling,
is to modify the definition of the 'run' function in ghost.ps:
change
{(r) file} % let the error happen
to
{(\nfile \007) print print ( not found\n\n) print flush} % warn user
Here is the diff for interp.c:
RCS file: RCS/interp.c,v
Retrieving revision 1.2
diff -c -r1.2 interp.c
*** /tmp/,RCSt1004558 Wed Jun 28 14:53:12 1989
--- interp.c Wed Jun 28 14:31:51 1989
***************
*** 150,155
case e_dictstackoverflow:
case e_execstackoverflow:
case e_stackoverflow:
case e_VMerror:
return code;
}
--- 150,156 -----
case e_dictstackoverflow:
case e_execstackoverflow:
case e_stackoverflow:
+ case e_undefinedfilename: /* avoid infinite loop -Snoopy */
case e_VMerror:
return code;
}
_____ .-----.
/_____\ Snoopy ./ RIP \.
/_______\ qiclab!sopwith!snoopy | |
|___| parsely!sopwith!snoopy | tekecs |
|___| sun!nosun!illian!sopwith!snoopy |_________|
"I *was* the next man!" -Indy