Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!ucbcad!ucbvax!ucsfcgl!cgl.ucsf.edu!kneller From: kneller@cgl.ucsf.edu (Don Kneller) Newsgroups: comp.sys.ibm.pc Subject: Re: ^P locks up keyboard Message-ID: <10495@cgl.ucsf.EDU> Date: Wed, 11-Nov-87 17:37:16 EST Article-I.D.: cgl.10495 Posted: Wed Nov 11 17:37:16 1987 Date-Received: Sat, 14-Nov-87 04:06:16 EST References: <15000045@silver> <753@pilchuck.Data-IO.COM> Sender: daemon@cgl.ucsf.edu Reply-To: kneller@socrates.ucsf.edu.UUCP (Don Kneller) Organization: UCSF Computer Graphics Lab Lines: 93 In article <753@pilchuck.Data-IO.COM> jgray@toad.pilchuck.Data-IO.COM (Jerry Late Nite Gray) writes: >In article <15000045@silver>, creps@silver.bacs.indiana.edu writes: >> >> >> This may have been discussed before, but I just noticed it. On >> DOS 3.21, if I type ^P at the system prompt the cursor moves back >> to the beginning of the line, and then the keyboard locks up, although > >I saw the same thing (sort of) but it usually occured when using ^P within >Emacs. There was generally no problem until exiting the program and the >system would lock up. I found out later [...] that this problem occurred >due to the PC trying to write to a non-existant printer and $##*$&^$#*$& >DOS not dealing with it in a civilized manner. Whenever this happens >now, I just enable the printer and it unlocks the system by generating the >familiar : > Trying to write to device driver > Abort, Retry or Ignore: > >Of course I have to type "Retry" since anything else will cause whatever >task I am running to abort (Stupid $#%&^&#%#&^#&%^ OS). > >My general question is how can I temporarily suspend the ^P function when >entering Emacs. The ^P toggles the "echo output to printer" command, just like ^PrtSc. With DOS 3.1 (I can't speak for any higher), when the prompt to "Abort, Retry or Ignore" happens, type ^P (toggling echo off again), then `I' each time you get reprompted. After only a few prompts, the printer buffer will be flushed and you will be back in business. It is possible to disable ^P (and ^S) with the DOS IOCTL interrupt. This is used to put the terminal into "raw" mode. A side affect of doing this is that output to the screen is sped up quite a bit (perhaps twice to thrice as fast). This side affect happens because DOS no longer checks the input buffer for special characters whenever it *outputs* to the screen. Here is a code fragment in C for putting the terminal into raw mode and for returning it to the default. This is for Microsoft C but it is very short and should be easy to modify. #include #include #define DEVICE 0x80 #define RAW 0x20 #define IOCTL 0x44 #define STDIN fileno(stdin) #define STDOUT fileno(stdout) #define GETBITS 0 #define SETBITS 1 static unsigned int old_stdin, old_stdout, ioctl(); void setraw() { old_stdin = ioctl(STDIN, GETBITS, 0); old_stdout = ioctl(STDOUT, GETBITS, 0); if (old_stdin & DEVICE) ioctl(STDIN, SETBITS, old_stdin | RAW); if (old_stdout & DEVICE) ioctl(STDOUT, SETBITS, old_stdout | RAW); } void unsetraw() { if (old_stdin) (void) ioctl(STDIN, SETBITS, old_stdin); if (old_stdout) (void) ioctl(STDOUT, SETBITS, old_stdout); } static unsigned int ioctl(handle, mode, setvalue) int handle, mode; unsigned int setvalue; { union REGS regs; regs.h.ah = IOCTL; regs.h.al = (unsigned char) mode; regs.x.bx = handle; regs.h.dl = (unsigned char) setvalue; regs.h.dh = 0; /* Zero out dh */ intdos(®s, ®s); return (regs.x.dx); } ----- Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller INTERNET: kneller@cgl.ucsf.edu BITNET: kneller@ucsfcgl.BITNET