On Fri, May 29, 2026 at 12:07 PM Steve Nickolas via Freedos-devel
<[email protected]> wrote:
>
> Hints:
>
> 1. Whatever you return from main() or pass to exit() (#include <stdlib.h>)
> is the ERRORLEVEL.
>
> 2. Borland has ctrlbrk(); I don't know what the Watcom equivalent is.
>
In Open Watcom C, break_off() will turn off ctrl+c and ctrl+brk
checking, but only during normal execution. It does not block ctrl+c
or ctrl+brk during keyboard input, such as with getch()
For example, this will prevent ctrl+c during the delay() function:
#include <stdlib.h> /* break_on, break_off */
break_off();
puts("wait 2 seconds..");
delay(2000);
puts("Ok");
To block ctrl+c and ctrl+brk during input, you should use
signal(SIGINT,SIG_IGN) instead. This sets the SIGINT signal to be
ignored. For example, this prevents ctrl+c when reading keyboard
input:
#include <signal.h> /* signal */
signal(SIGINT, SIG_IGN);
do {
key = getch();
if (key == 0) { getch(); }
printf("%d\n", key);
} while ((key != 27) && (key != 'q') && (key != 'Q'));
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel