xref: /original-bsd/usr.bin/learn/learn/whatnow.c (revision 4ee49cc0)
1 /*-
2  * Copyright (c) 1986, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)whatnow.c	8.1 (Berkeley) 06/06/93";
10 #endif /* not lint */
11 
12 #include "stdio.h"
13 #include "lrnref.h"
14 
15 extern	char	togo[];
16 extern	int	review;
17 
18 whatnow()
19 {
20 	if (again) {
21 		if (!review)
22 			printf("\nOK.  That was lesson %s.\n\n", todo);
23 		fflush(stdout);
24 		strcpy(level, togo);
25 		return;
26 	}
27 	if (skip) {
28 		printf("\nOK.  That was lesson %s.\n", todo);
29 		printf("Skipping to next lesson.\n\n");
30 		fflush(stdout);
31 		strcpy(level, todo);
32 		skip = 0;
33 		return;
34 	}
35 	if (todo == 0) {
36 		more=0;
37 		return;
38 	}
39 	if (didok) {
40 		strcpy(level,todo);
41 		if (speed<=9) speed++;
42 	}
43 	else {
44 		speed -= 4;
45 		/* the 4 above means that 4 right, one wrong leave
46 		    you with the same speed. */
47 		if (speed <0) speed=0;
48 	}
49 	if (wrong) {
50 		speed -= 2;
51 		if (speed <0 ) speed = 0;
52 	}
53 	if (didok && more) {
54 		printf("\nGood.  That was lesson %s.\n\n",level);
55 		fflush(stdout);
56 	}
57 }
58