|
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: 3057 (0xbf1) Types: TextFile Names: »syn_orname.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« └─⟦e5a54fb17⟧ └─⟦this⟧ »pp-5.0/Chans/dirlist/syn_orname.c«
/* syn_orname.c: */ # ifndef lint static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_orname.c,v 5.0 90/09/20 15:46:10 pp Exp Locker: pp $"; # endif /* * $Header: /cs/research/pp/hubris/pp-beta/Chans/dirlist/RCS/syn_orname.c,v 5.0 90/09/20 15:46:10 pp Exp Locker: pp $ * * $Log: syn_orname.c,v $ * Revision 5.0 90/09/20 15:46:10 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" extern OR_ptr orAddr_parse(); extern OR_ptr or_cpy(); orName_free (a) ORName * a; { if (a->on_dn != NULLDN) dn_free (a->on_dn); if (a->on_or != NULLOR) or_free (a->on_or); free ((char *) a); } ORName * orName_parse (str) char * str; { ORName * or; char * ptr; or = (ORName *) smalloc (sizeof (ORName)); if ( (ptr=index (str,'$')) == NULLCP) { if ((or->on_dn = str2dn (str)) == NULLDN) return (NULLORName); or->on_or = NULLOR; return or; } *ptr--= 0; if (isspace (*ptr)) { *ptr = 0; } ptr++; ptr++; if (*str == 0) or->on_dn = NULLDN; else if ((or->on_dn = str2dn (str)) == NULLDN) return (NULLORName); ptr = SkipSpace(ptr); if (*ptr == 0) or->on_or = NULLOR; else if ((or->on_or = orAddr_parse (ptr)) == NULLOR) return (NULLORName); return (or); } orName_print (ps,or,format) PS ps; ORName * or; int format; { if (or->on_dn != NULLDN) { dn_print (ps,or->on_dn,format); if ((format == UFNOUT) || format == READOUT) return; } if ((format != READOUT) && (format != UFNOUT)) ps_print (ps," $ "); else if (or->on_dn == NULLDN) ps_print (ps,"X.400 Address: "); if (or->on_or) orAddr_print (ps,or->on_or,format); } ORName * orName_cpy (a) ORName * a; { ORName * top; top = (ORName *) smalloc (sizeof (ORName)); top->on_or = or_cpy (a->on_or); top->on_dn = dn_cpy (a->on_dn); return (top); } orName_cmp (a,b) ORName *a, *b; { int res; if ( a == NULLORName) return (b == NULLORName ? 0 : -1); if ( b == NULLORName) return 1; if ((res = dn_cmp (a->on_dn,b->on_dn)) == 0) return orAddr_cmp (a->on_or,b->on_or); else return res; } orName_cmp_user (a,b) ORName *a, *b; { /* IF DN's equal -> match OK */ if ((a->on_dn == NULLDN) || (b->on_dn == NULLDN)) return orAddr_cmp (a->on_or,b->on_or); return dn_cmp (a->on_dn,b->on_dn); } static ORName * orName_dec (pe) PE pe; { ORName * m; m = (ORName *) smalloc (sizeof (ORName)); bzero ((char *)m,sizeof (ORName)); if (decode_MAS_ORName (pe,1,NULLIP,NULLVP,m) == NOTOK) { free ((char *)m); return (NULLORName); } #if ISODE < 65 if (m->on_dn != NULLDN) (void) dn_decode (m->on_dn); #endif return (m); } static PE orName_enc (m) ORName * m; { PE ret_pe; (void) encode_MAS_ORName (&ret_pe,0,0,NULLCP,m); return (ret_pe); } orName_syntax () { (void) add_attribute_syntax ("ORName", (IFP) orName_enc, (IFP) orName_dec, (IFP) orName_parse, orName_print, (IFP) orName_cpy, orName_cmp, orName_free, NULLCP, NULLIFP, TRUE); }