Annotation of 43BSDReno/contrib/isode-beta/ftam/ftambits.c, revision 1.1

1.1     ! root        1: /* ftambits.c - FPM: encode/decode BIT STRINGs */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/ftam/RCS/ftambits.c,v 7.0 89/11/23 21:53:25 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/ftam/RCS/ftambits.c,v 7.0 89/11/23 21:53:25 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       ftambits.c,v $
        !            12:  * Revision 7.0  89/11/23  21:53:25  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <stdio.h>
        !            31: #include "fpkt.h"
        !            32: 
        !            33: /*  */
        !            34: 
        !            35: PE     bits2fpm (fsb, pairs, actions, fti)
        !            36: register struct ftamblk *fsb;
        !            37: struct pair pairs[];
        !            38: int    actions;
        !            39: struct FTAMindication *fti;
        !            40: {
        !            41:     register struct pair *pp;
        !            42:     register PE            fpm;
        !            43: 
        !            44:     if ((fpm = prim2bit (pe_alloc (PE_CLASS_UNIV, PE_FORM_PRIM, PE_PRIM_BITS)))
        !            45:            == NULLPE) {
        !            46: no_mem: ;
        !            47:        (void) ftamlose (fti, FS_GEN (fsb), 1, NULLCP, "out of memory");
        !            48:        if (fpm)
        !            49:            pe_free (fpm);
        !            50:        return NULLPE;
        !            51:     }
        !            52: 
        !            53:     for (pp = pairs; pp -> p_mask; pp++)
        !            54:        if ((actions & pp -> p_mask) && bit_on (fpm, pp -> p_bitno) == NOTOK)
        !            55:            goto no_mem;
        !            56: 
        !            57:     return fpm;
        !            58: }
        !            59: 
        !            60: /*  */
        !            61: 
        !            62: /* ARGSUSED */
        !            63: 
        !            64: int    fpm2bits (fsb, pairs, fpm, actions, fti)
        !            65: struct ftamblk *fsb;
        !            66: struct pair pairs[];
        !            67: register PE  fpm;
        !            68: int    *actions;
        !            69: struct FTAMindication *fti;
        !            70: {
        !            71:     register int    i;
        !            72:     register struct pair *pp;
        !            73: 
        !            74:     i = 0;
        !            75:     for (pp = pairs; pp -> p_mask; pp++)
        !            76:        if (bit_test (fpm, pp -> p_bitno) > OK)
        !            77:            i |= pp -> p_mask;
        !            78: 
        !            79:     *actions = i;
        !            80: 
        !            81:     return OK;
        !            82: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.