|
|
BSD 4.3reno
/* ftambits.c - FPM: encode/decode BIT STRINGs */
#ifndef lint
static char *rcsid = "$Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/ftam/ftambits.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $";
#endif
/*
* $Header: /var/lib/cvsd/repos/CSRG/43BSDReno/contrib/isode-beta/ftam/ftambits.c,v 1.1.1.1 2018/04/24 16:12:56 root Exp $
*
*
* $Log: ftambits.c,v $
* Revision 1.1.1.1 2018/04/24 16:12:56 root
* BSD 4.3reno
*
* Revision 7.0 89/11/23 21:53:25 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 "fpkt.h"
/* */
PE bits2fpm (fsb, pairs, actions, fti)
register struct ftamblk *fsb;
struct pair pairs[];
int actions;
struct FTAMindication *fti;
{
register struct pair *pp;
register PE fpm;
if ((fpm = prim2bit (pe_alloc (PE_CLASS_UNIV, PE_FORM_PRIM, PE_PRIM_BITS)))
== NULLPE) {
no_mem: ;
(void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
if (fpm)
pe_free (fpm);
return NULLPE;
}
for (pp = pairs; pp -> p_mask; pp++)
if ((actions & pp -> p_mask) && bit_on (fpm, pp -> p_bitno) == NOTOK)
goto no_mem;
return fpm;
}
/* */
/* ARGSUSED */
int fpm2bits (fsb, pairs, fpm, actions, fti)
struct ftamblk *fsb;
struct pair pairs[];
register PE fpm;
int *actions;
struct FTAMindication *fti;
{
register int i;
register struct pair *pp;
i = 0;
for (pp = pairs; pp -> p_mask; pp++)
if (bit_test (fpm, pp -> p_bitno) > OK)
i |= pp -> p_mask;
*actions = i;
return OK;
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.