diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-02-15 20:00:58 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-02-15 20:00:58 (GMT) |
commit | 067ee3cfc7a79acd42cedb3f89713b9ed5f47f93 (patch) | |
tree | d5ea8d453754a1b971fadd965b8949a3a3d0de9a /src/util.cpp | |
parent | e0e5c8556b4713e7dad60537658cd411f8dfd858 (diff) | |
download | Doxygen-067ee3cfc7a79acd42cedb3f89713b9ed5f47f93.zip Doxygen-067ee3cfc7a79acd42cedb3f89713b9ed5f47f93.tar.gz Doxygen-067ee3cfc7a79acd42cedb3f89713b9ed5f47f93.tar.bz2 |
Release-1.3-rc3-20020215
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/src/util.cpp b/src/util.cpp index f7da9b5..94cf56e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -98,7 +98,7 @@ int iSystem(const char *command,const char *args,bool isBatchFile) if (command==0) return 1; -//#ifdef _OS_SOLARIS_ +#ifdef _OS_SOLARIS // for Solaris we use vfork since it is more memory efficient // on Solaris fork() duplicates the memory usage // so we use vfork instead @@ -131,38 +131,36 @@ int iSystem(const char *command,const char *args,bool isBatchFile) } 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 // Other Unices just use fork + + 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 // _OS_SOLARIS #else if (isBatchFile) |