Ejemplo n.º 1
0
static void		ft_cmd4(t_env *e, char cmd[], int fd)
{
	if (e->clients[fd].i_action < 10 && !ft_strcmp("fork", cmd))
		prefork(e, fd, cmd);
	else if (e->clients[fd].i_action < 10 && !ft_strcmp("expulse", cmd))
		preexpulse(e, fd, cmd);
}
Ejemplo n.º 2
0
int main(int argc, char **argv)
{
	int nchildren = 1;
	int c;

	while ((c = getopt(argc, argv, "c:")) != -1) {
		switch (c) {
			case 'c':
				nchildren = atoi(optarg);
				break;
			case '?':
				if (optopt == 'c')
					fprintf(stderr, "Option -%c requires an argument.\n", optopt);
				else if (isprint(optopt))
					fprintf(stderr, "Unknown option `-%c'.\n", optopt);
				else
					fprintf(stderr,
						"Unknown option character `\\x%x'.\n",
						optopt);
				return 1;
			default:
				abort();
		}
	}

	prefork(nchildren);
	fcgiwrap_main();
	return 0;
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
	int nchildren = 1;
	char *socket_url = NULL;
	int c;

	while ((c = getopt(argc, argv, "c:hfs:")) != -1) {
		switch (c) {
			case 'f':
				stderr_to_fastcgi++;
				break;
			case 'h':
				printf("Usage: %s [OPTION]\nInvokes CGI scripts as FCGI.\n\n"
					PACKAGE_NAME" version "PACKAGE_VERSION"\n\n"
					"Options are:\n"
					"  -c <number>\t\tNumber of processes to prefork\n"
					"  -s <socket_url>\tSocket to bind to (say -s help for help)\n"
					"  -h\t\t\tShow this help message and exit\n"
					"\nReport bugs to Grzegorz Nosek <"PACKAGE_BUGREPORT">.\n"
					PACKAGE_NAME" home page: <http://nginx.localdomain.pl/wiki/FcgiWrap>\n",
					argv[0]
				);
				return 0;
			case 'c':
				nchildren = atoi(optarg);
				break;
			case 's':
				socket_url = strdup(optarg);
				break;
			case '?':
				if (optopt == 'c' || optopt == 's')
					fprintf(stderr, "Option -%c requires an argument.\n", optopt);
				else if (isprint(optopt))
					fprintf(stderr, "Unknown option `-%c'.\n", optopt);
				else
					fprintf(stderr,
						"Unknown option character `\\x%x'.\n",
						optopt);
				return 1;
			default:
				abort();
		}
	}

	if (socket_url) {
		if (setup_socket(socket_url) < 0) {
			return 1;
		}
		free(socket_url);
	}

	prefork(nchildren);
	fcgiwrap_main();
	return 0;
}
Ejemplo n.º 4
0
void
singsub(char **s)
{
    LinkList foo;

    foo = newlinklist();
    addlinknode(foo, *s);
    prefork(foo, 4);
    if (errflag)
	return;
    *s = (char *) ugetnode(foo);
    DPUTS(nonempty(foo), "BUG: singsub() produced more than one word!");
}
Ejemplo n.º 5
0
Archivo: cond.c Proyecto: AMDmi3/zsh
static void cond_subst(char **strp, int glob_ok)
{
    if (glob_ok &&
	checkglobqual(*strp, strlen(*strp), 1, NULL)) {
	LinkList args = newlinklist();
	addlinknode(args, *strp);
	prefork(args, 0, NULL);
	while (!errflag && args && nonempty(args) &&
	       has_token((char *)peekfirst(args)))
	    zglob(args, firstnode(args), 0);
	*strp = sepjoin(hlinklist2array(args, 0), NULL, 1);
    } else
	singsub(strp);
}
Ejemplo n.º 6
0
int
multsub(char **s, char ***a, int *isarr, char *sep)
{
    LinkList foo;
    int l;
    char **r, **p;

    foo = newlinklist();
    addlinknode(foo, *s);
    prefork(foo, 0);
    if (errflag) {
	if (isarr)
	    *isarr = 0;
	return 0;
    }
    if ((l = countlinknodes(foo)) > 1) {
	p = r = ncalloc((l + 1) * sizeof(char*));
	while (nonempty(foo))
	    *p++ = (char *)ugetnode(foo);
	*p = NULL;
	if (a) {
	    *a = r;
	    *isarr = 1;
	    return 0;
	}
	*s = sepjoin(r, NULL);
	return 0;
    }
    if (l)
	*s = (char *) ugetnode(foo);
    else
	*s = dupstring("");
    if (isarr)
	*isarr = 0;
    return !l;
}