]>
diplodocus.org Git - nmh/blob - sbr/snprintb.c
3 * snprintb.c -- snprintf a %b string
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
14 snprintb (char *buffer
, size_t n
, unsigned v
, char *bits
)
19 snprintf (buffer
, n
, bits
&& *bits
== 010 ? "0%o" : "0x%x", v
);
20 bp
= buffer
+ strlen(buffer
);
22 if (bits
&& *++bits
) {
26 if (v
& (1 << (i
- 1))) {
29 for (; (c
= *bits
) > 32; bits
++)
33 for (; *bits
> 32; bits
++)