Use strict and warnings in posubst

This commit is contained in:
Rene Kita
2022-01-14 13:10:46 +01:00
parent 53d323453d
commit d5817a26c7

View File

@@ -1,12 +1,15 @@
#!@PERL@ #!@PERL@
# gettext message substitute # gettext message substitute
# #
$po_dir='po'; use strict;
$lang='@POLANG@'; use warnings;
%msg = ();
$msgid = ''; my $po_dir='po';
$charset = "UTF-8"; my $lang='@POLANG@';
$charset_code = "WC_CES_UTF_8"; my %msg = ();
my $msgid = '';
my $charset = "UTF-8";
my $charset_code = "WC_CES_UTF_8";
open(PO, "$po_dir/$lang.po") or die "cannot open $po_dir/$lang.po, $!"; open(PO, "$po_dir/$lang.po") or die "cannot open $po_dir/$lang.po, $!";
while (<PO>) { while (<PO>) {
if (/^msgid\s*"(.*)"/) { if (/^msgid\s*"(.*)"/) {
@@ -25,7 +28,7 @@ while (<PO>) {
close(PO); close(PO);
open(CL, "charset-list") or die "cannot open charset-list, $!"; open(CL, "charset-list") or die "cannot open charset-list, $!";
while (<CL>) { while (<CL>) {
@l = split; my @l = split;
if ($l[0] eq $charset) { if ($l[0] eq $charset) {
$charset_code = $l[1]; $charset_code = $l[1];
last; last;
@@ -33,9 +36,9 @@ while (<CL>) {
} }
close(CL); close(CL);
@src = grep {/\.c$/} @ARGV; my @src = grep {/\.c$/} @ARGV;
@tmp = (); my @tmp = ();
foreach $src (@src) { foreach my $src (@src) {
open(SRC0, $src) or die "cannot open $src, $!"; open(SRC0, $src) or die "cannot open $src, $!";
push(@tmp, ".$src"); push(@tmp, ".$src");
open(SRC1, ">.$src") or die "cannot create .$src, $!"; open(SRC1, ">.$src") or die "cannot create .$src, $!";