コード例 #1
0
int main(int argc, char *argv[]) {

    pager = getenv("PAGER");

    if (pager == NULL)
        pager = "less";

    /* Set number of processes and pipes depending on if we should run grep */
    args = (argc > 1) ? 1 : 0;
    num_procs = 3 + args;
    num_pipes = 2 + args;

    pipes_init();

    exec_proc(STDIN_FILENO, pipes[0][1], "printenv", argv); 

    if (args) {

        exec_proc(pipes[0][0], pipes[args][1], "grep", argv);
    }
    exec_proc(pipes[args][0], pipes[1 + args][1], "sort", argv);

    exec_proc(pipes[1 +args][0], STDOUT_FILENO, "less", argv);

    close_all_fd();

    wait_for_kids();

    return 0;
}
コード例 #2
0
ファイル: process.c プロジェクト: maisvendoo/phantomex
/*-----------------------------------------------------------------------------
 *
 *---------------------------------------------------------------------------*/
process_t* usr_exec(char* name)
{
	return exec_proc(name, false);
}
コード例 #3
0
ファイル: shell.c プロジェクト: synthdnb/WebShell
void execute(char *cmd) {
    proc_list *proclist = parse_proc(cmd);
    exec_proc(proclist);
    free_proc(proclist);
}