1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZPeekIfNotice function.
4 * Created by: Robert French
6 * $Id: ZPeekIfNot.c,v 1.14 1999/01/22 23:19:19 ghudson Exp $
8 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
9 * For copying and distribution information, see the file
14 static char rcsid_ZPeekIfNotice_c[] = "$Id: ZPeekIfNot.c,v 1.14 1999/01/22 23:19:19 ghudson Exp $";
19 Code_t ZPeekIfNotice(notice, from, predicate, args)
21 struct sockaddr_in *from;
28 struct _Z_InputQ *qptr;
30 if ((retval = Z_WaitForComplete()) != ZERR_NONE)
34 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) {
52 qptr = Z_GetNextComplete(qptr);
54 if ((retval = Z_ReadWait()) != ZERR_NONE)