1 /* 2 * Copyright (c) 1980, 1988, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char copyright[] = 10 "@(#) Copyright (c) 1980, 1988, 1993\n\ 11 The Regents of the University of California. All rights reserved.\n"; 12 #endif /* not lint */ 13 14 #ifndef lint 15 static char sccsid[] = "@(#)what.c 8.1 (Berkeley) 06/06/93"; 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 search() 42 { 43 register int c; 44 45 while ((c = getchar()) != EOF) { 46 loop: if (c != '@') 47 continue; 48 if ((c = getchar()) != '(') 49 goto loop; 50 if ((c = getchar()) != '#') 51 goto loop; 52 if ((c = getchar()) != ')') 53 goto loop; 54 putchar('\t'); 55 while ((c = getchar()) != EOF && c && c != '"' && 56 c != '>' && c != '\n') 57 putchar(c); 58 putchar('\n'); 59 } 60 } 61