#ifndef lint
static char *RCSid = "$Header: /usr/brule/guest/empire/empire/emprcs/lib/gen/hpux.c,v 2.0 1995/07/27 05:56:17 empire Exp $";
#endif

/*
 * hpux.c
 *
 * hpux dependencies
 *
 */

#include "misc.h"

#ifdef hpux
#include <stdio.h>

setbuffer(fp, buf, size)
	FILE	*fp;
	s_char	*buf;
	int	size;
{
	if (size > BUFSIZ)
		setbuf(fp, buf);
	/* XXX else report error */
}

s_char *
rindex(sp, c)
	register s_char *sp;
	register int c;
{
	register s_char *r;

	r = NULL;
	do {
		if (*sp == c)
			r = sp;
	} while (*sp++);
	return r;
}

s_char *
index(sp, c)
	register s_char *sp;
	register int c;
{
	do {
		if (*sp == c)
			return (sp);
	} while (*sp++);
	return NULL;
}

int
ffs(mask)
	register unsigned mask;
{
	register unsigned bit;
	register int i;

	if (mask == 0)
		return 0;
	for (bit=1, i=1; i <= 32; i++, bit <<= 1)
		if (mask & bit)
			return i;
	return 0;
}
#endif
