int sec = 10, status, onalarm();
progname = argv[0];
if (argc > 1 && argv[1][0] == '-') {
sec = atoi(&argv[1][1]);
argc--;
argv++;
}
if (argc < 2)
error("Usage: %s [-10] command", progname);
if ((pid=fork()) == 0) {
execvp(argv[1], &argv[1]);
error("couldn't start %s", argv[1]);
}
signal(SIGALRM, onalarm);
alarm(sec);
if (wait(&status) == -1 || (status & 0177) != 0)
error("%s killed", argv[1]);
exit((status >> 8) & 0377);
}
onalarm() /* kill child when alarm arrives */
{
kill(pid, SIGKILL);
}
#include "error.c"
3.8.55 toolong
length($0) > 72 { print "Line", NR, "too long:", substr($0,1,60) }
3.8.56 ttyin1.c
ttyin() /* process response from /dev/tty (version 1) */
{
char buf[BUFSIZ];