119926Ssam # include "../hdr/defines.h"
219926Ssam
3*30497Slepreau static char Sccsid[] = "@(#)setup.c 1.3 02/15/87";
419926Ssam
setup(pkt,serial)519926Ssam setup(pkt,serial)
619926Ssam register struct packet *pkt;
719926Ssam int serial;
819926Ssam {
919926Ssam register int n;
1019926Ssam register struct apply *rap;
11*30497Slepreau int first_app = 1;
1219926Ssam
1319926Ssam pkt->p_apply[serial].a_inline = 1;
1419926Ssam for (n = maxser(pkt); n; n--) {
1519926Ssam rap = &pkt->p_apply[n];
1619926Ssam if (rap->a_inline) {
1719926Ssam if (n != 1 && pkt->p_idel[n].i_pred == 0)
1819926Ssam fmterr(pkt);
1919926Ssam pkt->p_apply[pkt->p_idel[n].i_pred].a_inline = 1;
2019926Ssam if (pkt->p_idel[n].i_datetime > pkt->p_cutoff)
2119926Ssam condset(rap,NOAPPLY,CUTOFF);
2219926Ssam else {
2319926Ssam if (first_app)
2419940Ssam bcopy(&pkt->p_idel[n].i_sid,
2519926Ssam &pkt->p_gotsid,
2619926Ssam sizeof(pkt->p_gotsid));
2719926Ssam first_app = 0;
2819926Ssam condset(rap,APPLY,EMPTY);
2919926Ssam }
3019926Ssam }
3119926Ssam else
3219926Ssam condset(rap,NOAPPLY,EMPTY);
3319926Ssam if (rap->a_code == APPLY)
3419926Ssam ixgsetup(pkt->p_apply,&(pkt->p_idel[n].i_ixg));
3519926Ssam }
3619926Ssam }
3719926Ssam
3819926Ssam
3919926Ssam ixgsetup(ap,ixgp)
4019926Ssam struct apply *ap;
4119926Ssam struct ixg *ixgp;
4219926Ssam {
4319926Ssam int n;
4419926Ssam int code, reason;
4519926Ssam register int *ip;
4619926Ssam register struct ixg *cur, *prev;
4719926Ssam
4819926Ssam for (cur = ixgp; cur = (prev = cur)->i_next; ) {
4919926Ssam switch (cur->i_type) {
5019926Ssam
5119926Ssam case INCLUDE:
5219926Ssam code = APPLY;
5319926Ssam reason = INCL;
5419926Ssam break;
5519926Ssam case EXCLUDE:
5619926Ssam code = NOAPPLY;
5719926Ssam reason = EXCL;
5819926Ssam break;
5919926Ssam case IGNORE:
6019926Ssam code = EMPTY;
6119926Ssam reason = IGNR;
6219926Ssam break;
6319926Ssam }
6419926Ssam ip = cur->i_ser;
6519926Ssam for (n = cur->i_cnt; n; n--)
6619926Ssam condset(&ap[*ip++],code,reason);
6719926Ssam }
6819926Ssam }
6919926Ssam
7019926Ssam
condset(ap,code,reason)7119926Ssam condset(ap,code,reason)
7219926Ssam register struct apply *ap;
7319926Ssam int code, reason;
7419926Ssam {
7519926Ssam if (code == EMPTY)
76*30497Slepreau ap->a_reason |= reason;
7719926Ssam else if (ap->a_code == EMPTY) {
7819926Ssam ap->a_code = code;
79*30497Slepreau ap->a_reason |= reason;
8019926Ssam }
8119926Ssam }
82