Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Apr 2006 21:02:19 +0000
From:      "Jonathan Herriott" <herriojr@gmail.com>
To:        cpghost <cpghost@cordula.ws>
Cc:        freebsd-questions@freebsd.org, Bill Moran <wmoran@collaborativefusion.com>
Subject:   Re: C Program to execute programs in same console
Message-ID:  <6a56d69c0604041402i456d33cfm2c6f571e5c558e@mail.gmail.com>
In-Reply-To: <20060403220419.GA5042@epia2.farid-hajji.net>
References:  <6a56d69c0604031439o7c2eed8an5710dad733a0e97@mail.gmail.com> <20060403174519.4d478a95.wmoran@collaborativefusion.com> <20060403220419.GA5042@epia2.farid-hajji.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <cpghost@cordula.ws> 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" <herriojr@gmail.com> 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/
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a56d69c0604041402i456d33cfm2c6f571e5c558e>