pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools Change input file lookup behavior to close to...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/54a87416c04a
branches:  trunk
changeset: 528544:54a87416c04a
user:      obache <obache%pkgsrc.org@localhost>
date:      Mon May 07 09:31:05 2007 +0000

description:
Change input file lookup behavior to close to gnu msgfmt's implementation.
 * allow "-" (stdin)
 * allow other than regurar file (should fix PR 36257).
 * if doesn't exist, try to append extension ".po" and ".pot".

diffstat:

 mk/tools/msgfmt.sh |  17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diffs (33 lines):

diff -r a7bd12fbb09e -r 54a87416c04a mk/tools/msgfmt.sh
--- a/mk/tools/msgfmt.sh        Mon May 07 09:29:54 2007 +0000
+++ b/mk/tools/msgfmt.sh        Mon May 07 09:31:05 2007 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: msgfmt.sh,v 1.26 2006/12/15 13:15:07 martti Exp $
+# $NetBSD: msgfmt.sh,v 1.27 2007/05/07 09:31:05 obache Exp $
 #
 # Copyright (c) 2006 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -143,12 +143,15 @@
 # If the input file cannot be found as named, then also search for a file
 # with the same name that ends in ".po".
 #
-if test ! -f "$pofile"; then
-       case "$pofile" in
-       *.po)   popofile=$pofile ;;
-       *)      popofile=${pofile}.po ;;
-       esac
-       if test ! -f "$popofile"; then
+if test "$pofile" != "-" -a ! -e "$pofile"; then
+       popofile=""
+       for extension in po pot; do
+               if test -e "$pofile.$extension"; then
+                       popofile="$pofile.$extension"
+                       break;
+               fi
+       done
+       if test "x$popofile" = "x"; then
                echo 1>&2 "$0: error while opening \"$pofile\" for reading: No such file or directory"
                exit 1
        fi



Home | Main Index | Thread Index | Old Index