|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T b
Length: 1244 (0x4dc)
Types: TextFile
Names: »bitstr2strb.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/psap/bitstr2strb.c«
/* bitstr2strb.c - bit string to string of bits */
#ifndef lint
static char *rcsid = "$Header: /f/osi/psap/RCS/bitstr2strb.c,v 7.0 89/11/23 22:12:33 mrose Rel $";
#endif
/*
* $Header: /f/osi/psap/RCS/bitstr2strb.c,v 7.0 89/11/23 22:12:33 mrose Rel $
*
*
* $Log: bitstr2strb.c,v $
* Revision 7.0 89/11/23 22:12:33 mrose
* Release 6.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include <stdio.h>
#include "psap.h"
/* \f
*/
char *bitstr2strb (pe, k)
PE pe;
int *k;
{
register int i,
j,
len,
bit,
mask;
register char *dp;
char *cp;
if (pe == NULLPE)
return NULLCP;
*k = len = pe -> pe_nbits;
if ((cp = dp = calloc (1, (unsigned) (len / 8 + 2))) == NULLCP)
return NULLCP;
for (bit = i = 0, mask = 1 << (j = 7); i < len; i++) {
if (bit_test (pe, i))
bit |= mask;
if (j-- == 0)
*dp++ = bit & 0xff, bit = 0, mask = 1 << (j = 7);
else
mask >>= 1;
}
if (j != 7)
*dp = bit & 0xff;
return cp;
}