pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools Support a --debug flag that dumps the output ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/114a6a755e63
branches:  trunk
changeset: 511441:114a6a755e63
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Apr 14 14:40:34 2006 +0000

description:
Support a --debug flag that dumps the output of the awk script to a
*.debug file.

diffstat:

 mk/tools/msgfmt.sh |  18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r bbb85bf84af2 -r 114a6a755e63 mk/tools/msgfmt.sh
--- a/mk/tools/msgfmt.sh        Fri Apr 14 14:38:46 2006 +0000
+++ b/mk/tools/msgfmt.sh        Fri Apr 14 14:40:34 2006 +0000
@@ -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 @@
 # 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 @@
 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 @@
                next
        }
 }
-' | $cmd
+' | $debug | $cmd



Home | Main Index | Thread Index | Old Index