]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/lib/ZGetLocs.c
r4254@bucket (orig r244): kcr | 2008-01-20 14:40:42 -0500
[1ts-debian.git] / zephyr / lib / ZGetLocs.c
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It contains source for the ZGetLocations function.
3  *
4  *      Created by:     Robert French
5  *
6  *      $Id$
7  *
8  *      Copyright (c) 1987 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_ZGetLocations_c[] = "$Id$";
15 #endif
16
17 #include <internal.h>
18
19 #define min(a,b) ((a)<(b)?(a):(b))
20         
21 Code_t
22 ZGetLocations(ZLocations_t *location,
23               int *numlocs)
24 {
25     int i;
26         
27     if (!__locate_list)
28         return (ZERR_NOLOCATIONS);
29
30     if (__locate_next == __locate_num)
31         return (ZERR_NOMORELOCS);
32         
33     for (i=0;i<min(*numlocs, __locate_num-__locate_next);i++)
34         location[i] = __locate_list[i+__locate_next];
35
36     if (__locate_num-__locate_next < *numlocs)
37         *numlocs = __locate_num-__locate_next;
38
39     __locate_next += *numlocs;
40         
41     return (ZERR_NONE);
42 }