diff options
author | 1996-07-13 18:20:17 +0000 | |
---|---|---|
committer | 1996-07-13 18:20:17 +0000 | |
commit | 2df17d25873f53e8ace6f690fd7c1c29db8e9083 (patch) | |
tree | 6c18993d8b10cc8147514c20491fb1f3354bf927 /lib | |
parent | handle >9 days (diff) | |
download | wireguard-openbsd-2df17d25873f53e8ace6f690fd7c1c29db8e9083.tar.xz wireguard-openbsd-2df17d25873f53e8ace6f690fd7c1c29db8e9083.zip |
We are not neccecarily running with curses; if we are we won't use this
mvcur() implementation at all; if we are not we need our own rawmode()
implementation.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtermlib/mvcur.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/libtermlib/mvcur.c b/lib/libtermlib/mvcur.c index a0022089c9f..d78dc965edd 100644 --- a/lib/libtermlib/mvcur.c +++ b/lib/libtermlib/mvcur.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mvcur.c,v 1.1.1.1 1996/05/31 05:40:01 tholo Exp $ */ +/* $OpenBSD: mvcur.c,v 1.2 1996/07/13 18:20:17 tholo Exp $ */ /* * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com> @@ -31,12 +31,27 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: mvcur.c,v 1.1.1.1 1996/05/31 05:40:01 tholo Exp $"; +static char rcsid[] = "$OpenBSD: mvcur.c,v 1.2 1996/07/13 18:20:17 tholo Exp $"; #endif #include <string.h> +#include <unistd.h> +#include <termios.h> #include "term.h" +static int +rawmode() +{ + struct termios ti; + + if (tcgetattr(STDIN_FILENO, &ti) < 0) + return 1; + if (ti.c_oflag & OPOST) + if (ti.c_oflag & ONLCR) + return 0; + return 1; +} + /* * Optimized cursor movement, assume cursor is currently * located at (oldx,oldy), output what is needed for the @@ -49,7 +64,7 @@ mvcur(oldy, oldx, newy, newx) int newy; int newx; { - int l, c; + int l, c, raw; char *p; if (newx >= columns) { @@ -61,8 +76,9 @@ mvcur(oldy, oldx, newy, newx) oldy += l; oldx %= columns; if (!auto_right_margin) { + raw = rawmode(); while (l > 0) { - if (rawmode()) + if (raw) if (carriage_return != NULL) tputs(carriage_return, 0, _ti_outc); else |