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 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
7 * For copying and distribution information, see the file
13 Code_t
ZCheckIfNotice(notice
, from
, predicate
, args
)
15 struct sockaddr_in
*from
;
16 register int (*predicate
) __P((ZNotice_t
*, void *));
21 register char *buffer
;
22 register struct _Z_InputQ
*qptr
;
24 if ((retval
= Z_ReadEnqueue()) != ZERR_NONE
)
27 qptr
= Z_GetFirstComplete();
30 if ((retval
= ZParseNotice(qptr
->packet
, qptr
->packet_len
,
31 &tmpnotice
)) != ZERR_NONE
)
33 if ((*predicate
)(&tmpnotice
, args
)) {
34 if (!(buffer
= (char *) malloc((unsigned) qptr
->packet_len
)))
36 (void) memcpy(buffer
, qptr
->packet
, qptr
->packet_len
);
39 if ((retval
= ZParseNotice(buffer
, qptr
->packet_len
,
40 notice
)) != ZERR_NONE
) {
47 qptr
= Z_GetNextComplete(qptr
);
50 return (ZERR_NONOTICE
);