From owner-freebsd-questions@FreeBSD.ORG Mon Apr 3 22:02:30 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 EEA3616A420 for ; Mon, 3 Apr 2006 22:02:30 +0000 (UTC) (envelope-from cpghost@cordula.ws) Received: from fw.farid-hajji.net (fw.farid-hajji.net [213.146.115.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4105443D45 for ; Mon, 3 Apr 2006 22:02:30 +0000 (GMT) (envelope-from cpghost@cordula.ws) Received: from epia2.farid-hajji.net (epia-2 [192.168.254.11]) by fw.farid-hajji.net (Postfix) with ESMTP id 10663DDB52; Mon, 3 Apr 2006 23:57:58 +0200 (CEST) Date: Tue, 4 Apr 2006 00:04:19 +0200 From: cpghost To: Bill Moran Message-ID: <20060403220419.GA5042@epia2.farid-hajji.net> References: <6a56d69c0604031439o7c2eed8an5710dad733a0e97@mail.gmail.com> <20060403174519.4d478a95.wmoran@collaborativefusion.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060403174519.4d478a95.wmoran@collaborativefusion.com> User-Agent: Mutt/1.5.11 Cc: Jonathan Herriott , freebsd-questions@freebsd.org 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: Mon, 03 Apr 2006 22:02:31 -0000 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 knows > > how to do it here! > > Unless I'm misunderstanding your question, "man 2 chdir" should help out. 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/