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 l

⟦53268ff01⟧ TextFile

    Length: 2625 (0xa41)
    Types: TextFile
    Names: »list_rchan.c«

Derivation

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

TextFile

/* list_rchan.c: utility routines for struct LIST_REFORMAT */

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

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



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



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


/*
Creates a new list structure
*/

LIST_RCHAN*  list_rchan_new (site, chan)
char    *site;
char    *chan;
{
	LIST_RCHAN      *list;

	PP_DBG (("Lib/pp/list_rchan_new (%s, %s)", site, chan));

	if (site == NULLCP && chan == NULLCP)
		return (NULLIST_RCHAN);

	list = list_rchan_malloc ();

	if (list == NULLIST_RCHAN)
		return (NULLIST_RCHAN);

	if (chan) {
		list -> li_chan  = ch_nm2struct (chan);
		if (list -> li_chan == NULLCHAN) {
			PP_LOG (LLOG_EXCEPTIONS,
				("Chan %s not known", chan));
		      return (NULLIST_RCHAN);
		}
		PP_DBG (("Channel '%s' added", list -> li_chan -> ch_name));
	}

	if (site)
		list -> li_mta = strdup (site);

	return (list);
}



/*
Sets the channel part in the list structure
*/

int list_rchan_schan (list, chan)
LIST_RCHAN      *list;
char            *chan;
{

	PP_DBG (("Lib/pp/list_rchan_schan (%s)", chan));

	if (chan == NULLCP)  return (NOTOK);

	if ((list -> li_chan  = ch_nm2struct (chan)) == NULLCHAN)
		return (NOTOK);

	return (OK);
}



/*
Sets the site/mta info of the list structure
*/


int list_rchan_ssite (list, site)
LIST_RCHAN      *list;
char            *site;
{

	PP_DBG (("Lib/pp/list_rchan_ssite (%s)", site));

	if (site == NULLCP)  return (NOTOK);
	list -> li_mta = strdup (site);
	return (OK);
}



/*
Adds item onto the end of base
*/

void list_rchan_add (base, new)
LIST_RCHAN      **base,
		*new;
{
	LIST_RCHAN      *rp = *base;

	if (rp == NULLIST_RCHAN)
		*base = new;
	else {
		while (rp->li_next != NULLIST_RCHAN)
			rp = rp->li_next;
		rp->li_next = new;
	}
}

/*
Do not free the CHAN ptr because set by ch_all[]
*/

void list_rchan_free (list)
LIST_RCHAN      *list;
{
	if (list == NULLIST_RCHAN)  return;
	if (list -> li_next)
		list_rchan_free (list->li_next);
	if (list -> li_mta)
		free (list -> li_mta);

	free ((char *)list);
}


LIST_RCHAN *list_rchan_malloc()
{
	LIST_RCHAN      *new;

	new = (LIST_RCHAN*) smalloc (sizeof (LIST_RCHAN));

	new->li_mta	= NULLCP;
	new->li_chan	= NULLCHAN;
	new->li_auth	= NULL_AUTH;
	new->li_next	= NULLIST_RCHAN;
	return (new);
}