} // end: ioch
+#define IOKEY_INIT 0
+#define IOKEY_ONCE 1
+#define IOKEY_NEXT 2
+
/*
* Support for single or multiple keystroke input AND
* escaped cursor motion keys.
#endif
int i;
- if (action == 0) {
+ if (action == IOKEY_INIT) {
#define tOk(s) s ? s : ""
tinfo_tab[0].str = tOk(key_backspace);
tinfo_tab[1].str = tOk(key_ic);
#undef tOk
}
- if (action == 1) {
+ if (action == IOKEY_ONCE) {
memset(buf, '\0', sizeof(buf));
if (1 > ioch(0, buf, sizeof(buf)-1)) return 0;
}
#ifndef TERMIOS_ONLY
- if (action == 2) {
+ if (action == IOKEY_NEXT) {
if (pos < len)
return buf[pos++]; // exhaust prior keystrokes
pos = len = 0;
do {
fflush(stdout);
len = strlen(buf);
- key = iokey(2);
+ key = iokey(IOKEY_NEXT);
switch (key) {
case 0:
buf[0] = '\0';
fflush(stdout);
if (Frames_signal) goto signify_that;
- key = iokey(1);
+ key = iokey(IOKEY_ONCE);
if (key < 1) goto signify_that;
switch (key) {
tcflush(STDIN_FILENO, TCIFLUSH);
if (Frames_signal) goto signify_that;
- key = iokey(1);
+ key = iokey(IOKEY_ONCE);
if (key < 1) goto signify_that;
switch (key) {
case '=':
snprintf(buf, sizeof(buf), "%s: %s", Insp_sel->type, Insp_sel->fmts);
INSP_MKSL(1, buf); // show an extended SL
- if (iokey(1) < 1)
+ if (iokey(IOKEY_ONCE) < 1)
goto signify_that;
break;
default: // keep gcc happy
INSP_MKSL(0, " ");
if (Frames_signal) goto signify_that;
- if (key == INT_MAX) key = iokey(1);
+ if (key == INT_MAX) key = iokey(IOKEY_ONCE);
if (key < 1) goto signify_that;
switch (key) {
if (enter_ca_mode) putp(enter_ca_mode);
#endif
// and don't forget to ask iokey to initialize his tinfo_tab
- iokey(0);
+ iokey(IOKEY_INIT);
} // end: whack_terminal
\f
/*###### Windows/Field Groups support #################################*/
so we must try to get our own darn ch by begging the user... */
if (!ch) {
show_pmt(N_txt(CHOOSE_group_txt));
- if (1 > (ch = iokey(1))) return w;
+ if (1 > (ch = iokey(IOKEY_ONCE))) return w;
}
switch (ch) {
case 'a': // we don't carry 'a' / 'w' in our
fflush(stdout);
if (Frames_signal) goto signify_that;
- key = iokey(1);
+ key = iokey(IOKEY_ONCE);
if (key < 1) goto signify_that;
if (key == kbd_ESC) break;
fflush(stdout);
if (Frames_signal) goto signify_that;
- key = iokey(1);
+ key = iokey(IOKEY_ONCE);
if (key < 1) goto signify_that;
switch (key) {
, Winstk[2].rc.winname, Winstk[3].rc.winname));
putp(Cap_clr_eos);
fflush(stdout);
- if (Frames_signal || (key = iokey(1)) < 1) {
+ if (Frames_signal || (key = iokey(IOKEY_ONCE)) < 1) {
adj_geometry();
putp(Cap_clr_scr);
} else w = win_select(key);
if (Rc_questions) {
show_pmt(N_txt(XTRA_warncfg_txt));
- if ('y' != tolower(iokey(1)))
+ if ('y' != tolower(iokey(IOKEY_ONCE)))
return;
Rc_questions = 0;
}
if (Rc_compatibilty) {
show_pmt(N_txt(XTRA_warnold_txt));
- if ('y' != tolower(iokey(1)))
+ if ('y' != tolower(iokey(IOKEY_ONCE)))
return;
Rc_compatibilty = 0;
}
pselect(0, NULL, NULL, NULL, &ts, NULL);
else {
if (ioa(&ts))
- do_key(iokey(1));
+ do_key(iokey(IOKEY_ONCE));
}
/* note: that above ioa routine exists to consolidate all logic
which is susceptible to signal interrupt and must then