]>
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.
13 seq_bits (struct msgs
*mp
)
17 static char buffer
[BUFSIZ
];
19 strncpy (buffer
, MBITS
, sizeof(buffer
));
21 for (i
= 0; i
< svector_size (mp
->msgattrs
); i
++) {
22 len
= strlen (buffer
);
23 snprintf (buffer
+ len
, sizeof(buffer
) - len
,
24 "%c%s", FFATTRSLOT
+ 1 + (int) i
,
25 svector_at (mp
->msgattrs
, i
));
27 * seq_bits() is used by seq_printdebug(), which passes an
28 * unsigned int bit vector to snprintb(). So limit the
29 * size of the return value accordingly. Even worse,
30 * snprintb() only uses characters up through ASCII space
31 * as the delimiter (the %c character above). So limit
34 if ((int) i
== ' ' - FFATTRSLOT
- 1) break;