From owner-freebsd-questions@FreeBSD.ORG Tue Apr 4 21:02:43 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B9AB16A523 for ; Tue, 4 Apr 2006 21:02:43 +0000 (UTC) (envelope-from herriojr@gmail.com) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.191]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D7C443D78 for ; Tue, 4 Apr 2006 21:02:21 +0000 (GMT) (envelope-from herriojr@gmail.com) Received: by nproxy.gmail.com with SMTP id m18so28874nfc for ; Tue, 04 Apr 2006 14:02:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=dLdC9qT5wgOfy8WsOzK+OCSHlfKbXlGknhKufkQKCho/1eTVU9cAY18WzkjI/p3A/JTDJu9TVx4NB1jH6vvJTBCTh9LqJRD03JjqCAwTRGV7uls0uLHhDGr7D0H0VmU20HEPX/G2GrpIg4pfqccWvnlxXcD2VUyNk0Enz5oL5ug= Received: by 10.49.93.20 with SMTP id v20mr786531nfl; Tue, 04 Apr 2006 14:02:19 -0700 (PDT) Received: by 10.49.29.3 with HTTP; Tue, 4 Apr 2006 14:02:19 -0700 (PDT) Message-ID: <6a56d69c0604041402i456d33cfm2c6f571e5c558e@mail.gmail.com> Date: Tue, 4 Apr 2006 21:02:19 +0000 From: "Jonathan Herriott" To: cpghost In-Reply-To: <20060403220419.GA5042@epia2.farid-hajji.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <6a56d69c0604031439o7c2eed8an5710dad733a0e97@mail.gmail.com> <20060403174519.4d478a95.wmoran@collaborativefusion.com> <20060403220419.GA5042@epia2.farid-hajji.net> Cc: freebsd-questions@freebsd.org, Bill Moran Subject: Re: C Program to execute programs in same console X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Apr 2006 21:02:43 -0000 Thanks for the suggestion. I haven't tried it yet, but I'll post if I get it working. Thanks, Jon On 4/3/06, cpghost wrote: > On Mon, Apr 03, 2006 at 05:45:19PM -0400, Bill Moran wrote: > > On Mon, 3 Apr 2006 21:39:11 +0000 > > "Jonathan Herriott" wrote: > > > So, my question is how can I get it to execute a cd in the current > > > shell using c code. You don't have to give me the code, just give me > > > a term to search for or a function to look up. I'm sure someone know= s > > > how to do it here! > > > > Unless I'm misunderstanding your question, "man 2 chdir" should help ou= t. > > Hmmm... chdir(2) would not change the parent process' (the shell's > process) current working directory, only the current working directory > of the process running the C program. > > Perhaps connecting to the shell via a pty, and then sending it a 'cd' > command could work? Of look at how expect(1) (/usr/ports/lang/expect) > implements this kind of stuff... > > Regards, > -cpghost. > > -- > Cordula's Web. http://www.cordula.ws/ >