1 /* 2 * Copyright (c) 1980, 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 char copyright[] = 10 "@(#) Copyright (c) 1980, 1988 Regents of the University of California.\n\ 11 All rights reserved.\n"; 12 #endif /* not lint */ 13 14 #ifndef lint 15 static char sccsid[] = "@(#)what.c 5.4 (Berkeley) 06/01/90"; 16 #endif /* not lint */ 17 18 #include <stdio.h> 19 20 /* 21 * what 22 */ 23 /* ARGSUSED */ 24 main(argc, argv) 25 int argc; 26 char **argv; 27 { 28 if (!*++argv) 29 search(); 30 else do { 31 if (!freopen(*argv, "r", stdin)) { 32 perror(*argv); 33 exit(1); 34 } 35 printf("%s\n", *argv); 36 search(); 37 } while(*++argv); 38 exit(0); 39 } 40 41 static 42 search() 43 { 44 register int c; 45 46 while ((c = getchar()) != EOF) { 47 loop: if (c != '@') 48 continue; 49 if ((c = getchar()) != '(') 50 goto loop; 51 if ((c = getchar()) != '#') 52 goto loop; 53 if ((c = getchar()) != ')') 54 goto loop; 55 putchar('\t'); 56 while ((c = getchar()) != EOF && c && c != '"' && 57 c != '>' && c != '\n') 58 putchar(c); 59 putchar('\n'); 60 } 61 } 62