Bell 32V development
[unix-history] / usr / src / cmd / learn / learn.c
#include "stdio.h"
#include "lrndef"
#include "lrnref"
#include "signal.h"
main(argc,argv)
char *argv[];
{
extern hangup(), intrpt();
extern char * getlogin();
char *malloc();
speed = 0;
more = 1;
pwline = getlogin();
setbuf(stdout, malloc(BUFSIZ));
selsub(argc, argv);
signal(SIGHUP, hangup);
signal(SIGINT, intrpt);
while (more) {
selunit();
dounit();
whatnow();
}
wrapup(0);
}
hangup()
{
wrapup(1);
}
intrpt()
{
char response[20], *p;
signal(SIGINT, hangup);
write(2, "\nInterrupt.\nWant to go on? ", 28);
p = response;
*p = 'n';
while (read(0, p, 1) == 1 && *p != '\n')
p++;
if (response[0] != 'y')
wrapup(1);
ungetc('\n', stdin);
signal(SIGINT, intrpt);
}