From bfdce4d192a946521d54079cf15b9da79ab1316e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 7 Apr 2009 16:04:28 +0200 Subject: remove now unused util.[ch] --- src/util.c | 61 ------------------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/util.c (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c deleted file mode 100644 index 885538f..0000000 --- a/src/util.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2007 Johannes Hofmann - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - */ - -#include -#include -#include - -#include "util.h" - -FILE * -pexecvp(const char *file, char *const argv[], pid_t *pid, char *type) { - FILE *iop; - int pdes[2]; - - if (pipe(pdes) < 0) { - return NULL; - } - - *pid = fork(); - - if (*pid == -1) { - perror("vfork"); - close(pdes[0]); - close(pdes[1]); - return NULL; - } else if (*pid == 0) { - /* child */ - - if (*type == 'r') { - close(pdes[0]); - if (pdes[1] != STDOUT_FILENO) { - dup2(pdes[1], STDOUT_FILENO); - close(pdes[1]); - } - } else { - close(pdes[1]); - if (pdes[0] != STDIN_FILENO) { - dup2(pdes[0], STDIN_FILENO); - close(pdes[0]); - } - } - - execvp(file, argv); - _exit(127); - } else { - /* parent */ - if (*type == 'r') { - iop = fdopen(pdes[0], "r"); - close(pdes[1]); - } else { - iop = fdopen(pdes[1], "w"); - close(pdes[0]); - } - return iop; - } -} -- cgit v1.2.3