|
|
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 d
Length: 3832 (0xef8)
Types: TextFile
Names: »dsa_info.c«
└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
└─⟦eba4602b1⟧ »./isode-5.0.tar.Z«
└─⟦d3ac74d73⟧
└─⟦this⟧ »isode-5.0/dsap/common/dsa_info.c«
/* dsa_info.c - DSA Operational Information */
#ifndef lint
static char *rcsid = "$Header: /f/osi/dsap/common/RCS/dsa_info.c,v 6.0 89/03/18 23:27:34 mrose Rel $";
#endif
/*
* $Header: /f/osi/dsap/common/RCS/dsa_info.c,v 6.0 89/03/18 23:27:34 mrose Rel $
*
*
* $Log: dsa_info.c,v $
* Revision 6.0 89/03/18 23:27:34 mrose
* Release 5.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
/* LINTLIBRARY */
#include "quipu/util.h"
#include "quipu/entry.h"
extern LLog * log_dsap;
edb_info_free (edb)
struct edb_info * edb;
{
if (edb == NULLEDB)
return;
dn_free (edb->edb_name) ;
dn_free (edb->edb_getfrom);
dn_seq_free (edb->edb_allowed);
dn_seq_free (edb->edb_sendto);
free ((char *) edb);
}
struct edb_info * edb_info_cpy (a)
struct edb_info * a;
{
struct edb_info * result;
result = edb_info_alloc ();
result->edb_name = dn_cpy (a->edb_name);
result->edb_getfrom = dn_cpy (a->edb_getfrom);
result->edb_sendto = dn_seq_cpy (a->edb_sendto);
result->edb_allowed = dn_seq_cpy (a->edb_allowed);
return (result);
}
edb_info_cmp (a,b)
struct edb_info * a;
struct edb_info * b;
{
int lena = 0, lenb = 0;
DN dna, dnb;
if (a == NULLEDB)
return ( b ? -1 : 0 );
if (b == NULLEDB)
return (1);
for (dna = a->edb_name; dna != NULLDN; dna=dna->dn_parent, lena++)
;
for (dnb = b->edb_name; dnb != NULLDN; dnb=dnb->dn_parent, lenb++)
;
if ( lena == lenb )
return (-1); /* no real interest */
return ( lena > lenb ? -1 : 1 );
}
edb_info_decode (a)
struct edb_info * a;
{
dn_decode (a->edb_name);
dn_decode (a->edb_getfrom);
dn_seq_decode (a->edb_allowed);
dn_seq_decode (a->edb_sendto);
}
edb_info_print (ps,edb,format)
PS ps;
struct edb_info * edb;
int format;
{
if (edb == NULLEDB)
return;
if (edb->edb_name != NULLDN)
dn_print (ps,edb->edb_name,format);
ps_print (ps,"#");
dn_print (ps,edb->edb_getfrom,format);
ps_print (ps,"#");
dn_seq_print (ps,edb->edb_allowed,format);
if (edb->edb_sendto != NULLDNSEQ)
DLOG (log_dsap,LLOG_EXCEPTIONS,("edb_sendto not null"));
}
struct edb_info * str2update (str)
char * str;
{
register char * ptr;
char * save,val;
struct edb_info * ei;
/* dn # num # dn # dnseq # */
if ((ptr = index (str,'#')) == 0) {
parse_error ("# missing in update syntax '%s'",str);
return (NULLEDB);
}
ei = edb_info_alloc ();
ei->edb_sendto = NULLDNSEQ;
/* go for name */
save = ptr++;
if (*str == '#')
ei->edb_name = NULLDN;
else {
if (! isspace (*--save))
save++;
val = *save;
*save = 0;
if ((ei->edb_name = str2dn(str)) == NULLDN) {
free ((char *) ei);
return (NULLEDB);
}
*save = val;
}
str = SkipSpace(ptr);
if ((ptr = index (str,'#')) == 0) {
parse_error ("2nd # missing in update syntax '%s'",str);
dn_free (ei->edb_name);
free ((char *) ei);
return (NULLEDB);
}
save = ptr++;
if (*str == '#') {
ei->edb_getfrom = NULLDN;
} else {
if (! isspace (*--save))
save++;
val = *save;
*save = 0;
if ((ei->edb_getfrom = str2dn(str)) == NULLDN) {
dn_free (ei->edb_name);
free ((char *) ei);
return (NULLEDB);
}
*save = val;
}
/* send to */
str = SkipSpace(ptr);
if ((ptr = index (str,'#')) == 0) {
ptr = 0;
} else {
save = ptr++;
if (! isspace (*--save))
save++;
val = *save;
*save=0;
}
if (*str == 0)
ei->edb_allowed = NULLDNSEQ;
else if ((ei->edb_allowed = str2dnseq(str)) == NULLDNSEQ) {
parse_error ("invalid dn '%s'",str);
dn_free (ei->edb_name);
dn_free (ei->edb_getfrom);
free ((char *) ei);
return (NULLEDB);
}
if (ptr != 0)
*save = val;
return (ei);
}