|
|
1.1 root 1: /* isobject.c - lookup Object IDentifiers/DEscriptors */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/psap/RCS/isobject.c,v 7.0 89/11/23 22:12:40 mrose Rel $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/psap/RCS/isobject.c,v 7.0 89/11/23 22:12:40 mrose Rel $
9: *
10: *
11: * $Log: isobject.c,v $
12: * Revision 7.0 89/11/23 22:12:40 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 <ctype.h>
31: #include <stdio.h>
32: #include "psap.h"
33: #include "tailor.h"
34:
35: /* DATA */
36:
37: static char *isobjects = "isobjects";
38:
39: static FILE *servf = NULL;
40: static int stayopen = 0;
41:
42: static struct isobject ios;
43:
44: /* */
45:
46: int setisobject (f)
47: int f;
48: {
49: if (servf == NULL)
50: servf = fopen (isodefile (isobjects, 0), "r");
51: else
52: rewind (servf);
53: stayopen |= f;
54:
55: return (servf != NULL);
56: }
57:
58:
59: int endisobject () {
60: if (servf && !stayopen) {
61: (void) fclose (servf);
62: servf = NULL;
63: }
64:
65: return 1;
66: }
67:
68: /* */
69:
70: struct isobject *getisobject () {
71: register int i;
72: register struct isobject *io = &ios;
73: register char *cp;
74: static char buffer[BUFSIZ + 1];
75: static char *vec[NVEC + NSLACK + 1];
76: static unsigned int elements[NELEM + 1];
77:
78: if (servf == NULL
79: && (servf = fopen (isodefile (isobjects, 0), "r")) == NULL)
80: return NULL;
81:
82: bzero ((char *) io, sizeof *io);
83:
84: while (fgets (buffer, sizeof buffer, servf) != NULL) {
85: if (*buffer == '#')
86: continue;
87: if (cp = index (buffer, '\n'))
88: *cp = NULL;
89: if (str2vec (buffer, vec) < 2)
90: continue;
91:
92: if ((i = str2elem (vec[1], elements)) <= 1)
93: continue;
94:
95: io -> io_descriptor = vec[0];
96: io -> io_identity.oid_elements = elements;
97: io -> io_identity.oid_nelem = i;
98:
99: return io;
100: }
101:
102: return NULL;
103: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.