* Update copyright year.

* Give back one line of ws when showing a diff.
  This was requested by several.
* Un-quote DIFF_FLAG, and add DIFF_OPTIONS. This will allow the user to
  do more creative things in a mergemaster rc file. Un-quoting is necessary
  in order to handle things like CVS Id tags that look like shell variables.
* Simplify terminal width determination.

Suggestions related to ignoring the CVS Id's were taken from several, with
dillon and gad providing particularly helpful feedback.
This commit is contained in:
Doug Barton 2003-02-05 11:09:21 +00:00
parent 37e7a5a285
commit 1d825c58fb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110377

View File

@ -5,7 +5,7 @@
# Compare files created by /usr/src/etc/Makefile (or the directory
# the user specifies) with the currently installed copies.
# Copyright 1998-2002 Douglas Barton
# Copyright 1998-2003 Douglas Barton
# DougB@FreeBSD.org
# $FreeBSD$
@ -115,10 +115,9 @@ diff_loop () {
echo ' ====================================================================== '
echo ''
(
echo ''
echo " *** Displaying differences between ${COMPFILE} and installed version:"
echo ''
diff "${DIFF_FLAG}" "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
diff ${DIFF_FLAG} ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}"
) | ${PAGER}
echo ''
fi
@ -242,6 +241,7 @@ while getopts ":ascrvhipCm:t:du:w:D:" COMMAND_LINE_ARGUMENT ; do
case "${COMMAND_LINE_ARGUMENT}" in
s)
STRICT=yes
unset DIFF_OPTIONS
;;
c)
DIFF_FLAG='-c'
@ -372,7 +372,7 @@ SOURCEDIR=${SOURCEDIR:-/usr/src/etc}
# Check the width of the user's terminal
#
if [ -t 0 ]; then
w=$(stty -a | sed -ne 's/.* \([0-9][0-9]*\) columns.*/\1/p')
w=`tput columns`
case "${w}" in
0|'') ;; # No-op, since the input is not valid
*)
@ -812,7 +812,8 @@ for COMPFILE in `find . -type f -size +0`; do
# Do an absolute diff first to see if the files are actually different.
# If they're not different, delete the one in temproot.
#
if diff -q "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > /dev/null 2>&1; then
if diff -q ${DIFF_OPTIONS} "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
/dev/null 2>&1; then
echo " *** Temp ${COMPFILE} and installed are the same, deleting"
rm "${COMPFILE}"
else