|
|
1.1 ! root 1: /* oid_cpy.c - copy an object identifier */ ! 2: ! 3: #ifndef lint ! 4: static char *rcsid = "$Header: /f/osi/psap/RCS/oid_cpy.c,v 7.0 89/11/23 22:12:51 mrose Rel $"; ! 5: #endif ! 6: ! 7: /* ! 8: * $Header: /f/osi/psap/RCS/oid_cpy.c,v 7.0 89/11/23 22:12:51 mrose Rel $ ! 9: * ! 10: * ! 11: * $Log: oid_cpy.c,v $ ! 12: * Revision 7.0 89/11/23 22:12:51 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: OID oid_cpy (q) ! 36: register OID q; ! 37: { ! 38: register unsigned int i, ! 39: *ip, ! 40: *jp; ! 41: register OID oid; ! 42: ! 43: if (q == NULLOID) ! 44: return NULLOID; ! 45: if ((i = q -> oid_nelem) < 1) ! 46: return NULLOID; ! 47: if ((oid = (OID) malloc (sizeof *oid)) == NULLOID) ! 48: return NULLOID; ! 49: ! 50: if ((ip = (unsigned int *) malloc ((unsigned) (i + 1) * sizeof *ip)) ! 51: == NULL) { ! 52: free ((char *) oid); ! 53: return NULLOID; ! 54: } ! 55: ! 56: oid -> oid_elements = ip, oid -> oid_nelem = i; ! 57: ! 58: for (i = 0, jp = q -> oid_elements; i < oid -> oid_nelem; i++, jp++) ! 59: *ip++ = *jp; ! 60: ! 61: return oid; ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.