char s
[100], t
[100], s1
[100], *r
, *tod
;
extern int intrpt(), *action();
sprintf(subdir
, "../../%s", sname
);
if (pgets(s
, prompt
, fin
) == 0)
/* fprintf(stderr, "Don't type control-D\n"); */
/* this didn't work out very well */
/* change the sequence %s to lesson directory */
sprintf(s1
, s
, subdir
, subdir
, subdir
);
if (*p
== ONCE
) { /* some actions done only once per script */
if (wrong
) { /* we are on 2nd time */
write(comfile
, s
, strlen(s
));
fprintf(incopy
, "%s\n", s
);
fprintf(incopy
, "%s\n", r
);
scopy(fin
, NULL
); /* don't repeat message */
if (nmatch
> 0) /* we have already passed */
else if ((status
= strcmp(r
, last
)) == 0) { /* did we pass this time? */
if (strcmp(r
, last
) == 0) {
scopy(fin
, (status
== 0) ? stdout
: NULL
);
scopy(fin
, (status
!= 0) ? stdout
: NULL
);
status
= cmp(r
); /* contains two file names */
sprintf(nm
, "%s/L%s.%s", subdir
, todo
, r
);
incopy
= fopen(".copy", "w");
fprintf(incopy
, "%s\n", s
);
printf("You are in lesson %s\n", todo
);
printf("cd not allowed\n");
printf("You are already in learn.\n");
sprintf(logf
, "%s/log/%s", direct
, sname
);
f
= fopen( (r
? r
: logf
), "a");
fprintf(f
, "%s L%-6s %s %2d %s\n", tod
,
todo
, status
? "fail" : "pass", speed
, pwline
);
scopy(fi
, fo
) /* copy fi to fo until a line with # */
while ((c
= getc(fi
)) != '#' && c
!= EOF
) {
} while ((c
= getc(fi
)) != EOF
);
cmp(r
) /* compare two files for status */
for (s
= r
; *s
!= ' ' && *s
!= '\0'; s
++)
*s
++ = 0; /* r contains file 1 */
if (f1
== NULL
|| f2
== NULL
)
if (c1
== EOF
|| c2
== EOF
)
wordb(s
, t
) /* in s, t is prefix; return tail */
if (c
== ' ' || c
== '\t')
while (*s
== ' ' || *s
== '\t')