texlive[68690] Build/source/texk/web2c: [CWEB] Make 'proofsort' like

commits+ascherer at tug.org commits+ascherer at tug.org
Sun Oct 29 14:15:04 CET 2023


Revision: 68690
          https://tug.org/svn/texlive?view=revision&revision=68690
Author:   ascherer
Date:     2023-10-29 14:15:04 +0100 (Sun, 29 Oct 2023)
Log Message:
-----------
[CWEB] Make 'proofsort' like 'refsort'.

Read input from <STDIN> and write output to <STDOUT>.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/cwebdir/ChangeLog
    trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort
    trunk/Build/source/texk/web2c/cwebdir/ctwill.test
    trunk/Build/source/texk/web2c/man/ChangeLog
    trunk/Build/source/texk/web2c/man/ctwill.man
    trunk/Build/source/texk/web2c/man/cweb.man

Modified: trunk/Build/source/texk/web2c/cwebdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/cwebdir/ChangeLog	2023-10-29 13:15:04 UTC (rev 68690)
@@ -1,3 +1,8 @@
+2023-10-29  Andreas Scherer  <https://ascherer.github.io>
+
+	* ctwill-proofsort,
+	* ctwill.test: Make 'proofsort' like 'refsort'.
+
 2023-10-25  Andreas Scherer  <https://ascherer.github.io>
 
 	* cwebmac.tex,

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill-proofsort	2023-10-29 13:15:04 UTC (rev 68690)
@@ -22,17 +22,9 @@
   };
 }
 
-# We expect a TeX file as the single command-line parameter.
-my $usage = "Usage: $progname input_file\n";
-if (@ARGV > 1) {
-  my $first = shift @ARGV;
-  $usage .= "extra file argument(s): @ARGV\n";
-  unshift @ARGV, $first;
-}
-$usage .= "try --help if you need it.\n";
+my $usage = "Usage: $progname < input_file > output_file\n";
 
-die $usage unless scalar @ARGV == 1;
-
+# Standard options for TeX Live.
 Getopt::Long::GetOptions(
   'help|?'  => \&help_handler,
   'version' => sub { print version(); exit 0; }
@@ -50,14 +42,7 @@
   return $progname.' $Revision$ $Date$'."\n";
 }
 
-my $tex = $ARGV[0];
-
-open(TEX, $tex) or die "$0: Could not open input file $tex.\n";
-
-my %mini_index; # storage for index entries of a section
-my $print_index = 0; # do we collect and print a mini-index?
-
-# Scroll through the input file and look for blocks like
+# Read input from the console and look for blocks like
 # \mini
 # [LOCATION KEY TEXPART]*
 # }\FI
@@ -68,7 +53,9 @@
 # or as a single identifier in $math_mode$; the latter come from '@f'ormat
 # definitions. All internal backslashes are removed from the KEY before it
 # is used in the storage.
-foreach my $line (<TEX>)
+my %mini_index; # storage for index entries of a section
+my $print_index = 0; # do we collect and print a mini-index?
+foreach my $line (<STDIN>)
 {
 	if ("\\mini\n" eq $line) { # start of mini-index
 		$print_index = 1;
@@ -92,8 +79,6 @@
 	print $line;
 }
 
-close(TEX);
-
 exit 0;
 
 =pod
@@ -109,12 +94,13 @@
 This small Perl script 'ctwill-proofsort' sorts the mini-indexes for each
 section in the TeX file created by 'ctwill +P', i.e., prior to
 formatting with the 'ctproofmac.tex' macros.
+It reads its input from <STDIN> and writes its output to <STDOUT>.
 
 =over
 
 =item Run CTWILL twice on your 'input_file'.w, creating 'input_file'.tex
 
-=item Invoke "ctwill-proofsort 'input_file'.tex > 'input_file'-sorted.tex"
+=item Invoke "ctwill-proofsort < 'input_file'.tex > 'input_file'-sorted.tex"
 
 =item Invoke "mv 'input_file'-sorted.tex 'input_file'.tex"
 
@@ -135,7 +121,7 @@
 
 =item $ ctwill +P -x mmotype mmotype-twill (run this two times)
 
-=item $ ctwill-proofsort mmotype.tex > mmotype-sorted.tex
+=item $ ctwill-proofsort < mmotype.tex > mmotype-sorted.tex
 
 =item $ mv mmotype-sorted.tex mmotype.tex
 

Modified: trunk/Build/source/texk/web2c/cwebdir/ctwill.test
===================================================================
--- trunk/Build/source/texk/web2c/cwebdir/ctwill.test	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/cwebdir/ctwill.test	2023-10-29 13:15:04 UTC (rev 68690)
@@ -36,7 +36,7 @@
 # Perl script not available in builddir, and requires Unicode::Collate;
 # if that module is not available, just quit testing.
 perl -e 'use Unicode::Collate; Unicode::Collate->new();' 2>/dev/null || exit 0
-$testdir/../ctwill-proofsort ham.tex > ham-sorted.tex || exit 7
+$testdir/../ctwill-proofsort < ham.tex > ham-sorted.tex || exit 7
 $DIFF ham-sorted.tex $testdir/ham-sorted.tex || exit 8
 
 exit 0

Modified: trunk/Build/source/texk/web2c/man/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/man/ChangeLog	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/man/ChangeLog	2023-10-29 13:15:04 UTC (rev 68690)
@@ -1,3 +1,8 @@
+2023-10-29  Andreas Scherer  <https://ascherer.github.io>
+
+	* cweb.man: Regenerate with Pandoc 3.1.9.
+	* ctwill.man: Make 'proofsort' like 'refsort'.
+
 2023-10-13  Andreas Scherer  <https://ascherer.github.io>
 
 	* weave.man: Add option '-p' to '\input pwebmac'.

Modified: trunk/Build/source/texk/web2c/man/ctwill.man
===================================================================
--- trunk/Build/source/texk/web2c/man/ctwill.man	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/man/ctwill.man	2023-10-29 13:15:04 UTC (rev 68690)
@@ -1,6 +1,6 @@
 .\" Automatically generated by Pandoc
 .\"
-.TH "CTWILL" "1" "August 19, 2023" "Web2c @VERSION@" "General Commands Manual"
+.TH "CTWILL" "1" "October 29, 2023" "Web2c @VERSION@" "General Commands Manual"
 .SH NAME
 ctwill, ctwill-proofsort, ctwill-refsort, ctwill-twinx - translate CWEB to TeX with
 mini-indexes
@@ -10,7 +10,8 @@
 .PD 0
 .P
 .PD
-\f[B]ctwill-proofsort\f[R] \f[I]texfile\f[R].tex > \f[I]texfile\f[R]-sorted.tex
+\f[B]ctwill-proofsort\f[R] < \f[I]texfile\f[R].tex >
+\f[I]texfile\f[R]-sorted.tex
 .PD 0
 .P
 .PD
@@ -105,7 +106,8 @@
 You can use \f[B]ctwill-proofsort\f[R] to get the index entries in alphabetical
 order; just invoke
 .IP \[bu] 2
-\f[B]ctwill-proofsort\f[R] \f[I]texfile\f[R].tex > \f[I]texfile\f[R]-sorted.tex
+\f[B]ctwill-proofsort\f[R] < \f[I]texfile\f[R].tex >
+\f[I]texfile\f[R]-sorted.tex
 .IP \[bu] 2
 \f[B]mv\f[R] \f[I]texfile\f[R]-sorted.tex \f[I]texfile\f[R].tex
 .PP
@@ -240,8 +242,11 @@
 automatically by \f[B]ctwill\f[R] and the actual index files are created
 by TeX.
 .IP \[bu] 2
-\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from
-CTAN (https://ctan.org/pkg/cweb).
+\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from \c
+.UR https://ctan.org/pkg/cweb
+CTAN
+.UE \c
+\&.
 .SH SEE ALSO
 .IP \[bu] 2
 The CWEB System of Structured Documentation: by Donald E.\ Knuth and

Modified: trunk/Build/source/texk/web2c/man/cweb.man
===================================================================
--- trunk/Build/source/texk/web2c/man/cweb.man	2023-10-28 23:46:53 UTC (rev 68689)
+++ trunk/Build/source/texk/web2c/man/cweb.man	2023-10-29 13:15:04 UTC (rev 68690)
@@ -142,8 +142,11 @@
 \f[B]cwebmac.tex\f[R]: The default TeX\ macros \f[B]\[rs]input\f[R] in
 the first line of the \f[B]cweave\f[R] output file.
 .IP \[bu] 2
-\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from
-CTAN (https://ctan.org/pkg/cweb).
+\f[B]cwebman.tex\f[R]: The CWEB user manual, available in PDF from \c
+.UR https://ctan.org/pkg/cweb
+CTAN
+.UE \c
+\&.
 .SH SEE ALSO
 .IP \[bu] 2
 The CWEB System of Structured Documentation: by Donald E.\ Knuth and



More information about the tex-live-commits mailing list.