From owner-freebsd-hackers Wed Feb 14 00:12:25 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id AAA23353 for hackers-outgoing; Wed, 14 Feb 1996 00:12:25 -0800 (PST) Received: from mailhub.aros.net ([205.164.111.17]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id AAA23347 for ; Wed, 14 Feb 1996 00:12:23 -0800 (PST) Received: from terra.aros.net (terra.aros.net [205.164.111.10]) by mailhub.aros.net (8.6.12/Unknown) with ESMTP id BAA26334 for ; Wed, 14 Feb 1996 01:14:38 -0700 Received: (from angio@localhost) by terra.aros.net (8.6.12/8.6.12) id BAA04009 for hackers@freebsd.org; Wed, 14 Feb 1996 01:12:21 -0700 From: Dave Andersen Message-Id: <199602140812.BAA04009@terra.aros.net> Subject: kbdcontrol change To: hackers@freebsd.org Date: Wed, 14 Feb 1996 01:12:21 -0700 (MST) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@freebsd.org Precedence: bulk I got annoyed with kbdcontrol's inability to put returns or tabs in macros (makes it difficult to do multi-line commands. :), so I patched it to handle \ notation.. kbdcontrol -f 1 "cd /\nls\ncd\n" works admirably to create a sequence of: cd / ls cd Minor tweak, but it was bugging me that it wouldn't work. The disadvantage is that if anyone uses \s in their current keyboard macros, they'll have to escape them with \\. I can't see anywhere that the changes to kbdcontrol would cause any problems except that. I also left out the other standard escape characters, because I figured that those three are all you really need in a keyboard macro. Easy to insert them later. -Dave Andersen This is a diff off of FreeBSD-stable (as of today), which is identical to -current's kbdcontrol. *** kbdcontrol.c Tue Jan 30 19:53:42 1996 --- kbdnew.c Wed Feb 14 01:00:26 1996 *************** *** 403,408 **** --- 403,409 ---- void set_functionkey(char *keynumstr, char *string) { + int i, j; fkeyarg_t fkey; int keynum; *************** *** 417,422 **** --- 418,441 ---- NUM_FKEYS); return; } + + /* Do substitution on backslashed characters */ + + for (i = j = 0; string[i] != 0; i++) { + if (string[i] == '\\') { + if (!string[i+1]) string[j++] = '\\'; + else + switch (string[i+1]) { + case 'n' : string[j++] = '\n'; break; + case 't' : string[j++] = '\t'; break; + case 'r' : string[j++] = '\r'; break; + default : string[j++] = string[i+1]; + } + i++; + } else string[j++] = string[i]; + } + string[j] = 0; /* Make sure it's terminated */ + if ((fkey.flen = strlen(string)) > MAXFK) { fprintf(stderr, "function key string too long (%d > %d)\n", fkey.flen, MAXFK);