[comp.sys.sun] Am I running under sunview?

graham@relay.eu.net (Graham Underwood) (03/12/90)

Does anyone know a reliable way for a program to detect whether it is
executed under Sunview or not.

The way Sun supplied applications (such as shelltool) work is to check for
WINDOW_PARENT in the environment.  This test however breaks down if the
program is executed using `on' since the environment is exported. 

What I want to achieve is for a program to detect if it is running from
Sunview and present a graphical user interface or, if not, do the best it
can with a tty style interface.  

Does anyone out there know how this can be done ?

graham@advent.co.uk
..!ukc!advsys!graham

sxm@philabs.philips.com (Sandeep Mehta) (03/13/90)

In article <5712@brazos.Rice.edu>, advsys!graham@relay (Graham Underwood) writes:
>Does anyone know a reliable way for a program to detect whether it is
>executed under Sunview or not.
>
>The way Sun supplied applications (such as shelltool) work is to check for
>WINDOW_PARENT in the environment.  This test however breaks down if the
>program is executed using `on' since the environment is exported. 

Well, using WINDOW_PARENT/WINDOW_ME/WINDOW_GFX works most of the time, but
I can see why your program would need something more reliable. You could
either choose to twiddle the (envp) envariables exported.  Something I do
is to try and talk directly to the window manager using
we_getparentwindow() (and/or traverse the tree to the root
win_getlink(wfd, WL_OLDESTCHILD) etc.).

sxm@philabs.philips.com                             ...to be or not to bop ?