Add support for the CMSPAR flag to stty. Includes documentation and a
mention in NEWS as it's a user visible change.

Signed-off-by: Colin Leitner <[email protected]>
---
 NEWS               |    2 ++
 doc/coreutils.texi |    9 +++++++++
 src/stty.c         |    4 ++++
 tests/misc/stty.sh |    2 +-
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 22fb814..b6dab62 100644
--- a/NEWS
+++ b/NEWS
@@ -105,6 +105,8 @@ GNU coreutils NEWS                                    -*- 
outline -*-
   split --line-bytes=SIZE, now only allocates memory as needed rather
   than allocating SIZE bytes at program start.

+  stty now supports configuring "stick" (mark/space) parity where available.
+
 ** Build-related

   factor now builds on aarch64 based systems [bug introduced in coreutils-8.20]
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 3ae39d1..292c795 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -13792,6 +13792,15 @@ May be negated.
 @cindex even parity
 Set odd parity (even if negated).  May be negated.

+@item cmspar
+@opindex cmspar
+@cindex stick parity
+@cindex mark parity
+@cindex space parity
+Use "stick" (mark/space) parity. If parodd is set, the partiy bit is always 1;
+if parodd is not set, the parity bit is always zero. Non-POSIX@. May be
+negated.
+
 @item cs5
 @itemx cs6
 @itemx cs7
diff --git a/src/stty.c b/src/stty.c
index e518839..c95217e 100644
--- a/src/stty.c
+++ b/src/stty.c
@@ -205,6 +205,9 @@ static struct mode_info const mode_info[] =
 {
   {"parenb", control, REV, PARENB, 0},
   {"parodd", control, REV, PARODD, 0},
+#ifdef CMSPAR
+  {"cmspar", control, REV, CMSPAR, 0},
+#endif
   {"cs5", control, 0, CS5, CSIZE},
   {"cs6", control, 0, CS6, CSIZE},
   {"cs7", control, 0, CS7, CSIZE},
@@ -593,6 +596,7 @@ Control settings:\n\
    [-]hupcl      same as [-]hup\n\
    [-]parenb     generate parity bit in output and expect parity bit in 
input\n\
    [-]parodd     set odd parity (or even parity with '-')\n\
+ * [-]cmspar     use \"stick\" (mark/space) parity\n\
 "), stdout);
       fputs (_("\
 \n\
diff --git a/tests/misc/stty.sh b/tests/misc/stty.sh
index 2f9b9a3..2c1317e 100755
--- a/tests/misc/stty.sh
+++ b/tests/misc/stty.sh
@@ -52,7 +52,7 @@ for opt in $options; do
   # other serial control settings give the same error. So skip them.
   # Also on ppc*|sparc* glibc platforms 'icanon' gives the same error.
   # See: http://debbugs.gnu.org/7228#14
-  case $opt in parenb|parodd|cstopb|crtscts|cdtrdsr|icanon) continue;; esac
+  case $opt in parenb|parodd|cmspar|cstopb|crtscts|cdtrdsr|icanon) continue;; 
esac

   stty $opt || fail=1

-- 
1.7.10.4

Reply via email to