|
|
1.1 root 1: static char ID[] = "@(#) wtSPACE.c: 1.2 12/8/82";
2: #include <stdio.h>
3: #include "sdp.h"
4: #include "define3.h"
5:
6: #ifdef SHORT
7: #define WS01 "WS01 "
8: #define WS02 "WS02 "
9: #define WS03 "WS03 "
10: #define WS04 "WS04 "
11: #define WS05 "WS05 "
12: #define WS06 "WS06 "
13: #define WS07 "WS07 "
14: #define WS08 "WS08 "
15: #else
16: #define WS01 "WS01 -- fail to open header file\n%s\n",sp->head_name
17: #define WS02 "WS02 -- fail to position header file\n%s\n",sp->head_name
18: #define WS03 "WS03 -- fail to write header file\n%s\n",sp->head_name
19: #define WS04 "WS04 -- fail to position header file\n%s\n",sp->head_name
20: #define WS05 "WS05 -- fail to write header file\n%s\n",sp->head_name
21: #define WS06 "WS06 -- fail to position header file\n%s\n",sp->head_name
22: #define WS07 "WS07 -- fail to write header file\n%s\n",sp->head_name
23: #define WS08 "WS08 -- fail to close header file\n%s\n",sp->head_name
24: #endif
25:
26: extern struct LIBFILE *Glib_file ;
27: extern FATAL() ;
28: extern FREE() ;
29:
30: int /* SUCCESS or ERROR */
31: wtSPACE(sp)
32: register struct SPACE *sp ;
33: {
34: register FD fd ;
35:
36: if( (fd = MOPEN(sp->head_name,sp->perms)) == ERROR )
37: ERR_RET(WS01,ERROR)
38:
39: if(MSEEK(fd,(long)sizeof(struct SPACE)) == ERROR)
40: ERR_RET(WS02,ERROR)
41:
42: if(MWRITE(fd,sp->fileinfo,sp->numbfile*sizeof(struct FILEINFO)) == ERROR)
43: ERR_RET(WS03,ERROR)
44:
45: if(MSEEK(fd,(long)(sp->numbfile*sizeof(struct FILEINFO)+sizeof(struct SPACE))) == ERROR)
46: ERR_RET(WS04,ERROR)
47:
48: if(MWRITE(fd,sp->staxinfo,sp->numbstax*sizeof(struct STAXINFO)) == ERROR)
49: ERR_RET(WS05,ERROR)
50:
51: if(MSEEK(fd,0l) == ERROR)
52: ERR_RET(WS06,ERROR)
53:
54: if(MWRITE(fd,sp,sizeof(struct SPACE)) == ERROR)
55: ERR_RET(WS07,ERROR)
56:
57:
58: if(MCLOSE(fd) == ERROR)
59: ERR_RET(WS08,ERROR)
60:
61: return(SUCCESS) ;
62: }
63:
64: freeSPACE(sp)
65: register struct SPACE *sp ;
66: {
67: FREE(sp->head_name) ;
68: FREE(sp->fileinfo) ;
69: FREE(sp->staxinfo) ;
70: FREE(sp) ;
71: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.