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 m

⟦b57305f45⟧ TextFile

    Length: 1307 (0x51b)
    Types: TextFile
    Names: »misc.c«

Derivation

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

TextFile

/* misc.c: misc routines required by qmgr */

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

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Src/qmgr/RCS/misc.c,v 5.0 90/09/20 16:21:23 pp Exp Locker: pp $
 *
 * $Log:	misc.c,v $
 * Revision 5.0  90/09/20  16:21:23  pp
 * rcsforce : 5.0 public release
 * 
 */



#include "types.h"

int	hash (str, n)
char	*str;
int	n;
{
	int	res = 0;
	char	*cp;

	for (cp = str; *cp; cp++) {
		res = 3 * res + *cp;
		res %= n;
	}
	return res;
}

void cache_set (cp, utct)
Cache	*cp;
struct type_UNIV_UTCTime *utct;
{
	cp -> cachetime = utcqb2time_t (utct);
	cp -> cacheplus = 0;
}

void cache_clear (cp)
Cache *cp;
{
	cp -> cachetime = cp -> cacheplus = 0;
}

void cache_inc (cp, factor)
Cache *cp;
time_t	factor;
{
	int rfact;

	if (cp -> cacheplus < CACHE_MAX)
		cp -> cacheplus ++;
	cp -> cachetime = current_time + factor * cp -> cacheplus;

	/* round up the cache time - helps cluster mta's etc. */
	rfact = (factor/10) * cp -> cacheplus;
	cp -> cachetime += rfact - cp -> cachetime % rfact;
}

time_t	utcqb2time_t (qb)
struct qbuf *qb;
{
	char *p = qb2str (qb);
	UTC	ut;
	time_t	t;

	ut = str2utct(p, strlen (p));
	t = utc2time_t (ut);
	free (p);
	return t;
}