]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
manpage: ensure a maximum width for the text version
authorDaniel Stenberg <daniel@haxx.se>
Tue, 6 Aug 2024 15:11:20 +0000 (17:11 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 8 Aug 2024 15:49:37 +0000 (17:49 +0200)
... using the new script 'maxline' to which we specify the maximum
number of columns we allow any single line to be, or it will cause an
error.

Starting out with a max width at 100 columns.

Bonus: shorten the long line in the --ipfs-gateway section.

Closes #14423

docs/cmdline-opts/Makefile.am
docs/cmdline-opts/ipfs-gateway.md
scripts/Makefile.am
scripts/maxline [new file with mode: 0755]

index 0aa8a44fa27bbdadbc9abd72648df69abbc45f48..aff9011f4b2513e1bf3c96d716b33983192ff48d 100644 (file)
@@ -37,6 +37,10 @@ GN_1 =
 GN_ = $(GN_0)
 
 MANAGEN=$(top_srcdir)/scripts/managen
+MAXLINE=$(top_srcdir)/scripts/maxline
+
+# Maximum number of columns accepted in the ASCII version of the manpage
+MAXCOLS=100
 INCDIR=$(top_srcdir)/include
 
 if BUILD_DOCS
@@ -51,7 +55,7 @@ $(MANPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc $(MANAGEN)
        $(GEN)(rm -f $(MANPAGE) && @PERL@ $(MANAGEN) -d $(srcdir) -I $(INCDIR) mainpage $(DPAGES) > manpage.tmp.$$$$ && mv manpage.tmp.$$$$ $(MANPAGE))
 
 $(ASCIIPAGE): $(DPAGES) $(SUPPORT) mainpage.idx Makefile.inc $(MANAGEN)
-       $(GEN)(rm -f $(ASCIIPAGE) && @PERL@ $(MANAGEN) -d $(srcdir) -I $(INCDIR) ascii $(DPAGES) > asciipage.tmp.$$$$ && mv asciipage.tmp.$$$$ $(ASCIIPAGE))
+       $(GEN)(rm -f $(ASCIIPAGE) && @PERL@ $(MANAGEN) -d $(srcdir) -I $(INCDIR) ascii $(DPAGES) | @PERL@ $(MAXLINE) $(MAXCOLS) > asciipage.tmp.$$$$ && mv asciipage.tmp.$$$$ $(ASCIIPAGE))
 
 listhelp:
        $(MANAGEN) -d $(srcdir) listhelp $(DPAGES) > $(top_builddir)/src/tool_listhelp.c
index 70ca717a7612575a9bd6afc44da2adc539ad8ac3..5c8f121f5a124e66efeba286a2cd772cd7e5bf6e 100644 (file)
@@ -24,7 +24,7 @@ if a `~/.ipfs/gateway` file holding the gateway URL exists.
 If you run a local IPFS node, this gateway is by default available under
 `http://localhost:8080`. A full example URL would look like:
 
-    curl --ipfs-gateway http://localhost:8080 ipfs://bafybeigagd5nmnn2iys2f3doro7ydrevyr2mzarwidgadawmamiteydbzi
+    curl --ipfs-gateway http://localhost:8080 ipfs://bafybeigagd5nmnn2iys2f3
 
 There are many public IPFS gateways. See for example:
 https://ipfs.github.io/public-gateway-checker/
index 1a9a283cc5988e3f954300a0513c8203dd8ede12..bdae88bccd4b63d8faffa91b04e436f2cd03ed66 100644 (file)
@@ -24,7 +24,7 @@
 
 EXTRA_DIST = coverage.sh completion.pl firefox-db2pem.sh checksrc.pl    \
  mk-ca-bundle.pl schemetable.c cd2nroff nroff2cd cdall cd2cd managen \
- dmaketgz release-tools.sh verify-release
+ dmaketgz release-tools.sh verify-release maxline
 
 ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
 FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
diff --git a/scripts/maxline b/scripts/maxline
new file mode 100755 (executable)
index 0000000..d8afe2f
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/env perl
+#***************************************************************************
+#                                  _   _ ____  _
+#  Project                     ___| | | |  _ \| |
+#                             / __| | | | |_) | |
+#                            | (__| |_| |  _ <| |___
+#                             \___|\___/|_| \_\_____|
+#
+# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at https://curl.se/docs/copyright.html.
+#
+# You may opt to use, copy, modify, merge, publish, distribute and/or sell
+# copies of the Software, and permit persons to whom the Software is
+# furnished to do so, under the terms of the COPYING file.
+#
+# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+# KIND, either express or implied.
+#
+# SPDX-License-Identifier: curl
+#
+###########################################################################
+
+# The provided value is the max allowed length.
+my $max = $ARGV[0];
+my $line = 0;
+my $error;
+while(<STDIN>) {
+    my $i = length($_);
+    $line++;
+    if($i > $max) {
+        print STDERR "<STDIN>:$line ERROR line too long, $i > $max\n";
+        print STDERR "<STDIN>:$line $_";
+        $error++;
+    }
+    print $_;
+}
+exit $error;