#include "V.h"
static char SCCS_misc[] = "@(#)misc 14/04/23";
/*
* This is John Chambers' attempt to fake the BSD stuff that snmpd uses
* but is missing on HP-UX and Silicon Graphics and possibly some others.
*/
#if defined(HP) || defined(SG)
/* We fake the syslog package by just writing to the debug output,
* which is stdout.
*/
char *syslogident = "?";
int   syslogpid = 0;

openlog(ident, logopt, facility)
	char *ident;
{
	Fpush("openlog");
	syslogident = ident;
	syslogpid = getpid();
	V3 "pid=%d ident=\"%s\"",syslogpid,syslogident D;
	Fpop;
	return(0);
}
syslog(priority, message, ARGLIST)
	char *message;
{
	printf("[%d:%d]",syslogpid,priority);
	if (syslogident)
		printf("%s ",syslogident);
	printf(message,ARGLIST);
	printf("\n");
	fflush(stdout);
}
/*
* These are "standard" routines that are missing on some Unix systems,
* including HP-UX.
*/
#ifdef NOTNOW	/* Replaced by macro in local.h */
/*
* Copy n bytes from b1 to b2.
*/
bcopy(b1,b2,n)
	char *b1, *b2;
{
	while(n-- > 0)
		*b2++ = *b1++;
}
#endif
/*
* Zero out n bytes at b1.
*/
bzero(b1,n)
	char *b1;
{
	while(n-- > 0)
	 	*b1++ = 0;
}
/*
* Return a pointer to the first occurrence of c in s,
* or NULL if it isn't found.
*/
char *
index(s,c)
	char*s;
	char c;
{	char x;

	Fpush("index");

	for (x = *s; x; x = *++s) {
		if (x == c) {

			Fpop;
			return(s);
		}
	}
	if (x == c) {

		Fpop;
		return(s);
	}

	Fpop;
	return((char*)0);
}
#endif HP
