summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2003-01-19 21:02:02 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2003-01-19 21:02:02 (GMT)
commit92792d3adc9011f35467341eb535ed3580ddb901 (patch)
treea3abc0d2a3da492a873fd59a140684da6a15924e /src/util.cpp
parentf781e6dbbaa51edbdbe9b5906be9962968d0ee68 (diff)
downloadDoxygen-92792d3adc9011f35467341eb535ed3580ddb901.zip
Doxygen-92792d3adc9011f35467341eb535ed3580ddb901.tar.gz
Doxygen-92792d3adc9011f35467341eb535ed3580ddb901.tar.bz2
Release-1.3-rc2-20030119
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp88
1 files changed, 64 insertions, 24 deletions
diff --git a/src/util.cpp b/src/util.cpp
index b0b2244..f7da9b5 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2002 by Dimitri van Heesch.
+ * Copyright (C) 1997-2003 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
@@ -94,36 +94,76 @@ int iSystem(const char *command,const char *args,bool isBatchFile)
#ifndef _WIN32
isBatchFile=isBatchFile;
/*! taken from the system() manpage on my Linux box */
- int pid,status;
+ int pid,status=0;
if (command==0) return 1;
- pid = fork();
- if (pid==-1) return -1;
- if (pid==0)
- {
- char buf[4096];
- strcpy(buf,command);
- strcat(buf," ");
- strcat(buf,args);
- const char * argv[4];
- argv[0] = "sh";
- argv[1] = "-c";
- argv[2] = buf;
- argv[3] = 0;
- execve("/bin/sh",(char * const *)argv,environ);
- exit(127);
+
+//#ifdef _OS_SOLARIS_
+
+ // on Solaris fork() duplicates the memory usage
+ // so we use vfork instead
+
+ char buf[4096];
+ strcpy(buf,command);
+ strcat(buf," ");
+ strcat(buf,args);
+
+ // spawn shell
+ if ((pid=vfork())<0)
+ {
+ status=-1;
}
- for (;;)
+ else if (pid==0)
{
- if (waitpid(pid,&status,0)==-1)
- {
- if (errno!=EINTR) return -1;
- }
- else
+ execl("/bin/sh","sh","-c",buf,(char*)0);
+ _exit(127);
+ }
+ else
+ {
+ while (waitpid(pid,&status,0 )<0)
{
- return status;
+ if (errno!=EINTR)
+ {
+ status=-1;
+ break;
+ }
}
}
+ return status;
+
+//#else /* Other unices where clients do copy on demand for the parent's pages
+// * when forked.
+// */
+//
+// pid = fork();
+// if (pid==-1) return -1;
+// if (pid==0)
+// {
+// char buf[4096];
+// strcpy(buf,command);
+// strcat(buf," ");
+// strcat(buf,args);
+// const char * argv[4];
+// argv[0] = "sh";
+// argv[1] = "-c";
+// argv[2] = buf;
+// argv[3] = 0;
+// execve("/bin/sh",(char * const *)argv,environ);
+// exit(127);
+// }
+// for (;;)
+// {
+// if (waitpid(pid,&status,0)==-1)
+// {
+// if (errno!=EINTR) return -1;
+// }
+// else
+// {
+// return status;
+// }
+// }
+//#endif
+
#else
if (isBatchFile)
{