bug-inetutils
[Top][All Lists]
Advanced

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

[bug-inetutils] NetBSD support.


From: Mats Erik Andersson
Subject: [bug-inetutils] NetBSD support.
Date: Thu, 1 Dec 2011 13:19:10 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Dear all,

the patch text below is all that is needed to support NetBSD 5.1.
The resulting binaries pass every test, except "ftp-localhost"
due to the usual lack of a user "ftp".

There are two issues in the present source tree, one straight
and one unfortunate!

First off, as a single exception among all BSD decendants,
NetBSD implements UTMPX. This can be accounted for within
"configure.ac", exactly as we do it for Solaris.

Secondly, NetBSD is taking severe liberty in <arpa/telnet.h>:

  /*
    <arpa/telnet.h>
   */

  #define NTELOPTS  (1+TELOPT_LAST)

  #ifdef TELOPTS
  const char *telopts[NTELOPTS+1] = {
     /* content */
  };
  #else
  extern const char *telopts[NTELOPTS+1] 
  #endif

This forces me to exclude the external declaration in "telnet/commands.c",
and to enforce an explicit casting "(char **) telopts". I am ignoring
a warning for incompatible type of "telopts" in genget() on line 462,
but without the enforced cast the compiler throws an error.

Should we implement an autoconf test to cover for systems declaring
a replacement, i.e, [!TELOPTS], for "telopts"? Or, can we take the
below work around as a temporary solution?

Best regards,
  Mats


diff --git a/configure.ac b/configure.ac
index e4af8a6..3083005 100644
--- a/configure.ac
+++ b/configure.ac
@@ -791,6 +791,8 @@ case "$host" in
   ;;
 *irix* | *hpux*)
   AC_DEFINE([UTMPX], 1, [FIXME])
+  ;;
+*netbsd*)
   AC_DEFINE([UTMPX], 1, [FIXME])
   ;;
 esac
diff --git a/telnet/commands.c b/telnet/commands.c
index a2db7fe..34d210a 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -429,7 +429,11 @@ int
 send_tncmd (void (*func) (), char *cmd, char *name)
 {
   char **cpp;
+  /* FIXME: [!TELOPTS] NetBSD declares a replacement in <arpa/telnet.h>.
+   * This is the only known case!  */
+#ifndef __NetBSD__
   extern char *telopts[];
+#endif
   register int val = 0;
 
   if (isprefix (name, "help") || isprefix (name, "?"))
@@ -464,7 +468,11 @@ send_tncmd (void (*func) (), char *cmd, char *name)
     }
   if (cpp)
     {
+#ifndef __NetBSD__
       val = cpp - telopts;
+#else /* __NetBSD__ */
+      val = cpp - (char **) telopts;
+#endif
     }
   else
     {



reply via email to

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