Piping println() through an external pager program (more, less)

M

Martin Gregorie

It's sort of a requirement...

Otherwise what is the X client going to connect to?

X is backward in relation to the way we normally think of these things.
The program (on the remote host) is the client and the your terminal is
the server that the program talks to. If you're running non-networked
Linux on a PC, the setup is the same. Your program uses the localhost
(127.0.0.1) network to talk to the X-server, which just happens to be on
the same hardware as the program.

The PuTTY terminal program is just an ssh and telnet client, which is why
it can't do X-graphical things without assistance. Thats as far as it
used to go, but at has been pointed out, it has now grown the ability to
pass graphic requests on to an X-server if you have one running locally.
This makes its capability essentially the same as the traditional Unix
ssh client.
 
N

Nigel Wade

Martin said:
X is backward in relation to the way we normally think of these things.

Yes, I know it is. That's why, when you said you didn't have an X server
running, I responded "what is the X client going to connect to".
The program (on the remote host) is the client and the your terminal is
the server that the program talks to.

Yes, I know that. That's why I asked "what is the X client going to connect to".
If you're running non-networked
Linux on a PC, the setup is the same. Your program uses the localhost
(127.0.0.1) network to talk to the X-server, which just happens to be on
the same hardware as the program.

Yes, I know that....
The PuTTY terminal program is just an ssh and telnet client, which is why
it can't do X-graphical things without assistance. Thats as far as it
used to go, but at has been pointed out, it has now grown the ability to
pass graphic requests on to an X-server if you have one running locally.
This makes its capability essentially the same as the traditional Unix
ssh client.

It's not something I actually use, but I don't remember it ever not being there
in putty. But I've only been using it for the past 3 or 4 years so it's
possible it wasn't there prior to that.
 
M

Martin Gregorie

It's not something I actually use, but I don't remember it ever not
being there in putty. But I've only been using it for the past 3 or 4
years so it's possible it wasn't there prior to that.
...and the last time I used it on something up to date (last year, PuTTY
on XP) there wasn't anything on the host that wanted graphical X.

These days I use ssh from a Linux laptop, so of course remote X graphics
just work.
 
M

Martin Gregorie

Martin Gregorie wrote:
[...]
I've not used it, but it seems to allow Java programs to output the
escape sequences needed to control the text terminal its being run
from. Its documentation is minimal, but AFAICT it accesses either
/etc/termcap or the terminfo database to get the escape sequences.
Termcap and Terminfo terminal definitions contain the terminal screen
size specified as characters wide and lines deep. Its probably overkill
for what the OP wants but is worth a look.

I looked at the source for version 0.9.5. It has native code for
accessing the console using "curses" and "conio" in the directory
/jcurses/src/native/.
That sounded iffy to me, so as a proof of concept I've just implemented
most of the termcap library in pure Java. Consequently, I really don't
understand why Jcurses needs native code or conio.

The proof of concept is now working well, and fast, in a Linux terminal
window with terminal definitions read from a standard, unmodified /etc/
termcap file. This uses the 'xterm' definition, which on my system is a
stub linked to the main capabilities with the 'tc' capability. Control
sequences are written to the terminal via System.out.print(). Adding the
remaining features (\xxx octal byte notation and alternate charsets via
the 'ac', 'as' and 'ae' capabilities won't be hard. Implementing curses
should also be straightforward.

I implemented termcap rather than terminfo because a quick search didn't
turn up a spec for compiled terminfo files.

I'm posting this now in case the OP still needs a way for his Java
applications to handle character-mode screens. I'd intended to have this
done much quicker, but other things have got in the way.
 
M

Martin Gregorie

no problem (report bugs)
Will do.

With the combination of term(5) and term.h I believe I now have both the
structure and the capability<-->name mappings I need.
 

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,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top