|
|
1.1 root 1: static char ID[] = "@(#) destroy.c: 1.2 12/8/82";
2: #include <stdio.h>
3: #include "sdp.h"
4: #include "define2.h"
5: #include "define3.h"
6:
7: #ifdef SHORT
8: #define DE01 "DE01 "
9: #define DE02 "DE02 "
10: #define DE03 "DE03 "
11: #define DE04 "DE04 "
12: #define DE05 "DE05 "
13: #define DEAU "DEAU"
14: #else
15: #define DE01 "DE01 -- error return from rdSPACE\n%s\n",name
16: #define DE02 "DE02 -- fail to unlink header file\n%s\n",sp->head_name
17: #define DE03 "DE03 -- fail to build name\n%s%d\n",sp->head_name,i
18: #define DE04 "DE04 -- fail to unlink file\n%s\n",file_name
19: #define DE05 "DE05 -- unknown descriptor value\n%d\n",sp->fileinfo[i].desc
20: #define DEAU "%s","DEAU -- audit failed in sdp_destroy\n"
21: #endif
22:
23: #ifdef SWEET
24: #define PROLOG
25: #define EPILOG
26: #else
27: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\
28: ERR_RET(DEAU,ERROR)
29: #define EPILOG if(aud_flag == AUDITON)\
30: aud_set() ;\
31: if(hist_fp != NULL)\
32: fprintf(hist_fp,"DE\t%s\n",name) ;
33: #endif
34:
35:
36: extern int aud_flag ;
37: extern struct LIBFILE *Glib_file ;
38: extern FILE *hist_fp ;
39: extern struct LIBFILE lib_file ;
40:
41: extern char *BUILDNAME() ;
42: extern aud_set() ;
43: extern int aud_check() ;
44: extern FATAL() ;
45: extern FREE() ;
46: extern struct SPACE *rdSPACE() ;
47: extern UNLINK() ;
48:
49: int /* SUCCESS or ERROR */
50: sdp_destroy(name,library)
51: char *name ;
52: struct LIBFILE *library ;
53: {
54: register int i ;
55: register struct SPACE *sp ;
56: register char *file_name ;
57:
58: PROLOG
59:
60: Glib_file = (library == NULL) ? &lib_file : library ;
61: if( (sp = rdSPACE(name)) == NULL )
62: ERR_RET(DE01,ERROR)
63:
64: if(MUNLINK(sp->head_name) == ERROR)
65: ERR_RET(DE02,ERROR)
66:
67: for(i=0 ; i<sp->numbfile; i++)
68: switch(sp->fileinfo[i].desc)
69: {
70: case CLOSED:
71: if( (file_name = MBUILDNAME(sp->head_name,i)) == NULL )
72: ERR_RET(DE03,ERROR)
73: if(MUNLINK(file_name) == ERROR)
74: ERR_RET(DE04,ERROR)
75: FREE(file_name) ;
76: break ;
77:
78: case NOTMADE:
79: break ;
80:
81: default:
82: ERR_RET(DE05,ERROR)
83: break ;
84: }
85:
86: FREE(sp->head_name) ;
87: sp->head_name = NULL ;
88: FREE((char *)sp->fileinfo) ;
89: sp->fileinfo = NULL ;
90: FREE((char *)sp->staxinfo) ;
91: sp->staxinfo = NULL ;
92: FREE((char *)sp) ;
93: sp = NULL ;
94:
95: EPILOG
96: return(SUCCESS) ;
97: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.