]>
diplodocus.org Git - nmh/blob - sbr/seq_bits.c
1 /* seq_bits.c -- return the snprintb() string for a sequence
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
12 seq_bits (struct msgs
*mp
)
16 static char buffer
[BUFSIZ
];
18 strncpy (buffer
, MBITS
, sizeof(buffer
));
20 for (i
= 0; i
< svector_size (mp
->msgattrs
); i
++) {
21 len
= strlen (buffer
);
22 snprintf (buffer
+ len
, sizeof(buffer
) - len
,
23 "%c%s", FFATTRSLOT
+ 1 + (int) i
,
24 svector_at (mp
->msgattrs
, i
));
26 * seq_bits() is used by seq_printdebug(), which passes an
27 * unsigned int bit vector to snprintb(). So limit the
28 * size of the return value accordingly. Even worse,
29 * snprintb() only uses characters up through ASCII space
30 * as the delimiter (the %c character above). So limit
33 if ((int) i
== ' ' - FFATTRSLOT
- 1) break;