|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)learn.c 4.2 (Berkeley) 4/27/83"; ! 3: #endif not lint ! 4: ! 5: #include "stdio.h" ! 6: #include "lrnref.h" ! 7: #include "signal.h" ! 8: ! 9: char *direct = "/usr/lib/learn"; /* CHANGE THIS ON YOUR SYSTEM */ ! 10: int more; ! 11: char *level; ! 12: int speed; ! 13: char *sname; ! 14: char *todo; ! 15: FILE *incopy = NULL; ! 16: int didok; ! 17: int sequence = 1; ! 18: int comfile = -1; ! 19: int status; ! 20: int wrong; ! 21: char *pwline; ! 22: char *dir; ! 23: FILE *scrin; ! 24: int logging = 1; /* set to 0 to turn off logging */ ! 25: int ask; ! 26: int again; ! 27: int skip; ! 28: int teed; ! 29: int total; ! 30: ! 31: main(argc,argv) ! 32: int argc; ! 33: char *argv[]; ! 34: { ! 35: extern hangup(), intrpt(); ! 36: extern char * getlogin(); ! 37: char *malloc(); ! 38: ! 39: speed = 0; ! 40: more = 1; ! 41: pwline = getlogin(); ! 42: setbuf(stdout, malloc(BUFSIZ)); ! 43: setbuf(stderr, malloc(BUFSIZ)); ! 44: selsub(argc, argv); ! 45: chgenv(); ! 46: signal(SIGHUP, hangup); ! 47: signal(SIGINT, intrpt); ! 48: while (more) { ! 49: selunit(); ! 50: dounit(); ! 51: whatnow(); ! 52: } ! 53: wrapup(0); ! 54: } ! 55: ! 56: hangup() ! 57: { ! 58: wrapup(1); ! 59: } ! 60: ! 61: intrpt() ! 62: { ! 63: char response[20], *p; ! 64: ! 65: signal(SIGINT, hangup); ! 66: write(2, "\nInterrupt.\nWant to go on? ", 28); ! 67: p = response; ! 68: *p = 'n'; ! 69: while (read(0, p, 1) == 1 && *p != '\n') ! 70: p++; ! 71: if (response[0] != 'y') ! 72: wrapup(0); ! 73: ungetc('\n', stdin); ! 74: signal(SIGINT, intrpt); ! 75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.