-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkey.cpp
More file actions
70 lines (64 loc) · 1.02 KB
/
Copy pathkey.cpp
File metadata and controls
70 lines (64 loc) · 1.02 KB
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
/* key.cpp ---
*
* Filename: key.cpp
* Description:
* Author: Bryce
* Maintainer: Adeel Bhutta
* Created: Tue Sep 6 11:08:59 2016
* Last-Updated: 01-10-2021
* By: Adeel Bhutta
* Update #: 0
* Keywords:
* Compatibility:
*
*/
/* Commentary:
*
*
*
*/
/* Change log:
*
*
*/
/* Copyright (c) 2016 IUB
*
* All rights reserved.
*
* Additional copyrights may follow
*/
/* Code: */
#include <ncurses.h>
#include "key.hpp"
int read_escape(int *read_char) {
int c;
if ((c = getch()) == ERR) {
return (NOCHAR);
}
else if (c==0x1b) {
if ((c = getch()) == '[') {
c=getch();
switch (c) {
case 'A':
return (UP);
break;
case 'B':
return (DOWN);
break;
case 'C':
return (RIGHT);
break;
case 'D':
return (LEFT);
break;
default:
return (BADESC);
}
}
}
else {
*read_char = c;
return (REGCHAR);
}
}
/* key.cpp ends here */