How to disable stdio echoplex from java code (unix specific)?

  • Thread starter Robert Maas, see http://tinyurl.com/uh3t
  • Start date
R

Robert Maas, see http://tinyurl.com/uh3t

Before I ask the actual question, here's the java -version info:
java version "1.2.2"
Classic VM (build jdk1.2.2-FreeBSD:root:2000/11/25-02:08, green threads, nojit)

Usually anything that cames into standard-input is automatically echoed
back out to standard-output, so the user can see what he/she typed and
get confirmation it got through to the host correctly. But for certain
applications it's useful to disable this automatic echoing. I already
know how to do this, and a bunch of other stdio mode changes, from a C
program:

struct termios termiosRec;
res = tcgetattr(fileno(stdin), &termiosRec);
(then mucking with the bits in termiosRec, including:)
termiosRec.c_lflag &= ~ECHO;
(then finally:)
res = tcsetattr(fileno(stdin), TCSANOW, &termiosRec);

So is there any easy way to do the same thing from a java application?

I know about:
public Process Runtime.exec(String command)
whereby I could invoke another program, such as small C program to
disable echo, but that program runs in a separate process, so anything
it changes in stdio wouldn't affect stdio for the java program, or am I
mistaken about that?

The only way I know for sure would work would be a big pain: I could
have the java program run in background, have a C program run in
foreground doing all stdio, and have a pair of pipes or streams or
fifos connecting the two programs. Is there a significantly easier way
to do what I want?
 

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,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top