Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/linuxemu/libc/linux/9/_main.c

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


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

char **environ;
extern int main(int, char**, ...);

void
_main(char *argv0, ...)
{
	char **argv, **p, **envv;
	int argc, envc;

	argc = 0;
	p = &argv0;
	for(argv = p; *p; p++)
		argc++;

	envc = 0;
	for(envv = p++; *p; p++)
		envc++;

	environ = envv;
	main(argc, argv, envv);
	_exits(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.