home *** CD-ROM | disk | FTP | other *** search
- /*
- #### # # # #
- # # # # # The FreeWare C library for
- # # ## ### # # # # ### RISC OS machines
- # # # # # # # # # # # ___________________________________
- # # #### ### ## # # # #
- # # # # # # # # # # Please refer to the accompanying
- #### ### #### # # ##### # ### documentation for conditions of use
- ________________________________________________________________________
-
- File: Msgs.Drop.c
- Author: Copyright © 1992 Jason Williams
- Version: 1.00 (08 Apr 1992)
- Purpose: MessageTrans-like message handling functions.
- (If you want MessageTrans, use the SWI interface, if you want
- high-level message handling, use this code...)
- */
-
-
- #include <stdlib.h>
- #include "Msgs.h"
-
- typedef struct msg_def *msgdefptr;
-
- typedef struct msg_def
- {
- msgdefptr next;
- union
- {
- char *text;
- msgdefptr taglist;
- } data;
- char tag[10];
- } msg_def;
-
-
- extern msgdefptr msgs_grouplist;
- extern BOOL Msgs__MatchToken(char *tag1, char *tag2, BOOL wcallowed);
-
-
- extern void Msgs_DropGroup(char *grouptag)
- {
- msgdefptr ptr, next, last;
-
- ptr = msgs_grouplist; /* Try to find group */
- while (ptr != NULL)
- {
- if (Msgs__MatchToken(grouptag, ptr->tag, TRUE))
- break;
-
- last = ptr;
- ptr = ptr->next;
- }
-
- if (ptr == NULL) /* group not found */
- return;
-
- if (ptr == msgs_grouplist) /* unlink from list */
- msgs_grouplist = ptr->next;
- else
- last->next = ptr->next;
-
- next = ptr->data.taglist; /* Kill group record */
- free(ptr);
- ptr = next;
-
- while (ptr != NULL) /* Kill message list */
- {
- if (ptr->data.text != NULL)
- free(ptr->data.text);
-
- next = ptr->next;
- free(ptr);
- ptr = next;
- }
- }
-