Question re ncurses and the various ttys

Murray Taylor MTaylor at bytecraft.com.au
Thu Oct 12 18:58:44 PDT 2006


 

> -----Original Message-----
> From: Raaf [mailto:freebsd at luna.afraid.org] 
> Sent: Friday, 13 October 2006 7:36 AM
> To: freebsd-questions at freebsd.org
> Cc: Murray Taylor
> Subject: Re: Question re ncurses and the various ttys
> 
> > Hi all
> > 
> > I've been digging around in the various man pages and 
> havent yet found
> > the 
> > incantations I require.
> > 
> > Goal: to create a curses driven status screen that can run 
> without user
> > intervention.
> > 
> > I want to know if it is possible to _programatically_ switch to an
> > unused 
> > virtual tty,
> 
> Yes it is certainly possible, i have done this recently 
> myself and like
> you i couldn't find how to do it in any man page. Fortunately 
> i could find
> the answer in the xorg-server source code.
> 
> You just open one of the virtual terminals and issue the VT_ACTIVATE
> ioctl:
> 
> fd = open("/dev/ttyv9",O_RDONLY);
> ioctl(fd,VT_ACTIVATE,10);
> 
> > and then use this as the display page.
> > ( By unused I mean marked 'off' in /etc/ttys )
> 
> 
> Well, the above code only switches the active vt...
> 
> If you want your program output to go to a certain vt you 
> probably have
> to open the specific vt and replace the stdin and stdout file 
> descriptors
> of your program with the one of the one of the vt you just opened.
> 
> But there are probably some caveats to this method, so best 
> is to take a
> look at the getty source code and maybe add your program to /etc/ttys.
> 

Thank you - this is probably the incantation I need along with the 
curses newterm / setterm calls

cheers
mjt

 
---------------------------------------------------------------
The information transmitted in this e-mail is for the exclusive
use of the intended addressee and may contain confidential
and/or privileged material. Any review, re-transmission,
dissemination or other use of it, or the taking of any action
in reliance upon this information by persons and/or entities
other than the intended recipient is prohibited. If you
received this in error, please inform the sender and/or
addressee immediately and delete the material. 

E-mails may not be secure, may contain computer viruses and
may be corrupted in transmission. Please carefully check this
e-mail (and any attachment) accordingly. No warranties are
given and no liability is accepted for any loss or damage
caused by such matters.
---------------------------------------------------------------

### This e-mail message has been scanned for Viruses by Bytecraft ###


More information about the freebsd-questions mailing list