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 t

⟦75e039f7a⟧ TextFile

    Length: 2173 (0x87d)
    Types: TextFile
    Names: »tb_getuser.c«

Derivation

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

TextFile

/* tb_getuser.c: grab an user */

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

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/table/RCS/tb_getuser.c,v 5.0 90/09/20 16:15:37 pp Exp Locker: pp $
 *
 * $Log:	tb_getuser.c,v $
 * Revision 5.0  90/09/20  16:15:37  pp
 * rcsforce : 5.0 public release
 * 
 */



#include        "util.h"
#include        "chan.h"
#include        "list_rchan.h"


#define         MAX_ALTERNATIVE_CHANS           20
#define		MAX_USER_ARGS			5

/* ---------------------  Begin  Routines  -------------------------------- */


extern char	*user_tbl, *loc_dom_mta;

LIST_RCHAN	*tb_getuser (key, subdom)
char            *key;
char		*subdom;
{

	char    *argv [MAX_ALTERNATIVE_CHANS],
		*subargv[MAX_USER_ARGS],
		buf [BUFSIZ],
		tblname[FILNSIZE];
	int	argc, i;
	Table	*User = NULLTBL;
	LIST_RCHAN	*chans = NULLIST_RCHAN, *tmp;

	if (subdom == NULLCP || *subdom == '\0')
		(void) sprintf(tblname,"%s", user_tbl);
	else
		(void) sprintf(tblname,"%s-%s", subdom, user_tbl);


	PP_DBG (("Lib/tb_getuser (%s)", tblname));


	if ((User = tb_nm2struct (tblname)) == NULLTBL) {
		PP_OPER (NULLCP, ("Lib/tb_getuser (no table '%s')", tblname));
		return (NULLIST_RCHAN);
	}

	if (tb_k2val (User, key, buf) == NOTOK)
		return (NULLIST_RCHAN);

	if ((argc = sstr2arg (buf, MAX_ALTERNATIVE_CHANS, argv, ",")) == NOTOK)
		return (NULLIST_RCHAN);

	for (i = 0; i < argc; i++) {
		if ((sstr2arg (argv[i], MAX_USER_ARGS, subargv, " ")) == NOTOK) {
			PP_LOG(LLOG_EXCEPTIONS,
			       ("Unable to parse delivery channels for '%s' in the user table '%s'",  
				key, tblname));
			list_rchan_free(chans);
			return NULLIST_RCHAN;
		}
		if ((tmp = list_rchan_new ((subargv[1] == NULLCP) ? loc_dom_mta : subargv[1],
					    NULLCP)) == NULLIST_RCHAN) {
			PP_LOG(LLOG_EXCEPTIONS,
			       ("Unable to find delivery channel '%s' for '%s' in the user table '%s'",  
				argv[0], key, tblname));
			list_rchan_free(chans);
			return NULLIST_RCHAN;
		}
		tmp -> li_chan = ch_nm2struct(subargv[0]);
		list_rchan_add (&chans, tmp);
	}
	return (chans);
}