summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-04-14 14:40:34 +0000
committerjlam <jlam@pkgsrc.org>2006-04-14 14:40:34 +0000
commit46ac1a79cc8c8925b8cd8229b28b66067a17c9ae (patch)
tree73fb2a4df51e06ff40ddfc7cce357753fb38cb2d /mk
parent75bee2992a89325fd536bc1e8745b371170e688d (diff)
downloadpkgsrc-46ac1a79cc8c8925b8cd8229b28b66067a17c9ae.tar.gz
Support a --debug flag that dumps the output of the awk script to a
*.debug file.
Diffstat (limited to 'mk')
-rwxr-xr-xmk/tools/msgfmt.sh18
1 files changed, 16 insertions, 2 deletions
diff --git a/mk/tools/msgfmt.sh b/mk/tools/msgfmt.sh
index 4ec4ab71230..de36aa9ac99 100755
--- a/mk/tools/msgfmt.sh
+++ b/mk/tools/msgfmt.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: msgfmt.sh,v 1.6 2006/04/14 14:06:54 jlam Exp $
+# $NetBSD: msgfmt.sh,v 1.7 2006/04/14 14:40:34 jlam Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -67,6 +67,7 @@
: ${AWK=awk}
: ${CAT=cat}
: ${MSGFMT=/usr/bin/msgfmt}
+: ${TEE=tee}
case "${MSGFMT}" in
/*) ;;
@@ -82,9 +83,13 @@ fi
# Parse the command line options.
version=
pofile=
+debug=
cmd="${MSGFMT}"
while test $# -gt 0; do
case "$1" in
+ --debug)
+ debug=yes; shift
+ ;;
--version)
version="$1"
cmd="$cmd $1"; shift
@@ -106,6 +111,15 @@ done
test -z "$version" || exec $cmd
test -n "$pofile" || exec $cmd
+# If --debug is specified, then dump the output from the awk script
+# to $pofile.debug along the way.
+#
+if test -z "$debug"; then
+ debug="${CAT}"
+else
+ debug="${TEE} $pofile.debug"
+fi
+
${CAT} $pofile | ${AWK} '
{
s = 0
@@ -235,4 +249,4 @@ ${CAT} $pofile | ${AWK} '
next
}
}
-' | $cmd
+' | $debug | $cmd