Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!rex!ames!haven!mimsy!mojo!eng.umd.edu!stripes From: stripes@eng.umd.edu (Joshua Osborne) Newsgroups: comp.windows.x Subject: Re: UNIX/X-windows questions Message-ID: <1991Jan30.040040.23774@eng.umd.edu> Date: 30 Jan 91 04:00:40 GMT References: <139@bwilab3.UUCP> <1441@rascal.UUCP> <1991Jan18.075159.26771@eng.umd.edu> <96@tdatirv.UUCP> Sender: news@eng.umd.edu (C-News) Reply-To: stripes@eng.umd.edu (Joshua Osborne) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 30 In article <96@tdatirv.UUCP>, sarima@tdatirv.UUCP (Stanley Friesen) writes: > 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' *. > } Well, that will work more offen then most trys... it will still die when I login on a non-X terminal. I try to set DISPLAY in my .login, sometime I don't get it right. I supose I could try harder... anyway I can allways unsetenv DISPLAY before using whatever it is you wrote, just like I would have to if I used emacs. (I still think checking for a succesful XOpenDisplay & providing a "Don't use X" flag would be the best choice) -- stripes@eng.umd.edu "Security for Unix is like Josh_Osborne@Real_World,The Multitasking for MS-DOS" "The dyslexic porgramer" - Kevin Lockwood "CNN is the only nuclear capable news network..." - lbruck@eng.umd.edu (Lewis Bruck)