Annotation of 43BSDReno/contrib/isode-beta/psap/qb2prim.c, revision 1.1.1.1

1.1       root        1: /* qb2prim.c - octet string to primitive */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/psap/RCS/qb2prim.c,v 7.2 90/03/23 11:05:53 mrose Exp $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/psap/RCS/qb2prim.c,v 7.2 90/03/23 11:05:53 mrose Exp $
                      9:  *
                     10:  *
                     11:  * $Log:       qb2prim.c,v $
                     12:  * Revision 7.2  90/03/23  11:05:53  mrose
                     13:  * typo
                     14:  * 
                     15:  * Revision 7.1  90/03/22  08:38:15  mrose
                     16:  * touch-up
                     17:  * 
                     18:  * Revision 7.0  89/11/23  22:13:29  mrose
                     19:  * Release 6.0
                     20:  * 
                     21:  */
                     22: 
                     23: /*
                     24:  *                               NOTICE
                     25:  *
                     26:  *    Acquisition, use, and distribution of this module and related
                     27:  *    materials are subject to the restrictions of a license agreement.
                     28:  *    Consult the Preface in the User's Manual for the full terms of
                     29:  *    this agreement.
                     30:  *
                     31:  */
                     32: 
                     33: 
                     34: /* LINTLIBRARY */
                     35: 
                     36: #include <stdio.h>
                     37: #include "psap.h"
                     38: 
                     39: /* form: PRIMitive or CONStructor --
                     40: 
                     41:        qb2prim  -      octet string (via qbufs) to presentation element
                     42: 
                     43:  */
                     44: 
                     45: /*  */
                     46: 
                     47: PE     qb2prim_aux (qb, class, id, in_line)
                     48: register struct qbuf *qb;
                     49: PElementClass  class;
                     50: PElementID     id;
                     51: int    in_line;
                     52: {
                     53:     register PE            pe,
                     54:                    p;
                     55:     register struct qbuf *qp;
                     56: 
                     57:     if (qb == NULL)
                     58:        return NULLPE;
                     59:     
                     60:     if ((qp = qb -> qb_forw) == qb || qp -> qb_forw == qb) {
                     61:        if ((pe = pe_alloc (class, PE_FORM_PRIM, id)) == NULLPE)
                     62:            return NULLPE;
                     63: 
                     64:        if (in_line) {
                     65:            if (pe -> pe_len = qp -> qb_len)
                     66:                pe -> pe_prim = (PElementData) qp -> qb_data;
                     67:            pe -> pe_inline = 1;
                     68:        }
                     69:        else
                     70:            if (pe -> pe_len = qp -> qb_len) {
                     71:                if ((pe -> pe_prim = PEDalloc (pe -> pe_len)) == NULLPED)
                     72:                    goto no_mem;
                     73:                PEDcpy (qp -> qb_data, pe -> pe_prim, pe -> pe_len);
                     74:            }
                     75:     }
                     76:     else {
                     77:        if ((pe = pe_alloc (class, PE_FORM_CONS, id)) == NULLPE)
                     78:            return NULLPE;
                     79: 
                     80:        do {
                     81:            if (seq_add (pe, p = pe_alloc (PE_CLASS_UNIV, PE_FORM_PRIM,
                     82:                                           PE_PRIM_OCTS), -1) == NOTOK) {
                     83: no_mem: ;
                     84:                pe_free (pe);
                     85:                return NULLPE;
                     86:            }
                     87: 
                     88:            p -> pe_len = qp -> qb_len;
                     89:            if (in_line) {
                     90:                p -> pe_prim = (PElementData) qp -> qb_data;
                     91:                p -> pe_inline = 1;
                     92:            }
                     93:            else {
                     94:                if ((p -> pe_prim = PEDalloc (p -> pe_len)) == NULLPED)
                     95:                    goto no_mem;
                     96:                PEDcpy (qp -> qb_data, p -> pe_prim, p -> pe_len);
                     97:            }
                     98: 
                     99:            qp = qp -> qb_forw;
                    100:        }
                    101:        while (qp != qb);
                    102:     }
                    103: 
                    104:     return pe;
                    105: }

unix.superglobalmegacorp.com

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