|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)tee.c 4.2 (Berkeley) 4/25/83"; ! 3: #endif not lint ! 4: ! 5: #include <stdio.h> ! 6: main() ! 7: { ! 8: int f, c; ! 9: ! 10: f = creat(".ocopy", 0666); ! 11: while (read(0, &c, 1) == 1) { ! 12: write (1, &c, 1); ! 13: put(c, f); ! 14: } ! 15: fl(f); ! 16: close(f); ! 17: } ! 18: ! 19: static char ln[BUFSIZ]; ! 20: char *p = ln; ! 21: put(c, f) ! 22: { ! 23: *p++ = c; ! 24: if (c == '\n') { ! 25: fl(f); ! 26: p=ln; ! 27: } ! 28: } ! 29: fl(f) ! 30: { ! 31: register char *s; ! 32: ! 33: s = ln; ! 34: while (*s == '$' && *(s+1) == ' ') ! 35: s += 2; ! 36: write(f, s, p-s); ! 37: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.