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

Discussion in 'Java' started by Robert Maas, see http://tinyurl.com/uh3t, Jun 7, 2005.

  1. 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?
    Robert Maas, see http://tinyurl.com/uh3t, Jun 7, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    12
    Views:
    1,618
    Dave Thompson
    Jan 10, 2005
  2. Replies:
    18
    Views:
    1,884
    crazzybugger
    Oct 22, 2006
  3. Replies:
    18
    Views:
    608
    Dave Thompson
    Jan 10, 2005
  4. samoukos
    Replies:
    4
    Views:
    314
    Jerry Coffin
    Jan 30, 2008
  5. Robert Wallace

    my own perl "dos->unix"/"unix->dos"

    Robert Wallace, Jan 21, 2004, in forum: Perl Misc
    Replies:
    7
    Views:
    267
    Michele Dondi
    Jan 22, 2004
Loading...

Share This Page