aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2008-08-23 13:28:55 +0000
committerEd Schouten <ed@FreeBSD.org>2008-08-23 13:28:55 +0000
commitf8f8c9f0d6d0f38eae1ecde1b9ee39cb3ff6cae5 (patch)
tree933f4d4d4547a7c5299ff6d829d5af0c2d246d78
parentaa22af943854fbf5936c8a27928d1376a8d14de1 (diff)
Make stty(1) use tab0 and tab3 to handle tab completion.
After the MPSAFE TTY import, we have support for the TAB0 and TAB3 flags to handle tab expansion, while we only used to support OXTABS. Switch stty(1) to use tab0 and tab3 to print whether tab expansion is turned on or off. Implement the oxtabs and tabs switches by setting the appropriate TABx value. Even though POSIX only lists this as being XSI, we'd better follow it.
Notes
Notes: svn path=/head/; revision=182052
-rw-r--r--bin/stty/modes.c10
-rw-r--r--bin/stty/print.c9
-rw-r--r--bin/stty/stty.112
3 files changed, 23 insertions, 8 deletions
diff --git a/bin/stty/modes.c b/bin/stty/modes.c
index e72e2dfc3ea5..cc18d2cd4959 100644
--- a/bin/stty/modes.c
+++ b/bin/stty/modes.c
@@ -191,10 +191,12 @@ struct modes omodes[] = {
{ "-onlcr", 0, ONLCR },
{ "ocrnl", OCRNL, 0 },
{ "-ocrnl", 0, OCRNL },
- { "tabs", 0, OXTABS }, /* "preserve" tabs */
- { "-tabs", OXTABS, 0 },
- { "oxtabs", OXTABS, 0 },
- { "-oxtabs", 0, OXTABS },
+ { "tabs", TAB0, TABDLY }, /* "preserve" tabs */
+ { "-tabs", TAB3, TABDLY },
+ { "oxtabs", TAB3, TABDLY },
+ { "-oxtabs", TAB0, TABDLY },
+ { "tab0", TAB0, TABDLY },
+ { "tab3", TAB3, TABDLY },
{ "onocr", ONOCR, 0 },
{ "-onocr", 0, ONOCR },
{ "onlret", ONLRET, 0 },
diff --git a/bin/stty/print.c b/bin/stty/print.c
index 30fcbaa1446a..63b30b360734 100644
--- a/bin/stty/print.c
+++ b/bin/stty/print.c
@@ -136,7 +136,14 @@ print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
put("-opost", OPOST, 1);
put("-onlcr", ONLCR, 1);
put("-ocrnl", OCRNL, 0);
- put("-oxtabs", OXTABS, 1);
+ switch(tmp&TABDLY) {
+ case TAB0:
+ bput("tab0");
+ break;
+ case TAB3:
+ bput("tab3");
+ break;
+ }
put("-onocr", ONOCR, 0);
put("-onlret", ONLRET, 0);
diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index f1f0107bdae7..6cecfd6b0581 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -32,7 +32,7 @@
.\" @(#)stty.1 8.4 (Berkeley) 4/18/94
.\" $FreeBSD$
.\"
-.Dd April 18, 1994
+.Dd August 23, 2008
.Dt STTY 1
.Os
.Sh NAME
@@ -244,8 +244,12 @@ Map (do not map)
to
.Dv NL
on output.
-.It Cm oxtabs Pq Fl oxtabs
-Expand (do not expand) tabs to spaces on output.
+.It Cm tab0 tab3
+Select tab expansion policy.
+.Cm tab0
+disables tab expansion, while
+.Cm tab3
+enables it.
.It Cm onocr Pq Fl onocr
Do not (do) output CRs at column zero.
.It Cm onlret Pq Fl onlret
@@ -570,6 +574,8 @@ Same as
.It Cm litout Pq Fl litout
The converse of
.Cm opost .
+.It Cm oxtabs Pq Fl oxtabs
+Expand (do not expand) tabs to spaces on output.
.It Cm tabs Pq Fl tabs
The converse of
.Cm oxtabs .