# 2.11BSD#431 - /usr/src/ucb/what.c

##### Functions

    find              X
    main              X

##### Variables

    copyright         X
    infile            X

       1: /*
       2:  * Copyright (c) 1980 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifndef lint
       8: char copyright[] =
       9: "@(#) Copyright (c) 1980 Regents of the University of California.\n\
      10:  All rights reserved.\n";
      11: #endif not lint
      12:
      13: #ifndef lint
      14: static char sccsid[] = "@(#)what.c	5.1 (Berkeley) 5/31/85";
      15: #endif not lint
      16:
      17: #include <stdio.h>
      18:
      19: /*
      20:  * what
      21:  */
      22:
      23: char    *infile = "Standard input";
      24:
      25: main(argc, argv)
      26:     int argc;
      27:     char *argv[];
      28: {
      29:
      30:     argc--, argv++;
      31:     do {
      32:         if (argc > 0) {
      33:             if (freopen(argv[0], "r", stdin) == NULL) {
      34:                 perror(argv[0]);
      35:                 exit(1);
      36:             }
      37:             infile = argv[0];
      38:             printf("%s\n", infile);
      39:             argc--, argv++;
      40:         }
      41:         fseek(stdin, (long) 0, 0);
      42:         find();
      43:     } while (argc > 0);
      44:     exit(0);
      45: }
      46:
      47: find()
      48: {
      49:     static char buf[BUFSIZ];
      50:     register char *cp;
      51:     register int c, cc;
      52:     register char *pat;
      53:
      54: contin:
      55:     while ((c = getchar()) != EOF)
      56:         if (c == '@') {
      57:             for (pat = "(#)"; *pat; pat++)
      58:                 if ((c = getchar()) != *pat)
      59:                     goto contin;
      60:             putchar('\t');
      61:             while ((c = getchar()) != EOF && c && c != '"' &&
      62:                 c != '>' && c != '\n')
      63:                 putchar(c);
      64:             putchar('\n');
      65:         }
      66: }

#### Defined functions

find defined in line 47; used 1 times

- in line 42

main defined in line 25; never used

#### Defined variables

copyright defined in line 8; never used
infile defined in line 23; used 2 times

- in line 37-38(2)

sccsid defined in line 14; never used

Last modified: 1987-02-17 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 513 |