Skip to contentSkip to conversation

automate an interactive process

DISCUSSION kaushal 2 participants 2 messages Jul 7, 2004

lore
Share & tools
lore

kaushal

author
#0 lore raw

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

#1 lore raw
Quoted 6 lines · kaushal

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.

Signature · 1 line
Glynn Clements <[email protected]>