|
|
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 t
Length: 2291 (0x8f3)
Types: TextFile
Names: »tb_getalias.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z«
└─⟦e5a54fb17⟧
└─⟦this⟧ »pp-5.0/Lib/table/tb_getalias.c«
/* tb_getalias.c: grab an alias */
# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/table/RCS/tb_getalias.c,v 5.0 90/09/20 16:15:07 pp Exp Locker: pp $";
# endif
/*
* $Header: /cs/research/pp/hubris/pp-beta/Lib/table/RCS/tb_getalias.c,v 5.0 90/09/20 16:15:07 pp Exp Locker: pp $
*
* $Log: tb_getalias.c,v $
* Revision 5.0 90/09/20 16:15:07 pp
* rcsforce : 5.0 public release
*
*/
#include "util.h"
#include <isode/cmd_srch.h>
#include "table.h"
#include "alias.h"
#define MAX_ALIAS_ARGS 5
static CMD_TABLE aliastbl_type[] = {
"822", ALIAS_822,
"x400", ALIAS_X400,
"synonym", ALIAS_SYNONYM,
"alias", ALIAS_PROPER,
"822-synonym", ALIAS_822_SYNONYM,
"x400-synonym", ALIAS_X400_SYNONYM,
0, -1
};
/* --------------------- Begin Routines -------------------------------- */
/*
This routine returns the values:
NOTOK - Table or routine error.
OK - Alias found in Table
DONE - Alias not found in Table (- alias is a proper user name)
*/
extern char *alias_tbl;
int tb_getalias (key, alias, subdom)
char *key;
ALIAS *alias;
char *subdom;
{
char *argv [MAX_ALIAS_ARGS],
buf [BUFSIZ], tblname[FILNSIZE];
Table *Alias = NULLTBL;
if (subdom == NULLCP || *subdom == '\0')
(void) sprintf(tblname,"%s", alias_tbl);
else
(void) sprintf(tblname,"%s-%s", subdom, alias_tbl);
PP_DBG (("Lib/tb_getalias (%s)", tblname));
if ((Alias = tb_nm2struct (tblname)) == NULLTBL) {
PP_OPER (NULLCP, ("Lib/tb_getalias (no table '%s')",tblname));
return (NOTOK);
}
if (tb_k2val (Alias, key, buf) == NOTOK)
return (DONE);
/* -- get alias arguments -- */
if (sstr2arg (buf, MAX_ALIAS_ARGS, argv, " ") == NOTOK)
return (NOTOK);
switch (alias->alias_type = cmd_srch (argv[0], aliastbl_type)) {
case ALIAS_822:
case ALIAS_X400:
case ALIAS_SYNONYM:
case ALIAS_PROPER:
case ALIAS_822_SYNONYM:
case ALIAS_X400_SYNONYM:
break;
default:
PP_LOG (LLOG_EXCEPTIONS,
("Lib/tb_getalias (err type=%d)", alias->alias_type));
return (NOTOK);
}
(void) strcpy (&alias->alias_user[0], argv[1]);
return (OK);
}