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 o

⟦b5ff732c4⟧ TextFile

    Length: 3218 (0xc92)
    Types: TextFile
    Names: »or_rbits2or.c«

Derivation

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

TextFile

/* or_rbits2or.c: maps bits into OR */

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

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/or/RCS/or_rbits2or.c,v 5.0 90/09/20 16:08:36 pp Exp Locker: pp $
 *
 * $Log:	or_rbits2or.c,v $
 * Revision 5.0  90/09/20  16:08:36  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "or.h"
#include "util.h"
#include "table.h"

static Table    *tb_rfc2or = NULLTBL;
extern char     *rfc2or_tbl,
		or_error[];
/* ---------------------  Begin  Routines  -------------------------------- */




int or_rbits2or (local, domain, or)
char            *local;
char            *domain;
OR_ptr          *or;
{
    OR_ptr      ptr,
		tptr;
    char        buf[LINESIZE],
		*p;

    PP_DBG (("Lib/or_rbits2or (%s,%s)", local, domain));

    if (tb_rfc2or == NULLTBL) {
	    if ((tb_rfc2or = tb_nm2struct (rfc2or_tbl)) == NULLTBL) {
		    PP_LOG (LLOG_EXCEPTIONS, ("Lib/or_rbits2or: rfc2or table NULL!"));
		    return NOTOK;
	    }
    }

    *or = NULLOR;

    for (p = domain; *p != '\0';) {
	if (tb_k2val (tb_rfc2or, p, buf) == OK)
		break;
	p = index (p, '.');
	if (p == NULLCP)
		break;
	else
	    p++;
    }


    if (p == NULLCP || *p == '\0') {
	    sprintf(or_error,
		    "No translation of '%s' to X400 address", domain);
	    return NOTOK;
    }
    else {
	if (lexequ (buf, "local") == 0)
		*or = NULLOR;
	else {
		*or = or_dmn2or (buf);
		if (*or == NULLOR) {
			PP_LOG (LLOG_EXCEPTIONS,
				("Lib/or_rbits2or: fmt err '%s':'%s'",
				p, buf));
			sprintf(or_error,
				"format error '%s':'%s'",
				p, buf);
			return NOTOK;

		}  /* --- end of if --- */

	}  /* --- end of else --- */


	if (p != domain) {
		/* --- Must add more bits --- */
		int         i;
		int         tconst;
		int         type;
		int         oargc;
		char        *oargv[50];

		p--;
		*p = '\0';
		oargc = sstr2arg (domain, 49, oargv, ".");

		if (*or != NULLOR) {
			ptr = *or;
			tconst = (or_lastpart (ptr)) -> or_type;
		}
		else
			tconst = OR_OU;

		for (i = oargc - 1; i >= 0; i--) {
			tconst++;
			if (tconst > OR_OU)
				type = OR_OU;
			else
				type = tconst;

			if (!or_isdomsyntax (oargv[i])) {
				PP_LOG (LLOG_EXCEPTIONS,
					("Lib/or_rbits2or: dmn syntax err"));
				sprintf(or_error,
					"domain syntax error '%s'",
					oargv[i]);
				return NOTOK;
			}

			ptr = or_new (type, NULLCP, oargv[i]);
			*or = or_add (*or, ptr, FALSE);
			if (*or == NULLOR)
				return NOTOK;

		}  /* --- end of for --- */

	}  /* --- end of if --- */

    }  /* --- end of else --- */

    /* --- Add in the local bits --- */

    if ((ptr = or_std2or (local)) == NULLOR) {
	PP_LOG (LLOG_EXCEPTIONS,
		("Lib/or_rbits2or: local syntax err '%s'", local));
	sprintf(or_error,
		"local syntax error '%s'",
		local);
	return NOTOK;
    }


    for (; ptr != NULLOR ;) {
	tptr = ptr -> or_next;
	if ((ptr -> or_type == OR_DD) || (ptr -> or_type == OR_OU))
		*or = or_add (*or, ptr, FALSE);
	else
		*or = or_add (*or, ptr, TRUE);
	if (*or == NULLOR)
	    return NOTOK;
	ptr = tptr;
    }

   if (or_delete_atsigns (or) == NOTOK)
		return NOTOK;
   *or = or_default (*or);
   return OK;

}