X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Trace-PostClient-IP: 68.147.131.211 From: Brian Inglis Newsgroups: comp.os.msdos.djgpp Subject: Re: system() return value if no program present Organization: Systematic Software Message-ID: <7b8rl0hfv6q3g3hq6i5uclvha49ta50hil@4ax.com> References: <01c49d67$Blat.v2.2.2$625a64a0 AT zahav DOT net DOT il> <42da7100 DOT 0409200424 DOT 59601f01 AT posting DOT google DOT com> <01c49f48$Blat.v2.2.2$03122900 AT zahav DOT net DOT il> <42da7100 DOT 0409210019 DOT 1af1c09d AT posting DOT google DOT com> <01c4a00c$Blat.v2.2.2$f8f56520 AT zahav DOT net DOT il> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Lines: 40 Date: Fri, 01 Oct 2004 18:29:00 GMT NNTP-Posting-Host: 24.71.223.147 X-Complaints-To: abuse AT shaw DOT ca X-Trace: pd7tw2no 1096655340 24.71.223.147 (Fri, 01 Oct 2004 12:29:00 MDT) NNTP-Posting-Date: Fri, 01 Oct 2004 12:29:00 MDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Fri, 01 Oct 2004 12:37:33 +0200 in comp.os.msdos.djgpp, Rafael García wrote: >Eli Zaretskii escribió: >>>>>When executed in my system I find myself in a new shell: >>>>> >>>>>Microsoft Windows XP [Versin 5.1.2600] >>>>>(C) Copyright 1985-2001 Microsoft Corp. >>>>> >>>>>c:\c> >>>> > >I have found the same problem in another computer and I have found that >this only happens when an environment variable "SHELL" is defined. If I >undefined it, no interactive shell is launched. > >set SHELL= > - system("grep")=2 and works as expected > - system("notexist")=0 and works as expected ("not found") > - system("dir")=0 and works as expected > >set SHELL=cmd > - system("grep")=2 and works as expected > - system("notexist")=-1 and works as expected ("not found") > - system("dir")=-1 and it does nothing (¿why?) > >set SHELL=c:\wtsrv\system32\cmd.exe (correct path) > - system("grep")=2 and works as expected > - system("notexist") runs interactive shell and then returns 0 (¿why?) > (this was what begun my question) > - system("dir") runs interactive shell and then returns 0 (¿why?) SHELL is expected to name a Unix like shell, COMSPEC is expected to name a DOS like shell, so your first setting is correct. -- Thanks. Take care, Brian Inglis Calgary, Alberta, Canada Brian DOT Inglis AT CSi DOT com (Brian[dot]Inglis{at}SystematicSW[dot]ab[dot]ca) fake address use address above to reply