|
|
1.1 root 1: static char ID[] = "@(#) connect.c: 1.1 3/16/82";
2: #include <stdio.h>
3: #include "sdp.h"
4: #include "define3.h"
5:
6: #ifdef SHORT
7: #define CO01 "CO01 "
8: #define CO02 "CO02 "
9: #define CO03 "CO03 "
10: #define CO04 "CO04 "
11: #define CO05 "CO05 "
12: #define CO06 "CO06 "
13: #define COAU "COAU "
14: #else
15: #define CO01 "CO01 -- unknown permissions\n%d\n",perms
16: #define CO02 "CO02 -- error return from rdSPACE\n%s\n",name
17: #define CO03 "CO03 -- your address space (%ld) not compatible with this version (%ld)\n%s\n",sp->version,compatible,name
18: #define CO04 "CO04 -- environment not housed\n%o\t%s\n",environ,name
19: #define CO05 "CO05 -- framesize not compatible with file size\n%s\t%ld\t%d\n",name,sp->fileinfo[i].leng,environ->frame_size
20: #define CO06 "CO06 -- page/frame conflict\n%s\t%d\t%d\n",name,environ->frame_size,sp->page_size
21: #define COAU "%s","COAU -- audit failed in sdp_connect\n"
22: #endif
23:
24: #ifdef SWEET
25: #define PROLOG
26: #define EPILOG
27: #else
28: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\
29: ERR_RET(COAU,NULL)
30: #define EPILOG if(aud_flag == AUDITON)\
31: aud_set() ;\
32: if(hist_fp != NULL)\
33: fprintf(hist_fp,"CO\t%s\t%o\t%o\n",name,environ,sp) ;
34: #endif
35:
36: extern int aud_flag ;
37: extern struct LIBFILE *Glib_file ;
38: extern int hist_fp ;
39: extern struct LIBFILE lib_file ;
40: extern struct SPACE *first_space ;
41: extern ITEMID *known_idptr ;
42:
43: extern aud_set() ;
44: extern int aud_check() ;
45: extern long compatible ;
46: extern int ensearch() ;
47: extern FATAL() ;
48: extern struct SPACE *rdSPACE() ;
49:
50: struct SPACE * /* pointer to configuration structure or NULL */
51: sdp_connect(name,environ,library,perms)
52: char *name ;
53: struct ENVIRON *environ ;
54: struct LIBFILE *library ;
55: int perms ;
56: {
57: register struct SPACE *sp ;
58: register int i ;
59:
60: PROLOG
61:
62: Glib_file = (library == NULL) ? &lib_file : library ;
63: if( (perms != RNLY) && (perms != WRTN) )
64: ERR_RET(CO01,NULL)
65:
66: if( (sp = rdSPACE(name)) == NULL )
67: ERR_RET(CO02,NULL)
68:
69: if(sp->version < compatible)
70: ERR_RET(CO03,NULL)
71:
72: if( ensearch(environ) == NOTFOUND )
73: ERR_RET(CO04,NULL)
74:
75: for(i=0; i < sp->numbfile; i++)
76: if( sp->fileinfo[i].leng % environ->frame_size != 0 )
77: ERR_RET(CO05,NULL)
78:
79: if(environ->frame_size % sp->page_size != 0)
80: ERR_RET(CO06,NULL)
81:
82: sp->next_space = first_space ;
83: first_space = sp ;
84: environ->cnct_count++ ;
85: sp->environ = environ ;
86: sp->lib_file = Glib_file ;
87: sp->perms = perms ;
88: known_idptr = &(sp->known_id) ;
89: EPILOG
90: return(sp) ;
91: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.