# 2.11BSD#431 - /usr/src/usr.bin/refer/refer4.c

##### Functions

    append            X
    flout             X
    output            X
    trimnl            X

##### Macros

    punctuat          X

       1: #ifndef lint
       2: static char *sccsid = "@(#)refer4.c	4.1 (Berkeley) 5/6/83";
       3: #endif
       4:
       5: #include "refer..c"
       6: #define punctuat(c) (c=='.' || c=='?' || c=='!' || c==',' || c==';' || c==':')
       7:
       8: static gate = 0;
       9: static char buff[BUFSIZ];
      10:
      11: output(s)
      12: char *s;
      13: {
      14:     if (gate)
      15:         fputs(buff,ftemp);
      16:     else
      17:         gate = 1;
      18:     strcpy(buff, s);
      19:     if (strlen(buff) > BUFSIZ)
      20:         err("one buff too big (%d)!", BUFSIZ);
      21: }
      22:
      23: append(s)
      24: char *s;
      25: {
      26:     char *p;
      27:     int lch;
      28:
      29:     trimnl(buff);
      30:     for (p = buff; *p; p++)
      31:         ;
      32:     lch = *--p;
      33:     if (postpunct && punctuat(lch))
      34:         *p = NULL;
      35:     else /* pre-punctuation */
      36:         switch (lch) {
      37:         case '.':
      38:         case '?':
      39:         case '!':
      40:         case ',':
      41:         case ';':
      42:         case ':':
      43:             *p++ = lch;
      44:             *p = NULL;
      45:         }
      46:     strcat(buff, s);
      47:     if (postpunct)
      48:         switch(lch) {
      49:         case '.':
      50:         case '?':
      51:         case '!':
      52:         case ',':
      53:         case ';':
      54:         case ':':
      55:             for(p = buff; *p; p++)
      56:                 ;
      57:             if (*--p == '\n')
      58:                 *p = NULL;
      59:             *p++ = lch;
      60:             *p++ = '\n';
      61:             *p = NULL;
      62:         }
      63:     if (strlen(buff) > BUFSIZ)
      64:         err("output buff too long (%d)", BUFSIZ);
      65: }
      66:
      67: flout()
      68: {
      69:     if (gate)
      70:         fputs(buff,ftemp);
      71:     gate = 0;
      72: }
      73:
      74: char *
      75: trimnl(ln)
      76: char *ln;
      77: {
      78:     register char *p = ln;
      79:
      80:     while (*p)
      81:         p++;
      82:     p--;
      83:     if (*p == '\n')
      84:         *p = 0;
      85:     return(ln);
      86: }

#### Defined functions

append defined in line 23; used 1 times

- in /usr/src/usr.bin/refer/refer5.c line 116

flout defined in line 67; used 4 times

- in /usr/src/usr.bin/refer/refer2.c line 150
- in /usr/src/usr.bin/refer/refer5.c line 117, 160
- in /usr/src/usr.bin/refer/refer7.c line 45

output defined in line 11; used 2 times

- in /usr/src/usr.bin/refer/refer1.c line 121, 129

trimnl defined in line 74; used 9 times

- in line 29
- in /usr/src/usr.bin/refer/glue2.c line 11
- in /usr/src/usr.bin/refer/mkey1.c line 76
- in /usr/src/usr.bin/refer/mkey3.c line 35
- in /usr/src/usr.bin/refer/refer..c line 46
- in /usr/src/usr.bin/refer/refer2.c line 118
- in /usr/src/usr.bin/refer/refer5.c line 92-93(2)
- in /usr/src/usr.bin/refer/what3.c line 66

#### Defined variables

buff defined in line 9; used 9 times

- in line 15-19(3), 29-30(2), 46, 55, 63, 70

sccsid defined in line 2; never used

#### Defined macros

punctuat defined in line 6; used 1 times

- in line 33

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