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

1.1       root        1: /* addr2ref.c - manage encoded session addresses */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/psap/RCS/addr2ref.c,v 7.0 89/11/23 22:12:30 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/psap/RCS/addr2ref.c,v 7.0 89/11/23 22:12:30 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       addr2ref.c,v $
                     12:  * Revision 7.0  89/11/23  22:12:30  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: #include "ssap.h"
                     33: 
                     34: 
                     35: long   time ();
                     36: 
                     37: /*  */
                     38: 
                     39: struct SSAPref *addr2ref (addr)
                     40: register char   *addr;
                     41: {
                     42:     int     result;
                     43:     long    clock;
                     44:     register    PE pe;
                     45:     register struct tm *tm;
                     46:     struct UTCtime  uts;
                     47:     register struct UTCtime *ut = &uts;
                     48:     static struct SSAPref   srs;
                     49:     register struct SSAPref *sr = &srs;
                     50: 
                     51:     bzero ((char *) sr, sizeof *sr);
                     52: 
                     53:     if ((pe = t61s2prim (addr, strlen (addr))) == NULLPE)
                     54:        return NULL;
                     55:     result = stuff (pe, sr -> sr_udata, &sr -> sr_ulen);
                     56:     pe_free (pe);
                     57:     if (result == NOTOK)
                     58:        return NULL;
                     59: 
                     60:     if (time (&clock) == NOTOK || (tm = gmtime (&clock)) == NULL)
                     61:        return NULL;
                     62:     tm2ut (tm, ut);
                     63: 
                     64:     if ((pe = utct2prim (ut)) == NULLPE)
                     65:        return NULL;
                     66:     result = stuff (pe, sr -> sr_cdata, &sr -> sr_clen);
                     67:     pe_free (pe);
                     68:     if (result == NOTOK)
                     69:        return NULL;
                     70: 
                     71:     return sr;
                     72: }
                     73: 
                     74: /*  */
                     75: 
                     76: static int  stuff (pe, dbase, dlen)
                     77: register PE pe;
                     78: register char *dbase;
                     79: register u_char *dlen;
                     80: {
                     81:     int     len;
                     82:     char   *base;
                     83: 
                     84:     if (pe2ssdu (pe, &base, &len) == NOTOK)
                     85:        return NOTOK;
                     86: 
                     87:     bcopy (base, dbase, (int) (*dlen = len));
                     88:     free (base);
                     89: 
                     90:     return OK;
                     91: }

unix.superglobalmegacorp.com

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