summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorThorsten Lockert <tholo@cvs.openbsd.org>1996-12-16 20:04:57 +0000
committerThorsten Lockert <tholo@cvs.openbsd.org>1996-12-16 20:04:57 +0000
commit5a09a67a00e664c638ec75e42527b7be43e106e9 (patch)
treebdbaf1bcb1add1dcbe2614ec0bcd2eb2d63324dd /bin
parent296c12c4b0ff928c16b41811ddd1edaddfb093e1 (diff)
Implement more tty flags for better portability from other systems:
XCASE - canonical input/output processing IUCLC - translate uppercase to lowercase on input OLCUC - translate lowercase to uppercase on output OCRNL - translate carriage return to newline on output ONOCR - do not output carriage return at column 0 ONLRET - newline performs carriage return function In addition the tty compatibility interface supports LCASE properly. Look at termios(4) for a more complete description of the above flags.
Diffstat (limited to 'bin')
-rw-r--r--bin/stty/key.c22
-rw-r--r--bin/stty/modes.c16
-rw-r--r--bin/stty/stty.125
3 files changed, 58 insertions, 5 deletions
diff --git a/bin/stty/key.c b/bin/stty/key.c
index 1ab7f305fbc..4b9f40f94ce 100644
--- a/bin/stty/key.c
+++ b/bin/stty/key.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: key.c,v 1.4 1996/08/02 12:10:21 deraadt Exp $ */
+/* $OpenBSD: key.c,v 1.5 1996/12/16 20:04:39 tholo Exp $ */
/* $NetBSD: key.c,v 1.11 1995/09/07 06:57:11 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)key.c 8.4 (Berkeley) 2/20/95";
#else
-static char rcsid[] = "$OpenBSD: key.c,v 1.4 1996/08/02 12:10:21 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: key.c,v 1.5 1996/12/16 20:04:39 tholo Exp $";
#endif
#endif /* not lint */
@@ -61,6 +61,7 @@ void f_dec __P((struct info *));
void f_everything __P((struct info *));
void f_extproc __P((struct info *));
void f_ispeed __P((struct info *));
+void f_lcase __P((struct info *));
void f_nl __P((struct info *));
void f_ospeed __P((struct info *));
void f_raw __P((struct info *));
@@ -89,6 +90,7 @@ static struct key {
{ "everything", f_everything, 0 },
{ "extproc", f_extproc, F_OFFOK },
{ "ispeed", f_ispeed, F_NEEDARG },
+ { "lcase", f_lcase, 0 },
{ "new", f_tty, 0 },
{ "nl", f_nl, F_OFFOK },
{ "old", f_tty, 0 },
@@ -221,6 +223,22 @@ f_ispeed(ip)
}
void
+f_lcase(ip)
+ struct info *ip;
+{
+ if (ip->off) {
+ ip.t_iflag &= ~IUCLC;
+ ip.t_oflag &= ~OLCUC;
+ ip.t_lflag &= ~XCASE;
+ } else {
+ ip.t_iflag |= IUCLC;
+ ip.t_oflag |= OLCUC;
+ ip.t_lflag |= XCASE;
+ }
+ ip->set = 1;
+}
+
+void
f_nl(ip)
struct info *ip;
{
diff --git a/bin/stty/modes.c b/bin/stty/modes.c
index 1c4cc17428d..4807ac5e00e 100644
--- a/bin/stty/modes.c
+++ b/bin/stty/modes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: modes.c,v 1.3 1996/06/23 14:21:51 deraadt Exp $ */
+/* $OpenBSD: modes.c,v 1.4 1996/12/16 20:04:41 tholo Exp $ */
/* $NetBSD: modes.c,v 1.9 1996/05/07 18:20:09 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)modes.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: modes.c,v 1.3 1996/06/23 14:21:51 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: modes.c,v 1.4 1996/12/16 20:04:41 tholo Exp $";
#endif
#endif /* not lint */
@@ -110,6 +110,8 @@ const struct modes imodes[] = {
{ "-igncr", 0, IGNCR },
{ "icrnl", ICRNL, 0 },
{ "-icrnl", 0, ICRNL },
+ { "iuclc", IUCLC, 0 },
+ { "-iuclc", 0, IUCLC },
{ "ixon", IXON, 0 },
{ "-ixon", 0, IXON },
{ "flow", IXON, 0 },
@@ -176,6 +178,8 @@ const struct modes lmodes[] = {
{ "-nokerninfo",0, NOKERNINFO },
{ "kerninfo", 0, NOKERNINFO },
{ "-kerninfo", NOKERNINFO, 0 },
+ { "xcase", XCASE, 0 },
+ { "-xcase", 0, XCASE },
{ NULL },
};
@@ -184,8 +188,16 @@ const struct modes omodes[] = {
{ "-opost", 0, OPOST },
{ "litout", 0, OPOST },
{ "-litout", OPOST, 0 },
+ { "ocrnl", OCRNL, 0 },
+ { "-ocrnl", 0, OCRNL },
+ { "olcuc", OLCUC, 0 },
+ { "-olcuc", 0, OLCUC },
{ "onlcr", ONLCR, 0 },
{ "-onlcr", 0, ONLCR },
+ { "onlret", ONLRET, 0 },
+ { "-onlret", 0, ONLRET },
+ { "onocr", ONOCR, 0 },
+ { "-onocr", 0, ONOCR },
{ "tabs", 0, OXTABS }, /* "preserve" tabs */
{ "-tabs", OXTABS, 0 },
{ "oxtabs", OXTABS, 0 },
diff --git a/bin/stty/stty.1 b/bin/stty/stty.1
index 1c643d434ee..6ed86180a62 100644
--- a/bin/stty/stty.1
+++ b/bin/stty/stty.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: stty.1,v 1.4 1996/12/10 09:06:01 deraadt Exp $
+.\" $OpenBSD: stty.1,v 1.5 1996/12/16 20:04:42 tholo Exp $
.\" $NetBSD: stty.1,v 1.10 1995/09/07 06:57:14 jtc Exp $
.\"
.\" Copyright (c) 1990, 1993, 1994
@@ -189,6 +189,9 @@ Map (do not map)
to
.Dv NL
on input.
+.It Cm iuclc Pq Fl iuclc
+Translate (do not translate) upper case to lower case
+on input.
.It Cm ixon Pq Fl ixon
Enable (disable)
.Dv START/STOP
@@ -241,6 +244,14 @@ Map (do not map)
to
.Dv CR-NL
on output.
+.It Cm ocrnl Pq Fl ocrnl
+Translate (do not translate) carriage return to newline on output.
+.It Cm onocr Pq Fl onocr
+Carriage return is output (is not output) at column 0.
+.It Cm onlret Pq Fl onlret
+Newline performs (does not perform) carriage return on output.
+.It Cm olcuc Pq Fl olcuc
+Translate (do not translate) lower case to upper case on output.
.It Cm oxtabs Pq Fl oxtabs
Expand (do not expand) tabs to spaces on output.
.El
@@ -351,6 +362,12 @@ Indicates output is (is not) being discarded.
Indicates input is (is not) pending after a switch from non-canonical
to canonical mode and will be re-input when a read becomes pending
or more input arrives.
+.It Cm xcase Pq Fl xcase
+Upper and lower case is (is not) handled canonically on input and output
+with
+.Cm iuclc
+and
+.Cm olcuc .
.El
.Ss Control Characters:
.Bl -tag -width Fl
@@ -553,6 +570,12 @@ Same as
.It Cm prterase Pq Fl prterase
Same as
.Cm echoprt .
+.It Cm lcase Pq Fl lcase
+Same as
+.Cm iuclc ,
+.Cm olcuc
+and
+.Cm xcase .
.It Cm litout Pq Fl litout
The converse of
.Cm opost .