X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: =?ISO-8859-1?Q?Hans-Bernhard_Br=F6ker?= Newsgroups: comp.os.msdos.djgpp Subject: Re: detecting child processes? Date: Sun, 11 May 2014 21:12:47 +0200 Lines: 17 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de AfjZffUWi5Exyny/64BghQHtq5458l5LfafN8K2xFRnOGuAlKHa19BmF4d Cancel-Lock: sha1:IJ0E3HI7OKyC9aomBI2+nLrM2+4= User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Bytes: 1525 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 On 11.05.2014 19:59, Rod Pemberton wrote: > I have a process which spawns a child of itself via system(). > > Although the parent and child are the same application, I'd now > like the child to function slightly differently from the parent. I'll assume you're referring only to the case where the parent process is this same program, rather than your program being invoked as any arbitrary other program's child process. > To do that, I need to be able to detect that the child is not > the parent. So make the parent _tell_ the child: set an environment variable like "PAPA_ALREADY_THERE", pass a command line argument to the child, or whatever you like.