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,v 1.15 1999/01/22 23:19:03 ghudson Exp $
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,v 1.15 1999/01/22 23:19:03 ghudson Exp $";
19 Code_t ZCheckIfNotice(notice, from, predicate, args)
21 struct sockaddr_in *from;
22 register int (*predicate) __P((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);