]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - lib/ZRecvPkt.c
fix zwgc man page on linux and note
[1ts-debian.git] / lib / ZRecvPkt.c
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It contains source for ZReceivePacket function.
3  *
4  *      Created by:     Robert French
5  *
6  *      $Id: ZRecvPkt.c,v 1.17 1999/01/22 23:19:22 ghudson Exp $
7  *
8  *      Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
9  *      For copying and distribution information, see the file
10  *      "mit-copyright.h". 
11  */
12
13 #ifndef lint
14 static char rcsid_ZReceivePacket_c[] = "$Id: ZRecvPkt.c,v 1.17 1999/01/22 23:19:22 ghudson Exp $";
15 #endif
16
17 #include <internal.h>
18
19 Code_t ZReceivePacket(buffer, ret_len, from)
20     ZPacket_t buffer;
21     int *ret_len;
22     struct sockaddr_in *from;
23 {
24     Code_t retval;
25     struct _Z_InputQ *nextq;
26     
27     if ((retval = Z_WaitForComplete()) != ZERR_NONE)
28         return (retval);
29
30     nextq = Z_GetFirstComplete();
31
32     *ret_len = nextq->packet_len;
33     if (*ret_len > Z_MAXPKTLEN)
34         return (ZERR_PKTLEN);
35     
36     (void) memcpy(buffer, nextq->packet, *ret_len);
37
38     if (from)
39         *from = nextq->from;
40         
41     Z_RemQueue(nextq);
42
43     return (ZERR_NONE);
44 }