#ifndef lint static char *sccsid = "@(#)what.c 4.1 (Berkeley) 10/15/80"; #endif #include /* * what */ char *infile = "Standard input"; main(argc, argv) int argc; char *argv[]; { argc--, argv++; do { if (argc > 0) { if (freopen(argv[0], "r", stdin) == NULL) { perror(argv[0]); exit(1); } infile = argv[0]; printf("%s\n", infile); argc--, argv++; } fseek(stdin, (long) 0, 0); find(); } while (argc > 0); } find() { register int c; register char *pat; contin: while ((c = getchar()) != EOF) if (c == '@') { for (pat = "(#)"; *pat; pat++) if ((c = getchar()) != *pat) goto contin; putchar('\t'); while ((c = getchar()) != EOF && c && c != '"' && c != '>' && c != '\n') putchar(c); putchar('\n'); } }