Path: utzoo!utgpu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!news.funet.fi!funic!santra!santra!sja From: sja@sirius.hut.fi (Sakari Jalovaara) Newsgroups: alt.sys.sun Subject: Re: How to disable break key on console? Message-ID: <1991Feb10.174225.19268@santra.uucp> Date: 10 Feb 91 18:41:55 GMT References: <1991Feb6.195059.18763@cbnews.att.com> <1991Feb7.032051.281@ccs.carleton.ca> Sender: news@santra.uucp (Cnews - USENET news system) Organization: Helsinki University of Technology Lines: 175 In-Reply-To: otto@tukki.jyu.fi's message of 9 Feb 91 17:45:42 This is for demonstration purposes only. To really turn off the abort key, binary-patch the kernel. I don't use this myself; as a sysadmin I think the abort key is a very useful feature. ++sja #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # If this archive is complete, you will see the following message at the end: # "End of shell archive." # # Contents: # Makefile disable-abort.c # # Wrapped by sja@sirius.hut.fi on Sun Feb 10 19:39:20 1991 # PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(342 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' X# X# Makefile for disable-abort X# X X# -g or -O. You can also compile with "make DEBUG=-g" XDEBUG = -O X XCFLAGS = $(DEBUG) XLINTFLAGS = XLIBS = XSHELL = /bin/sh X XSRC = disable-abort.c XOBJ = disable-abort.o X Xdisable-abort: $(OBJ) X $(CC) $(CFLAGS) $(OBJ) $(LIBS) -o disable-abort X Xlint: X lint $(LINTFLAGS) $(SRC) $(LIBS) X Xclean: X rm -f *.o a.out core END_OF_Makefile if test 342 -ne `wc -c disable-abort.c <<'END_OF_disable-abort.c' X X/* X * X * disable-abort.c -- disable the keyboard abort sequence X * X * Sakari Jalovaara (sja@sirius.hut.fi) X * X * Public domain -- PLEASE do not distribute any part of this software X * under the GNU license and do not distribute with any other software X * that is covered by the GNU license. X */ X X#include X#include X#include X#include X#include X X Xchar *errstr (); X Xchar *program; Xint debug = 0; X Xint Xmain (argc, argv) Xint argc; Xchar **argv; X{ X struct kiockey key; X int fd; X X program = argv[0]; X X if (argc != 1) X debug++; X X if ((fd = open ("/dev/kbd", O_RDWR)) == -1) { X fprintf (stderr, "%s: can't open /dev/kbd: %s\n", program, errstr ()); X exit (1); X } X X key.kio_tablemask = KIOCABORT1; X key.kio_station = 1; X key.kio_entry = 0; X key.kio_string[0] = 0; X X doit (fd, &key); X X key.kio_tablemask = KIOCABORT2; X key.kio_station = 1; X key.kio_entry = 0; X key.kio_string[0] = 0; X X doit (fd, &key); X X exit (0); X} X X Xdoit (fd, key) Xint fd; Xstruct kiockey *key; X{ X if (debug) { X X if (ioctl (fd, KIOCGETKEY, key) == -1) { X fprintf (stderr, "%s: can't GETKEY: %s\n", program, errstr ()); X exit (1); X } X X printf ("mask %d\n", key->kio_tablemask); X printf ("station %d\n", key->kio_station); X printf ("entry %d\n", key->kio_entry); X printf ("string \"%s\"\n", key->kio_string); X X } else { X X if (ioctl (fd, KIOCSETKEY, key) == -1) { X fprintf (stderr, "%s: can't SETKEY: %s\n", program, errstr ()); X exit (1); X } X } X} X X X X/* X * char *errstr() X * X * Converts errno to an error message. X * X * Usage X * fprintf (stderr, "%s: can't open %s: %s\n", program, filename, errstr ()); X * X */ X Xchar * Xerrstr () X{ X extern int errno; X extern char *sys_errlist[]; X extern int sys_nerr; X static char unknown[40]; X X if (errno < sys_nerr && errno >= 0) X return sys_errlist[errno]; X X sprintf (unknown, "unknown error %d", errno); X return unknown; X} END_OF_disable-abort.c if test 1982 -ne `wc -c