2 * fpopen.c --- unlike the libc popen, it directly executes the
3 * command instead of call out to the shell.
15 extern FILE *fpopen(const char *cmd, const char *mode);
17 FILE *fpopen(const char *cmd, const char *mode)
45 * Create the argv vector....
47 buf = malloc(strlen(cmd)+1);
73 /* Fork and execute the correct program. */
74 if ((pid = fork()) < 0) {
77 } else if (pid == 0) {
85 (void) execvp(prog, argv);
89 return fdopen(do_stdin ? fds[1] : fds[0], mode);