Page MenuHomeFreeBSD

D14936.id.diff
No OneTemporary

D14936.id.diff

Index: sys/dev/vt/vt_core.c
===================================================================
--- sys/dev/vt/vt_core.c
+++ sys/dev/vt/vt_core.c
@@ -843,6 +843,27 @@
return (0);
}
+ int fkey = c - (FKEY | F(1));
+ /* checking if function key strings are set (see kbdcontrol(1) manual)*/
+ if (fkey >=0 && fkey < 65) {
+ size_t len;
+ fkey += F_FN;
+ u_char *raw_str = genkbd_get_fkeystr(kbd, fkey, &len);
+ if (raw_str) {
+ /*
+ since our strings here are of type u_char *,
+ normal strncpy() would not work here.
+ */
+ u_char fkey_str[MAXFK];
+ for (int i = 0 ; i < len; i++) {
+ fkey_str[i] = raw_str[i];
+ }
+ fkey_str[len] = '\0';
+ terminal_handle_fkey(vw->vw_terminal, fkey_str);
+ return (0);
+ }
+ }
+
switch (c) {
case NEXT:
/* Switch to next VT. */
Index: sys/kern/subr_terminal.c
===================================================================
--- sys/kern/subr_terminal.c
+++ sys/kern/subr_terminal.c
@@ -343,6 +343,23 @@
tty_unlock(tp);
}
+void
+terminal_handle_fkey(struct terminal *tm, u_char *fkey_str) {
+ struct tty *tp;
+
+ tp = tm->tm_tty;
+ if (tp == NULL)
+ return;
+
+ if (fkey_str == NULL)
+ return;
+
+ tty_lock(tp);
+ ttydisc_rint_simple(tp, fkey_str, strlen(fkey_str));
+ ttydisc_rint_done(tp);
+ tty_unlock(tp);
+}
+
void
terminal_input_special(struct terminal *tm, unsigned int k)
{
Index: sys/sys/terminal.h
===================================================================
--- sys/sys/terminal.h
+++ sys/sys/terminal.h
@@ -216,6 +216,7 @@
void terminal_mute(struct terminal *tm, int yes);
void terminal_input_char(struct terminal *tm, term_char_t c);
void terminal_input_raw(struct terminal *tm, char c);
+void terminal_handle_fkey(struct terminal *tm, u_char *fkey_str);
void terminal_input_special(struct terminal *tm, unsigned int k);
void termcn_cnregister(struct terminal *tm);

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 4, 7:05 AM (11 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28432605
Default Alt Text
D14936.id.diff (1 KB)

Event Timeline