Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / RCS / sprintb.c,v
1 head    1.3;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.3
9 date    92.12.15.00.20.22;      author jromine; state Exp;
10 branches;
11 next    1.2;
12
13 1.2
14 date    92.01.31.21.57.33;      author jromine; state Exp;
15 branches;
16 next    1.1;
17
18 1.1
19 date    92.01.31.21.57.13;      author jromine; state Exp;
20 branches;
21 next    ;
22
23
24 desc
25 @@
26
27
28 1.3
29 log
30 @endif sugar
31 @
32 text
33 @/* sprintb.c - sprintf a %b string */
34 #ifndef lint
35 static char ident[] = "@@(#)$Id: sprintb.c,v 1.2 1992/01/31 21:57:33 jromine Exp jromine $";
36 #endif  /* lint */
37
38 #include "../h/mh.h"
39 #include <stdio.h>
40
41
42 char   *sprintb (buffer, v, bits)
43 register char  *buffer,
44                *bits;
45 register unsigned   v;
46 {
47     register int    i,
48                     j;
49     register char   c,
50                    *bp;
51
52     (void) sprintf (buffer, bits && *bits == 010 ? "0%o" : "0x%x", v);
53     bp = buffer + strlen (buffer);
54
55     if (bits && *++bits) {
56         j = 0;
57         *bp++ = '<';
58         while (i = *bits++)
59             if (v & (1 << (i - 1))) {
60                 if (j++)
61                     *bp++ = ',';
62                 for (; (c = *bits) > 32; bits++)
63                     *bp++ = c;
64             }
65             else
66                 for (; *bits > 32; bits++)
67                     continue;
68         *bp++ = '>';
69         *bp = 0;
70     }
71
72     return buffer;
73 }
74 @
75
76
77 1.2
78 log
79 @kerberos
80 @
81 text
82 @d3 2
83 a4 2
84 static char ident[] = "@@(#)$Id: m_getfld.c,v 1.10 1992/01/31 21:54:32 jromine Exp $";
85 #endif  lint
86 @
87
88
89 1.1
90 log
91 @Initial revision
92 @
93 text
94 @d2 3
95 d37 1
96 a37 1
97         *bp = NULL;
98 @