Plan 9 from Bell Labs’s /usr/web/sources/plan9/sys/src/9/boot/testboot.c

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


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

void
usage(void)
{
	fprint(2, "usage: testboot cmd args...\n");
	exits("usage");
}

void
main(int argc, char **argv)
{
	int p[2];

	if(argc == 1)
		usage();

	pipe(p);
	switch(rfork(RFPROC|RFFDG|RFNAMEG)){
	case -1:
		sysfatal("fork: %r");

	case 0:
		dup(p[0], 0);
		dup(p[1], 1);
		exec(argv[1], argv+1);
		sysfatal("exec: %r");

	default:
		if(amount(p[0], "/n/kremvax", MREPL, "") < 0)
			sysfatal("amount: %r");
		break;
	}
	exits(nil);
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.