Пример #1
0
int ttshell(unsigned char *cmd)
{
	int x, omode = ttymode;
	int stat= -1;
	unsigned char *s = (unsigned char *)getenv("SHELL");

	if (!s) {
		s = "/bin/sh";
		/* return; */
	}
	ttclsn();
	if ((x = fork()) != 0) {
		if (x != -1)
			wait(&stat);
		if (omode)
			ttopnn();
		return stat;
	} else {
		signrm();
		if (cmd)
			execl((char *)s, (char *)s, "-c", cmd, NULL);
		else {
			fprintf(stderr, (char *)joe_gettext(_("You are at the command shell.  Type 'exit' to return\n")));
			execl((char *)s, (char *)s, NULL);
		}
		_exit(0);
		return 0;
	}
}
Пример #2
0
int ttshell(unsigned char *cmd)
{
	int x, omode = ttymode;
	int stat= -1;
	unsigned char *s = (unsigned char *)getenv("SHELL");

	if (!s) {
		s = USTR "/bin/sh";
		/* return; */
	}
	ttclsn();
#ifdef HAVE_FORK
	if ((x = fork()) != 0) {
#else
	if ((x = vfork()) != 0) { /* For AMIGA only  */
#endif
		if (x != -1)
			wait(&stat);
		if (omode)
			ttopnn();
		return stat;
	} else {
		signrm();
		if (cmd)
			execl((char *)s, (char *)s, "-c", cmd, NULL);
		else {
			fprintf(stderr, (char *)joe_gettext(_("You are at the command shell.  Type 'exit' to return\n")));
			execl((char *)s, (char *)s, NULL);
		}
		_exit(0);
		return 0;
	}
}

/* Create keyboard task */

static void mpxresume(void)
{
	int fds[2];
	pipe(fds);
	acceptch = NO_MORE_DATA;
	have = 0;
	if (!(kbdpid = fork())) {
		close(fds[1]);
		do {
			unsigned char c;
			int sta;

			pack.who = 0;
			sta = joe_read(fileno(termin), &c, 1);
			if (sta == 0)
				pack.ch = NO_MORE_DATA;
			else
				pack.ch = c;
			pack.size = 0;
			joe_write(mpxsfd, &pack, sizeof(struct packet) - 1024);
		} while (joe_read(fds[0], &pack, 1) == 1);
		_exit(0);
	}
	close(fds[0]);
	ackkbd = fds[1];
}
Пример #3
0
void ttclose(void)
{
	ttclsn();
	signrm();
}