|
|
1.1 ! root 1: static char *sccsid = "@(#)what.c 4.1 (Berkeley) 10/15/80"; ! 2: #include <stdio.h> ! 3: ! 4: /* ! 5: * what ! 6: */ ! 7: ! 8: char *infile = "Standard input"; ! 9: ! 10: main(argc, argv) ! 11: int argc; ! 12: char *argv[]; ! 13: { ! 14: ! 15: argc--, argv++; ! 16: do { ! 17: if (argc > 0) { ! 18: if (freopen(argv[0], "r", stdin) == NULL) { ! 19: perror(argv[0]); ! 20: exit(1); ! 21: } ! 22: infile = argv[0]; ! 23: printf("%s\n", infile); ! 24: argc--, argv++; ! 25: } ! 26: fseek(stdin, (long) 0, 0); ! 27: find(); ! 28: } while (argc > 0); ! 29: } ! 30: ! 31: find() ! 32: { ! 33: static char buf[BUFSIZ]; ! 34: register char *cp; ! 35: register int c, cc; ! 36: register char *pat; ! 37: ! 38: contin: ! 39: while ((c = getchar()) != EOF) ! 40: if (c == '@') { ! 41: for (pat = "(#)"; *pat; pat++) ! 42: if ((c = getchar()) != *pat) ! 43: goto contin; ! 44: putchar('\t'); ! 45: while ((c = getchar()) != EOF && c && c != '"' && ! 46: c != '>' && c != '\n') ! 47: putchar(c); ! 48: putchar('\n'); ! 49: } ! 50: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.