Пример #1
0
extern int
main (int argc, char * argv[])
{
    atexit (resource_detection);

    return (xmain (argc, argv));
}
Пример #2
0
// main takes care of OS-specific startup and dispatches to xmain.
void
main(int argc, char **argv)
{
	Buf b;

	setvbuf(stdout, nil, _IOLBF, BUFSIZ);
	setvbuf(stderr, nil, _IOLBF, BUFSIZ);

	binit(&b);

	rfork(RFENVG);

	slash = "/";
	gohostos = "plan9";

	xgetenv(&b, "objtype");
	if(b.len == 0)
		fatal("$objtype is unset");
	gohostarch = btake(&b);

	xgetenv(&b, "GOBIN");
	if(b.len == 0){
		bpathf(&b, "/%s/bin", gohostarch);
		xsetenv("GOBIN", bstr(&b));
	}

	srand(time(0)+getpid());
	init();
	xmain(argc, argv);

	bfree(&b);
	exits(nil);
}
Пример #3
0
// main takes care of OS-specific startup and dispatches to xmain.
int
main(int argc, char **argv)
{
	Buf b;
	struct utsname u;

	setvbuf(stdout, nil, _IOLBF, 0);
	setvbuf(stderr, nil, _IOLBF, 0);

	binit(&b);
	
	slash = "/";

#if defined(__APPLE__)
	gohostos = "darwin";
	// Even on 64-bit platform, darwin uname -m prints i386.
	run(&b, nil, 0, "sysctl", "machdep.cpu.extfeatures", nil);
	if(contains(bstr(&b), "EM64T"))
		gohostarch = "amd64";
#elif defined(__linux__)
	gohostos = "linux";
#elif defined(__FreeBSD__)
	gohostos = "freebsd";
#elif defined(__FreeBSD_kernel__)
	// detect debian/kFreeBSD. 
	// http://wiki.debian.org/Debian_GNU/kFreeBSD_FAQ#Q._How_do_I_detect_kfreebsd_with_preprocessor_directives_in_a_C_program.3F
	gohostos = "freebsd";	
#elif defined(__OpenBSD__)
	gohostos = "openbsd";
#elif defined(__NetBSD__)
	gohostos = "netbsd";
#else
	fatal("unknown operating system");
#endif

	if(gohostarch == nil) {
		if(uname(&u) < 0)
			fatal("uname: %s", strerror(errno));
		if(contains(u.machine, "x86_64") || contains(u.machine, "amd64"))
			gohostarch = "amd64";
		else if(hassuffix(u.machine, "86"))
			gohostarch = "386";
		else if(contains(u.machine, "arm"))
			gohostarch = "arm";
		else
			fatal("unknown architecture: %s", u.machine);
	}

	if(strcmp(gohostarch, "arm") == 0)
		maxnbg = 1;

	init();
	xmain(argc, argv);
	bfree(&b);
	return 0;
}
Пример #4
0
int main(int argc, char **argv) {
	redisClient * c = NULL;
	int i, j, iterator_max;

	z_usage(argc, argv);

	xmain(argc, argv);
	xmain_noOptions(argc, argv);
	c = createClient(0);
	if(!c) errx(-1, "main:createClient:Failed");

	iterator_max = atoi(argv[1]);
	for(i = 0; i < iterator_max; i++) {
		
		for(j = 2; j < argc; j++) {
			z_apply_op(c, i, j, ops, (sizeof(ops)/sizeof(z_ops))-1, argv[j]);
		}
	}

	saveCommand(c);
}