diff options
author | Robert S. French <rfrench@mit.edu> | 1987-07-09 16:02:06 +0000 |
---|---|---|
committer | Robert S. French <rfrench@mit.edu> | 1987-07-09 16:02:06 +0000 |
commit | e85212e9bd725eda9c1ca3667ee5bbf4d4316379 (patch) | |
tree | 5a291eea92b9c9eeccc5c752c75962124794fa56 /lib/ZGetSubs.c | |
parent | eb457f2f6720a5336d2931798f452810c2b156ed (diff) |
Initial revision
Diffstat (limited to 'lib/ZGetSubs.c')
-rw-r--r-- | lib/ZGetSubs.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/lib/ZGetSubs.c b/lib/ZGetSubs.c new file mode 100644 index 0000000..002a473 --- /dev/null +++ b/lib/ZGetSubs.c @@ -0,0 +1,42 @@ +/* This file is part of the Project Athena Zephyr Notification System. + * It contains source for the ZGetSubscriptions 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> + +#define min(a,b) ((a)<(b)?(a):(b)) + +Code_t ZGetSubscriptions(subscription,numsubs) + ZSubscription_t *subscription; + int *numsubs; +{ + int i; + + if (!__subscriptions_list) + return (ZERR_NOSUBSCRIPTIONS); + + if (__subscriptions_next == __subscriptions_num) + return (ZERR_NOMORESUBSCRIPTIONS); + + for (i=0;i<min(*numsubs,__subscriptions_num-__subscriptions_next);i++) + subscription[i] = __subscriptions_list[i+__subscriptions_next]; + + if (__subscriptions_num-__subscriptions_next < *numsubs) + *numsubs = __subscriptions_num-__subscriptions_next; + + __subscriptions_next += *numsubs; + + return (ZERR_NONE); +} |