delorie.com/djgpp/doc/libc/libc_145.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

__djgpp_set_sigquit_key

Syntax

 
#include <sys/exceptn.h>

void __djgpp_set_sigquit_key(int new_key);

Description

This function changes the QUIT key that generates the signal SIGQUIT. By default, Ctrl-\ is set as the QUIT key. To replace it with another key, put the scan code of the new QUIT key into the bits 0-7 and the required keyboard status byte into bits 8-15 of new_key, and call this function. Here's how the keyboard status bits are defined:

 
   Bit
 76543210    Meaning

 .......X    Right Shift key
 ......X.    Left Shift key
 .....X..    Ctrl key
 ....X...    Alt key
 ...X....    Scroll Lock key
 ..X.....    Num Lock key
 .X......    Caps Lock key
 X.......    Insert

A 1 in any of the above bits means that the corresponding key should be pressed; a zero means it should be released. Currently, all but the lower 4 bits are always ignored by the DJGPP keyboard handler when you set the QUIT key with this function.

For example, the default Ctrl-\ key should be passed as 0x042b, since the scan code of \ is 2Bh and when the Ctrl key is pressed, the keyboard status byte is 04h.

To disable SIGQUIT generation, pass zero as the argument (since no key has a zero scan code).

This function will set things up so that the left Shift key doesn't affect Ctrl- and Alt-modified keys; the right Shift key won't affect them either, unless its bit is explicitly set in new_key. This means that Ctrl-\ and Ctrl-| will both trigger SIGQUIT if 0x042b is passed to this function.

The DJGPP built-in keyboard handler pretends that when the right Shift key is pressed, so is the left Shift key (but not vice versa).

For getting similar effects via the POSIX termios functions, see tcsetattr.

Return Value

The previous QUIT key (scan code in bits 0-7, keyboad status in bits 8-15).

Portability

ANSI/ISO C No
POSIX No

Example

 
  __djgpp_set_sigint_key(0);  /* disable SIGQUIT's */


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004