www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/12/10/04:11:49

Date: Fri, 10 Dec 93 09:24:08 +0100
From: terra AT diku DOT dk
To: dj AT ctron DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Ctrl-Break check (and therefore a lot more) is broken in 1.11

The following code shows that there is something wrong with the Ctrl-Break check
in 1.11.  Compile and run it; then press Ctrl-Break a couple of times and it
will crash with an exception 0x16.  I have only seen crashes when int86/intdos
was used where Ctrl-Break is pressed.
=============================================================================
/* Modified samples/ctrlbrk.c */
#include <stdio.h>
#include <pc.h>
#include <go32.h>
#include <dos.h>

int main()
{
  char c;

  printf("waiting and polling - press Ctrl-Break to step a counter,\n");
  printf("any other key to go on, 's' to stop.\n");
  do
    {
      _go32_want_ctrl_break(1);
      while (!kbhit())
	{
	  union REGS regs;
	  regs.h.ah = 1; /* Harmless check for stroke.  */
	  int86 (0x16, &regs, &regs);
	}
      printf("Ctrl-break was pressed %d time(s).\n", 
	     _go32_was_ctrl_break_hit());
      c= getkey();
    } 
  while (c != 's');
  return 0;
}
=============================================================================

Morten Welinder
terra AT diku DOT dk

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019