[comp.binaries.atari.st] v02i047: break -- Exit programs with a keypress

koreth@ssyx.ucsc.edu (Steven Grimm) (08/25/88)

Submitted-by: uunet!mcvax!philmds!leo (Leo de Wit)
Posting-number: Volume 2, Issue 47
Archive-name: break

The following program, when placed in the AUTO folder or started by hand,
lets you interrupt any program (except the desktop).
This posting consists of a manual page and a uuencoded program.
The corresponding source is sent to the moderator of comp.sources.atari.st.

For correspondence conceirning this program (bugs, questions etc.) try

      L. J. M. de Wit
      Nachtegaallaan 7
      5731XP Mierlo
      Holland
      e-mail: ..!mcvax!philmds!leo
              (or perhaps  ..!hp4nl!philmds!leo)

----------------------------- start of manual page ----------------------------
  NAME
     break - stop current program on receipt of interrupt character
 
  SYNTAX
     break [-e|-d|-z] [-i|-c<code>]
 
  DESCRIPTION
     After installing break, any program can be interrupted.
     This is achieved by 'extending' the existing keyboard interrupt
     routine: after executing the old code the break character check
     is done.
 
     The various flags have the following meaning:
        e(nable) : the current break character will end the program.
                   the code returned is -32, what seems to be the standard
                   value for programs interrupted by ^C in GEMDOS.
        d(isable): no actions are done; this restores the old behaviour
        z(ero)   : the current break character will be discarded (made 0)
                   in the input buffer; this can be used to disable ^C.
        i(nput)  : the break character is prompted for. Combinations with
                   shift, control and alternate keys are also allowed.
                   Useful for specifying the break character interactively.
        c(ode)   : specifies the break character as a hexadecimal code.
                   The hex code must follow the 'c' flag immediately.
                   Useful for specifying the break character from a script.
     Of the flags e,d and z only one should be used; e is the default.
     Also, of the flags i and c only one should be used; control-delete is
     the default. This is done on purpose; you can always change it to ^C
     if you want to (or whatever key you like).
      
     The break program can be reused indefinitely, because a next invocation
     is not made memory resident; it only modifies parameters in the first
     invocation (the resident one).
 
     The program can be placed into the \AUTO folder to be installed
     automatically, or activated 'by hand'. If placed in the \AUTO folder, it
     should of course have a .PRG extension (break.prg); as \AUTO folder
     programs don't get arguments, the break will be enabled and the break
     character is control-delete in this case.
 
  BUGS/SHORTCOMINGS
     A nice extension would be the possibility to catch the interrupt from
     a user program; this could be achieved by using a new trap. As this
     implies restoring the old interrupt catch routine when the program
     exits, and maybe also core dumps could be added to the action of an
     (other) interrupt character, such a more general signal mechanism is
     not added (yet). Gives me time to think of a nice implementation 8-).
 
  JOKE
     Gimme a break, huh?!
 
-------------- end of manual page; start of uuencoded program -----------------
begin 640 break.prg
M8!H   +6                             "!O  30_ " <  0&$(P   0
M&&<  /@,  !!;0H,  !:;@0    @#   968(4/D   )F8-P,  !D9@A1^0  
M F9@S@P  &EF+"\(2'H"*3\\  E.05R//SP !TY!5(\CP    EI(>@)L/SP 
M"4Y!7(\@7V"<#   8V94<@ 0&&8*(\$   ):8   A P  "!G- P   EG+@P 
M #!M6@P  &%M! 1  " ,  !&;DH,   Y;P@,  !!;3Y?@ 0  ##I@8( 8+@C
MP0   EI@ /]$#   >F8*4/D   )G8 #_- P  "!G /\L#   "6< _R0,   M
M9P#_'$AZ :L_/  )3D%<CS\\  $_/ !,3D$_/  !/SP #DY.6(\CP    E8O
M//____\_/ !&/SP !4Y-4(\CP    F)!^@"8D(@CP    EY"IS\\ "!.052/
M+H!!^@$8(#H!"D/P"  @/     RS"%;(__QG/C\\ "!.05R/0KD   )>2'H 
M6#\\ $8_/  %3DU0CR!O  0@/    0#0J  ,T*@ %-"H !Q"9R\ /SP ,4Y!
M/SP ($Y!7(\@.@"N0?H LA&0" !!^@"K$9 ( $'Z )8AD @ /SP  $Y!2'H 
M"D#G+SH BDYU2.? X$HY   "9F=>('H ;# H  BP:  &9U!P B)X8"Q*D6=&
M(FD )%'(__9P # H  8B.@!*(E"P:  (9RQ8@+!H  1F G  LK$  &;J2CD 
M  )G9P9"L0  8-PQ:  (  8O?    DP %DS?!P-.<S\\_^ _/ !,3D$     
M %, 'P          _P!"4D5!2R!-05)+15( 26YP=70@=&AE(&)R96%K(&-O
M9&4@8GD@:&ET=&EN9R!T:&4@:V5Y*',I(#H@ &)R96%K.B!U<V%G93H@8G)E
M86L@6RUE?"UD?"UZ72!;+6E\+6,\8V]D93Y=#0H #0H      "X.)")$$$08
&##1P2A0 
 
end