get information about a console
#include <sys/console.h> int console_info( struct _console_ctrl *cc, int console, struct _console_info *info );
Get information about a console, and put it in the structure pointed to by info. Values for console are in the range [1..N]. However, a value of zero for console specifies to get information on the console referred to in the cc parameter (as returned by console_open()). A value of -1 for console specifies the currently visible console.
The _console_info structure is defined in <sys/console.h>, and contains at least the following members:
Type | Member | Description |
---|---|---|
unsigned short | console | Console number [1..N]. |
unsigned char | type | Type of console device. |
unsigned char | protocol | Type of emulation supported. |
unsigned short | flags | Miscellaneous flag bits. |
short int | max_fonts | Maximum number of loadable fonts. |
short int | font | Current font [0..N-1]. |
short int | rows | Current number of rows. |
short int | cols | Current number of columns. |
#include <sys/console.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> int main( void ) { struct _console_ctrl *cc; struct _console_info info; /* * Open up a channel to the console driver * associated with standard input */ if ((cc =console_open(fileno(stdin),O_RDWR)) == NULL) { perror( "console open" ); exit( EXIT_FAILURE); } if( cc && console_info( cc, 0, &info) == 0 ) { if( info.type == _CON_TYPE_QWIN ) printf( "Stdin is a QNX Windows console\n" ); else printf( "Stdin is a standard console\n" ); }else printf( "Stdin is not a console\n" ); /* * Close the channel */ if ( console_close( cc ) == -1 ) { perror( "console close" ); exit( EXIT_FAILURE ); } return (EXIT_SUCCESS); }
QNX
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | Yes, but modifies errno |
Thread | Yes |
console_active(), console_arm(), console_close(), console_ctrl(), console_font(), console_open(), console_protocol(), console_read(), console_size(), console_state(), console_write(), errno