Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/snmp/ticks.c

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


/* plan9.c
 * Russ Cox <[email protected]>
 * 7 August 1997
 * 
 * system dependant routines for plan9.
 * stolen from other places
 */

#include <u.h>
#include <libc.h>

extern int chatty;
#define SIZE 1024

void
chat(char *fmt, ...)
{
	va_list v;

	if (!chatty)
		return;
	va_start(v, fmt);
	vfprint(2, fmt, v);
	va_end(v);
}

int
openlisten(char *addr)
{
	int fd, cfd;
	char devdir[40], data[60];

	cfd = announce(addr, devdir);
	if(cfd < 0)
		sysfatal("can't announce '%s'", addr);
	if(fprint(cfd, "headers") < 0)
		sysfatal("can't set header mode");

	sprint(data, "%s/data", devdir);
	fd = open(data, ORDWR);
	if(fd < 0)
		sysfatal("open udp data");
	return fd;
}


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].