[comp.terminals] termcap accessing the database.

quan@sol.surv.utas.oz (Stephen Quan) (09/18/90)

I was wondering if anyone can tell me short answer to the following, I can only
think of horrible solutions.

Scenario: Accessing termcap database using termcap routines, not using curses
          because the high-level interface doesn't quite suit my requirements.

Problem:  Getting a field from the database.  I figured out how to get the
          entire environment listing for, say for eg, icl :

             wb|icl|icl|icl-kds7362:
             :co#80:li#24:cl=^Z:nd=^L:ho=^^:cm=\E=%+ %+ :
             :kb=^H:kd=^V:kh=^^:kl=^H:kr=^L:ku=^K:
             :cr=^M:do=^J:nl=^J:vb=:le=^H:up=^K:
             :sf=^J:sr=\E=  \Ej:
             :bs:
             :so=\E(:se=\E):
             :dc=\EW:dl=\ER:ce=\ET:cd=\EY:
             :ic=\EQ:

           (this is a Home-Brew ICL termcap, ICL users try it out!  Not 100%)

           The problem how do I look up and translate a particular field?
           At the moment I have a vigorous string routine which searches
           for example ':sr' and then reads in its value and translates \E
           and similar control code combinations.  I was wondering is I
           have missed something in the termcap manual, ie is there something
           similar to getenv().
           ie I want :

           char *termgetenv(termenv,field)
           char *termenv; /* termcap environment entry */
           char *field; /* field interested */

           /* function returns a translated string for the field. */
           /* interested or NULL if the field is not found.       */

Stephen Quan (quan@sol.surv.utas.edu.au - I know it says utas.oz above!),
Programmer,
University of Tasmania,
Aussie.