DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T a

⟦e40bf33ac⟧ TextFile

    Length: 4671 (0x123f)
    Types: TextFile
    Names: »adr2rfc.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/format/adr2rfc.c« 

TextFile

/* adr2rfc.c - Converts an X400 address into an RFC one */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/adr2rfc.c,v 5.0 90/09/20 16:04:44 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/adr2rfc.c,v 5.0 90/09/20 16:04:44 pp Exp Locker: pp $
 *
 * $Log:	adr2rfc.c,v $
 * Revision 5.0  90/09/20  16:04:44  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "util.h"
#include "or.h"
#include "adr.h"
#include <isode/cmd_srch.h>


/* -------------------- Begin Routines  ----------------------------------- */

extern char	*sprintoid();

extern CMD_TABLE atbl_rdm[], atbl_pd_modes[], atbl_reg_mail[];

int adr2rfc (ap, buffer, order_pref)
ADDR    *ap;
char    *buffer;
int	order_pref;
{
	OR_ptr  or;
	char    lbuf[LINESIZE];
	char	*type, *str = NULLCP;

	/* -- RFC or X400 address ? -- */

	if (ap->ad_r822adr) {
		(void) strcpy (buffer, ap->ad_r822adr);
		goto adr2rfc_end;
	}

	if (ap->ad_type == AD_822_TYPE)
		return NOTOK;

	if (ap->ad_r400adr) {
		if ((or = or_std2or (ap->ad_r400adr)) == NULLOR)
			return NOTOK;
		if (or_or2rfc (or, &lbuf[0]) == NOTOK)
			return NOTOK;
		or_free (or);
		(void) strcpy (buffer, lbuf);
	}
	else
		return NOTOK;


adr2rfc_end: ;
	ap_s2s(buffer, &str, order_pref);
	if (str != NULLCP) {
		(void) strcpy (buffer, str);
		free (str);
	}
	if (ap -> ad_no != 0) {
		/* don't do for Originator */
		/* do 1138 stuff */
		if (ap -> ad_redirection_history != NULL) {
			char		*reason;
			Redirection	*ix = ap -> ad_redirection_history;
			while (ix != NULL) {
				switch (ix->rd_reason) {
				    case RDR_RECIP_ASSIGNED:
					reason = strdup("Recipient Assigned Alternate Recipient");
					break;
				    case RDR_ORIG_ASSIGNED:
					reason = strdup("Originator Assigned Alternate Recipient");
					break;
				    case RDR_MD_ASSIGNED:
					reason = strdup("Recipient MD Assigned Alternate Recipient");
					break;
				    default:
					reason = NULLCP;
					break;
				}
				if (ix -> rd_addr != NULLCP
				    || ix -> rd_dn != NULLCP)
					(void) sprintf (buffer,
							"%s (Redirected from %s",
							buffer,
							(ix -> rd_addr != NULLCP) ? ix -> rd_addr : ix -> rd_dn);
				else 
					(void) sprintf (buffer,
							"%s (Redirection",
							buffer);
				if (reason != NULLCP) {
					(void) sprintf (buffer,
							"%s; reason=%s",
							buffer,
							reason);
					free(reason);
				}
				(void) sprintf(buffer, "%s)", buffer);
			}
			ix = ix -> rd_next;
		}
			
		if (ap -> ad_orig_req_alt != NULLCP)
			(void) sprintf (buffer, 
					"%s (Originally Intended Recipient %s)",
					buffer,
					ap -> ad_orig_req_alt);
		
		if (ap -> ad_req_del[0] != AD_RDM_NOTUSED
		    && ap -> ad_req_del[0] != AD_RDM_ANY) {
			int ix = 0, first = OK;

			(void) sprintf (buffer,
					"%s (Requested Delivery Methods ",
					buffer);
			while (ix < AD_RDM_MAX 
			       && ap -> ad_req_del[ix] != AD_RDM_NOTUSED
			       && ap -> ad_req_del[ix] != AD_RDM_ANY) {
				if ((type = rcmd_srch(ap -> ad_req_del[ix], atbl_rdm)) != NULLCP)
					(void) sprintf(buffer,
						       "%s%s%s",
						       buffer,
						       (first == OK) ? "" : ", ",
						       type);
				ix++;
				first = NOTOK;
			}
			(void) sprintf (buffer, "%s)", buffer);
		}
		
		if (ap -> ad_phys_forward)
			(void) sprintf (buffer,
					"%s (Physical Forwarding Prohibited)",
					buffer);
		
		if (ap -> ad_phys_fw_ad_req)
			(void) sprintf (buffer,
					"%s (Physical Forwarding Address Requested)",
					buffer);
		
		if (ap -> ad_phys_modes
		    && ap -> ad_phys_modes != AD_PM_ORD
		    && (type = rcmd_srch (ap -> ad_phys_modes, atbl_pd_modes)) != NULLCP)
			(void) sprintf (buffer,
					"%s (Physical Delivery Mode %s)",
					buffer, type);
		
		if (ap -> ad_reg_mail_type
		    && ap -> ad_reg_mail_type != AD_RMT_UNSPECIFIED
		    && (type = rcmd_srch (ap -> ad_reg_mail_type, atbl_reg_mail)) != NULLCP)
			(void) sprintf (buffer,
					"%s (Registered Mail Type %s)",
					buffer, type);
		
		if (ap -> ad_recip_number_for_advice != NULLCP)
			(void) sprintf (buffer,
					"%s (Recipient Number For Advice %s)",
					buffer, 
					ap -> ad_recip_number_for_advice);
		
		if (ap -> ad_phys_rendition_attribs != NULL)
			(void) sprintf (buffer,
					"%s (Physical Rendition Attributes %s)",
					buffer, 
					sprintoid(ap -> ad_phys_rendition_attribs));

		if (ap -> ad_pd_report_request)
			(void) sprintf (buffer,
					"%s (Physical Delivery Report Requested)",
					buffer);

		if (ap -> ad_proof_delivery)
			(void) sprintf (buffer,
					"%s (Proof of Delivery Requested)",
					buffer);
		
	}
	PP_DBG (("Lib/adr2rfc returns (%s)", buffer));
	return OK;
}