commit-inetutils
[Top][All Lists]
Advanced

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

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-326-g309ba


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-326-g309ba4a
Date: Fri, 30 Aug 2013 13:52:23 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  309ba4a5419830ed357d18979a8b34944d0ce6ad (commit)
      from  ab8e5c4d8079ecb1278b9724e04d98e093ef5e23 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=309ba4a5419830ed357d18979a8b34944d0ce6ad


commit 309ba4a5419830ed357d18979a8b34944d0ce6ad
Author: Mats Erik Andersson <address@hidden>
Date:   Wed Aug 28 16:43:49 2013 +0200

    Portability of Unix macros.

diff --git a/ChangeLog b/ChangeLog
index b88741d..88eaa18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,61 @@
 2013-08-28  Mats Erik Andersson  <address@hidden>
 
+       Identification of unices.  Check `__unix' and
+       `__unix__' in addition to `unix'.  This is needed
+       for `ftp' with GCC on NetBSD, OpenBSD.  Both macros
+       are necessary to distinguish AIX and HP-UX!
+
+       * ftp/cmds.c (setpeer)
+       [(unix || __unix || __unix__) && (NBBY==8)]: Add
+       macros __unix and __unix__ in conditional; this
+       sends initial SYST request from NetBSD and OpenBSD.
+
+       * ftpd/ftpcmd.y (cmd) [unix || __unix || __unix__]:
+       Likewise; announce system as UNIX.
+
+       * telnet/commands.c (Togglelist, filestuff)
+       [(unix || __unix || __unix__) && TN3270]: Likewise.
+       (status, transcomhelp)
+       [(unix || __unix || __unix__) && TN3270]: Likewise.
+       (zhelp) [unix || __unix || __unix__]: Likewise.
+       (cmdtab) [unix || __unix || __unix__]
+       <cases "transcom", "z">: Likewise.
+       (command) [unix || __unix || __unix__] <!top>:
+       Likewise; ignore SIGINT and SIGQUIT.
+       * telnet/main.c (argp_options)
+       [(unix || __unix || __unix__) && TN3270]: Likewise.
+       (parse_opt) [(unix || __unix || __unix__) && TN3270]
+       <case 't'>: Likewise.
+       * telnet/telnet.c [unix || __unix || __unix__]:
+       Likewise; include <signal.h>.
+       (Scheduler) [(unix || __unix || __unix__) && TN3270]:
+       Likewise.
+       * telnet/tn3270.c (HaveInput, cursesdata, sigiocount)
+       (tline, transcom) [(unix || __unix || __unix__) && TN3270]:
+       Likewise.
+       (init_3270, inputAvailable, DataToTerminal, Finish3270)
+       (settranscom) [(unix || __unix || __unix__) && TN3270]:
+       Likewise.
+       * telnet/utilities.c (EmptyTerminal)
+       [unix || __unix || __unix__]: Likewise; handle fdset.
+
+       Check macro `__sun' to detect Solaris.  Possibly
+       the code is portable also to Solaris Studio.
+
+       * ifconfig/system.c [!__linux__]: Check macro  __sun,
+       not the less portable __sun__.
+       * ifconfig/system.h [!__linux__]: Likewise.
+       * ping/ping6.c: Likewise.
+
+
+       Helper program for identifying build environments.
+
+       * tests/identify.c: New file.
+       * tests/Makefile.am (noinst_PROGRAMS, identify_LDADD):
+       New variables.
+
+2013-08-28  Mats Erik Andersson  <address@hidden>
+
        ftp: Secrecy in debug mode.
 
        * ftp/ftp.c (command) <debug>: Insert a missing `else'.
diff --git a/ftp/cmds.c b/ftp/cmds.c
index 45c870a..e6904ea 100644
--- a/ftp/cmds.c
+++ b/ftp/cmds.c
@@ -288,7 +288,7 @@ setpeer (int argc, char **argv)
       if (autologin)
        login (host);
 
-#if defined unix && NBBY == 8
+#if (defined unix || defined __unix || defined __unix__) && NBBY == 8
 /*
  * this ifdef is to keep someone form "porting" this to an incompatible
  * system and not checking this out. This way they have to think about it.
@@ -342,7 +342,7 @@ setpeer (int argc, char **argv)
              ("Remember to set tenex mode when transfering binary files from 
this machine.\n");
        }
       verbose = overbose;
-#endif /* unix */
+#endif /* (unix || __unix || __unix__) && (NBBY == 8) */
     }
 }
 
diff --git a/ftpd/ftpcmd.y b/ftpd/ftpcmd.y
index 3c77d7a..5e126f5 100644
--- a/ftpd/ftpcmd.y
+++ b/ftpd/ftpcmd.y
@@ -542,7 +542,7 @@ cmd
 # endif /* BSD */
 #endif /* !HAVE_UNAME */
 
-#if defined unix || defined __unix__
+#if defined unix || defined __unix || defined __unix__
                        sys_type = "UNIX";
 #else
                        sys_type = "UNKNOWN";
diff --git a/ifconfig/system.c b/ifconfig/system.c
index 0fd5ad8..7c00597 100644
--- a/ifconfig/system.c
+++ b/ifconfig/system.c
@@ -21,7 +21,7 @@
 
 #if defined __linux__
 # include "system/linux.c"
-#elif defined __sun__
+#elif defined __sun
 # include "system/solaris.c"
 #elif defined __QNX__
 # include "system/qnx.c"
diff --git a/ifconfig/system.h b/ifconfig/system.h
index 7ff5f56..7bc297d 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -89,7 +89,7 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
 
 # if defined __linux__
 #  include "system/linux.h"
-# elif defined __sun__
+# elif defined __sun
 #  include "system/solaris.h"
 # elif defined __QNX__
 #  include "system/qnx.h"
diff --git a/ping/ping6.c b/ping/ping6.c
index 7cdf991..ef0c584 100644
--- a/ping/ping6.c
+++ b/ping/ping6.c
@@ -19,9 +19,9 @@
 
 #include <config.h>
 
-#ifdef __sun__
+#ifdef __sun
 #  define _XPG4_2      1       /* OpenSolaris: msg_control */
-#endif /* __sun__ */
+#endif /* __sun */
 
 #include <sys/socket.h>
 #include <sys/time.h>
diff --git a/telnet/commands.c b/telnet/commands.c
index 944516e..a9ed244 100644
--- a/telnet/commands.c
+++ b/telnet/commands.c
@@ -826,7 +826,7 @@ static struct togglelist Togglelist[] = {
    &localchars,
    "recognize certain control characters"},
   {" ", "", 0, NULL, NULL},                    /* empty line */
-#if defined unix && defined TN3270
+#if (defined unix || defined __unix || defined __unix__) && defined TN3270
   {"apitrace",
    "(debugging) toggle tracing of API transactions",
    0,
@@ -837,7 +837,7 @@ static struct togglelist Togglelist[] = {
    0,
    &cursesdata,
    "print hexadecimal representation of curses data"},
-#endif /* defined(unix) && defined(TN3270) */
+#endif /* (unix || __unix || __unix__)) && TN3270 */
   {"debug",
    "debugging",
    togdebug,
@@ -2306,7 +2306,7 @@ encrypt_cmd (int argc, char *argv[])
 }
 #endif /* ENCRYPTION */
 
-#if defined unix && defined TN3270
+#if (defined unix || defined __unix || defined __unix__) && defined TN3270
 static void
 filestuff (int fd)
 {
@@ -2335,7 +2335,7 @@ filestuff (int fd)
       return;
     }
 }
-#endif /* defined(unix) && defined(TN3270) */
+#endif /* (unix || __unix || __unix__) && TN3270 */
 
 /*
  * Print status about the connection.
@@ -2392,7 +2392,7 @@ status (int argc, char *argv[])
     {
       printf ("Escape character is '%s'.\n", control (escape));
     }
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
   if ((argc >= 2) && !strcmp (argv[1], "everything"))
     {
       printf ("SIGIO received %d time%s.\n",
@@ -2413,7 +2413,7 @@ status (int argc, char *argv[])
     {
       printf ("Transparent mode command is '%s'.\n", transcom);
     }
-# endif        /* defined(unix) */
+# endif /* unix || __unix || __unix__ */
   fflush (stdout);
   if (In3270)
     {
@@ -2827,10 +2827,9 @@ static char
   togglestring[] = "toggle operating parameters ('toggle ?' for more)",
   slchelp[] = "change state of special characters ('slc ?' for more)",
   displayhelp[] = "display operating parameters",
-#if defined TN3270 && defined unix
+#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
   transcomhelp[] = "specify Unix command for transparent mode pipe",
-#endif
-  /* defined(TN3270) && defined(unix) */
+#endif /* TN3270 && (unix || __unix || __unix__) */
 #if defined AUTHENTICATION
   authhelp[] = "turn on (off) authentication ('auth ?' for more)",
 #endif
@@ -2838,10 +2837,9 @@ static char
   encrypthelp[] = "turn on (off) encryption ('encrypt ?' for more)",
 #endif
   /* ENCRYPTION */
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
   zhelp[] = "suspend telnet",
-#endif
-  /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
   shellhelp[] = "invoke a subshell",
   envhelp[] = "change environment variables ('environ ?' for more)",
   modestring[] = "try to enter line or character mode ('mode ?' for more)";
@@ -2861,18 +2859,18 @@ static Command cmdtab[] = {
   {"status", statushelp, status, 0},
   {"toggle", togglestring, toggle, 0},
   {"slc", slchelp, slccmd, 0},
-#if defined TN3270 && defined unix
+#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
   {"transcom", transcomhelp, settranscom, 0},
-#endif /* defined(TN3270) && defined(unix) */
+#endif /* TN3270 && (unix || __unix || __unix__) */
 #if defined AUTHENTICATION
   {"auth", authhelp, auth_cmd, 0},
 #endif
 #ifdef ENCRYPTION
   {"encrypt", encrypthelp, encrypt_cmd, 0},
 #endif /* ENCRYPTION */
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
   {"z", zhelp, suspend, 0},
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
 #if defined TN3270
   {"!", shellhelp, shell, 1},
 #else
@@ -2934,13 +2932,13 @@ command (int top, char *tbuf, int cnt)
   if (!top)
     {
       putchar ('\n');
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
     }
   else
     {
       signal (SIGINT, SIG_DFL);
       signal (SIGQUIT, SIG_DFL);
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
     }
   for (;;)
     {
diff --git a/telnet/main.c b/telnet/main.c
index ed350fe..419462a 100644
--- a/telnet/main.c
+++ b/telnet/main.c
@@ -183,7 +183,7 @@ static struct argp_option argp_options[] = {
 # undef GRID
 #endif
 
-#if defined TN3270 && defined unix
+#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
 # define GRID 40
   { NULL, 0, NULL, 0,
     "TN3270 support:", GRID },
@@ -193,7 +193,7 @@ static struct argp_option argp_options[] = {
   { "noasynctty", OPTION_NOASYNCTTY, NULL, 0, "", GRID+1 },
   { "noasyncnet", OPTION_NOASYNCNET, NULL, 0, "", GRID+1 },
 # undef GRID
-#endif
+#endif /* TN3270 && (unix || __unix || __unix__) */
   { NULL, 0, NULL, 0, NULL, 0 }
 };
 
@@ -285,7 +285,7 @@ parse_opt (int key, char *arg, struct argp_state *state 
_GL_UNUSED_PARAMETER)
       rlogin = '~';
       break;
 
-#if defined TN3270 && defined unix
+#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
     case 't':
       /* FIXME: Buffer!!! */
       transcom = tline;
@@ -303,7 +303,7 @@ parse_opt (int key, char *arg, struct argp_state *state 
_GL_UNUSED_PARAMETER)
     case OPTION_NOASYNCNET:
       noasynchnet = 1;
       break;
-#endif
+#endif /* TN3270 && (unix || __unix || __unix__) */
 
 #ifdef ENCRYPTION
     case 'x':
diff --git a/telnet/telnet.c b/telnet/telnet.c
index 694b8f8..73406ed 100644
--- a/telnet/telnet.c
+++ b/telnet/telnet.c
@@ -51,13 +51,13 @@
 
 #include <sys/types.h>
 
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
 # include <signal.h>
 /* By the way, we need to include curses.h before telnet.h since,
  * among other things, telnet.h #defines 'DO', which is a variable
  * declared in curses.h.
  */
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
 
 #include <arpa/telnet.h>
 
@@ -2353,13 +2353,13 @@ Scheduler (int block)
   netex = !SYNCHing;
 
   /* If we have seen a signal recently, reset things */
-#if defined TN3270 && defined unix
+#if defined TN3270 && (defined unix || defined __unix || defined __unix__)
   if (HaveInput)
     {
       HaveInput = 0;
       signal (SIGIO, inputAvailable);
     }
-#endif /* defined(TN3270) && defined(unix) */
+#endif /* TN3270 && (unix || __unix || __unix__) */
 
   /* Call to system code to process rings */
 
diff --git a/telnet/tn3270.c b/telnet/tn3270.c
index 96e8b30..969dc38 100644
--- a/telnet/tn3270.c
+++ b/telnet/tn3270.c
@@ -66,14 +66,14 @@
 # include "../sys_curses/telextrn.h"
 # include "../ctlr/externs.h"
 
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
 int HaveInput,                 /* There is input available to scan */
   cursesdata,                  /* Do we dump curses data? */
   sigiocount;                  /* Number of times we got a SIGIO */
 
 char tline[200];
 char *transcom = 0;            /* transparent mode command (default: none) */
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
 
 char Ibuf[8 * BUFSIZ], *Ifrontp, *Ibackp;
 
@@ -94,10 +94,10 @@ void
 init_3270 (void)
 {
 #if defined TN3270
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
   HaveInput = 0;
   sigiocount = 0;
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
   Sent3270TerminalType = 0;
   Ifrontp = Ibackp = Ibuf;
   init_ctlr ();                        /* Initialize some things */
@@ -184,14 +184,14 @@ DataToNetwork (register char *buffer, register int count, 
int done)
 }
 
 
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
 void
 inputAvailable (int signo)
 {
   HaveInput = 1;
   sigiocount++;
 }
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
 
 void
 outputPurge ()
@@ -226,19 +226,19 @@ DataToTerminal (register char *buffer, register int count)
     {
       if (TTYROOM () == 0)
        {
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
          fd_set o;
 
          FD_ZERO (&o);
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
          ttyflush (0);
          while (TTYROOM () == 0)
            {
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
              FD_SET (tout, &o);
              select (tout + 1, (fd_set *) 0, &o, (fd_set *) 0,
                      (struct timeval *) 0);
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
              ttyflush (0);
            }
        }
@@ -294,9 +294,9 @@ Finish3270 ()
 {
   while (Push3270 () || !DoTerminalOutput ())
     {
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
       HaveInput = 0;
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
       ;
     }
 }
@@ -431,7 +431,7 @@ tn3270_ttype ()
     }
 }
 
-# if defined unix
+# if defined unix || defined __unix || defined __unix__
 int
 settranscom (int argc, char *argv[])
 {
@@ -454,6 +454,6 @@ settranscom (int argc, char *argv[])
     }
   return 1;
 }
-# endif        /* defined(unix) */
+# endif        /* unix || __unix || __unix__ */
 
 #endif /* defined(TN3270) */
diff --git a/telnet/utilities.c b/telnet/utilities.c
index 1c29649..567e07e 100644
--- a/telnet/utilities.c
+++ b/telnet/utilities.c
@@ -994,28 +994,28 @@ printsub (char direction, unsigned char *pointer, int 
length)
 void
 EmptyTerminal (void)
 {
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
   fd_set o;
 
   FD_ZERO (&o);
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
 
   if (TTYBYTES () == 0)
     {
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
       FD_SET (tout, &o);
       select (tout + 1, (fd_set *) 0, &o, (fd_set *) 0, (struct timeval *) 0); 
/* wait for TTLOWAT */
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
     }
   else
     {
       while (TTYBYTES ())
        {
          ttyflush (0);
-#if defined unix
+#if defined unix || defined __unix || defined __unix__
          FD_SET (tout, &o);
          select (tout + 1, (fd_set *) 0, &o, (fd_set *) 0, (struct timeval *) 
0);      /* wait for TTLOWAT */
-#endif /* defined(unix) */
+#endif /* unix || __unix || __unix__ */
        }
     }
 }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7b64e3b..8abff39 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,7 +21,11 @@ AM_CPPFLAGS = $(iu_INCLUDES)
 
 LDADD = $(iu_LIBRARIES)
 
+noinst_PROGRAMS = identify
+identify_LDADD =
+
 check_PROGRAMS = localhost readutmp waitdaemon
+
 if ENABLE_inetd
 check_PROGRAMS += addrpeek tcpget
 endif
diff --git a/tests/identify.c b/tests/identify.c
new file mode 100644
index 0000000..b4debf6
--- /dev/null
+++ b/tests/identify.c
@@ -0,0 +1,117 @@
+/* identify -- Probe system and report characteristica.
+  Copyright (C) 2013 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Written by Mats Erik Andersson.  */
+
+/* Collect information about this system and report it.
+ * Some identified characteristica of relevance to GNU Inetutils
+ * are displayed for use in bug reporting and resolution.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <sys/param.h>
+#include <sys/utsname.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#define tell_macro(a,b)        \
+  printf ("%s: %s\n", (b) ? "Available macro" : "Not defined", (a));
+
+int
+main (void)
+{
+  int a, ux;
+  struct utsname uts;
+  struct sockaddr_un su;
+
+  if (uname (&uts) < 0)
+    {
+      fprintf (stderr, "Not able to identify running system.\n");
+      exit (EXIT_FAILURE);
+    }
+
+  /* Identify the hardware.  */
+  printf ("Running system: %s, %s\n",
+         uts.sysname, uts.machine);
+  printf (" Variant: %s\n", uts.release);
+  printf (" Variant: %s\n", uts.version);
+  puts ("");
+
+  /*
+   * Report on macros that determine alternate code.
+   * These depend on toolchains and hardware.
+   */
+  ux = 0;
+#ifdef unix
+  ux = 1;
+#endif
+  tell_macro ("unix", ux);
+
+  ux = 0;
+#ifdef __unix
+  ux = 1;
+#endif
+  tell_macro ("__unix", ux);
+
+  ux = 0;
+#ifdef __unix__
+  ux = 1;
+#endif
+  tell_macro ("__unix__", ux);
+
+  ux = 0;
+#ifdef __sun
+  ux = 1;
+#endif
+  tell_macro ("__sun", ux);
+
+  ux = 0;
+#ifdef __sun__
+  ux = 1;
+#endif
+  tell_macro ("__sun__", ux);
+
+  a = 0;
+#ifdef TN3270
+  a = 1;
+#endif
+  tell_macro ("TN3270", a);
+
+  /*
+   * Implementation specific charateristica.
+   */
+  puts ("");
+
+  a = 0;
+#ifdef BSD
+  a = 1;
+#endif
+  tell_macro ("BSD", a);
+
+  printf ("Size of 'struct sockaddr_un.sun_path': %zu\n",
+         sizeof (su.sun_path));
+  return 0;
+}

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   56 +++++++++++++++++++++++++
 ftp/cmds.c         |    4 +-
 ftpd/ftpcmd.y      |    2 +-
 ifconfig/system.c  |    2 +-
 ifconfig/system.h  |    2 +-
 ping/ping6.c       |    4 +-
 telnet/commands.c  |   34 +++++++--------
 telnet/main.c      |    8 ++--
 telnet/telnet.c    |    8 ++--
 telnet/tn3270.c    |   28 ++++++------
 telnet/utilities.c |   12 +++---
 tests/Makefile.am  |    4 ++
 tests/identify.c   |  117 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 13 files changed, 228 insertions(+), 53 deletions(-)
 create mode 100644 tests/identify.c


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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