/* plan9.c
* Russ Cox <rsc@research.att.com>
* 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;
}
|