Plan 9 from Bell Labs’s /usr/web/sources/contrib/aiju/ncserv.c

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


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

void
main(int argc, char **argv)
{
	int f, g, rc;

	if(argc != 2 && argc != 3)
		sysfatal("usage: %s target [local]\n", argv[0]);
	f = open("/dev/kmesg", OREAD);
	if(f < 0) sysfatal("open /dev/kmesg: %r");
	g = dial(argv[1], argv[2], 0, 0);
	if(g < 0) sysfatal("dialing %s: %r", argv[1]);
	while(1) {
		char buf[512];
		rc = read(f, buf, sizeof buf);
		if(rc == 0) sleep(1);
		if(rc > 0)
			write(g, buf, rc);
	}
}

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].