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