Path: utzoo!mnetor!tmsoft!torsqnt!hybrid!scifi!bywater!uunet!tdatirv!sarima From: sarima@tdatirv.UUCP (Stanley Friesen) Newsgroups: comp.windows.x Subject: Re: UNIX/X-windows questions Message-ID: <96@tdatirv.UUCP> Date: 24 Jan 91 16:26:59 GMT References: <139@bwilab3.UUCP> <1441@rascal.UUCP> <1991Jan18.075159.26771@eng.umd.edu> Reply-To: sarima@tdatirv.UUCP (Stanley Friesen) Organization: Teradata Corp., Irvine Lines: 31 In article razdan@phx.mcd.mot.com (Anshuman Razdan) writes: >In article <1991Jan18.075159.26771@eng.umd.edu> stripes@eng.umd.edu (Joshua Osborne) writes: > In article <1441@rascal.UUCP>, theo@rascal.UUCP (T. Kramer) writes: > > In article <139@bwilab3.UUCP> chris@bwilab3.UUCP (Chris Curtin) writes: > > >Is there a call to see if we are in X? I would rather not do a simple call > > >and see if it fails since this is a hack and doesn't look too good. > > How about setting an environment variable eg. TERM=xterm for the X logins > > and TERM=vt100 for character based terminal logins. > In my XView shelltool window my TERM variable is sun-cmd, not xterm. Quite true. This whole thing seems to be getting overly clever. I have simply used the environment variable DISPLAY, since almost all startup mechanisms I know set it (including xinit and xdm). Why mess around with stuff that does not really have anything to do with X, stick with: if(getenv("DISPLAY") != NULL) { /* We are running under X */ } else { /* We are running in a ''terminal' *. } -- --------------- uunet!tdatirv!sarima (Stanley Friesen)