1: #include "stdio.h"
2: #include "lrnref"
3: #define ND 64
4:
5: start(lesson)
6: char *lesson;
7: {
8: struct direct {
9: int inode;
10: char name[14];
11: };
12: struct direct dv[ND], *dm, *dp;
13: int f, c, n;
14: char where [100];
15:
16: f = open(".", 0);
17: n = read(f, dv, ND*sizeof(*dp));
18: n /= sizeof(*dp);
19: if (n==ND)
20: fprintf(stderr, "lesson too long\n");
21: dm = dv+n;
22: for(dp=dv; dp<dm; dp++)
23: if (dp->inode) {
24: n = strlen(dp->name);
25: if (dp->name[n-2] == '.' && dp->name[n-1] == 'c')
26: continue;
27: c = dp->name[0];
28: if (c>='a' && c<= 'z')
29: unlink(dp->name);
30: }
31: close(f);
32: if (ask)
33: return;
34: sprintf(where, "../../%s/L%s", sname, lesson);
35: if (access(where, 04)==0) /* there is a file */
36: return;
37: fprintf(stderr, "No lesson %s\n",lesson);
38: wrapup(1);
39: }
40:
41: fcopy(new,old)
42: char *new, *old;
43: {
44: char b[512];
45: int n, fn, fo;
46: fn = creat(new, 0666);
47: fo = open(old,0);
48: if (fo<0) return;
49: if (fn<0) return;
50: while ( (n=read(fo, b, 512)) > 0)
51: write(fn, b, n);
52: close(fn);
53: close(fo);
54: }
Defined functions
fcopy
defined in line
41; used 1 times
start
defined in line
5; used 2 times
Defined struct's
direct
defined in line
8; used 2 times
Defined macros
ND
defined in line
3; used 3 times