From 676ba063252eb60049e772df52a6fd687e89461b Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 30 Oct 2006 21:22:43 +0100 Subject: more copyright simplification --- src/util.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index f33c1b4..df3126d 100644 --- a/src/util.c +++ b/src/util.c @@ -1,26 +1,9 @@ -/* - * "$Id: util.c,v 1.1 2005/02/28 17:56:51 hofmann Exp $" +/* + * Copyright 2006 Johannes Hofmann * - * flpsed program. - * - * Copyright 2005 by Johannes Hofmann - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. */ - #include #include #include -- cgit v1.2.3 From f8fb82ba705f6314d502b8efc8f03ecd16b8bed8 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 30 Oct 2006 22:27:04 +0100 Subject: more reindent --- src/util.c | 82 +++++++++++++++++++++++++++++++------------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index df3126d..7a31712 100644 --- a/src/util.c +++ b/src/util.c @@ -12,48 +12,48 @@ FILE * pexecvp(const char *file, char *const argv[], pid_t *pid, char *type) { - FILE *iop; - int pdes[2]; + FILE *iop; + int pdes[2]; - if (pipe(pdes) < 0) { - return NULL; - } - - *pid = vfork(); + if (pipe(pdes) < 0) { + return NULL; + } - 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]); - } - } + *pid = vfork(); - 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; - } + 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