aboutsummaryrefslogtreecommitdiffstats
path: root/wavemon.c
diff options
context:
space:
mode:
authorJonathan McCrohan <jmccrohan@gmail.com>2012-05-06 21:13:09 +0100
committerJonathan McCrohan <jmccrohan@gmail.com>2012-05-06 21:13:09 +0100
commitd0faeb165ac7cd3ce0d1f22f15b0e90072bed969 (patch)
treea723545835f20a19a9620407b10259c10e8d3246 /wavemon.c
parentc20edfe61df77fa1b31572b26473fd12029a35b7 (diff)
parent3645c236e9720deb696e7aebc33cd9a6d8cbbdc6 (diff)
downloadwavemon-d0faeb165ac7cd3ce0d1f22f15b0e90072bed969.tar.gz
Merge tag 'upstream/0.7.5'
Upstream version 0.7.5
Diffstat (limited to '')
-rw-r--r--wavemon.c51
1 files changed, 41 insertions, 10 deletions
diff --git a/wavemon.c b/wavemon.c
index 6c3196e..f74ec74 100644
--- a/wavemon.c
+++ b/wavemon.c
@@ -48,7 +48,7 @@ static const struct {
.loop = scr_lhist_loop,
.fini = scr_lhist_fini
},
- [SCR_APLIST] = {
+ [SCR_SCAN] = {
.key_name = "scan",
.init = scr_aplst_init,
.loop = scr_aplst_loop,
@@ -63,7 +63,7 @@ static const struct {
[SCR_EMPTY_F6] = {
.key_name = "",
},
- [SCR_CONF] = {
+ [SCR_PREFS] = {
.key_name = "prefs",
.init = scr_conf_init,
.loop = scr_conf_loop,
@@ -183,6 +183,7 @@ int main(int argc, char *argv[])
sigaddset(&blockmask, SIGWINCH);
for (cur = conf.startup_scr; cur != SCR_QUIT; cur = next) {
+ int escape = 0;
if (sigprocmask(SIG_BLOCK, &blockmask, &oldmask) < 0)
err_sys("cannot block SIGWINCH");
@@ -202,24 +203,54 @@ int main(int argc, char *argv[])
if (key <= 0)
usleep(5000);
+ /*
+ * Translate vt100 PF1..4 escape sequences sent
+ * by some X terminals (e.g. aterm) into F1..F4.
+ */
switch (key) {
+ case 033:
+ escape = 1;
+ break;
+ case 'O':
+ escape = 2;
+ break;
+ case 'P' ... 'S':
+ if (escape == 2)
+ key = KEY_F(key - 'P' + 1);
+ /* fall through */
+ default:
+ escape = 0;
+ }
+
+ /* Main menu */
+ switch (key) {
+ case 'i':
case KEY_F(1):
+ next = SCR_INFO;
+ break;
+ case 'l':
case KEY_F(2):
+ next = SCR_LHIST;
+ break;
+ case 's':
case KEY_F(3):
+ next = SCR_SCAN;
+ break;
+ case 'p':
case KEY_F(7):
+ next = SCR_PREFS;
+ break;
+ case 'h':
case KEY_F(8):
- case KEY_F(9):
- case KEY_F(10):
- next = key - KEY_F(1);
+ next = SCR_HELP;
break;
- case 'i':
- next = SCR_INFO;
+ case 'a':
+ case KEY_F(9):
+ next = SCR_ABOUT;
break;
case 'q':
+ case KEY_F(10):
next = SCR_QUIT;
- break;
- default:
- continue;
}
} while (next == cur);
}