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

1.1       root        1: /* prim2num.c - presentation element to integer */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/psap/RCS/prim2num.c,v 7.0 89/11/23 22:13:11 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/psap/RCS/prim2num.c,v 7.0 89/11/23 22:13:11 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       prim2num.c,v $
                     12:  * Revision 7.0  89/11/23  22:13:11  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 "psap.h"
                     32: 
                     33: /*  */
                     34: 
                     35: integer        prim2num (pe)
                     36: register PE    pe;
                     37: {
                     38:     register integer    i;
                     39:     register PElementData dp,
                     40:                          ep;
                     41: 
                     42:     if (pe -> pe_form != PE_FORM_PRIM || pe -> pe_prim == NULLPED)
                     43:        return pe_seterr (pe, PE_ERR_PRIM, NOTOK);
                     44:     if (pe -> pe_len > sizeof (i))
                     45:        return pe_seterr (pe, PE_ERR_OVER, NOTOK);
                     46: 
                     47:     pe -> pe_errno = PE_ERR_NONE;/* in case integer is NOTOK-valued */
                     48:     i = (*(dp = pe -> pe_prim) & 0x80) ? (-1) : 0;
                     49:     for (ep = dp + pe -> pe_len; dp < ep;)
                     50:        i = (i << 8) | (*dp++ & 0xff);
                     51: 
                     52:     return i;
                     53: }

unix.superglobalmegacorp.com

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