summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2015-02-17 15:43:35 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2015-02-17 15:43:35 +0000
commit840c10ca4976dbdc9c7af5906414d62a9f9d2e0b (patch)
treeff5fb5fa55264b016f78659431bef23c6497718d /usr.sbin
parent08d7f4a8561515937b08d4f0e5f4e482435eda6c (diff)
Instead of a relatively complex "stty size | ( read ..." in sysmerge, use
"tput cols". (This from ajacoutot@). Use it directly in the sdiff command, rather than saving it once at startup. Handling window size changes at runtime makes sysmerge significantly easier to use in common cases. Adds around .17s per sdiff invocation on my slowest machine (486), imperceptible on a faster machine, so it seems a reasonable trade-off. ok ajacoutot@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sysmerge/sysmerge.sh7
1 files changed, 3 insertions, 4 deletions
diff --git a/usr.sbin/sysmerge/sysmerge.sh b/usr.sbin/sysmerge/sysmerge.sh
index 56a93e09982..955d5c810cc 100644
--- a/usr.sbin/sysmerge/sysmerge.sh
+++ b/usr.sbin/sysmerge/sysmerge.sh
@@ -1,6 +1,6 @@
#!/bin/ksh -
#
-# $OpenBSD: sysmerge.sh,v 1.193 2014/11/26 15:52:30 ajacoutot Exp $
+# $OpenBSD: sysmerge.sh,v 1.194 2015/02/17 15:43:34 sthen Exp $
#
# Copyright (c) 2008-2014 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 1998-2003 Douglas Barton <DougB@FreeBSD.org>
@@ -366,7 +366,7 @@ sm_merge_loop() {
_tomerge=true
while ${_tomerge}; do
cp -p ${COMPFILE} ${COMPFILE}.merged
- sdiff -as -w ${_STTYSIZE} -o ${COMPFILE}.merged \
+ sdiff -as -w $(tput cols) -o ${COMPFILE}.merged \
${TARGET} ${COMPFILE}
_instmerged=v
while [[ ${_instmerged} == v ]]; do
@@ -620,8 +620,7 @@ _WRKDIR=$(mktemp -d -p ${TMPDIR:=/tmp} sysmerge.XXXXXXXXXX) || exit 1
_BKPDIR=${_WRKDIR}/backups
_TMPROOT=${_WRKDIR}/temproot
_RELINT=$(uname -r | tr -d '.') || exit 1
-_STTYSIZE=$(stty size | ( read r c; ((c==0)) && c=80; echo $c )) || exit 1
-readonly _WRKDIR _BKPDIR _TMPROOT _RELINT _STTYSIZE
+readonly _WRKDIR _BKPDIR _TMPROOT _RELINT
[[ -z ${VISUAL} ]] && EDITOR=${EDITOR:=/usr/bin/vi} || EDITOR=${VISUAL}
PAGER=${PAGER:=/usr/bin/more}