diff options
author | obache <obache@pkgsrc.org> | 2007-05-07 09:31:05 +0000 |
---|---|---|
committer | obache <obache@pkgsrc.org> | 2007-05-07 09:31:05 +0000 |
commit | 6615c8e011de1b7baba1aa076a82761119a05064 (patch) | |
tree | c50dd00387ec83f570bbe63feb40c030c088212c /mk | |
parent | 69d0dbcad7b3ea546794af30e45fb909bfaf663c (diff) | |
download | pkgsrc-6615c8e011de1b7baba1aa076a82761119a05064.tar.gz |
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 (limited to 'mk')
-rwxr-xr-x | mk/tools/msgfmt.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mk/tools/msgfmt.sh b/mk/tools/msgfmt.sh index ec388c2752b..d12d9fce86b 100755 --- a/mk/tools/msgfmt.sh +++ b/mk/tools/msgfmt.sh @@ -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 @@ fi # 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 |