l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2001 Dec 30 17:07

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] detecting X from within C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] detecting X from within C

On Mon, 16 Jul 2001 brian_sroufek@msdesigninc.com wrote:

> The question was two-fold, as I understood it.
> Testing for X/ncurses and Testing for Console.

Well, Peter's question wasn't.  But why you thought this intrigues me...  
my own background in this area is sketchy enough that I am curious to find
out more about your thoughts.  Even if your solution doesn't answer
Peter's question specifically, what related problems might your solution
apply to?

> The approach suggested below -- the use of the ncurses
> pre-init routines is a library as opposed to environment
> approach to testing for X/ncurses as well as console,
> non-console.

I am not seeing how ncurses library routines would allow one to
distinguish a graphical display from a character-cell display.

> I suppose the DISPLAY can be used by its value to
> determine the console target, but that implies a console
> target, not a console environment, unless I'm wrong.

As I understand it, DISPLAY contains a display name... but what this has
to console targets eludes me.  An empty DISPLAY could be construed as
indicating that X libraries should not be used, though it might be
appropriate to use a command line option to allow ncurses to be forced to
be used from an xterm.

While I find myself thinking I understand your terminology, I am not sure.
What is your definition of "console target" vs. "console environment"?

> In any case, the library approach seemed to be a more
> sure fire method.

A library approach that was known to be portable and was designed to
address this problem might well be the best solution.  I am just
scratching my head trying to see how your suggestion applies.

> Brian S.
> Peter Jay Salzman wrote:
> > begin: Henry House <hajhouse@houseag.com> quote
> > > On Mon, Jul 16, 2001 at 11:31:30AM -0700, Peter Jay Salzman wrote:
> > > [...]
> > > > from.  how is this done from C?
> > >
> > > Usually one checks for the existance of a non-empty DISPLAY.
> >
> > cool beans.  works like a charm.  it's neat to be able to run this program
> > from both console and X.   very cool...

Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.