Deleted Added
full compact
prgbox.c (241818) prgbox.c (244850)
1/*
1/*
2 * $Id: prgbox.c,v 1.8 2011/10/20 23:42:32 tom Exp $
2 * $Id: prgbox.c,v 1.7 2011/06/30 20:44:13 tom Exp $
3 *
4 * prgbox.c -- implements the prg box
5 *
6 * Copyright 2011 Thomas E. Dickey
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License, version 2.1
10 * as published by the Free Software Foundation.

--- 15 unchanged lines hidden (view full) ---

26/*
27 * Open a pipe which ties stderr and stdout together.
28 */
29static FILE *
30dlg_popen(const char *command, const char *type)
31{
32 FILE *result = 0;
33 int fd[2];
3 *
4 * prgbox.c -- implements the prg box
5 *
6 * Copyright 2011 Thomas E. Dickey
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License, version 2.1
10 * as published by the Free Software Foundation.

--- 15 unchanged lines hidden (view full) ---

26/*
27 * Open a pipe which ties stderr and stdout together.
28 */
29static FILE *
30dlg_popen(const char *command, const char *type)
31{
32 FILE *result = 0;
33 int fd[2];
34 int pid;
34 const char *argv[4];
35
36 if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) {
35 const char *argv[4];
36
37 if ((*type == 'r' || *type != 'w') && pipe(fd) == 0) {
37 switch (fork()) {
38 switch (pid = fork()) {
38 case -1: /* Error. */
39 (void) close(fd[0]);
40 (void) close(fd[1]);
41 break;
42 case 0: /* child. */
43 if (*type == 'r') {
44 if (fd[1] != STDOUT_FILENO) {
45 (void) dup2(fd[1], STDOUT_FILENO);

--- 63 unchanged lines hidden ---
39 case -1: /* Error. */
40 (void) close(fd[0]);
41 (void) close(fd[1]);
42 break;
43 case 0: /* child. */
44 if (*type == 'r') {
45 if (fd[1] != STDOUT_FILENO) {
46 (void) dup2(fd[1], STDOUT_FILENO);

--- 63 unchanged lines hidden ---