static char sccsid
[] = "@(#)selunit.c 4.2 (Berkeley) 4/25/83";
char fnam
[80], s
[80], zb
[200];
int diff
[20], i
, k
, m
, n
, best
, alts
;
if (strcmp(dobuff
, "bye") == 0)
f
= scrin
; /* use old lesson to find next */
sprintf(fnam
, "%s/%s/L%s", direct
, sname
, level
);
fprintf(stderr
, "Selunit: no script for lesson %s.\n", level
);
while (fgets(zb
, 200, f
)) {
if (strcmp(zb
, "#next")==0)
printf("Congratulations; you have finished this sequence.\n");
for(i
=0; fgets(s
, 80, f
); i
++) {
sscanf(s
, "%s %d", posslev
[i
], &diff
[i
]);
/* cycle through lessons from random start */
/* first try the current place, failing that back up to
last place there are untried alternatives (but only one backup) */
alts
++; /* real alternatives */
if (abs(diff
[m
]-speed
) < abs(diff
[best
]-speed
))
/* lessons exhausted or missing */
printf("Sorry, there are no alternative lessons at this stage.\n");
printf("See someone for help.\n");
strcpy (dobuff
, posslev
[best
]);