示例#1
0
文件: main.c 项目: asegid/rhombus
int fish_exec_fg(int argc, char **argv, FILE *in, FILE *out, FILE *err) {
	char const **_argv;
	int pid;

	pid = fork();
	if (pid == 0) {
		if (in)  stdin  = in;
		if (out) stdout = out;
		if (err) stderr = err;

		_argv = malloc(sizeof(char*) * (argc + 1));
		memcpy(_argv, argv, sizeof(char*) * argc);
		_argv[argc] = NULL;

		if (execvp(_argv[0], _argv)) {
			if (errno == ENOENT) {
				fprintf(stderr, "%s: %s: command not found\n", getname_s(), argv[0]);
			}
			else {
				perror(argv[0]);
			}
			
			abort();
		}
	}
	frcall(stdout->fd, AC_WRITE, "set_fgjob %d", pid);
	waitpid(pid, NULL, 0);
	frcall(stdout->fd, AC_WRITE, "set_fgjob %d", 0);
	
	return 0;
}
示例#2
0
文件: main.c 项目: jrepan/rhombus
int main(int argc, char **argv) {
	
	frcall(stdout->fd, "clear");
	
	return 0;
}