From 21a3ac968cef962fe9dadcd7a7058f169e836e36 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 6 Feb 2016 12:56:55 -0800 Subject: [PATCH] port to new Autom4te::XFile API --- bin/autoheader.in | 12 ++++++------ bin/autom4te.in | 16 ++++++++-------- bin/autoreconf.in | 2 +- bin/autoscan.in | 12 ++++++------ bin/autoupdate.in | 16 ++++++++-------- bin/ifnames.in | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/bin/autoheader.in b/bin/autoheader.in index 8c70663d..5e8b128e 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -201,7 +201,7 @@ $config_h_in ||= "$config_h.in"; # only the name of the macro. %symbol = map { s/\(.*//; $_ => 1 } keys %symbol; -my $out = new Autom4te::XFile ("> " . open_quote ("$tmp/config.hin")); +my $out = new Autom4te::XFile ("$tmp/config.hin", ">"); # Don't write "do not edit" -- it will get copied into the # config.h, which it's ok to edit. @@ -210,7 +210,7 @@ print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n"; # Dump the top. if ($config_h_top) { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_top)); + my $in = new Autom4te::XFile ($config_h_top, "<"); while ($_ = $in->getline) { print $out $_; @@ -220,7 +220,7 @@ if ($config_h_top) # Dump 'acconfig.h', except for its bottom portion. if ($acconfig_h) { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); + my $in = new Autom4te::XFile ($acconfig_h, "<"); while ($_ = $in->getline) { last if /\@BOTTOM\@/; @@ -238,7 +238,7 @@ foreach (sort keys %verbatim) # Dump bottom portion of 'acconfig.h'. if ($acconfig_h) { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); + my $in = new Autom4te::XFile ($acconfig_h, "<"); my $dump = 0; while ($_ = $in->getline) { @@ -250,7 +250,7 @@ if ($acconfig_h) # Dump the bottom. if ($config_h_bot) { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_bot)); + my $in = new Autom4te::XFile ($config_h_bot, "<"); while ($_ = $in->getline) { print $out $_; @@ -261,7 +261,7 @@ $out->close; # Check that all the symbols have a template. { - my $in = new Autom4te::XFile ("< " . open_quote ("$tmp/config.hin")); + my $in = new Autom4te::XFile ("$tmp/config.hin", "<"); my $suggest_ac_define = 1; while ($_ = $in->getline) { diff --git a/bin/autom4te.in b/bin/autom4te.in index 798013a5..a459e520 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -258,7 +258,7 @@ sub load_configuration ($) my ($file) = @_; use Text::ParseWords; - my $cfg = new Autom4te::XFile ("< " . open_quote ($file)); + my $cfg = new Autom4te::XFile ($file, "<"); my $lang; while ($_ = $cfg->getline) { @@ -527,7 +527,7 @@ sub handle_output ($$) handle_traces ($req, "$tmp/patterns", ('m4_pattern_forbid' => 'forbid:$1:$2', 'm4_pattern_allow' => 'allow:$1')); - my @patterns = new Autom4te::XFile ("< " . open_quote ("$tmp/patterns"))->getlines; + my @patterns = new Autom4te::XFile ("$tmp/patterns", "<")->getlines; chomp @patterns; my %forbidden = map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns; @@ -554,7 +554,7 @@ sub handle_output ($$) } fatal "cannot create $output: $!" unless $out; - my $in = new Autom4te::XFile ("< " . open_quote ($ocache . $req->id)); + my $in = new Autom4te::XFile ($ocache . $req->id, "<"); my %prohibited; my $res; @@ -599,7 +599,7 @@ sub handle_output ($$) if ($ARGV[$#ARGV] ne '-') { my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; - my $file = new Autom4te::XFile ("< " . open_quote ($ARGV[$#ARGV])); + my $file = new Autom4te::XFile ($ARGV[$#ARGV], "<"); while ($_ = $file->getline) { @@ -717,7 +717,7 @@ sub handle_traces ($$%) verb "formatting traces for '$output': " . join (', ', sort keys %trace); # Processing the traces. - my $trace_m4 = new Autom4te::XFile ("> " . open_quote ("$tmp/traces.m4")); + my $trace_m4 = new Autom4te::XFile ("$tmp/traces.m4", ">"); $_ = <<'EOF'; divert(-1) @@ -818,7 +818,7 @@ EOF # # Pay attention that the file name might include colons, if under DOS # for instance, so we don't use '[^:]+'. - my $traces = new Autom4te::XFile ("< " . open_quote ($tcache . $req->id)); + my $traces = new Autom4te::XFile ($tcache . $req->id, "<"); while ($_ = $traces->getline) { # Trace with arguments, as the example above. We don't try @@ -834,7 +834,7 @@ EOF $trace_m4->close; my $in = new Autom4te::XFile ("$m4 " . shell_quote ("$tmp/traces.m4") . " |"); - my $out = new Autom4te::XFile ("> " . open_quote ($output)); + my $out = new Autom4te::XFile ($output, ">"); # This is dubious: should we really transform the quadrigraphs in # traces? It might break balanced [ ] etc. in the output. The @@ -896,7 +896,7 @@ sub up_to_date ($) handle_traces ($req, "$tmp/dependencies", ('include' => '$1', 'm4_include' => '$1')); - my $deps = new Autom4te::XFile ("< " . open_quote ("$tmp/dependencies")); + my $deps = new Autom4te::XFile ("$tmp/dependencies", "<"); while ($_ = $deps->getline) { chomp; diff --git a/bin/autoreconf.in b/bin/autoreconf.in index 9f353b09..84e327b9 100644 --- a/bin/autoreconf.in +++ b/bin/autoreconf.in @@ -257,7 +257,7 @@ sub autoreconf_current_directory () my $uses_gettext; if (-f $configure_ac) { - my $configure_ac_file = new Autom4te::XFile "< $configure_ac"; + my $configure_ac_file = new Autom4te::XFile ("$configure_ac", "<"); while ($_ = $configure_ac_file->getline) { s/#.*//; diff --git a/bin/autoscan.in b/bin/autoscan.in index 5a3344dc..e47c2130 100644 --- a/bin/autoscan.in +++ b/bin/autoscan.in @@ -169,7 +169,7 @@ sub init_tables () # instead of duplicating the code in lots of configure.ac files. my $file = find_file ("autoscan/autoscan.list", reverse (@prepend_include), @include); - my $table = new Autom4te::XFile "< " . open_quote ($file); + my $table = new Autom4te::XFile ($file, "<"); my $tables_are_consistent = 1; while ($_ = $table->getline) @@ -244,7 +244,7 @@ sub scan_c_file ($) # Nonzero if in a multiline comment. my $in_comment = 0; - my $file = new Autom4te::XFile "< " . open_quote ($file_name); + my $file = new Autom4te::XFile ($file_name, "<"); while ($_ = $file->getline) { @@ -310,7 +310,7 @@ sub scan_makefile ($) my ($file_name) = @_; push @makefiles, $File::Find::name; - my $file = new Autom4te::XFile "< " . open_quote ($file_name); + my $file = new Autom4te::XFile ($file_name, "<"); while ($_ = $file->getline) { @@ -352,7 +352,7 @@ sub scan_sh_file ($) my ($file_name) = @_; push @shfiles, $File::Find::name; - my $file = new Autom4te::XFile "< " . open_quote ($file_name); + my $file = new Autom4te::XFile ($file_name, "<"); while ($_ = $file->getline) { @@ -521,7 +521,7 @@ sub output ($) my $configure_scan = shift; my %unique_makefiles; - my $file = new Autom4te::XFile "> " . open_quote ($configure_scan); + my $file = new Autom4te::XFile ($configure_scan, ">"); print $file ("# -*- Autoconf -*-\n" . @@ -639,7 +639,7 @@ sub check_configure_ac ($) ## -------------- ## parse_args; -$log = new Autom4te::XFile "> " . open_quote ("$me.log"); +$log = new Autom4te::XFile ("$me.log", ">"); $autoconf .= " --debug" if $debug; $autoconf .= " --verbose" if $verbose; diff --git a/bin/autoupdate.in b/bin/autoupdate.in index 75397a98..e9833bab 100644 --- a/bin/autoupdate.in +++ b/bin/autoupdate.in @@ -130,7 +130,7 @@ sub handle_autoconf_macros () { # Get the builtins. xsystem ("echo dumpdef | $m4 2>" . shell_quote ("$tmp/m4.defs") . " >/dev/null"); - my $m4_defs = new Autom4te::XFile "< " . open_quote ("$tmp/m4.defs"); + my $m4_defs = new Autom4te::XFile ("$tmp/m4.defs", "<"); while ($_ = $m4_defs->getline) { $m4_builtins{$1} = 1 @@ -186,9 +186,9 @@ sub handle_autoconf_macros () # ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded). # unac.m4 -- undefine the AC macros. - my $ac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/ac.m4"); + my $ac_m4 = new Autom4te::XFile ("$tmp/ac.m4", ">"); print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n"; - my $unac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unac.m4"); + my $unac_m4 = new Autom4te::XFile ("$tmp/unac.m4", ">"); print $unac_m4 "# unac.m4 -- undefine the AC macros.\n"; foreach (sort keys %ac_macros) { @@ -199,11 +199,11 @@ sub handle_autoconf_macros () # m4save.m4 -- save the m4 builtins. # unm4.m4 -- disable the m4 builtins. # m4.m4 -- enable the m4 builtins. - my $m4save_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/m4save.m4"); + my $m4save_m4 = new Autom4te::XFile ("$tmp/m4save.m4", ">"); print $m4save_m4 "# m4save.m4 -- save the m4 builtins.\n"; - my $unm4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unm4.m4"); + my $unm4_m4 = new Autom4te::XFile ("$tmp/unm4.m4", ">"); print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n"; - my $m4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/m4.m4"); + my $m4_m4 = new Autom4te::XFile ("$tmp/m4.m4", ">"); print $m4_m4 "# m4.m4 -- enable the m4 builtins.\n"; foreach (sort keys %m4_builtins) { @@ -381,9 +381,9 @@ EOF $input_m4 =~ s/\$file/$file/g; # prepared input -- input, but reenables the quote before each AU macro. - open INPUT_M4, "> " . open_quote ("$tmp/input.m4") + open INPUT_M4, ">", "$tmp/input.m4" or error "cannot open: $!"; - open FILE, "< " . open_quote ($file) + open FILE, "<", $file or error "cannot open: $!"; print INPUT_M4 "$input_m4"; while () diff --git a/bin/ifnames.in b/bin/ifnames.in index 2910370a..00f29fd6 100644 --- a/bin/ifnames.in +++ b/bin/ifnames.in @@ -96,7 +96,7 @@ my %occurrence; sub scan_file ($) { my ($file_name) = @_; - my $file = new Autom4te::XFile ("< " . open_quote ($file_name)); + my $file = new Autom4te::XFile ($file_name, "<"); while ($_ = $file->getline) { # Continuation lines. -- 2.11.4.GIT