/* isoalias.c - application entity info -- directory service utilities */
static char *rcsid
= "$Header: /f/osi/acsap/RCS/isoalias.c,v 7.2 91/02/22 09:14:41 mrose Interim $";
* $Header: /f/osi/acsap/RCS/isoalias.c,v 7.2 91/02/22 09:14:41 mrose Interim $
* Revision 7.2 91/02/22 09:14:41 mrose
* Revision 7.1 90/01/11 18:35:01 mrose
* Revision 7.0 89/11/23 21:22:12 mrose
* 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
static char *isoaliases
= "isoaliases";
(((nm)[1]) ? (((chrcnv[((nm)[0])] - chrcnv[((nm)[1])]) & 0x1f) \
+ ((chrcnv[(nm)[2]]) & 0x5f)) \
: (chrcnv[(nm)[0]]) & 0x7f)
static struct pair
*Pbuckets
[PBUCKETS
];
for (p
= Pbuckets
[PHASH (name
)];
p
&& lexequ (p
-> p_name
, name
);
return (p
? p
-> p_value
: NULL
);
static int read_aliases ()
bzero ((char *) Pbuckets
, sizeof Pbuckets
);
read_file (isodefile (isoaliases
, 0));
if ((hp
= getenv ("HOME")) == NULL
)
(void) sprintf (buffer
, "%s/.isode_aliases", hp
);
static int read_file (file
)
if ((fp
= fopen (file
, "r")) == NULL
)
while (fgets (buffer
, sizeof buffer
, fp
)) {
if (cp
= index (buffer
, '\n'))
if (str2vec (buffer
, vec
) < 2)
if (add_alias (vec
[0], vec
[1]) == NOTOK
)
int add_alias (name
, value
)
if ((p
= (struct pair
*) calloc (1, sizeof *p
)) == NULL
) {
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
,
("calloc of alias structure failed"));
if ((p
-> p_name
= malloc ((unsigned) (strlen (name
) + 1))) == NULL
|| (p
-> p_value
= malloc ((unsigned) (strlen (value
) + 1)))
SLOG (addr_log
, LLOG_EXCEPTIONS
, NULLCP
,
("malloc of alias structure failed"));
(void) strcpy (p
-> p_name
, name
);
(void) strcpy (p
-> p_value
, value
);
p
-> p_chain
= Pbuckets
[i
= PHASH (p
-> p_name
)];