diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-07-24 14:51:16 +0000 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2005-07-24 14:51:16 +0000 |
commit | 067c99f4bfc64da4686baae048129803d7afc572 (patch) | |
tree | 0303280229d0845e62017481bdab49853d62ccc0 /scripts/remove-trailing-ws.in | |
parent | 8d2af3e17aeddcbed2080ae6631e1047fa446373 (diff) | |
download | quilt-067c99f4bfc64da4686baae048129803d7afc572.tar.gz |
- Let the perl scripts (edmail, parse-patch and remove-trailing-ws) work
without Locale::gettext.
Diffstat (limited to 'scripts/remove-trailing-ws.in')
-rw-r--r-- | scripts/remove-trailing-ws.in | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/remove-trailing-ws.in b/scripts/remove-trailing-ws.in index dfda46b..8179a9a 100644 --- a/scripts/remove-trailing-ws.in +++ b/scripts/remove-trailing-ws.in @@ -8,11 +8,28 @@ use strict; use FileHandle; use File::Temp qw( :mktemp ); -use POSIX qw(setlocale); -use Locale::gettext; use Getopt::Std; use vars qw($opt_p $opt_n); +# This ugly trick lets the script work even if gettext support is missing. +# We did so because Locale::gettext doesn't ship with the standard perl +# distribution. +BEGIN { + if (eval { require Locale::gettext }) { + import Locale::gettext; + require POSIX; + import POSIX, qw(setlocale); + } else { + eval ' + use constant LC_MESSAGES => 0; + sub setlocale($$) { } + sub bindtextdomain($$) { } + sub textdomain($) { } + sub gettext($) { shift } + ' + } +} + setlocale(LC_MESSAGES, ""); bindtextdomain("quilt", "@LOCALEDIR@"); textdomain("quilt"); |