I've included three files here, each to address some aspect of 
PowerBASIC which I find problematic.

Brent Ashley
(416)314-0179 bus
(905)846-0541 evgs

-----
CONTROLC.BAS contains a routine called ControlC, which hooks the 
DOS Ctrl-C interrupt vector.  This is necessary because DOS 
output (via cons: or con) can be interrupted by Ctrl-C, returning 
directly to DOS, leaving some interrupts hooked, causing lockups.
Instead, ControlC sets a flag and returns you to your program.  
You can then check the flag yourself to see if control-c has been 
pressed and decide what to do.  ControlC automatically uninstalls 
itself at the end of your program.  Here's a test program - try 
pressing control-c to interrupt it with and without the REMmed
out lines.  Be prepared to boot!

$DEBUG MAP ON
REM $link "controlc.pbu"
REM ControlC

OPEN "cons:" FOR OUTPUT AS #1

FOR i = 1 TO 200
  PRINT i
  REM IF CtrlCFlag THEN END
NEXT

The $DEBUG MAP ON statement seems to be necessary in PB3, for the
internal procedure SetOnExit to be loaded at compile time.

-----
ErrShell.BAS contains the ErrShell function, which is to be used 
as a replacement for SHELL, which doesn't keep track of the DOS 
cursor, and therefore causes you to be unsure of where to start 
printing on return from the SHELL.  ErrShell further returns an 
errorlevel value from the executed program.  If you don't need the 
errorlevel, you can call it like a SUB, too:

ErrorLevel? = ErrShell( "MyProg Parm1 Parm2" )
ErrShell "MyProg Parm1 Parm2"

