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
|
#include <termios.h>
#include <stdio.h>
#include "utils.h"
#include "keys.h"
static struct termios original_term;
void disable_term_echo()
{
struct termios new_setting;
tcgetattr(0, &original_term);
new_setting = original_term;
new_setting.c_lflag &= ~ECHO;
tcsetattr(0, TCSANOW, &new_setting);
}
void enable_term_echo()
{
tcsetattr(0, TCSANOW, &original_term);
}
void print_cfg_route(struct config *cfg)
{
}
/* void print_pure(struct input_event *ie, struct config *cfg) */
/* { */
/* if (!cfg || !ie) { */
/* fprintf(stderr, "NULL.\n"); */
/* return; */
/* } */
/* if (!cfg->repeat && !cfg->show_shifted) { */
/* printf("%s\n", key_names[ie->code]); */
/* return; */
/* } */
/* if (cfg->repeat) { */
/* printf("%s\r", key_names[ie->code]); */
/* return; */
/* } */
/* /\* if (cfg->show_shifted) { *\/ */
/* /\* } *\/ */
/* } */
/* void print_with_time(struct input_event *ie, struct config *cfg) */
/* { */
/* if (!cfg || !ie) { */
/* fprintf(stderr, "NULL.\n"); */
/* return; */
/* } */
/* struct tm *tm_info; */
/* char time_buf[64]; */
/* time_t sec = (time_t)ie->input_event_sec; */
/* tm_info = localtime(&sec); */
/* strftime(time_buf, sizeof(time_buf), "%F %T", tm_info); */
/* printf("%s.%06ld: %s\n", time_buf, (long)ie->time.tv_usec, */
/* key_names[ie->code]); */
/* } */
|