2 /* ###--------------------------------------------------------------### */
4 /* file : beh_delbebus.c */
5 /* date : Sep 3 1993 */
7 /* authors : Pirouz BAZARGAN SABET */
8 /* content : low-level function */
10 /* ###--------------------------------------------------------------### */
17 /* ###--------------------------------------------------------------### */
18 /* function : beh_delbebus */
19 /* description : delete a BEBUS 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_frebiabl, beh_frebinode */
23 /* ###--------------------------------------------------------------### */
25 bebus_list
*beh_delbebus (listbebus
, ptbebus
, mode
)
27 bebus_list
*listbebus
; /* list of bebus containing the object */
28 bebus_list
*ptbebus
; /* pointer of the BEBUS to be deleted */
29 char mode
; /* recursive delete or not (Y or N) */
33 struct bebus
*ptlastbus
;
35 if ((listbebus
!= NULL
) && (ptbebus
!= NULL
))
38 /* ###------------------------------------------------------### */
39 /* Search the object to be deleted */
40 /* ###------------------------------------------------------### */
42 headbus
.NEXT
= listbebus
;
44 while ((ptlastbus
!= NULL
) && (ptlastbus
->NEXT
!= ptbebus
))
45 ptlastbus
= ptlastbus
->NEXT
;
47 if (ptlastbus
!= NULL
)
50 /* ###------------------------------------------------------### */
51 /* If the object doesn't exist return the list without */
53 /* If the object has been found check the mode and, if asked */
54 /* delete pointed objects recursively. */
55 /* ###------------------------------------------------------### */
59 if ((ptbebus
->BIABL
!= NULL
) || (ptbebus
->BINODE
!= NULL
))
60 beh_warning(301,ptbebus
->NAME
,NULL
);
61 //(stderr,"BEH_warning : bebus `%s` not empty\n", ptbebus->NAME);
65 beh_frebiabl (ptbebus
->BIABL
);
66 beh_frebinode (ptbebus
->BINODE
);
69 ptlastbus
->NEXT
= ptbebus
->NEXT
;
73 listbebus
= headbus
.NEXT
;