version 1.1, 2012/07/10 08:02:27 |
version 1.2, 2012/07/10 10:28:05 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <ctype.h> |
#include <ctype.h> |
#include <err.h> |
|
#include <errno.h> |
#include <errno.h> |
#include <signal.h> |
#include <signal.h> |
#include <stdio.h> |
#include <stdio.h> |
|
|
act.sa_flags = 0; |
act.sa_flags = 0; |
act.sa_handler = input_signal; |
act.sa_handler = input_signal; |
if (sigaction(SIGINT, &act, &oact) != 0) |
if (sigaction(SIGINT, &act, &oact) != 0) |
err(1, "sigaction"); |
cu_err(1, "sigaction"); |
input_stop = 0; |
input_stop = 0; |
|
|
restore_termios(); |
restore_termios(); |
|
|
while (cp != s + sizeof(s) - 1) { |
while (cp != s + sizeof(s) - 1) { |
n = read(STDIN_FILENO, &c, 1); |
n = read(STDIN_FILENO, &c, 1); |
if (n == -1 && errno != EINTR) |
if (n == -1 && errno != EINTR) |
err(1, "read"); |
cu_err(1, "read"); |
if (n != 1 || input_stop) |
if (n != 1 || input_stop) |
break; |
break; |
if (c == '\n') { |
if (c == '\n') { |