1: /* m_seq.c - print out a message sequence */
   2: 
   3: #include "../h/mh.h"
   4: #include <stdio.h>
   5: 
   6: 
   7: char   *m_seq (mp, cp)
   8: struct msgs *mp;
   9: char   *cp;
  10: {
  11:     int     bits,
  12:             found,
  13:             hack;
  14:     register int    i,
  15:                     j,
  16:                     k;
  17:     register char  *bp;
  18:     static char buffer[BUFSIZ];
  19: 
  20:     bits = FFATTRSLOT;
  21:     hack = strcmp (current, cp) == 0;
  22:     for (i = 0; mp -> msgattrs[i]; i++)
  23:     if (strcmp (mp -> msgattrs[i], cp) == 0) {
  24:         found = 0;
  25:         bp = buffer;
  26:         for (j = mp -> lowmsg; j <= mp -> hghmsg; j++)
  27:         if ((mp -> msgstats[j] & EXISTS)
  28:             && (mp -> msgstats[j] & (1 << (bits + i)))) {
  29:             (void) sprintf (bp, "%s%s", found ? " " : "", m_name (j));
  30:             bp += strlen (bp);
  31:             for (k = j + 1; k <= mp -> hghmsg
  32:                 && (mp -> msgstats[k] & EXISTS)
  33:                 && (mp -> msgstats[k] & (1 << (bits + i)));
  34:                 k++)
  35:             continue;
  36:             if (--k > j) {
  37:             (void) sprintf (bp, "-%s", m_name (k));
  38:             bp += strlen (bp);
  39:             }
  40:             j = k + 1;
  41:             found++;
  42:         }
  43:         if (found == 0 && hack && mp -> curmsg) {
  44:         found++;
  45:         (void) sprintf (buffer, "%s", m_name (mp -> curmsg));
  46:         }
  47:         return (found > 0 ? buffer : NULL);
  48:     }
  49: 
  50:     return NULL;
  51: }

Defined functions

m_seq defined in line 7; used 2 times
Last modified: 1985-11-06
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 967
Valid CSS Valid XHTML 1.0 Strict