Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!bcm!dimacs.rutgers.edu!seismo!uunet!shelby!agate!pasteur!aldebaran!carlton From: carlton@aldebaran (Mike Carlton) Newsgroups: comp.sys.next Subject: Re: NeXT keyboards Message-ID: <10839@pasteur.Berkeley.EDU> Date: 6 Feb 91 20:04:39 GMT References: <5111@media-lab.MEDIA.MIT.EDU> <_u8G$b1f@cs.psu.edu> <1991Feb5.032803.23922@ni.umd.edu> <11946@darkstar.ucsc.edu> <10811@pasteur.Berkeley.EDU> Sender: news@pasteur.Berkeley.EDU Reply-To: carlton@aldebaran.berkeley.edu (Mike Carlton) Organization: University of California at Berkeley Lines: 68 In article <10811@pasteur.Berkeley.EDU> carlton@aldebaran.berkeley.edu (Mike Carlton) writes: -- a bunch of useless stuff about moving the pipe to shift-del OK, I was pretty cryptic in my previous message. In short, I found the delete key entry in a keymap and and posted it's location. I got several responses requesting info on how to actually change it. Below is source to a quick hack that reads a keymap on stdin and changes the shift-del character to one given on the command line. To run, compile this and run "a.out '|' new.keymapping". Move new.keymapping to ~/Library/Keyboards, /NextLibrary/Keyboards or /LocalLibrary/Keyboards, restart Preferences and it will appear in the list of keyboards. If anyone needs a compiled copy of this, send me mail and I'll email a uuencoded copy to you. Cheers, --mike Mike Carlton carlton@cs.berkeley.edu --------- cut here ------------------------------------------------------------- #include #define stx '\002' #define nul '\000' #define del '\177' char delmap[] = { stx, nul, del, nul }; /* Next char is shift-del */ int main(int argc, char *argv[]) { int i, bytes; char buf[1024], *key, *lim; if (argc != 2) { fprintf(stderr, "Usage: %s shift_del_char\n", argv[0]); fprintf(stderr, "Reads a keymap on stdin and writes modified one to stdout\n"); exit(1); } bytes = fread(buf, sizeof(char), 1024, stdin); key = buf; lim = key+bytes; while (key < lim) { for (i=0; i<4; i++) if (key[i] != delmap[i]) break; if (i == 4) { /* matched */ key[4] = argv[1][0]; break; } else key++; } if (key == lim) { fprintf(stderr, "Del key map not found\n", argv[0]); exit(1); } fwrite(buf, sizeof(char), bytes, stdout); return 0; } Mike Carlton carlton@cs.berkeley.edu