2 /* ###--------------------------------------------------------------### */
4 /* file : beh_rmvbefig.c */
5 /* date : Sep 3 1993 */
7 /* authors : Pirouz BAZARGAN SABET */
8 /* content : low-level function */
10 /* ###--------------------------------------------------------------### */
17 /* ###--------------------------------------------------------------### */
18 /* function : beh_rmvbefig */
19 /* description : delete a BEFIG structure and return the pointer of */
20 /* the next object. A warning is printed out if the */
21 /* object to be deleted is not empty when the mode is N. */
22 /* called func. : mbkfree , beh_frebereg, beh_frebemsg, */
23 /* beh_freberin, beh_frebeout, beh_frebebus, */
24 /* beh_frebeaux, beh_frebebux, beh_frebepor, */
25 /* beh_frebegen, getptype */
26 /* ###--------------------------------------------------------------### */
28 befig_list
*beh_rmvbefig (listbefig
, befigname
, mode
)
30 befig_list
*listbefig
; /* list of befig containing the object */
31 char *befigname
; /* name of the BEFIG to be deleted */
32 char mode
; /* recursive delete or not (Y or N) */
36 struct befig
*ptlastfig
;
37 struct befig
*ptbefig
;
40 if (listbefig
!= NULL
)
43 /* ###------------------------------------------------------### */
44 /* Search the object to be deleted */
45 /* ###------------------------------------------------------### */
47 headfig
.NEXT
= listbefig
;
49 headfig
.BEREG
= NULL
;
50 headfig
.BEMSG
= NULL
;
51 headfig
.BERIN
= NULL
;
52 headfig
.BEAUX
= NULL
;
53 headfig
.BEBUX
= NULL
;
54 headfig
.BEDLY
= NULL
;
55 headfig
.BEPOR
= NULL
;
58 while ((ptbefig
!= NULL
) && (ptbefig
->NAME
!= befigname
))
61 ptbefig
= ptbefig
->NEXT
;
67 /* ###------------------------------------------------------### */
68 /* If the object doesn't exist return the list without */
70 /* If the object has been found check the mode and, if asked */
71 /* delete pointed objects recursively. */
72 /* ###------------------------------------------------------### */
76 if ((ptbefig
->BEREG
!= NULL
) || (ptbefig
->BEMSG
!= NULL
) ||
77 (ptbefig
->BERIN
!= NULL
) || (ptbefig
->BEOUT
!= NULL
) ||
78 (ptbefig
->BEBUS
!= NULL
) || (ptbefig
->BEAUX
!= NULL
) ||
79 (ptbefig
->BEBUX
!= NULL
) || (ptbefig
->BEDLY
!= NULL
) ||
80 (ptbefig
->BEPOR
!= NULL
) || (ptbefig
->USER
!= NULL
))
82 beh_warning(304,befigname
,NULL
);
83 // (stderr,"BEH_warning : befig `%s` not empty\n", befigname);
87 beh_frebereg (ptbefig
->BEREG
);
88 beh_frebemsg (ptbefig
->BEMSG
);
89 beh_freberin (ptbefig
->BERIN
);
90 beh_frebeout (ptbefig
->BEOUT
);
91 beh_frebebus (ptbefig
->BEBUS
);
92 beh_frebeaux (ptbefig
->BEAUX
);
93 beh_frebeaux (ptbefig
->BEDLY
);
94 beh_frebebux (ptbefig
->BEBUX
);
95 beh_frebepor (ptbefig
->BEPOR
);
96 if ((ptptype
= getptype (ptbefig
->USER
,BEH_GENERIC
)) != NULL
)
97 beh_frebegen (ptptype
->DATA
);
100 ptlastfig
->NEXT
= ptbefig
->NEXT
;
104 listbefig
= headfig
.NEXT
;