bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

about termname() implementation


From: Stanislav Ievlev
Subject: about termname() implementation
Date: Tue, 23 Dec 2003 11:47:21 +0300

Hello, friends!

As I understand termname() function doesn't match definition in X/Open Curses 
(Issue 4,Version 2) standart.

In ncurses manual I see:
"The termname routine returns the value of  the  environmental  variable TERM 
(truncated to 14 characters)."

(Second question: Why truncated?)

But in standart I see:
"The termname() function obtains the terminal name as recorded by setupterm()."

As a result test program bellow will fail if enviroment variable TERM value 
differ 
from terminal name.
--
int main()
{
    int retcode = EXIT_SUCCESS;
    const char terminal[]="vt100";
    setupterm(terminal, 1, (int *)0);
    const char *name=termname();
    printf("termname=%s, terminal=%s\n",name,terminal);
    if (strcmp(termname,name))
    {
        puts("test failed");
        retcode = EXIT_FAILURE;
    }
    return retcode;
}
--

$gcc -lncurses l.c
$ ./a.out
termname=xterm, terminal=vt100
test failed

--
With best regards
Stanislav Ievlev.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]