Subject: misc/32615: Incoherency in file include/arpa/telnet.h
To: None <,,>
From: None <>
List: netbsd-bugs
Date: 01/24/2006 15:30:00
>Number:         32615
>Category:       misc
>Synopsis:       Incoherency in file include/arpa/telnet.h
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 24 15:30:00 +0000 2006
>Originator:     Yves-Emmanuel JUTARD
>Release:        3.0.0
THALES Communications France
custom environment : recompiled from /src, only some parts of NetBSD are used (TCP/IP stack and some parts of the kernel). Target : PPC custom board
In file 'include/arpa/telnet.h', one can see the use of a trick for using global variables definition in a '.h' file without defining it multiple time.
For example, at line 63, the variable 'telcmds' is defined only if macro 'TELCMDS' is declared, and just declared 'extern' else. This trick is used several times in this file.

But there is one variable which seems to be concerned, but for which this trick is badly implemented. On line 135, the variable 'telopts' is defined only if TELOPTS is set, but this variable is NOT declared else.
Because of that, someone who includes 'telnet.h' has no view on this useful variable. Or it must define TELOPTS, which lead to conflicts if several '.c' includes telnet.h

try to make a program which use telnet.h in two different files and try to access to variable 'telopts' in each file.
Either :
- add the declaration 'extern const char *telopts[NTELOPTS+1];' if TELOPTS is not set;
- or add a comment explaining why telopts should not be accessible