Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <426DBB5D.5660669D@dessent.net> Date: Mon, 25 Apr 2005 20:54:05 -0700 From: Brian Dessent Organization: My own little world... MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: system() fails on pristine Windows systems References: <426D5CAB DOT 2070804 AT awcubed DOT com> <426DB60B DOT 9090004 AT awcubed DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Reply-To: cygwin AT cygwin DOT com Archie Warnock wrote: > Hmmm... you're right. Thanks. I was hoping the mention of /bin/sh was > more figurative - ie, just _a_ command interpreter. Guess not, eh? That is how system() works on every unix platform: "/bin/sh -c %s" > So, what would be the right way to call an external program from a > Cygwin program without installing Cygwin, if not system()? You could fork() and exec(), or just call one of the spawn() family of functions. This is all open source you know, you could look and see how system() is implemented in winsup/cygwin/syscalls.cc. > I also find it somewhat puzzling that it works on my development > machines even though /bin/sh isn't anywhere along in the path of the > Windows command shell. The path is irrelevent because it's called as "/bin/sh -c cmd", and the location of /bin is taken from the mount table. On your systems without Cygwin installed you could just mount /bin to point to a directory that contains sh.exe and it would work. Though I don't recommend that. If you can avoid not depending on the mount table it will probably make your program work better on systems without Cygwin installed. However, that's kind of off topic for this list, as people here don't really care about experiences of people that don't have Cygwin installed. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/