From owner-freebsd-questions@FreeBSD.ORG Mon Apr 3 21:45:21 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 2EAE916A420 for ; Mon, 3 Apr 2006 21:45:21 +0000 (UTC) (envelope-from wmoran@collaborativefusion.com) Received: from mx00.pub.collaborativefusion.com (mx00.pub.collaborativefusion.com [206.210.89.199]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5BA7C43D48 for ; Mon, 3 Apr 2006 21:45:19 +0000 (GMT) (envelope-from wmoran@collaborativefusion.com) Received: from vanquish.pgh.priv.collaborativefusion.com (vanquish.pgh.priv.collaborativefusion.com [192.168.2.61]) by wingspan with esmtp; Mon, 03 Apr 2006 17:45:19 -0400 id 00056414.4431976F.0000860E Date: Mon, 3 Apr 2006 17:45:19 -0400 From: Bill Moran To: "Jonathan Herriott" Message-Id: <20060403174519.4d478a95.wmoran@collaborativefusion.com> In-Reply-To: <6a56d69c0604031439o7c2eed8an5710dad733a0e97@mail.gmail.com> References: <6a56d69c0604031439o7c2eed8an5710dad733a0e97@mail.gmail.com> Organization: Collaborative Fusion X-Mailer: Sylpheed version 2.2.0 (GTK+ 2.8.12; i386-portbld-freebsd6.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: 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 21:45:21 -0000 On Mon, 3 Apr 2006 21:39:11 +0000 "Jonathan Herriott" wrote: > > I've come into an interesting problem I've been trying to figure out. > For no other reason than my own interest, I've been trying to get a c > program to execute other programs in the current console I am in > (using kde if that helps). > > I tried using system() and execvp() calls to try and execute a cd > command in my current shell, which of course, didn't work. It seems > to open up a new shell, then execute the command, and then exit that > new shell it had opened. > > 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. -- Bill Moran Collaborative Fusion Inc.