summaryrefslogtreecommitdiffstats
path: root/usr.bin/sed/process.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-07-19 17:21:21 +0000
committerderaadt <deraadt@openbsd.org>2015-07-19 17:21:21 +0000
commitf9142e5b7234cd9cb5764a1b5474d8a66977d452 (patch)
treeb87d5dd896eb1ec4e80266fe837358f41cda5736 /usr.bin/sed/process.c
parentOops. Missed a file from offset commit. (diff)
downloadwireguard-openbsd-f9142e5b7234cd9cb5764a1b5474d8a66977d452.tar.xz
wireguard-openbsd-f9142e5b7234cd9cb5764a1b5474d8a66977d452.zip
figure out the linewidth at initialization, rather than late
ok tedu miod
Diffstat (limited to 'usr.bin/sed/process.c')
-rw-r--r--usr.bin/sed/process.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/usr.bin/sed/process.c b/usr.bin/sed/process.c
index d61249e0a26..26daab57d52 100644
--- a/usr.bin/sed/process.c
+++ b/usr.bin/sed/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.24 2015/07/17 20:38:57 jasper Exp $ */
+/* $OpenBSD: process.c,v 1.25 2015/07/19 17:21:21 deraadt Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@@ -35,7 +35,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/ioctl.h>
#include <sys/uio.h>
#include <ctype.h>
@@ -473,25 +472,9 @@ static void
lputs(char *s)
{
int count;
+ extern int termwidth;
const char *escapes;
char *p;
- struct winsize win;
- static int termwidth = -1;
-
- if (outfile != stdout)
- termwidth = 60;
-
- if (termwidth == -1) {
- termwidth = 0;
- if ((p = getenv("COLUMNS")))
- termwidth = strtonum(p, 0, INT_MAX, NULL);
- if (termwidth == 0 &&
- ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
- win.ws_col > 0)
- termwidth = win.ws_col;
- if (termwidth == 0)
- termwidth = 60;
- }
for (count = 0; *s; ++s) {
if (count >= termwidth) {