[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl: if macro_expand_file_name, internal_links_file_name or sort_element_count_file_name is -, which means output to STDOUT, do not close the filehandle/file descriptor immediately, and instead put it in main_program_unclosed_stdout/main_unclosed_files. |
Date: |
Sat, 25 Jan 2025 12:59:35 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new e5f372dc11 * tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl: if
macro_expand_file_name, internal_links_file_name or
sort_element_count_file_name is -, which means output to STDOUT, do not close
the filehandle/file descriptor immediately, and instead put it in
main_program_unclosed_stdout/main_unclosed_files.
e5f372dc11 is described below
commit e5f372dc1194f63e2ea401a0da0714865f0bcb3f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Jan 25 18:59:43 2025 +0100
* tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl: if
macro_expand_file_name, internal_links_file_name or
sort_element_count_file_name is -, which means output to STDOUT, do
not close the filehandle/file descriptor immediately, and instead put
it in main_program_unclosed_stdout/main_unclosed_files.
---
ChangeLog | 8 +++++++
tp/Texinfo/XS/texi2any.c | 45 ++++++++++++++++++++++++------------
tp/texi2any.pl | 59 +++++++++++++++++++++++++++++-------------------
3 files changed, 74 insertions(+), 38 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 61f322d8ec..cd77f2e8d3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2025-01-25 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl: if
+ macro_expand_file_name, internal_links_file_name or
+ sort_element_count_file_name is -, which means output to STDOUT, do
+ not close the filehandle/file descriptor immediately, and instead put
+ it in main_program_unclosed_stdout/main_unclosed_files.
+
2025-01-25 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Convert/HTML.pm (_do_jslicenses_file),
diff --git a/tp/Texinfo/XS/texi2any.c b/tp/Texinfo/XS/texi2any.c
index e1c5ace906..f7f847c228 100644
--- a/tp/Texinfo/XS/texi2any.c
+++ b/tp/Texinfo/XS/texi2any.c
@@ -2621,15 +2621,20 @@ main (int argc, char *argv[], char *env[])
write_to_file (texinfo_text, file_fh,
encoded_macro_expand_file_name);
- output_files_register_closed (&output_files_information,
- encoded_macro_expand_file_name);
- if (fclose (file_fh))
+ if (!strcmp (macro_expand_file_name, "-"))
{
- txi_config_document_warn (
+ output_files_register_closed (&output_files_information,
+
encoded_macro_expand_file_name);
+ if (fclose (file_fh))
+ {
+ txi_config_document_warn (
"error on closing macro expand file %s: %s",
macro_expand_file_name, strerror (errno));
- error_macro_expand_file = 1;
+ error_macro_expand_file = 1;
+ }
}
+ else
+ main_program_unclosed_stdout = file_fh;
}
else
{
@@ -2833,15 +2838,20 @@ main (int argc, char *argv[], char *env[])
write_to_file (internal_links_text, file_fh,
encoded_internal_links_file_name);
- output_files_register_closed (&output_files_information,
- encoded_internal_links_file_name);
- if (fclose (file_fh))
+ if (!strcmp (internal_links_file_name, "-"))
{
- txi_config_document_warn (
+ output_files_register_closed (&output_files_information,
+ encoded_internal_links_file_name);
+ if (fclose (file_fh))
+ {
+ txi_config_document_warn (
"error on closing internal links file %s: %s",
internal_links_file_name, strerror (errno));
- error_internal_links_file = 1;
+ error_internal_links_file = 1;
+ }
}
+ else
+ main_program_unclosed_stdout = file_fh;
}
else
{
@@ -2964,15 +2974,20 @@ main (int argc, char *argv[], char *env[])
write_to_file (sort_element_count_text, file_fh,
encoded_sort_element_count_file_name);
- output_files_register_closed (&output_files_information,
- encoded_sort_element_count_file_name);
- if (fclose (file_fh))
+ if (!strcmp (sort_element_count_file_name, "-"))
{
- txi_config_document_warn (
+ output_files_register_closed (&output_files_information,
+ encoded_sort_element_count_file_name);
+ if (fclose (file_fh))
+ {
+ txi_config_document_warn (
"error on closing internal links file %s: %s",
sort_element_count_file_name, strerror (errno));
- error_element_count_file = 1;
+ error_element_count_file = 1;
+ }
}
+ else
+ main_program_unclosed_stdout = file_fh;
}
else
{
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index e168777bc7..e421fa183e 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1837,13 +1837,17 @@ while(@input_files) {
my $error_macro_expand_file;
if (defined($macro_expand_fh)) {
print $macro_expand_fh $texinfo_text;
- Texinfo::Convert::Utils::output_files_register_closed(
- $macro_expand_files_information,
- $encoded_macro_expand_file_name);
- if (!close($macro_expand_fh)) {
- document_warn(sprintf(__("error on closing macro expand file %s: %s"),
- $macro_expand_file_name, $!));
- $error_macro_expand_file = 1;
+ if ($macro_expand_file_name ne '-') {
+ if (!close($macro_expand_fh)) {
+ document_warn(sprintf(__("error on closing macro expand file %s:
%s"),
+ $macro_expand_file_name, $!));
+ $error_macro_expand_file = 1;
+ }
+ Texinfo::Convert::Utils::output_files_register_closed(
+ $macro_expand_files_information,
+ $encoded_macro_expand_file_name);
+ } else {
+ $main_unclosed_files{$macro_expand_file_name} = $macro_expand_fh;
}
} else {
document_warn(sprintf(__("could not open %s for writing: %s"),
@@ -1859,7 +1863,7 @@ while(@input_files) {
# we do not need to go through unclosed files of
# $macro_expand_files_information as we know that the file is
- # already closed if needed.
+ # already closed if needed, or registered in main_unclosed_files.
if ($error_macro_expand_file) {
$error_count++;
_exit($error_count, \%opened_files);
@@ -2059,17 +2063,21 @@ while(@input_files) {
$internal_links_files_information, $converter,
$encoded_internal_links_file_name);
my $error_internal_links_file;
- if (defined ($internal_links_fh)) {
+ if (defined($internal_links_fh)) {
print $internal_links_fh $internal_links_text;
- if (!close ($internal_links_fh)) {
- warn(sprintf(__("%s: error on closing internal links file %s:
%s")."\n",
+ if ($internal_links_file_name ne '-') {
+ if (!close ($internal_links_fh)) {
+ warn(sprintf(__("%s: error on closing internal links file %s: %s")."\n",
$real_command_name, $internal_links_file_name, $!));
- $error_internal_links_file = 1;
- }
- Texinfo::Convert::Utils::output_files_register_closed(
+ $error_internal_links_file = 1;
+ }
+ Texinfo::Convert::Utils::output_files_register_closed(
$internal_links_files_information,
$encoded_internal_links_file_name);
+ } else {
+ $main_unclosed_files{$internal_links_file_name} = $internal_links_fh;
+ }
} else {
warn(sprintf(__("%s: could not open %s for writing: %s")."\n",
$real_command_name, $internal_links_file_name,
@@ -2085,7 +2093,7 @@ while(@input_files) {
\%opened_files, $internal_links_opened_file);
# we do not need to go through unclosed files of
# $internal_links_files_information as we know that the file is
- # already closed if needed.
+ # already closed if needed, or registered in main_unclosed_files.
if ($error_internal_links_file) {
$error_count++;
@@ -2137,17 +2145,22 @@ while(@input_files) {
$sort_elem_files_information, $converter_element_count,
$encoded_sort_element_count_file_name);
my $error_sort_element_count_file;
- if (defined ($sort_element_count_fh)) {
+ if (defined($sort_element_count_fh)) {
print $sort_element_count_fh $sort_element_count_text;
- if (!close ($sort_element_count_fh)) {
- warn(sprintf(__("%s: error on closing elements size file %s: %s")."\n",
+ if ($sort_element_count_file_name ne '-') {
+ if (!close($sort_element_count_fh)) {
+ warn(sprintf(__("%s: error on closing elements size file %s: %s")."\n",
$real_command_name, $sort_element_count_file_name, $!));
- $error_sort_element_count_file = 1;
+ $error_sort_element_count_file = 1;
+ }
+ Texinfo::Convert::Utils::output_files_register_closed(
+ $sort_elem_files_information,
+ $encoded_sort_element_count_file_name);
+ } else {
+ $main_unclosed_files{$sort_element_count_file_name}
+ = $sort_element_count_fh;
}
- Texinfo::Convert::Utils::output_files_register_closed(
- $sort_elem_files_information,
- $encoded_sort_element_count_file_name);
} else {
warn(sprintf(__("%s: could not open %s for writing: %s")."\n",
$real_command_name, $sort_element_count_file_name, $!));
@@ -2164,7 +2177,7 @@ while(@input_files) {
$converter_element_count->destroy();
# we do not need to go through unclosed files of
# $sort_elem_files_information as we know that the file is
- # already closed if needed.
+ # already closed if needed, or registered in main_unclosed_files.
if ($error_sort_element_count_file) {
$error_count++;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/XS/texi2any.c (main), tp/texi2any.pl: if macro_expand_file_name, internal_links_file_name or sort_element_count_file_name is -, which means output to STDOUT, do not close the filehandle/file descriptor immediately, and instead put it in main_program_unclosed_stdout/main_unclosed_files.,
Patrice Dumas <=