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_4-33-ge0b19a


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_4-33-ge0b19a9
Date: Fri, 3 Mar 2017 13:53:19 -0500 (EST)

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  e0b19a99126c32b3566cedbedc517c2707c26c55 (commit)
      from  56fc0cc15dd9b2986e890dd8b919c9af4a8fa46a (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=e0b19a99126c32b3566cedbedc517c2707c26c55


commit e0b19a99126c32b3566cedbedc517c2707c26c55
Author: Mats Erik Andersson <address@hidden>
Date:   Fri Mar 3 19:49:55 2017 +0100

    Test utility displays some termcaps.

diff --git a/ChangeLog b/ChangeLog
index 119787b..14b51b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-03-03  Mats Erik Andersson  <address@hidden>
+
+       Test utility displays some termcaps.
+
+       * tests/Makefile.am (identify_LDADD): Set to contain
+       `$(top_builddir)/lib/libgnu.a' and `$(LIBUTIL)'.
+       * tests/identify.c: Include <string.h>.
+       [HAVE_TERMIOS_H]: Include <errno.h>, <termios.h>, <pty.h>.
+       [HAVE_TERMIOS_H && HAVE_FCNTL_H]: Include <fcntl.h>.
+       [HAVE_TCGETATTR] (test_flag): New macro.
+       [HAVE_TCGETATTR] (do_termcap): New function.
+       [HAVE_TCGETATTR] (main): Call do_termcap().
+
 2017-03-02  Fredrik Fornwall  <address@hidden>  (tiny change)
 
        ftp: Portability to Android.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 379e0ed..ce98fc3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,7 +22,7 @@ AM_CPPFLAGS = $(iu_INCLUDES)
 LDADD = $(iu_LIBRARIES)
 
 noinst_PROGRAMS = identify
-identify_LDADD =
+identify_LDADD = $(top_builddir)/lib/libgnu.a $(LIBUTIL)
 
 check_PROGRAMS = localhost readutmp waitdaemon
 
diff --git a/tests/identify.c b/tests/identify.c
index b96051a..c0faf40 100644
--- a/tests/identify.c
+++ b/tests/identify.c
@@ -29,6 +29,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 #include <sys/param.h>
@@ -37,9 +38,128 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#ifdef HAVE_TERMIOS_H
+# include <errno.h>
+# if HAVE_FCNTL_H
+#  include <fcntl.h>
+# endif
+# include <termios.h>
+
+# include <pty.h>
+#endif /* HAVE_TERMIOS_H */
+
 #define tell_macro(a,b)        \
   printf ("%s: %s\n", (b) ? "Available macro" : "Not defined", (a));
 
+#ifdef HAVE_TCGETATTR
+# define test_flag(a, b, name) \
+  if (tc.a & b) printf (" %s", name);
+
+void
+do_termcap(void)
+{
+  int pty, tty;
+  struct termios tc;
+
+  pty = openpty (&pty, &tty, NULL, NULL, NULL);
+  if (pty < 0)
+    {
+      fprintf (stderr, "openpt: errno = %d, %s\n",
+              errno, strerror (errno));
+      return;
+    }
+
+  if (tcgetattr (tty, &tc) < 0)
+    {
+      fprintf (stderr, "tcgetattr; errno = %d, %s\n",
+              errno, strerror (errno));
+      return;
+    }
+
+  printf ("_POSIX_VDISABLE = 0x%02x\n\n", _POSIX_VDISABLE);
+
+  /* Report the most interesting observations.  */
+  puts ("Default terminal settings (octal and hexadecimal):");
+  printf ("iflag = 0%06o = 0x%04x,  oflag = 0%06o = 0x%04x\n",
+         tc.c_iflag, tc.c_iflag, tc.c_oflag, tc.c_oflag);
+  printf ("cflag = 0%06o = 0x%04x,  lflag = 0%06o = 0x%04x\n",
+         tc.c_cflag, tc.c_cflag, tc.c_lflag, tc.c_lflag);
+
+  puts ("\nThe most relevant properties being set:");
+
+  printf ("iflag:");
+  test_flag (c_iflag, IXOFF, "IXOFF");
+  test_flag (c_iflag, IXON, "IXON");
+  test_flag (c_iflag, IXANY, "IXANY");
+  test_flag (c_iflag, BRKINT, "BRKINT");
+  test_flag (c_iflag, ISTRIP, "ISTRIP");
+  test_flag (c_iflag, IGNCR, "IGNCR");
+  test_flag (c_iflag, INLCR, "INLCR");
+  test_flag (c_iflag, ICRNL, "ICRNL");
+  puts ("");
+
+  printf ("oflag:");
+  test_flag (c_oflag, OPOST, "OPOST");
+  test_flag (c_oflag, OCRNL, "OCRNL");
+  test_flag (c_oflag, ONLCR, "ONLCR");
+  test_flag (c_oflag, ONLRET, "ONLRET");
+
+# ifdef TABDLY
+  printf (" TAB");
+  switch (tc.c_oflag & TABDLY)
+    {
+    case TAB3:
+      putchar ('3');
+      break;
+#  ifdef TAB2
+    case TAB2:
+      putchar ('2');
+      break;
+#  endif /* TAB2 */
+#  ifdef TAB1
+    case TAB1:
+      putchar ('1');
+      break;
+#  endif /* TAB1 */
+    case TAB0:
+      putchar ('0');
+      break;
+    }
+# elif defined OXTABS /* !TABDLY */
+  test_flag (c_oflag, OXTABS, "OXTABS");
+# endif /* OXTABS */
+
+  puts ("");
+
+  printf ("cflag:");
+  switch (tc.c_cflag & CSIZE)
+    {
+    case CS8:
+      printf (" CS8");
+      break;
+    case CS7:
+      printf (" CS7");
+    }
+  puts ("");
+
+  printf ("lflag:");
+  test_flag (c_lflag, ICANON, "ICANON");
+  test_flag (c_lflag, ISIG, "TRAPSIG");
+  test_flag (c_lflag, IEXTEN, "IEXTEN");
+  test_flag (c_lflag, ECHO, "ECHO");
+  test_flag (c_lflag, ECHOE, "ECHOE");
+  test_flag (c_lflag, ECHOK, "ECHOK");
+  test_flag (c_lflag, ECHOKE, "ECHOKE");
+  test_flag (c_lflag, ECHONL, "ECHONL");
+  test_flag (c_lflag, ECHOCTL, "ECHOCTL");
+  puts ("");
+
+  return;
+}
+# undef test_flag
+#endif /* HAVE_TCGETATTR */
+
+
 int
 main (void)
 {
@@ -113,5 +233,11 @@ main (void)
 
   printf ("Size of 'struct sockaddr_un.sun_path': %zu\n",
          sizeof (su.sun_path));
+
+#if HAVE_TCGETATTR
+  puts("");
+  do_termcap ();
+#endif
+
   return 0;
 }

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

Summary of changes:
 ChangeLog         |  13 ++++++
 tests/Makefile.am |   2 +-
 tests/identify.c  | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 140 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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