Re: check if X is running?

1999-01-24 Thread Martin Held
I think another way to do it is to build two seperate binaries.  For
example, create xprog and prog, one that is X-only, and another that is
console-only.  This allows the user to specifcally set which version they
want, and it might also reduce the amount of code needed per program and
speed it up a bit.  Downside is, tho, you have to actually seperate the
code for both programs, and keep them updated at the same time (or just
share .c files... however you please.).  Anyway.  As far as detection, I
dunno, but hope this helps. 

Do Svidonia,

Martin Held
[EMAIL PROTECTED]
---
The way to love anything is to realize that it might be lost.


On Sun, 24 Jan 1999, Hamish Moffatt wrote:

 Can anyone suggest a good way to tell if the user is running a program from X?
 
 A program I maintain can run in terminal or graphical mode. It currently
 checks if graphics are available by comparing $TERM to a string
 included at compile time. That's xterm by default, which doesn't work
 on Debian because of xterm-debian, and doesn't work in rxvt either.
 
 I'd like to remove that check and make it a better one. Is checking
 for $DISPLAY sufficient?



Re: check if X is running?

1999-01-24 Thread Martin Held
Hmm.  This sounds a lot like the Matlab Engineering tool I just learned
how to use last Term.  It's mainly console based, but can display graphs
and plots and the like.  If the user doesn't have the DISPLAY variable set
right, it just tries to send the graphics off to a null server and doens't
even give an error message.  If your program doesn't require X11 to run
(as in, there are some things in there that never require X), you could
consider letting the user run the program even if $DISPLAY isn't set, and
maybe give a warning that it hasn't, or something like that.

Do Svidonia,

Martin Held
[EMAIL PROTECTED]
---
The way to love anything is to realize that it might be lost.


On Sun, 24 Jan 1999, Hamish Moffatt wrote:

 That's an idea. The same binary does text and graphics just fine;
 it's mostly text oriented but can display some graphics too. However,
 since it's linked against X, the package depends on the X libraries.
 
 Even with the X version installed, it runs fine in text mode, so I
 still need the check for X11 :-)