|
|
1.1 root 1: static char ID[] = "@(#) vacate.c: 1.1 3/16/82";
2: #include <stdio.h>
3: #include "sdp.h"
4: #include "define3.h"
5:
6: #ifdef SHORT
7: #define VA01 "VA01 "
8: #define VA02 "VA02 "
9: #define VAAU "VAAU "
10: #else
11: #define VA01 "VA01 -- attempt to vacate a connected environment\n%o\n",environ
12: #define VA02 "VA02 -- attempt to vacate unhoused environment\n%o\n",environ
13: #define VAAU "%s","VAAU -- audit failed in sdp_vacate\n"
14: #endif
15:
16: #ifdef SWEET
17: #define PROLOG
18: #define EPILOG
19: #else
20: #define PROLOG if( (aud_flag == AUDITON) && (aud_check() == ERROR) )\
21: ERR_RET(VAAU,ERROR)
22: #define EPILOG if(aud_flag == AUDITON)\
23: aud_set() ;\
24: if(hist_fp != NULL)\
25: fprintf(hist_fp,"VA\t%o\n",environ) ;
26: #endif
27:
28: extern int aud_flag ;
29: extern struct ENVIRON *first_environ ;
30: extern struct LIBFILE *Glib_file ;
31: extern struct LIBMEM *Glib_mem ;
32: extern FILE *hist_fp ;
33:
34: extern int aud_check() ;
35: extern aud_set() ;
36: extern FATAL() ;
37:
38: int /* SUCCESS or ERROR */
39: sdp_vacate(environ)
40: struct ENVIRON *environ ;
41: {
42: register struct MANAGER *manager ;
43: register int j ;
44: register struct ENVIRON *curr ;
45: register struct ENVIRON *next ;
46: register struct ENVIRON *prev ;
47:
48: PROLOG
49:
50: prev = NULL ;
51: for(curr=first_environ; curr!=NULL; curr=next)
52: {
53: next = curr->next_environ ;
54: if( (curr==environ) || (environ==NULL) )
55: {
56: if(curr->cnct_count != 0)
57: ERR_RET(VA01,ERROR)
58:
59: Glib_mem = curr->lib_mem ;
60:
61: if(prev == NULL)
62: first_environ = next ;
63: else
64: prev->next_environ = next ;
65:
66: manager = curr->manp ;
67: for(j=0; j<curr->num_frames; j++)
68: {
69: MFREE(manager[j].frame_pntr) ;
70: manager[j].frame_pntr = NULL ;
71: }
72: MFREE(curr->manp) ;
73: curr->manp = NULL ;
74: MFREE(curr) ;
75: if(environ == curr)
76: break ;
77: }
78: else
79: prev = curr ;
80: }
81:
82: if( (curr==NULL) && (environ!=NULL) )
83: ERR_RET(VA02,ERROR)
84:
85: EPILOG
86: return(SUCCESS) ;
87: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.