|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 3821 (0xeed)
Types: TextFile
Names: »set_1dr.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Lib/pp/set_1dr.c«
/* set_1dr.c: Do the necessary stuff to mark one recip as needing a DR */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/pp/RCS/set_1dr.c,v 5.0 90/09/20 16:11:29 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Lib/pp/RCS/set_1dr.c,v 5.0 90/09/20 16:11:29 pp Exp Locker: pp $
*
* $Log: set_1dr.c,v $
* Revision 5.0 90/09/20 16:11:29 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include "adr.h"
#include "q.h"
#include "dr.h"
#include "retcode.h"
#include <isode/cmd_srch.h>
extern char *ppversion;
extern CMD_TABLE rr_tcode[],
rr_dcode[],
rr_rcode[];
#define gval(x) ((x -> ad_type) == AD_X400_TYPE ? \
(x -> ad_r400adr) : (x -> ad_r822adr))
int set_all_dr (qp, ap, reason, diag, str)
Q_struct *qp;
ADDR *ap;
int reason, diag;
char *str;
{
char sdl, boundadd[BUFSIZ];
for (; ap; ap = ap -> ad_next)
if (set_1dr_aux (qp, ap -> ad_no,
reason, diag, str, NOTOK) == NOTOK)
return NOTOK;
if (index (gval (qp->Oaddress), '"') == NULLCP)
sdl = '"';
else if (index (gval (qp->Oaddress), '\'') == NULLCP)
sdl = '\'';
else
sdl = '`';
if (str != NULLCP)
sprintf (boundadd, "reason=\"%s\" ", str);
PP_STAT (("totalDR chan=\"%s\" sender=%c%s%c \"%s\" %s reason-code=\"%s (%d)\", diag-code=\"%s (%d)\"",
qp->inbound->li_chan->ch_name,
sdl, gval(qp->Oaddress), sdl,
qp->inbound->li_mta,
(str != NULLCP) ? boundadd : "",
rcmd_srch(reason, rr_rcode), reason,
rcmd_srch(diag, rr_dcode), diag));
return OK;
}
int set_1dr (qp, no, reason, diag, str)
Q_struct *qp;
int no;
int reason, diag;
char *str;
{
return set_1dr_aux (qp, no, reason, diag, str, OK);
}
int set_1dr_aux (qp, no, reason, diag, str, log)
Q_struct *qp;
int no;
int reason, diag;
char *str;
int log;
{
ADDR *ap;
for (ap = qp -> Raddress; ap; ap = ap -> ad_next) {
if (ap -> ad_no == no)
break;
}
if (ap == NULLADDR) {
PP_LOG (LLOG_EXCEPTIONS, ("set_1dr: address %d not found",
no));
return NOTOK;
}
ap -> ad_status = AD_STAT_DRREQUIRED;
ap -> ad_reason = reason;
ap -> ad_diagnostic = diag;
ap -> ad_add_info = (str == NULLCP) ? NULLCP : strdup(str);
if (log == OK) {
char rdl, sdl, boundadd[BUFSIZ];
LIST_RCHAN *lastchan = ap->ad_fmtchan;
if (index (gval (qp->Oaddress), '"') == NULLCP)
sdl = '"';
else if (index (gval (qp->Oaddress), '\'') == NULLCP)
sdl = '\'';
else
sdl = '`';
if (index (gval (ap), '"') == NULLCP)
rdl = '"';
else if (index (gval (ap), '\'') == NULLCP)
rdl = '\'';
else
rdl = '`';
if (str != NULLCP)
sprintf (boundadd, "reason=\"%s\" ", str);
if (ap->ad_rcnt != 0) {
int i = 0;
while (i < ap->ad_rcnt && lastchan != NULLIST_RCHAN) {
i++;
lastchan = lastchan->li_next;
}
}
if (lastchan == NULLIST_RCHAN)
lastchan = ap->ad_outchan;
if (reason == DRR_NO_REASON) {
PP_STAT (("DR-good chan=\"%s\" sender=%c%s%c \"%s\" recip=%c%s%c on %s \"%s\" channel=%s",
qp -> inbound -> li_chan->ch_name,
sdl, gval(qp->Oaddress), sdl,
qp -> inbound->li_mta,
rdl, gval(ap), rdl,
ap -> ad_outchan->li_chan->ch_name,
ap -> ad_outchan -> li_mta,
lastchan -> li_chan -> ch_name));
}
else
PP_STAT (("DR chan=\"%s\" sender=%c%s%c \"%s\" recip=%c%s%c on %s \"%s\" channel=%s %s reason-code=\"%s (%d)\", diag-code=\"%s (%d)\"",
qp->inbound->li_chan->ch_name,
sdl, gval(qp->Oaddress), sdl,
qp->inbound->li_mta,
rdl, gval(ap), rdl,
ap->ad_outchan->li_chan->ch_name,
ap->ad_outchan->li_mta,
lastchan->li_chan->ch_name,
(str != NULLCP) ? boundadd : "",
rcmd_srch(reason, rr_rcode), reason,
rcmd_srch(diag, rr_dcode), diag));
}
return OK;
}