Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/newnsquote/newns.c.0.backup

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: newns [-n namespace] [cmd [args...]]\n");
	exits("usage");
}

void
main(int argc, char **argv)
{
	char *nsfile;
	char *defargv[] = { "/bin/rc", "-i", nil };

	nsfile = "/lib/namespace";
	ARGBEGIN{
	case 'n':
		nsfile = ARGF();
		break;
	default:
		usage();
		break;
	}ARGEND
	if(argc == 0)
		argv = defargv;
	newns(getuser(), nsfile);
	exec(argv[0], argv);
	sysfatal("exec: %s: %r", argv[0]);
}	

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.