summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorobache <obache>2007-05-07 09:31:05 +0000
committerobache <obache>2007-05-07 09:31:05 +0000
commitee29fed4ff4c3e4a9cb2fe97b8fde702f067db00 (patch)
treec50dd00387ec83f570bbe63feb40c030c088212c /mk
parent8983cdd680ac04e2b838098570fdbe4eabf45c00 (diff)
downloadpkgsrc-ee29fed4ff4c3e4a9cb2fe97b8fde702f067db00.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-xmk/tools/msgfmt.sh17
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