Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/sysinst Print the program name in error messages.
details: https://anonhg.NetBSD.org/src/rev/85cf4b2e1b31
branches: trunk
changeset: 1015969:85cf4b2e1b31
user: christos <christos%NetBSD.org@localhost>
date: Thu Nov 05 19:13:21 2020 +0000
description:
Print the program name in error messages.
diffstat:
usr.sbin/sysinst/msg_xlat.sh | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diffs (65 lines):
diff -r 39bd6ba0c526 -r 85cf4b2e1b31 usr.sbin/sysinst/msg_xlat.sh
--- a/usr.sbin/sysinst/msg_xlat.sh Thu Nov 05 18:43:55 2020 +0000
+++ b/usr.sbin/sysinst/msg_xlat.sh Thu Nov 05 19:13:21 2020 +0000
@@ -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 @@
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 @@
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 @@
}
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 @@
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
Home |
Main Index |
Thread Index |
Old Index