summaryrefslogtreecommitdiff
path: root/usr.sbin/sysinst
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2020-11-05 19:13:21 +0000
committerchristos <christos@NetBSD.org>2020-11-05 19:13:21 +0000
commitea8a7194abfa71ee9b27936207c487859eaf7d8a (patch)
tree04de0d656b4ac08a18a3df0a1043d457446b478f /usr.sbin/sysinst
parent2b4a1b410fd31b589596b2473be456de932bceba (diff)
Print the program name in error messages.
Diffstat (limited to 'usr.sbin/sysinst')
-rwxr-xr-xusr.sbin/sysinst/msg_xlat.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.sbin/sysinst/msg_xlat.sh b/usr.sbin/sysinst/msg_xlat.sh
index 02231784f70..ae7767a672a 100755
--- a/usr.sbin/sysinst/msg_xlat.sh
+++ b/usr.sbin/sysinst/msg_xlat.sh
@@ -1,5 +1,5 @@
#! /bin/sh
-# $NetBSD: msg_xlat.sh,v 1.1 2014/07/26 19:30:44 dholland Exp $
+# $NetBSD: msg_xlat.sh,v 1.2 2020/11/05 19:13:21 christos Exp $
#-
# Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -30,12 +30,17 @@
# POSSIBILITY OF SUCH DAMAGE.
#
+PROG=$(basename "$0")
usage()
{
- echo "usage: msg_xlat.sh [-ci] [-d msg_defs.h] [-f fmt_count]" >&2
+ echo "Usage: $PROG [-ci] [-d msg_defs.h] [-f fmt_count]" >&2
exit 1
}
+error() {
+ echo "$PROG: ERROR $@" >&2
+}
+
count_fmtargs=
msg_defs=msg_defs.h
while getopts cd:f:i f
@@ -112,7 +117,7 @@ do
name="$2"
eval number=\$MSG_$name
[ -z "$number" ] && {
- echo "ERROR: unknown message \"$name\"" >&2
+ error "unknown message \"$name\""
[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
number=unknown
}
@@ -137,7 +142,7 @@ do
msg="${msg%z}"
eval old=\"\$MSGTEXT_$number\"
[ -n "$old" -a "$number" != unknown ] && {
- echo "ERROR: Two translations for message \"$name\"" >&2
+ error "Two translations for message \"$name\""
[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
}
eval MSGTEXT_$number=\"\${msg}\"
@@ -156,7 +161,7 @@ do
}
eval count=\${count_$number:-unknown}
[ "$count" = $# ] || {
- echo "ERROR: Wrong number of format specifiers in \"$sv_name\", got $#, expected $count" >&2
+ error "Wrong number of format specifiers in \"$sv_name\", got $#, expected $count"
[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
}
done
@@ -177,7 +182,7 @@ while
do
eval msg=\${MSGTEXT_$msgnum}
[ -z "$msg" ] && {
- eval echo "ERROR: No translation for message \$MSGNUM_$msgnum" >&2
+ eval error "No translation for message \$MSGNUM_$msgnum"
printf '%-7d\0' 0
[ -n "$IGNORE_MISSING_TRANSLATIONS" ] || rval=1
continue