Commit | Line | Data |
---|---|---|
bbddffb1 TL |
1 | main() |
2 | { | |
3 | int f, c; | |
4 | ||
5 | f = creat(".ocopy", 0666); | |
6 | while (read(0, &c, 1) == 1) { | |
7 | write (1, &c, 1); | |
8 | put(c, f); | |
9 | } | |
10 | fl(f); | |
11 | close(f); | |
12 | } | |
13 | ||
14 | static char ln[512]; | |
15 | char *p = ln; | |
16 | put(c, f) | |
17 | { | |
18 | *p++ = c; | |
19 | if (c == '\n') { | |
20 | fl(f); | |
21 | p=ln; | |
22 | } | |
23 | } | |
24 | fl(f) | |
25 | { | |
26 | register char *s; | |
27 | ||
28 | s = ln; | |
29 | while (*s == '$' && *(s+1) == ' ') | |
30 | s += 2; | |
31 | write(f, s, p-s); | |
32 | } |