diff options
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/util.c | 61 | ||||
-rw-r--r-- | src/util.h | 23 |
3 files changed, 2 insertions, 88 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5686c2b..a9fe688 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,8 +2,6 @@ bin_PROGRAMS = gipfel gipfel_SOURCES = \ gipfel.cxx \ - util.c \ - strsep.c \ GipfelWidget.cxx \ Panorama.cxx \ ProjectionLSQ.cxx \ @@ -19,7 +17,8 @@ gipfel_SOURCES = \ TIFFOutputImage.cxx \ PreviewOutputImage.cxx \ ImageMetaData.cxx \ - ScreenDump.cxx + ScreenDump.cxx \ + strsep.c noinst_HEADERS = \ GipfelWidget.H \ @@ -41,5 +40,4 @@ noinst_HEADERS = \ PreviewOutputImage.H \ ImageMetaData.H \ ScreenDump.H \ - util.h \ strsep.h 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 <Johannes.Hofmann@gmx.de> - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - */ - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> - -#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; - } -} diff --git a/src/util.h b/src/util.h deleted file mode 100644 index f30047e..0000000 --- a/src/util.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2006 Johannes Hofmann <Johannes.Hofmann@gmx.de> - * - * This software may be used and distributed according to the terms - * of the GNU General Public License, incorporated herein by reference. - */ -#ifndef _UTIL_H_ -#define _UTIL_H_ - -#include <stdio.h> - -#ifdef __cplusplus -extern "C" { -#endif - - FILE * - pexecvp(const char *file, char *const argv[], pid_t *pid, char *type); - -#ifdef __cplusplus -} -#endif - -#endif |