[gaim-migrate @ 3063]
[pidgin-git.git] / src / protocols / zephyr / ZGetSubs.c
blob90cd0c3d12a66d7a9c1a4479d1c0da12d50be629
1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZGetSubscriptions function.
4 * Created by: Robert French
6 * $Source$
7 * $Author: warmenhoven $
9 * Copyright (c) 1987 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
11 * "mit-copyright.h".
13 /* $Header$ */
15 #ifndef lint
16 static char rcsid_ZGetSubscriptions_c[] = "$Header$";
17 #endif
19 #include <internal.h>
21 #define min(a,b) ((a)<(b)?(a):(b))
23 Code_t ZGetSubscriptions(subscription, numsubs)
24 ZSubscription_t *subscription;
25 int *numsubs;
27 int i;
29 if (!__subscriptions_list)
30 return (ZERR_NOSUBSCRIPTIONS);
32 if (__subscriptions_next == __subscriptions_num)
33 return (ZERR_NOMORESUBSCRIPTIONS);
35 for (i=0;i<min(*numsubs, __subscriptions_num-__subscriptions_next);i++)
36 subscription[i] = __subscriptions_list[i+__subscriptions_next];
38 if (__subscriptions_num-__subscriptions_next < *numsubs)
39 *numsubs = __subscriptions_num-__subscriptions_next;
41 __subscriptions_next += *numsubs;
43 return (ZERR_NONE);