DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T s

⟦4b99f7d4d⟧ TextFile

    Length: 687 (0x2af)
    Types: TextFile
    Names: »sprintb.c«

Derivation

└─⟦9ae75bfbd⟧ Bits:30007242 EUUGD3: Starter Kit
    └─⟦3658e588a⟧ »EurOpenD3/mail/mh/mh-6.7.tar.Z« 
        └─⟦c75e36ecb⟧ 
            └─⟦this⟧ »mh-6.7/sbr/sprintb.c« 

TextFile

/* sprintb.c - sprintf a %b string */

#include "../h/mh.h"
#include <stdio.h>


char   *sprintb (buffer, v, bits)
register char  *buffer,
               *bits;
register unsigned   v;
{
    register int    i,
                    j;
    register char   c,
                   *bp;

    (void) sprintf (buffer, bits && *bits == 010 ? "0%o" : "0x%x", v);
    bp = buffer + strlen (buffer);

    if (bits && *++bits) {
	j = 0;
	*bp++ = '<';
	while (i = *bits++)
	    if (v & (1 << (i - 1))) {
		if (j++)
		    *bp++ = ',';
		for (; (c = *bits) > 32; bits++)
		    *bp++ = c;
	    }
	    else
		for (; *bits > 32; bits++)
		    continue;
	*bp++ = '>';
	*bp = NULL;
    }

    return buffer;
}