ncurses and stdin

ncurses and stdin

Post by wroo » Fri, 06 Jul 2001 04:40:43



Hi,

A certain program asks for password. I need to enter 'newline at this
prompt'. How can I automate this? I tried
echo | program
but it doesn't work. Apparently, password isn't read from stdin, but maybe
from some other stream. What else can I try instead of echo | program?

Thanks

Wroot

 
 
 

ncurses and stdin

Post by DPac » Fri, 06 Jul 2001 05:41:33



> Hi,

> A certain program asks for password. I need to enter 'newline at this
> prompt'. How can I automate this? I tried
> echo | program
> but it doesn't work. Apparently, password isn't read from stdin, but maybe
> from some other stream. What else can I try instead of echo | program?

> Thanks

> Wroot

Here is a sketchy possible strategy:

There is a perl library for telneting and
reading and writing to/from a remote site
and doing complex key stroke responses.
There are probably other programs that do
telnet scripts.  Maybe you can use them to
log into your own PC and excute the program
and get replies.  I'm not sure if that
does or doesn't overcome the stdin limitation.
But, it is a germ of an idea.

--
David Pace - Free commodity/stock graphing software
and Linux links at http://www.daveware.com

 
 
 

ncurses and stdin

Post by bowma » Fri, 06 Jul 2001 13:17:21



Quote:

> A certain program asks for password. I need to enter 'newline at this
> prompt'. How can I automate this? I tried
> echo | program

Expect. What language are you using for automation? Expect is most closely
ties to Tcl, but i believe there are perl and python bindings, as well as a
C library and API.
 
 
 

ncurses and stdin

Post by Jon Wilso » Sun, 08 Jul 2001 06:36:48


Maybe get hold of the source and chop out the bit that asks for the new
line? Dunno, depends what it is and what it is doing.
Jon
 
 
 

ncurses and stdin

Post by Thomas Dicke » Mon, 09 Jul 2001 10:18:19



Quote:> Hi,
> A certain program asks for password. I need to enter 'newline at this
> prompt'. How can I automate this? I tried

getpass() is the usual function for this; it doesn't use ncurses.

Quote:> echo | program
> but it doesn't work. Apparently, password isn't read from stdin, but maybe
> from some other stream. What else can I try instead of echo | program?

the manpage says it opens /dev/tty

--

http://dickey.his.com
ftp://dickey.his.com

 
 
 

1. select() from sockets & STDIN with ncurses

Hello all,
I've been having this problem for a while.
I wrote a nifty UI with ncurses, and then
when I wanted to move one stage ahead,
that is, add some functionality to my UI with
sockets, I discovered that unless I want my
program to hog all the CPU, I'm gonna have
to make it select() from both the sockets and
STDIN.
The problem is, that I'm using ncurses.
For some reason, the program would not return
from select() when there is data on the sockets
unless I press some characters.
I've tried anything, from setting either the sockets
or STDIN to non-blocking.
For setting the buffer of STDIN to 0, or whatever.
(fcntl(), setbuf() and various ncurses specific functions)
My question is: Is there some kind of trick for doing it?
Is there a tutorial?
Is there anyone out there willing to look at my source?:)
Email me at jacob at logicolor.net if you're interested.
Thanks alot,
Jacob Shapiro.

2. Linux Consultant for Hire in Calgary, Alberta, Canada

3. ncurses and stdin/stdout

4. How to PPP so that it does not dialout except when rlogin?

5. Matrox Mystique ands X.

6. Flushing Sendmail Queue

7. Ncurses.4 s ncurse.5

8. How to 'dumb-up' on-demand dialing?

9. no stdin so how do I pass variables instead?

10. Flush STDIN in ksh/sh?

11. writing to stdin !!

12. sockets dup()ed to stdin and stdout of a process

13. redirecting stdin with yppasswd