PC Character Set, System V - streams module?

34 views
Skip to first unread message

Jim Mohr

unread,
Jan 16, 2002, 12:25:10 PM1/16/02
to
If I wanted to print the IBM PC character set 'octal 315' (double horizontal
lines) on 3.2v4.2 on the console I could just do
printf("\315");, where TERM=ansi. This prints a capital 'I' on a System V
machine. I ASSUME this has something to do with console streams, but would
appreciate an insight where to start (files to look at).
Thanks
j


Ronald J Marchand

unread,
Jan 16, 2002, 12:25:12 PM1/16/02
to
Jim Mohr <jrm...@snet.net> wrote in message
news:WHi18.9039$_U5.230...@newssvr10.news.prodigy.com...

Try mapchan -n

Ron

Bob Rasmussen

unread,
Jan 16, 2002, 1:18:56 PM1/16/02
to

A better approach, which is terminal independent:

tput smacs
printf "whatever"
tput rmacs

Let me explain. The tput command outputs a particular sequence based on your
TERM variable and the corresponding terminfo entry. The "smacs" sequence is
"Set Mode Alternate Character Set". Once in smacs mode, certain ASCII
characters translate to certain line-drawing characters. I could look them up,
or you could, or you could printf an alphabet and see what goes with what. The
last tput sets you back to normal.

This approach should work with various consoles, dumb terminals, Xterms and
similar, PC-based emulators, etc. However, the double-line set is pushing the
envelope. You'll have more thorough coverage by sticking to the single-line
characters.

Also, make sure there is no translation going on via "mapchan" or equivalent.

Regards,
....Bob Rasmussen, President, Rasmussen Software, Inc.

personal e-mail: r...@anzio.com
company e-mail: r...@anzio.com
voice: (US) 503-624-0360 (9:00-6:00 Pacific Time)
fax: (US) 503-624-0760
web: http://www.anzio.com

Jim Mohr

unread,
Jan 16, 2002, 2:25:15 PM1/16/02
to

"Bob Rasmussen" <r...@anzio.com> wrote in message
news:Pine.LNX.4.42.02011...@nimbus.anzio.com...

I understand that your way is the 'right' way to do things, but I am working
with Unify application that uses it's own termcap facility that actually
defines:
ansi:\
...
:gs=:gx=:gk=\315:ga=\310:gb=\311:gc=\273:gd=\274:\
:ge=\310:gf=\311:gg=\273:gh=\274:gi=\316:gj=\272:\
:gl=\271:gm=\314:gn=\313:go=\312:\
...
which works under 3.2v4.2 and not under System V. I just tried to show the
simplest example that exhibited the problem.
Thanks - you guys gave me something to look at
Jim


Robert Carnegie

unread,
Jan 17, 2002, 4:43:54 AM1/17/02
to
"Jim Mohr" <jrm...@snet.net> wrote in message news:<WHi18.9039$_U5.230...@newssvr10.news.prodigy.com>...

If it's any use, in ksh I seem to be required to include a leading zero,
'echo "\0315"'.

If it's a foreign-language* capital I with an accent this way "/" above
it, *foreign being "not English", I note that that's what Microsoft
Windows has in character sets, as well, so conceivably it would be
worth reading "man locale" on the topic of international use settings
and seeing what it currently reports. Mine is showing C_C.C for
everything, which perhaps isn't right since I'm outside the U.S., and
'echo "\0315"' does get me the thing that looks like "=".

Reply all
Reply to author
Forward
0 new messages