1 /* m_seq.c - print out a message sequence */
7 static int bufsize = BUFSIZ;
15 register int i, j, linlen;
16 register char *bp, *ep;
19 if ((buffer = malloc(bufsize)) == NULL)
20 adios (NULLCP, "unable to allocate seq str storage");
22 if (strcmp(current, cp) == 0) {
24 (void) sprintf(buffer, "%s", m_name(mp->curmsg));
29 for (i = 0; mp->msgattrs[i]; i++)
30 if (strcmp(mp->msgattrs[i], cp) == 0)
33 if (! mp->msgattrs[i])
36 mask = EXISTS | (1 << (FFATTRSLOT + i));
38 ep = bp + bufsize - 16;
39 linlen = strlen(cp) + 2;
40 for (i = mp->lowmsg; i <= mp->hghmsg; ++i) {
43 if ((mp->msgstats[i] & mask) != mask)
49 int oldoff = bp - buffer;
51 if ((buffer = realloc(buffer, bufsize)) == NULL)
52 adios (NULLCP, "unable to allocate seq str storage");
53 oldbp = bp = buffer + oldoff;
54 ep = bp + bufsize - 16;
63 (void) sprintf(bp, "%s", m_name(i));
66 for (++i; i <= mp->hghmsg && (mp->msgstats[i] & mask) == mask;
70 (void) sprintf(bp, "-%s", m_name(i - 1));
75 return (bp > buffer? buffer : NULL);