www.delorie.com/djgpp/doc/libc/libc_144.html   search  
libc.a reference

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



#include <sys/exceptn.h>

void __djgpp_set_sigint_key(int new_key);


This function changes the INTR key that generates the signal SIGINT. By default, Ctrl-C is set as the INTR key. To replace it with another key, put the scan code of the new INTR 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:

 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 INTR key using this function.

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

To disable SIGINT 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-C and Ctrl-c will both trigger SIGINT if 0x042e 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 INTR key (scan code in bits 0-7, keyboad status in bits 8-15).




  __djgpp_set_sigint_key(0x0422);  /* make Ctrl-g generate SIGINT's */

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

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004