summaryrefslogtreecommitdiff
path: root/sysutils/whowatch/patches/patch-ac
blob: 9494e145727cfa7c2c342ae50d1b8f4195224386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
$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,
-	   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 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 KEY_UP:
 		cursor_up(windows[state]);
 		wrefresh(windows[state]->wd);
 		break;
-	case DOWN:
+	case KEY_DOWN:
 		cursor_down(windows[state]);
 		wrefresh(windows[state]->wd);
 		break;