* automate an interactive process
@ 2004-07-07 5:14 kaushal
2004-07-07 8:18 ` Glynn Clements
0 siblings, 1 reply; 2+ messages in thread
From: kaushal @ 2004-07-07 5:14 UTC (permalink / raw)
To: linux-c-programming
Hello all,
Iam trying to automate the login program.That is I want "my process" to
spawn login process and then provide it with the username and password
without my interaction.
I know that I can use the "expect" program for it which is based on TCL.
But I want to do this from within a C program.
Thanks in advance.
Regards-
Kaushal
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: automate an interactive process
2004-07-07 5:14 automate an interactive process kaushal
@ 2004-07-07 8:18 ` Glynn Clements
0 siblings, 0 replies; 2+ messages in thread
From: Glynn Clements @ 2004-07-07 8:18 UTC (permalink / raw)
To: kaushal; +Cc: linux-c-programming
kaushal wrote:
> Iam trying to automate the login program.That is I want "my process" to
> spawn login process and then provide it with the username and password
> without my interaction.
>
> I know that I can use the "expect" program for it which is based on TCL.
> But I want to do this from within a C program.
Then you need to re-create the guts of "expect" in C.
Essentially, you need to obtain a pty, create a child process in a new
session, redirect stdin/stdout/stderr from the pty slave, then have it
execute /bin/login. The parent process reads the prompts from the pty
master and writes the appropriate input to it.
--
Glynn Clements <glynn.clements@virgin.net>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-07-07 8:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-07 5:14 automate an interactive process kaushal
2004-07-07 8:18 ` Glynn Clements
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).