Commit | Line | Data |
---|---|---|
cf908fd1 WJ |
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.1 91/02/22 09:35:56 mrose Interim $"; | |
5 | #endif | |
6 | ||
7 | /* | |
8 | * $Header: /f/osi/psap/RCS/oid_cmp.c,v 7.1 91/02/22 09:35:56 mrose Interim $ | |
9 | * | |
10 | * | |
11 | * $Log: oid_cmp.c,v $ | |
12 | * Revision 7.1 91/02/22 09:35:56 mrose | |
13 | * Interim 6.8 | |
14 | * | |
15 | * Revision 7.0 89/11/23 22:12:50 mrose | |
16 | * Release 6.0 | |
17 | * | |
18 | */ | |
19 | ||
20 | /* | |
21 | * NOTICE | |
22 | * | |
23 | * Acquisition, use, and distribution of this module and related | |
24 | * materials are subject to the restrictions of a license agreement. | |
25 | * Consult the Preface in the User's Manual for the full terms of | |
26 | * this agreement. | |
27 | * | |
28 | */ | |
29 | ||
30 | ||
31 | /* LINTLIBRARY */ | |
32 | ||
33 | #include <stdio.h> | |
34 | #include "psap.h" | |
35 | ||
36 | /* \f */ | |
37 | ||
38 | int oid_cmp (p, q) | |
39 | register OID p, | |
40 | q; | |
41 | { | |
42 | if (p == NULLOID) | |
43 | return (q ? -1 : 0); | |
44 | ||
45 | return elem_cmp (p -> oid_elements, p -> oid_nelem, | |
46 | q -> oid_elements, q -> oid_nelem); | |
47 | } | |
48 | ||
49 | /* \f */ | |
50 | ||
51 | int elem_cmp (ip, i, jp, j) | |
52 | register int i, | |
53 | j; | |
54 | register unsigned int *ip, | |
55 | *jp; | |
56 | { | |
57 | while (i > 0) { | |
58 | if (j == 0) | |
59 | return 1; | |
60 | if (*ip > *jp) | |
61 | return 1; | |
62 | else | |
63 | if (*ip < *jp) | |
64 | return (-1); | |
65 | ||
66 | ip++, i--; | |
67 | jp++, j--; | |
68 | } | |
69 | return (j == 0 ? 0 : -1); | |
70 | } |