Annotation of 43BSD/contrib/mh/sbr/m_seq.c, revision 1.1.1.1

1.1       root        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: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.