diff options
author | wiz <wiz@pkgsrc.org> | 2000-10-16 01:34:38 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2000-10-16 01:34:38 +0000 |
commit | d2e2398c329564d2d690c2bc57f5aaf6c54e16b9 (patch) | |
tree | 87c881d4a818b903485f9dd585577a743370ca10 /sysutils | |
parent | d8c410786581e31198cb4301b8cb284e3bb5204d (diff) | |
download | pkgsrc-d2e2398c329564d2d690c2bc57f5aaf6c54e16b9.tar.gz |
Clean up input handling.
Patches provided by Brett Lymn in private mail.
Diffstat (limited to 'sysutils')
-rw-r--r-- | sysutils/whowatch/files/patch-sum | 6 | ||||
-rw-r--r-- | sysutils/whowatch/patches/patch-ab | 50 | ||||
-rw-r--r-- | sysutils/whowatch/patches/patch-ac | 90 |
3 files changed, 120 insertions, 26 deletions
diff --git a/sysutils/whowatch/files/patch-sum b/sysutils/whowatch/files/patch-sum index 97ead475eaf..2a8820f2378 100644 --- a/sysutils/whowatch/files/patch-sum +++ b/sysutils/whowatch/files/patch-sum @@ -1,4 +1,4 @@ -$NetBSD: patch-sum,v 1.2 2000/08/11 23:49:04 itojun Exp $ +$NetBSD: patch-sum,v 1.3 2000/10/16 01:34:38 wiz Exp $ -MD5 (patch-ab) = 2efbede552652f0ef692c5ef3f0efc98 -MD5 (patch-ac) = bdb96f44d469dc9b1b626b9b3870f33c +MD5 (patch-ab) = ab1a89e96c6c2663ac29f5759fc85de6 +MD5 (patch-ac) = 0cd8d85fd350bc9c892744be8b5a5e1a diff --git a/sysutils/whowatch/patches/patch-ab b/sysutils/whowatch/patches/patch-ab index 1feac1b3f85..4320573e4a1 100644 --- a/sysutils/whowatch/patches/patch-ab +++ b/sysutils/whowatch/patches/patch-ab @@ -1,12 +1,48 @@ -$NetBSD: patch-ab,v 1.2 2000/08/11 23:49:06 itojun Exp $ -BSD curses: use strlen(s) on waddnstr(w, s, 0) -ncurses: print nothing on waddnstr(w, s, 0) -the code assumes ncurses behavior. be explicit about the requirement. ---- screen.c- Fri Aug 11 22:05:43 2000 -+++ screen.c Fri Aug 11 22:06:00 2000 -@@ -118,3 +118,4 @@ +$NetBSD: patch-ab,v 1.3 2000/10/16 01:34:39 wiz Exp $ + +--- screen.c.orig Tue Jun 6 20:53:24 2000 ++++ screen.c +@@ -6,6 +6,7 @@ + struct window info_win; + static chtype *curs_buf; + extern int screen_cols; ++int old_cur_vis = 1; /* this is the cursor mode, set to normal as default */ + + char *help_line[] = + { +@@ -38,7 +39,7 @@ + } + + wattrset(users_list.wd, A_BOLD); +- printf("\033[?25l"); /* disable cursor */ ++ old_cur_vis = curs_set(0); /* disable cursor */ + + start_color(); + init_pair(1,COLOR_CYAN,COLOR_BLACK); +@@ -58,6 +59,7 @@ + + cbreak(); + nodelay(stdscr,TRUE); ++ keypad(info_win.wd, TRUE); + scrollok(users_list.wd,TRUE); + noecho(); + } +@@ -67,7 +69,7 @@ + werase(help_win.wd); + wrefresh(help_win.wd); + endwin(); +- printf("\033[?25h"); /* enable cursor */ ++ curs_set(old_cur_vis); /* enable cursor */ + } + + void cursor_on(struct window *w, int line) +@@ -116,7 +118,8 @@ + if (i > w->cols) break; + if (*p < 17){ i--; - waddnstr(w->wd, q, p - q); + if (p - q != 0) + waddnstr(w->wd, q, p - q); wattrset(w->wd, COLOR_PAIR(*p)); + q = p + 1; + } diff --git a/sysutils/whowatch/patches/patch-ac b/sysutils/whowatch/patches/patch-ac index acab72222ce..9494e145727 100644 --- a/sysutils/whowatch/patches/patch-ac +++ b/sysutils/whowatch/patches/patch-ac @@ -1,26 +1,84 @@ -$NetBSD: patch-ac,v 1.1 2000/08/11 23:47:52 itojun Exp $ -UP/DOWN conflicts with some curses.h ---- whowatch.c- Fri Aug 11 22:06:36 2000 -+++ whowatch.c Fri Aug 11 22:07:02 2000 -@@ -22,3 +22,3 @@ +$NetBSD: patch-ac,v 1.2 2000/10/16 01:34:39 wiz Exp $ + +--- whowatch.c.orig Tue Jun 6 12:21:44 2000 ++++ whowatch.c +@@ -20,8 +20,7 @@ + #define ut_user ut_name + #endif -enum key { ENTER=0x100, UP, DOWN, LEFT, RIGHT, DELETE, ESC, CTRL_K, CTRL_I, -+enum key { ENTER=0x100, K_UP, K_DOWN, LEFT, RIGHT, DELETE, ESC, CTRL_K, CTRL_I, - PG_DOWN, PG_UP, HOME, END }; -@@ -346,4 +346,4 @@ - switch(c) { +- PG_DOWN, PG_UP, HOME, END }; ++enum key { ENTER=KEY_MAX + 1, ESC, CTRL_K, CTRL_I}; + + enum State{ USERS_LIST, PROC_TREE, INIT_TREE } state; + +@@ -334,30 +333,12 @@ + int read_key() + { + int c; +- c = getc(stdin); ++ c = wgetch(info_win.wd); + switch (c){ + case 0xD: + case 0xA: return ENTER; + case 0xB: return CTRL_K; + case 0x9: return CTRL_I; +- case 0x1B: +- getc(stdin); +- c = getc(stdin); +- switch(c) { - case 0x41: return UP; - case 0x42: return DOWN; -+ case 0x41: return K_UP; -+ case 0x42: return K_DOWN; - case 0x34: -@@ -476,3 +476,3 @@ +- case 0x34: +- case 0x38: +- case 0x46: return END; +- case 0x36: +- case 0x47: return PG_DOWN; +- case 0x31: +- case 0x37: +- case 0x48: return HOME; +- case 0x35: +- case 0x49: return PG_UP; +- } +- break; + default: + break; + } +@@ -420,6 +401,7 @@ + signal_sent = 0; + } + switch(key){ ++ case KEY_ENTER: + case ENTER: + werase(windows[state]->wd); + switch(state){ +@@ -462,23 +444,23 @@ + send_signal(9, pid); + tree_periodic(); + break; +- case PG_DOWN: ++ case KEY_NPAGE: + page_down(windows[state], rfrsh[state]); + break; +- case PG_UP: ++ case KEY_PPAGE: + page_up(windows[state], rfrsh[state]); + break; +- case HOME: ++ case KEY_HOME: + key_home(windows[state], rfrsh[state]); + break; +- case END: ++ case KEY_END: + key_end(windows[state], rfrsh[state]); break; - case UP: -+ case K_UP: ++ case KEY_UP: cursor_up(windows[state]); -@@ -480,3 +480,3 @@ + wrefresh(windows[state]->wd); break; - case DOWN: -+ case K_DOWN: ++ case KEY_DOWN: cursor_down(windows[state]); + wrefresh(windows[state]->wd); + break; |