|
Home > Archive > Unix Programming > June 2004 > parse acs termcap entry
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
parse acs termcap entry
|
|
|
| I'm looking for a way to parse the acs graphic characters in the
/etc/termcap file with out having to use curses.
Is there an easy way to do this in C?
| |
|
|
"Thomas Dickey" <dickey@saltmine.radix.net> wrote in message
news:10cb3nth9tv1mb4@corp.supernews.com...
> Nick <edivemaster@netscape.net> wrote:
>
> yes
>
> --
> Thomas E. Dickey
> http://invisible-island.net
> ftp://invisible-island.net
The ac= line in the termcap file is one long string that consists of the
line drawing characters.
How can you get each of these into a variable with out using curses or
ncurses?
How can it be accomplished with C?
| |
| Thomas Dickey 2004-06-14, 5:56 pm |
| SFD <sfd@adelphia.net> wrote:
> The ac= line in the termcap file is one long string that consists of the
> line drawing characters.
not exactly (see the terminfo manpage).
> How can you get each of these into a variable with out using curses or
> ncurses?
man tgetent
man tgetstr
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
| |
|
| "Thomas Dickey" <dickey@saltmine.radix.net> wrote in message
news:10crskh69fke9d@corp.supernews.com...
> SFD <sfd@adelphia.net> wrote:
>
>
> not exactly (see the terminfo manpage).
>
>
> man tgetent
> man tgetstr
I think I'm getting there.
I'm using the tgetent to grap the TERM type, the tgetstr to grap the ac and
it outputs the entire ac string.
Now I'm trying to figure out how to parse the ac string into, what it
appears from reading, the ACS_VLINE, etc...
From reading it looks like I need to use tgoto or tparm, but I'm not sure.
Do you have suggestions from here? Or am I overlooking something with using
the tgetstr?
Here is the line I put together to grab and ac line in a variable and print
it:
p = p(p=tgetstr(ac, &gettev)) ? p : "" ;
printf("%s='%s' ", ac, p);
As you can see, I'm sure, I'm new to C programming and still have a lot to
learn. I appreciate your help with this.
Nick
| |
| Thomas Dickey 2004-06-16, 5:57 pm |
| SFD <sfd@adelphia.net> wrote:
> "Thomas Dickey" <dickey@saltmine.radix.net> wrote in message
> news:10crskh69fke9d@corp.supernews.com...
[vbcol=seagreen]
> I think I'm getting there.
> I'm using the tgetent to grap the TERM type, the tgetstr to grap the ac and
> it outputs the entire ac string.
> Now I'm trying to figure out how to parse the ac string into, what it
> appears from reading, the ACS_VLINE, etc...
> From reading it looks like I need to use tgoto or tparm, but I'm not sure.
The ac= string is a list of character pairs. If you send the as= string, then
any of the pairs in ac= tells how to get a given graphic character. The first
character in the pair identifies the graphic character (referring to the
vt100's graphic character set), and the second character in the pair is the one
that you would send. Turn the graphic mode off by sending the ae= string.
tparm() is actually a terminfo function. tgoto() is provided by both termcap-
and terminfo-interfaces.
In termcap form, the text is just that: text. It has to be interpreted - it
represents some special characters with backslashed codes, e.g., \E for escape.
So it's not simply counting bytes in the string. If you were using terminfo,
the equivalent string is already interpreted.
But generally speaking, unless you're using the GNU termcap package, it is
unlikely that you are actually using termcap - more likely a termcap interface
to terminfo, which gives the results in terminfo's format. Occasionally that's
a source of confusion, e.g., some FreeBSD users who suggest patches for their
termcap file which are in terminfo form, since it is really ncurses underneath.
--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net
|
|
|
|
|