Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

directly using terminal capabilities

Does anyone use terminfo capabilities functions like tputs(), tparm(), tigetstr(), tigetnum() directly anymore?

I can't find any practical examples online with these low-level terminal functions.

Does everyone uses ncurses library to control terminal and doesn't bother with this low-level code?

This low-level code is very hard to read I think.

Should I bother with this low-level code or just learn ncurses which is a lot less overwhelming with ncurses-provided higher-level code?

If anybody knows some practical info about such low-level functions, share with me.

like image 747
lychee Avatar asked Sep 14 '25 17:09

lychee


1 Answers

Does everyone uses ncurses library to control terminal and doesn't bother with this low-level code?

This is very easy to check.

First, prepare a list of function in the ncurses library. On my system that would be:

nm -D /lib64/libncurses.so.5.9 | fgrep ' T ' \
  | sed 's/^[0-9A-Fa-f ]*T //' > /tmp/ncurses-functions-list

Now see how many of those are used in various programs.

for f in /usr/bin/* ; do 
    nm -D $f 2>/dev/null | fgrep ' U ' \
      | sed 's/^ *U //' \
      | fgrep -x -f - /tmp/ncurses-functions-list && echo ==== $f; 
done
like image 72
n. m. could be an AI Avatar answered Sep 17 '25 08:09

n. m. could be an AI