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 s

⟦25a87dd28⟧ TextFile

    Length: 2597 (0xa25)
    Types: TextFile
    Names: »syn_oraddr.c«

Derivation

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

TextFile

/* syn_oraddr.c: */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_oraddr.c,v 5.0 90/09/20 15:46:05 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_oraddr.c,v 5.0 90/09/20 15:46:05 pp Exp Locker: pp $
 *
 * $Log:	syn_oraddr.c,v $
 * Revision 5.0  90/09/20  15:46:05  pp
 * rcsforce : 5.0 public release
 * 
 */



/* LINTLIBRARY */

#include "util.h"
#include <varargs.h>
#include "retcode.h"
#include "adr.h"
#include "ap.h"
#include "dlist.h"
#include <isode/quipu/attrvalue.h>

OR_ptr orAddr_parse (ptr)
char * ptr;
{
OR_ptr or;
char * str;

	if (*ptr == '/') {
		if ((or = or_std2or(ptr)) == NULLOR) {
			parse_error ("std2or failed %s",ptr);
			return (NULLOR);
		}
	} else {
		ap_s2s (ptr, &str, CH_USA_PREF);
		if (str != NULLCP)
			ptr = str;
		if (or_rfc2or(ptr,&or) != OK) {
                        parse_error ("rfc2or failed %s",ptr);
			if (str != NULLCP)
				free (str);
			return (NULLOR);
		}
		if (str != NULLCP)
			free (str);
	}

	return (or);
}

/* ARGSUSED */
orAddr_print (ps,or,format)
PS ps;
OR_ptr or;
int format;
{
char buf[LINESIZE];

/*
	if ((format == READOUT) || (format == UFNOUT))
		or_or2rfc (or,buf);
	else
*/
		or_or2std (or,buf,0);

	ps_printf (ps,"%s",buf);
}

OR_ptr or_cpy (a)
OR_ptr a;
{
OR_ptr top = NULLOR;

	for (; a != NULLOR; a=a->or_next) 
		top = or_add (top,or_dup(a),FALSE);

	return (top);
}

static int my_or_cmp (or1, or2)
OR_ptr          or1;
OR_ptr          or2;
{
int res;

    if (or1 -> or_type != or2 -> or_type) 
	return (or1 -> or_type > or2 -> or_type) ? 1 : -1;

    if ((res = lexequ (or1 -> or_value, or2 -> or_value)) != 0)
		return res;

    if (or1 -> or_type == OR_DD
	&& (res = lexequ (or1 -> or_ddname, or2 -> or_ddname)) != 0)
		return res;

    return 0;
}

orAddr_cmp (a,b)
OR_ptr a,b;
{
int res;

	for (; (a != NULLOR) && (b != NULLOR) ; a = a->or_next, b = b->or_next) 
		if ((res = my_or_cmp (a,b)) != 0) 
			return res;

	if (( a == NULLOR) && (b == NULLOR)) 
		return 0;
	else
		return (a == NULLOR) ? 1 : -1;
}

static OR_ptr orAddr_dec (pe)
PE pe;
{
OR_ptr m = NULLOR;

	if (decode_MAS_ORAddress (pe,1,NULLIP,NULLVP,&m) == NOTOK) 
		return (NULLOR);
	return (m);
}

static PE orAddr_enc (m)
OR_ptr m;
{
PE ret_pe;

        (void) encode_MAS_ORAddress (&ret_pe,0,0,NULLCP,m);

	return (ret_pe);
}

orAddr_syntax ()
{
	(void) add_attribute_syntax ("ORAddress",
		(IFP) orAddr_enc,	(IFP) orAddr_dec,
		(IFP) orAddr_parse,	orAddr_print,
		(IFP) or_cpy,		orAddr_cmp,
		(IFP) or_free,		NULLCP,
		NULLIFP,		TRUE);
}