popen.c (31329) | popen.c (33829) |
---|---|
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$"; | 42 "$Id: popen.c,v 1.9 1997/11/21 07:38:43 charnier 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> 51#include <stdio.h> 52#include <stdlib.h> 53#include <string.h> 54#include <unistd.h> 55 56#include "extern.h" 57#ifdef INTERNAL_LS 58#include "pathnames.h" | 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> 51#include <stdio.h> 52#include <stdlib.h> 53#include <string.h> 54#include <unistd.h> 55 56#include "extern.h" 57#ifdef INTERNAL_LS 58#include "pathnames.h" |
59#include <syslog.h> 60#include <varargs.h> |
|
59#endif 60 61#define MAXUSRARGS 100 62#define MAXGLOBARGS 1000 63 64/* 65 * Special version of popen which avoids call to shell. This ensures noone 66 * may create a pipe to a hidden program as a side effect of a list or dir --- 74 unchanged lines hidden (view full) --- 141 } 142 (void)close(pdes[1]); 143 } 144#ifdef INTERNAL_LS 145 if (strcmp(gargv[0], _PATH_LS) == 0) { 146 extern int optreset; 147 /* Reset getopt for ls_main() */ 148 optreset = optind = optopt = 1; | 61#endif 62 63#define MAXUSRARGS 100 64#define MAXGLOBARGS 1000 65 66/* 67 * Special version of popen which avoids call to shell. This ensures noone 68 * may create a pipe to a hidden program as a side effect of a list or dir --- 74 unchanged lines hidden (view full) --- 143 } 144 (void)close(pdes[1]); 145 } 146#ifdef INTERNAL_LS 147 if (strcmp(gargv[0], _PATH_LS) == 0) { 148 extern int optreset; 149 /* Reset getopt for ls_main() */ 150 optreset = optind = optopt = 1; |
151 /* Close syslogging to remove pwd.db missing msgs */ 152 closelog(); |
|
149 exit(ls_main(gargc, gargv)); 150 } 151#endif 152 execv(gargv[0], gargv); 153 _exit(1); 154 } 155 /* parent; assume fdopen can't fail... */ 156 if (*type == 'r') { --- 39 unchanged lines hidden --- | 153 exit(ls_main(gargc, gargv)); 154 } 155#endif 156 execv(gargv[0], gargv); 157 _exit(1); 158 } 159 /* parent; assume fdopen can't fail... */ 160 if (*type == 'r') { --- 39 unchanged lines hidden --- |