🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.postscript
Article #6032

Re: Env Vars

#6032
From: Jim Graham
Date: Fri, 17 May 1991 19:39
49 lines
1854 bytes
This really belongs in comp.windows.news...

gaudreau@juggler.East.Sun.COM (Joe Gaudreau (Dances with PostScript)) writes:

|> scairns@citib.com (Scott Cairns) writes:
|> =We're running SunOS 4.1 with OpenLook 2.0 window manager.
|> =
|> =I want to modify the OpenLook init.ps file so that I can
|> =check the value of an environment variable (in postscript
|> =language of course) and take appropriate action. 
|> =
|> =Something along the lines of:
|> =
|> =(1) get value of env variable (e.g. LOGO)
|> =
|> =(2) if (LOGO == 1) 
|> =
|> =        run some post-script file
|> =
|> =    else
|> =    
|> =        continue on
|> =
|> =Not knowing post-script and not finding any sample post-script
|> =code in the ~openwin directory that does something like this, I
|> =was hoping for some suggestions...

|> Piece of PS (actually NeWS):
|> 
|> (LOGO) getenv  1 eq {%ifelse
|> 	(somefilename) run
|> } if
|> 
|> %continue on...
|> 
|> Is this what you wanted?

Since the getenv operator returns an error if the environment
variable doesn't exist, ?getenv should be used instead to provide
a default.  Also, getenv returns a string, so a cvi should be
performed or a string compare should be done:

	(LOGO) (0) ?getenv (1) eq {
		(somefilename) run
	} if

should work.

				...jim
Technical Details
Message-ID: <13513@exodus.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!exodus!bendenweyr!flar
References: <1991May7.211628.5275@citib.com> <6214@eastapps.East.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!sun-barr!newstop!exodus!bendenweyr!flar
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
Newsgroups: comp.lang.postscript
Subject: Re: Env Vars
Message-ID: <13513@exodus.Eng.Sun.COM>
Date: 17 May 91 19:39:30 GMT
References: <1991May7.211628.5275@citib.com> <6214@eastapps.East.Sun.COM>
Sender: news@exodus.Eng.Sun.COM
Reply-To: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
Organization: Sun Microsystems, Inc.
Lines: 49