1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZCheckIfNotice function.
4 * Created by: Robert French
6 * $Id: ZCkIfNot.c 2123 2008-01-20 19:40:42Z kcr $
8 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
9 * For copying and distribution information, see the file
16 static const char rcsid_ZCheckIfNotice_c[] = "$Id: ZCkIfNot.c 2123 2008-01-20 19:40:42Z kcr $";
20 ZCheckIfNotice(ZNotice_t *notice,
21 struct sockaddr_in *from,
22 register int (*predicate)(ZNotice_t *, void *),
27 register char *buffer;
28 register struct _Z_InputQ *qptr;
30 if ((retval = Z_ReadEnqueue()) != ZERR_NONE)
33 qptr = Z_GetFirstComplete();
36 if ((retval = ZParseNotice(qptr->packet, qptr->packet_len,
37 &tmpnotice)) != ZERR_NONE)
39 if ((*predicate)(&tmpnotice, args)) {
40 if (!(buffer = (char *) malloc((unsigned) qptr->packet_len)))
42 (void) memcpy(buffer, qptr->packet, qptr->packet_len);
45 if ((retval = ZParseNotice(buffer, qptr->packet_len,
46 notice)) != ZERR_NONE) {
53 qptr = Z_GetNextComplete(qptr);
56 return (ZERR_NONOTICE);