popen.c (33829) | popen.c (35474) |
---|---|
1/* 2 * Copyright (c) 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software written by Ken Arnold and 6 * published in UNIX Review, Vol. 6, No. 8. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; 40#endif 41static const char rcsid[] = | 1/* 2 * Copyright (c) 1988, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software written by Ken Arnold and 6 * published in UNIX Review, Vol. 6, No. 8. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 25 unchanged lines hidden (view full) --- 34 * SUCH DAMAGE. 35 */ 36 37#ifndef lint 38#if 0 39static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; 40#endif 41static const char rcsid[] = |
42 "$Id: popen.c,v 1.9 1997/11/21 07:38:43 charnier Exp $"; | 42 "$Id: popen.c,v 1.10 1998/02/25 07:10:57 danny Exp $"; |
43#endif /* not lint */ 44 45#include <sys/types.h> 46#include <sys/wait.h> 47 48#include <errno.h> 49#include <glob.h> 50#include <signal.h> --- 38 unchanged lines hidden (view full) --- 89 if ((pids = (int *)malloc((u_int)(fds * sizeof(int)))) == NULL) 90 return (NULL); 91 memset(pids, 0, fds * sizeof(int)); 92 } 93 if (pipe(pdes) < 0) 94 return (NULL); 95 96 /* break up string into pieces */ | 43#endif /* not lint */ 44 45#include <sys/types.h> 46#include <sys/wait.h> 47 48#include <errno.h> 49#include <glob.h> 50#include <signal.h> --- 38 unchanged lines hidden (view full) --- 89 if ((pids = (int *)malloc((u_int)(fds * sizeof(int)))) == NULL) 90 return (NULL); 91 memset(pids, 0, fds * sizeof(int)); 92 } 93 if (pipe(pdes) < 0) 94 return (NULL); 95 96 /* break up string into pieces */ |
97 for (argc = 0, cp = program; argc < MAXUSRARGS; cp = NULL) | 97 for (argc = 0, cp = program; argc < MAXUSRARGS; cp = NULL) { |
98 if (!(argv[argc++] = strtok(cp, " \t\n"))) 99 break; | 98 if (!(argv[argc++] = strtok(cp, " \t\n"))) 99 break; |
100 } 101 argv[argc - 1] = NULL; |
|
100 101 /* glob each piece */ 102 gargv[0] = argv[0]; 103 for (gargc = argc = 1; argv[argc] && gargc < (MAXGLOBARGS-1); argc++) { 104 glob_t gl; 105 int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE; 106 107 memset(&gl, 0, sizeof(gl)); --- 92 unchanged lines hidden --- | 102 103 /* glob each piece */ 104 gargv[0] = argv[0]; 105 for (gargc = argc = 1; argv[argc] && gargc < (MAXGLOBARGS-1); argc++) { 106 glob_t gl; 107 int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_QUOTE|GLOB_TILDE; 108 109 memset(&gl, 0, sizeof(gl)); --- 92 unchanged lines hidden --- |