how to ignore keyboard "ctrl +"combine command in program?

My system is Qnx6.1.0.
I have a process running in foreground.
I want to ignore the "CTRl+ "command in program ,
such as CTRL+Q
CTRL+S
CTRL+D
CTRL+Z
Because that when I press these combine command unconsciously ,it will
affect the process.
So I want to ignore these command,
How to ignore keyboard "ctrl +"combine command in program?

zhz_zhang <zhz_zhang26@sina.com> wrote:

My system is Qnx6.1.0.
I have a process running in foreground.
I want to ignore the "CTRl+ "command in program ,
such as CTRL+Q
CTRL+S
CTRL+D
CTRL+Z
Because that when I press these combine command unconsciously ,it will
affect the process.
So I want to ignore these command,
How to ignore keyboard "ctrl +"combine command in program?

You would have to tell your terminal to not generate the related
signals for those actions.

If you do an “stty” on your terminal, it will list a mapping from
ctrl- key strokes to operations. You need to un-map those operations
that you don’t want.

This would be done with tcsetattr(), normally you do a tcgetattr(),
change the bits of the termios structure that you need to, then
do a tcsetattr() to put the changes back down.

QNX follows a standard Unix/Posix terminal handling behaviour. Our
docs on doing this sort of stuff are a bit scant – a good Unix book
will cover it in more detail. e.g. Advanced Programming in the
Unix Environment
by W. Richard Stevens, ISBN 0-201-56317-7.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

“zhz_zhang” <zhz_zhang26@sina.com> wrote:

My system is Qnx6.1.0.
I have a process running in foreground.
I want to ignore the "CTRl+ "command in program ,
such as CTRL+Q
CTRL+S
CTRL+D
CTRL+Z

Depending what you’re trying to accomplish, you may be able to simply
ignore certain signals:


#include <signal.h>

int main( int argc, char* argv[] )
{
/* Ignore SIGINT (CTRL-C), SIGQUIT (CTRL-), and SIGTSTP (CTRL-Z) */
(void)signal( SIGINT, SIG_IGN );
(void)signal( SIGQUIT, SIG_IGN );
(void)signal( SIGTSTP, SIG_IGN );

while( 1 ) {

sleep( 1 ); /* You’ll have to use ‘slay’ to terminate this

  • prog…
    } */

return 0;
}


HTH,

  • Dave

David Wolfe <da5id@luvspamwolfe.name> wrote:

“zhz_zhang” <> zhz_zhang26@sina.com> > wrote:
My system is Qnx6.1.0.
I have a process running in foreground.
I want to ignore the "CTRl+ "command in program ,
such as CTRL+Q
CTRL+S
CTRL+D
CTRL+Z

Depending what you’re trying to accomplish, you may be able to simply
ignore certain signals:

I don’t think you can ignore STOP signals.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Depending what you’re trying to accomplish, you may be able to
simply ignore certain signals:

I don’t think you can ignore STOP signals.

Too true. As I said, it really depends what the goal is. I thought
perhaps it might be as simple as preventing someone from inadvertently
CTRL-C’ing out of the app or using job control commands. Though the
original poster didn’t explicitly frame their question this way, it
seems to be a really common one; so I gave the ‘Captain Obvious’ answer.
:sunglasses:

Is it only one program that you want to ignore these signals?

If so, you will have to do it in that program.

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:ap3p81$g26$1@nntp.qnx.com

zhz_zhang <> zhz_zhang26@sina.com> > wrote:
My system is Qnx6.1.0.
I have a process running in foreground.
I want to ignore the "CTRl+ "command in program ,
such as CTRL+Q
CTRL+S
CTRL+D
CTRL+Z
Because that when I press these combine command unconsciously ,it will
affect the process.
So I want to ignore these command,
How to ignore keyboard "ctrl +"combine command in program?

You would have to tell your terminal to not generate the related
signals for those actions.

If you do an “stty” on your terminal, it will list a mapping from
ctrl- key strokes to operations. You need to un-map those operations
that you don’t want.

This would be done with tcsetattr(), normally you do a tcgetattr(),
change the bits of the termios structure that you need to, then
do a tcsetattr() to put the changes back down.

QNX follows a standard Unix/Posix terminal handling behaviour. Our
docs on doing this sort of stuff are a bit scant – a good Unix book
will cover it in more detail. e.g. Advanced Programming in the
Unix Environment
by W. Richard Stevens, ISBN 0-201-56317-7.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.