Annotation of 43BSDReno/contrib/isode-beta/dsap/common/pe.c, revision 1.1

1.1     ! root        1: /* pe.c - General PE utility routines */
        !             2: 
        !             3: #ifndef lint
        !             4: static char *rcsid = "$Header: /f/osi/dsap/common/RCS/pe.c,v 7.0 89/11/23 21:44:20 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /*
        !             8:  * $Header: /f/osi/dsap/common/RCS/pe.c,v 7.0 89/11/23 21:44:20 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       pe.c,v $
        !            12:  * Revision 7.0  89/11/23  21:44:20  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 "quipu/util.h"
        !            31: #include "psap.h"
        !            32: #include "quipu/attr.h"               /* for defn of READOUT */
        !            33: 
        !            34: pe_print (ps, pe, format)
        !            35: register PS     ps;
        !            36: register PE     pe;
        !            37: int     format;
        !            38: {
        !            39: char * ptr;
        !            40: register int i;
        !            41: PS sps;
        !            42: char * fmt;
        !            43: 
        !            44:        if ( format == FILEOUT) {
        !            45:                (void) pe2ps (ps,pe);
        !            46:                return;
        !            47:        }
        !            48: 
        !            49:        if ((sps = ps_alloc (str_open)) == NULLPS)
        !            50:                return;
        !            51:        if (str_setup (sps,NULLCP,LINESIZE,0) == NOTOK)
        !            52:                return;
        !            53: 
        !            54:        if (format == READOUT)
        !            55:                fmt = "%02x ";
        !            56:        else {
        !            57:                ps_print (ps,"{ASN} "); 
        !            58:                fmt = "%02x";
        !            59:        }
        !            60: 
        !            61:        (void) pe2ps (sps,pe);
        !            62: 
        !            63:        ptr = sps->ps_base;
        !            64:        for (i=0; i<sps->ps_byteno; i++)
        !            65:                ps_printf (ps,fmt,*ptr++ & 255);
        !            66: 
        !            67:        ps_print (ps,"00");
        !            68: 
        !            69:        ps_free (sps);
        !            70: 
        !            71: }
        !            72: 
        !            73: PE asn2pe (str)
        !            74: char * str;
        !            75: {
        !            76: char * ptr;
        !            77: char * pe_ptr;
        !            78: register int i,j;
        !            79: PS sps;
        !            80: void StripSpace ();
        !            81: int val;
        !            82: PE pe;
        !            83: 
        !            84:        StripSpace (str);
        !            85: 
        !            86:        j = strlen (str);
        !            87:        pe_ptr = (char *) smalloc (j+10);
        !            88:        ptr = pe_ptr;
        !            89: 
        !            90:        for ( i=0 ; i<j; i++) {
        !            91:            (void) sscanf (str,"%2x",&val);
        !            92:            *ptr++ = val & 0xff;
        !            93:            str++; str++;
        !            94:        }
        !            95: 
        !            96: 
        !            97:        if ((sps = ps_alloc (str_open)) == NULLPS)
        !            98:                return(NULLPE);
        !            99:        if (str_setup (sps,pe_ptr,j,1) == NOTOK)
        !           100:                return(NULLPE);
        !           101: 
        !           102:        pe = ps2pe (sps);
        !           103: 
        !           104:        ps_free (sps);
        !           105: 
        !           106:        return (pe);
        !           107: }

unix.superglobalmegacorp.com

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