TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Simeon Cran
from: David Nugent
date: 1995-07-23 06:06:00
subject: Trapping ctrl-c

> I have a multi-threaded serial terminal program that uses
 > VIO for screen writes, DosRead and DosWrite for the
 > serial port and KbdCharIn to read the keyboard. It works
 > great, but I can't stop it from exitting when I press
 > ctrl-c!

Enable 'binary' mode on the keyboard. When in binary mode, ^C is just like
any other key with no specific meaning or translation applied. Just
remember to return it to ASCII mode before returning from the program -
while CMD.EXE effectively masks such a problem by forcing it to ascii mode
again, some shells such as 4OS2 don't.


 > I don't know how to handle signals with OS/2 because I
 > don't have the full docs. I found out about VIO and KBD
 > from the 16 bit reference in .inf format. They talk about
 > signals but I believe that 32 bit OS/2 doesn't use
 > signals any more... only exceptions.

I think you're missing the point that's C's semi-posix "signal"
interface are more in the nature of exceptions than not. They just pre-date
them, and represent a somewhat more OS generic UNIX-style interface. In any
case, whether the program is 16- or 32- bit, the VIO & KBD interfaces
are still valid APIs unless you're writing PM apps. They are (still) 16-bit
(although you can get 32-bit versions as well), but afaik the lowest level
drivers are still 16-bit anyway.

---
* Origin: Unique Computing, Melbourne, Australia (3:632/348)
SEEN-BY: 620/243 632/103 341 348 363 635/503 638/102 640/820 690/660 711/409
SEEN-BY: 711/410 413 430 807 808 809 934 949 955 712/515 713/888 800/1
SEEN-BY: 7877/2809
@PATH: 632/103 348 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.