%! % Date: Tue, 21 Feb 89 17:21:27 EST % To: NeWS-makers@brillig.umd.edu % Subject: Re: Sun Terminal & Executive Prompt. % From: leah!rpi!pawl.rpi.edu!deven@csd4.milw.wisc.edu (Deven Corzine) % % In article <21145.8902131122@isgcl.cs.reading.ac.uk> Anthony.D.Worrall@reading.ac.UK writes: % > Is it possible to set a prompt in the psh executive mode? Laser writers % >use a prompt and it makes things so much more user friendly. % % Yes, indeed. This is one of the many changes I have in my user.ps. % There is a slight bug in the input handling that will cause problems % if you try to type a literal string with a newline in it. In other % words: % % PS> (this is % PS> a string) % % will not work correctly. (it will put (this is) on the stack and try % to execute "a", "string", and ")"...) Aside from that, there is no % limit to input line length. Here is the relevant code from my user.ps: % % -------------------------------------------------------------------------- systemdict /prompt {(PS> ) print flush} put systemdict /executive { % - => - (Execute current file) countdictstack 1 eq {100 dict begin} if % make sure there is a userdict (Welcome to NeWS Version ) print version print (\n) print /execfile currentfile dup null eq {pop (%stdin) (r) file} if def { { execfile status not { quit } if { { prompt () { execfile 256 string readline pop dup length 256 eq not {append exit} if append } loop % get a line of input, without size restrictions cvx exec } loop } stopped pop execfile status not { quit } if ExecutiveErrorHandler } loop } stopped { quit } if } put % -------------------------------------------------------------------------- % % As in the Adobe implementation, you can change the prompt globally with: % % systemdict /prompt {(NeWS> ) print flush} put % % to change the default prompt to "NeWS> " or you could use: % % /prompt {(NeWS> ) print flush} def % % to change it locally, for a single psh. The whole setup works rather % nicely. I gave this change along with some others to gregm@sun.com a % while back; maybe it will make it into a later release. I have yet to % get around to fixing the string problem, but aside from that, it seems % ok. Try it, you'll like it. :-) % % Deven % -- % ------- shadow@pawl.rpi.edu ------- Deven Thomas Corzine --------------------- % Cogito shadow@acm.rpi.edu 2346 15th Street Pi-Rho America % ergo userfxb6@rpitsmts.bitnet Troy, NY 12180-2306 (518) 272-5847 % sum... In the immortal words of Socrates: "I drank what?" ...I think. %