[PATCH 03/18] dim: echoerr helper for printing to stderr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 dim | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/dim b/dim
index 192d6ee10838..2601bb7dbbad 100755
--- a/dim
+++ b/dim
@@ -102,12 +102,17 @@ DRY=
 FORCE=
 HELP=
 
+function echoerr
+{
+	echo "$@" >&2
+}
+
 function warn_or_fail
 {
 	if [[ $FORCE ]] ; then
-		echo WARNING: $1, but continuing
+		echoerr WARNING: $1, but continuing
 	else
-		echo ERROR: $1, aborting
+		echoerr ERROR: $1, aborting
 		exit 1
 	fi
 }
@@ -128,7 +133,7 @@ while getopts hdfi opt; do
 			HELP=1
 			;;
 		*)
-			echo "See '$dim help' for more information." >&2
+			echoerr "See '$dim help' for more information."
 			exit
 	esac
 done
@@ -167,18 +172,18 @@ function dim_uptodate
 	local using="${BASH_SOURCE[0]}"
 
 	if [[ ! -e "$using" ]]; then
-		echo "$dim: could not figure out the version being used ($using)." >&2
+		echoerr "$dim: could not figure out the version being used ($using)."
 		exit 1
 	fi
 
 	if [[ ! -e "$DIM_PREFIX/maintainer-tools/.git" ]]; then
-		echo "$dim: could not find the upstream repo for $dim." >&2
+		echoerr "$dim: could not find the upstream repo for $dim."
 		exit 1
 	fi
 
 	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show @{upstream}:dim |\
 			diff "$using" - >& /dev/null; then
-		echo "$dim: not running upstream version of the script." >&2
+		echoerr "$dim: not running upstream version of the script."
 		exit 1
 	fi
 }
@@ -1280,6 +1285,6 @@ subcmd_func=dim_${subcmd//-/_}
 if declare -f $subcmd_func >/dev/null; then
 	$subcmd_func "$@"
 else
-	echo "$dim: '$subcommand' is not a dim command." >&2
+	echoerr "$dim: '$subcommand' is not a dim command."
 	dim_usage
 fi
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux