X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:in-reply-to:mime-version:content-type:references :x-google-sender-auth; bh=M3bmMbaYevVMKGxgNGUK1RNvzrNJKbRiBxbj90179T4=; b=v+eaO3wI6AKOlOW2CfCruDUdxL5kzRz2T4PDFkcKIaFOv5FWP/7FwogJdth04Wrl1U nYUtqDSP7ln1DL29ZYApPF3xrE3YbpBWTTyjS/z68euQWyCXxCzq6MPq/flzcv0AgsRY YP3BhvKlNUVxgRLobFO1cHjX6TcTBkbwP2miU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:in-reply-to:mime-version :content-type:references:x-google-sender-auth; b=RMc7J3oEJwrh0u5maB/ReLzYiIrBdOO5Bb+YbEf85AImD0ToF9blzGANrzogXw77Zd ScgpiQZkhNvuz0Q4JyTIN5o27bOROHpY6+Z50yvmqX+e5sJxvNczGVQgaqoOh7ZYUjiA o0ysAz1cviq1nBvyXeZ/iASxiAsDF2Ecg7Etk= Message-ID: <9af855b0809210048h192a03b2s7f350ae2dcb61541@mail.gmail.com> Date: Sun, 21 Sep 2008 09:48:07 +0200 From: "Gerrit van Niekerk" Sender: gerritvn1945 AT gmail DOT com To: djgpp AT delorie DOT com Subject: Re: Exiting from system() In-Reply-To: <0K7J008HL7GIRYO0@mta4.srv.hcvlny.cv.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_50683_32990615.1221983287229" References: <0K7J008HL7GIRYO0 AT mta4 DOT srv DOT hcvlny DOT cv DOT net> X-Google-Sender-Auth: 6f5b161c52e5353e Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk ------=_Part_50683_32990615.1221983287229 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, Sep 21, 2008 at 8:02 AM, Ethan Rosenberg wrote: > Dear List - > > Thanks for all your excellent help in the past. > > I wish to write the following type of program: > > #include > #include > > int main(void) > > { > system(prog1); > system(prog2); > > } > > If prog1 terminates with an exit value of 1, which will indicate an error > condition in prog1, I do not wish that prog2 should run. How do I do it? > > Thanks again. > > Ethan Rosenberg > int main(void) { if (system(prog1) == 0) system(prog2); } ------=_Part_50683_32990615.1221983287229 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline

On Sun, Sep 21, 2008 at 8:02 AM, Ethan Rosenberg <ethros AT earthlink DOT net> wrote:
Dear List -

Thanks for all your excellent help in the past.

I wish to write the following type of program:

#include <stdlib.h>
#include <stdio.h>

int main(void)

{
       system(prog1);
       system(prog2);

}

If prog1 terminates with an exit value of 1, which will indicate an error condition in prog1, I do not wish that prog2 should run.  How do I do it?

Thanks again.

Ethan Rosenberg

int main(void)
{
   if (system(prog1) == 0)
      system(prog2);
}


------=_Part_50683_32990615.1221983287229--