summaryrefslogtreecommitdiff
path: root/lib/ZCkIfNot.c
diff options
context:
space:
mode:
authorGravatar Robert S. French <rfrench@mit.edu>1987-06-12 12:58:47 +0000
committerGravatar Robert S. French <rfrench@mit.edu>1987-06-12 12:58:47 +0000
commit2a79930d731c6d85df0fc46e869a4466dbf1d1fd (patch)
tree69baaff8f1bc1fb934473a1fe7b31946f3ceb3b6 /lib/ZCkIfNot.c
parent2a5fbec60dbc9c1a08e104760f64bbdc33c8a1fa (diff)
First working library - safe checkin
Diffstat (limited to 'lib/ZCkIfNot.c')
-rw-r--r--lib/ZCkIfNot.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/ZCkIfNot.c b/lib/ZCkIfNot.c
new file mode 100644
index 0000000..71622f2
--- /dev/null
+++ b/lib/ZCkIfNot.c
@@ -0,0 +1,55 @@
+/* This file is part of the Project Athena Zephyr Notification System.
+ * It contains source for the ZCheckIfNotice function.
+ *
+ * Created by: Robert French
+ *
+ * $Source$
+ * $Author$
+ *
+ * Copyright (c) 1987 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, see the file
+ * "mit-copyright.h".
+ */
+/* $Header$ */
+
+#include <zephyr/mit-copyright.h>
+
+#include <zephyr/zephyr_internal.h>
+
+Code_t ZCheckIfNotice(buffer,buffer_len,notice,auth,predicate,args)
+ ZPacket_t buffer;
+ int buffer_len;
+ ZNotice_t *notice;
+ int *auth;
+ int (*predicate)();
+ char *args;
+{
+ ZNotice_t tmpnotice;
+ int qcount,retval,tmpauth;
+ struct _Z_InputQ *qptr;
+
+ if ((retval = Z_ReadEnqueue()) != ZERR_NONE)
+ return (retval);
+
+ qptr = __Q_Head;
+ qcount = __Q_Length;
+
+ for (;qcount;qcount--) {
+ if ((retval = ZParseNotice(qptr->packet,qptr->packet_len,
+ &tmpnotice,&tmpauth)) != ZERR_NONE)
+ return (retval);
+ if ((predicate)(&tmpnotice,args)) {
+ if (qptr->packet_len > buffer_len)
+ return (ZERR_PKTLEN);
+ bcopy(qptr->packet,buffer,qptr->packet_len);
+ if ((retval = ZParseNotice(buffer,qptr->packet_len,
+ notice,auth))
+ != ZERR_NONE)
+ return (retval);
+ return (Z_RemQueue(qptr));
+ }
+ qptr = qptr->next;
+ }
+
+ return (ZERR_NONOTICE);
+}