#endif
/* a few references only */
#if ENABLE_FEATURE_VI_USE_SIGNALS
- jmp_buf restart; // catch_sig()
+ sigjmp_buf restart; // catch_sig()
#endif
struct termios term_orig, term_vi; // remember what the cooked mode was
#if ENABLE_FEATURE_VI_COLON
catch_sig(0);
signal(SIGWINCH, winch_sig);
signal(SIGTSTP, suspend_sig);
- sig = setjmp(restart);
+ sig = sigsetjmp(restart, 1);
if (sig != 0) {
screenbegin = dot = text;
}
else if (strncmp(cmd, "!", 1) == 0) { // run a cmd
int retcode;
// :!ls run the <cmd>
- alarm(0); // wait for input- no alarms
place_cursor(rows - 1, 0, FALSE); // go to Status line
clear_to_eol(); // clear the line
cookmode();
printf("\nshell returned %i\n\n", retcode);
rawmode();
Hit_Return(); // let user see results
- alarm(3); // done waiting for input
}
#endif
else if (strncmp(cmd, "=", i) == 0) { // where is the address
{
signal(SIGINT, catch_sig);
if (sig)
- longjmp(restart, sig);
+ siglongjmp(restart, sig);
}
#endif /* FEATURE_VI_USE_SIGNALS */
};
enum { ESCCMDS_COUNT = ARRAY_SIZE(esccmds) };
- alarm(0); // turn alarm OFF while we wait for input
fflush(stdout);
n = chars_to_parse;
// get input from User- are there already input chars in Q?
// remove key sequence from Q
chars_to_parse -= n;
memmove(readbuffer, readbuffer + n, sizeof(readbuffer) - n);
- alarm(3); // we are done waiting for input, turn alarm ON
return c;
}
case VI_K_PAGEUP: // Cursor Key Page Up
dot_scroll(rows - 2, -1);
break;
-#if ENABLE_FEATURE_VI_USE_SIGNALS
- case 0x03: // ctrl-C interrupt
- longjmp(restart, 1);
- break;
- case 26: // ctrl-Z suspend
- suspend_sig(SIGTSTP);
- break;
-#endif
case 4: // ctrl-D scroll down half screen
dot_scroll((rows - 2) / 2, 1);
break;
}
if (msg[0]) {
- alarm(0);
printf("\n\n%d: \'%c\' %s\n\n\n%s[Hit return to continue]%s",
totalcmds, last_input_char, msg, SOs, SOn);
fflush(stdout);
if (d[0] == '\n' || d[0] == '\r')
break;
}
- alarm(3);
}
tim = time(NULL);
if (tim >= (oldtim + 3)) {