|
|
1.1 root 1: static char ID[] = "@(#) rdSPACE.c: 1.1 3/16/82";
2: #include <stdio.h>
3: #include "sdp.h"
4: #include "define2.h"
5: #include "define3.h"
6:
7: #ifdef SHORT
8: #define RS01 "RS01 "
9: #define RS02 "RS02 "
10: #define RS03 "RS03 "
11: #define RS04 "RS04 "
12: #define RS05 "RS05 "
13: #define RS06 "RS06 "
14: #define RS07 "RS07 "
15: #define RS08 "RS08 "
16: #define RS09 "RS09 "
17: #define RS10 "RS10 "
18: #define RS11 "RS11 "
19: #define RS12 "RS12 "
20: #else
21: #define RS01 "RS01 -- fail to allocate for header file\n%s\n",sp->head_name
22: #define RS02 "RS02 -- error return from buildname\n%s\n",name
23: #define RS03 "RS03 -- fail to open header file\n%s\n",sp->head_name
24: #define RS04 "RS04 -- fail to position header file\n%s\n",sp->head_name
25: #define RS05 "RS05 -- fail to read header file\n%s\n",sp->head_name
26: #define RS06 "RS06 -- fail to allocate for file information\n%s\n",sp->head_name
27: #define RS07 "RS07 -- fail to position header file for file information\n%s\n",sp->head_name
28: #define RS08 "RS08 -- fail to read header file for file information\n%s\n",sp->head_name
29: #define RS09 "RS09 -- fail to allocate for stack information\n%s\n",sp->head_name
30: #define RS10 "RS10 -- fail to position header file for stack information\n%s\n",sp->head_name
31: #define RS11 "RS11 -- fail to read stack information\n%s\n",sp->head_name
32: #define RS12 "RS12 -- fail to close header file\n%s\n",sp->head_name
33: #endif
34:
35: extern struct LIBFILE *Glib_file ;
36: extern int *ALLOC() ;
37: extern char *BUILDNAME() ;
38: extern FATAL() ;
39:
40: struct SPACE * /* pointer to configuration structure or NULL */
41: rdSPACE(name)
42: char *name ;
43: {
44: register FD fd ;
45: char *head_name ;
46: register struct SPACE *sp ;
47:
48: if( (sp = (struct SPACE *)ALLOC(sizeof(struct SPACE))) == NULL )
49: ERR_RET(RS01,NULL)
50:
51: if( (head_name = MBUILDNAME(name,-1)) == NULL )
52: ERR_RET(RS02,NULL)
53:
54: if( (fd=MOPEN(head_name,RNLY)) == ERROR )
55: ERR_RET(RS03,NULL)
56: if(MSEEK(fd,0l) == ERROR)
57: ERR_RET(RS04,NULL)
58:
59: if(MREAD(fd,sp,sizeof(struct SPACE)) == ERROR)
60: ERR_RET(RS05,NULL)
61:
62: sp->head_name = head_name ;
63:
64: if( (sp->fileinfo = (struct FILEINFO *)ALLOC(sp->numbfile*sizeof(struct FILEINFO))) == NULL )
65: ERR_RET(RS06,NULL)
66:
67: if(MSEEK(fd,(long)sizeof(struct SPACE)) == ERROR)
68: ERR_RET(RS07,NULL)
69:
70: if(MREAD(fd,sp->fileinfo,sp->numbfile*sizeof(struct FILEINFO)) == ERROR)
71: ERR_RET(RS08,NULL)
72:
73: if( (sp->staxinfo = (struct STAXINFO *)ALLOC(sp->numbstax*sizeof(struct STAXINFO))) == NULL )
74: ERR_RET(RS09,NULL)
75:
76: if(MSEEK(fd,(long)(sp->numbfile*sizeof(struct FILEINFO)+sizeof(struct SPACE))) == ERROR)
77: ERR_RET(RS10,NULL)
78:
79: if(MREAD(fd,sp->staxinfo,sp->numbstax*sizeof(struct STAXINFO)) == ERROR)
80: ERR_RET(RS11,NULL)
81:
82: sp->next_space = NULL ;
83: sp->environ = NULL ;
84:
85: if(MCLOSE(fd) == ERROR)
86: ERR_RET(RS12,NULL)
87:
88: return(sp) ;
89: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.