coreutils
[Top][All Lists]
Advanced

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

[PATCH] stty: add support for extproc/LINEMODE


From: Pádraig Brady
Subject: [PATCH] stty: add support for extproc/LINEMODE
Date: Wed, 21 Jan 2015 18:21:24 +0000

Add support for the "extproc" option which is well described at:
http://lists.gnu.org/archive/html/bug-readline/2011-01/msg00004.html

* src/stty.c (usage): Describe the extproc option if either
LINUX EXTPROC local option is defined, or the equivalent
BSD TIOCEXT ioctl is defined.
(main): Make the separate ioctl call for extproc on BSD.
* doc/coreutils.texi (stty invocation): Describe the option,
and reference the related RFC 1116.
* NEWS: Mention the new feature.
---
 NEWS               |  3 +++
 doc/coreutils.texi | 10 +++++++++-
 src/stty.c         | 25 +++++++++++++++++++++++--
 3 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index e0a2893..73314d7 100644
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,9 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   split accepts a new --separator option to select a record separator character
   other than the default newline character.
 
+  stty allows setting the "extproc" option where supported, which is
+  a useful setting with high latency links.
+
 ** Changes in behavior
 
   df no longer suppresses separate exports of the same remote device, as
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 5a3c31a..f840940 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -14269,6 +14269,14 @@ the line as indicated by the @code{echoprt} and 
@code{echoe} settings,
 instead of by the @code{echoctl} and @code{echok} settings.
 Non-POSIX@.
 May be negated.
+
+@item extproc
+@opindex extproc
+Enable @samp{LINEMODE}, which is used to avoid echoing
+each character over high latency links.  See also
+@uref{ftp://ftp.rfc-editor.org/in-notes/rfc1116.txt, Internet RFC 1116}.
+Non-POSIX@.
+May be negated.
 @end table
 
 
@@ -14311,7 +14319,7 @@ cread -ignbrk brkint -inlcr -igncr icrnl -ixoff
 -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr
 -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0
 ff0 isig icanon iexten echo echoe echok -echonl
--noflsh -xcase -tostop -echoprt echoctl echoke
+-noflsh -xcase -tostop -echoprt echoctl echoke -extproc
 @end example
 
 @noindent
diff --git a/src/stty.c b/src/stty.c
index 14c4254..f265f96 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -342,6 +342,9 @@ static struct mode_info const mode_info[] =
   {"echoke", local, SANE_SET | REV, ECHOKE, 0},
   {"crtkill", local, REV | OMIT, ECHOKE, 0},
 #endif
+#ifdef EXTPROC
+  {"extproc", local, SANE_UNSET | REV, EXTPROC, 0},
+#endif
 
   {"evenp", combination, REV | OMIT, 0, 0},
   {"parity", combination, REV | OMIT, 0, 0},
@@ -807,6 +810,11 @@ Local settings:\n\
  * [-]echoprt    echo erased characters backward, between '\\' and '/'\n\
 "), stdout);
 #endif
+#if defined EXTPROC || defined TIOCEXT
+      fputs (_("\
+ * [-]extproc    enable \"LINEMODE\"; useful with high latency links\n\
+"), stdout);
+#endif
       fputs (_("\
    [-]icanon     enable erase, kill, werase, and rprnt special characters\n\
    [-]iexten     enable non-POSIX special characters\n\
@@ -892,8 +900,8 @@ Combination settings:\n\
                  -ixoff -iuclc -ixany imaxbel opost -olcuc -ocrnl onlcr\n\
                  -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\n\
                  isig icanon iexten echo echoe echok -echonl -noflsh\n\
-                 -xcase -tostop -echoprt echoctl echoke, all special\n\
-                 characters to their default values\n\
+                 -xcase -tostop -echoprt echoctl echoke -extproc,\n\
+                 all special characters to their default values\n\
 "), stdout);
       fputs (_("\
 \n\
@@ -1111,6 +1119,19 @@ main (int argc, char **argv)
               speed_was_set = true;
               require_set_attr = true;
             }
+#ifdef TIOCEXT
+          else if (STREQ (arg, "extproc") || STREQ (arg, "-extproc"))
+            {
+              /* This is the BSD interface to "extproc".  */
+              int val = *arg != '-';
+
+              if (ioctl (STDIN_FILENO, TIOCEXT, &val) != 0)
+                {
+                  error (EXIT_FAILURE, errno, "error setting %s on %s",
+                         arg, device_name);
+                }
+            }
+#endif
 #ifdef TIOCGWINSZ
           else if (STREQ (arg, "rows"))
             {
-- 
2.1.0




reply via email to

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