How do I pass interactive commands in this case?

  • Thread starter grocery_stocker
  • Start date
G

grocery_stocker

I have a program that access's a bbs. When I do the following:
#!/usr/bin/perl -w
my $kidpid;
if (!defined($kidpid = fork())) {
die "cannot fork: $!";
} elsif ($kidpid == 0) {

exec("bbs");
die "can't exec date: $!";

} else {

waitpid($kidpid, 0);


}

I get
23 newresponse items and 2 brandnew items
First item 1, last 34

Ok:


The problem is that I want to pass the bbs 'browse' command at the
"Ok:"
prompt. Ie when I run the perl script, I want it to go like:

23 newresponse items and 2 brandnew items
First item 1, last 34

Ok:browse

Ideas?
 
G

grocery_stocker

A. Sinan Unur said:
The fork+exec means that this process has now been replaced with the bbs
process. Interacting with that process is now no different than
interacting with any other external process.

Have you looked into Expect.pm?

I've used expect once. It was sort of fuzzy the first time I used it.
It was the same sort of fuzziness
that I had when I first dealt with pointers in C..
http://search.cpan.org/~rgiersig/Expect-1.20/

Does the bbs program read its input from STDIN?
I'm not that sure if the bbs reads from STDIN. Is there any way to find
out?
Do you need to read the responses from bbs?

Yes. I've also read the man pages for the bbs seeing if there was some
way I could perhaps
pass the browse option at the command line vs typing bbs and then
typing browse at the
"OK" prompt. There is no such option. All the command line options to
the bbs are used to
control how text gets inputed when you read or write a response to a
thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top