+2026-07-17 Paul Eggert <eggert@cs.ucla.edu>
+
+ gendocs: output human-readable file sizes
+ * build-aux/gendocs.sh (calcsize): Output human-readable file
+ size, rather than always size in KiB mislabled as "K bytes".
+ But fall back on a plain byte count if GNU du is not in use.
+ (time-stamp-time-zone): Now "UTC0" so scriptversion does not decrease.
+ * doc/gendocs_template, doc/gendocs_template_min:
+ Don’t assume sizes are in KiB (the old values were mislabeled anyway).
+ Be more consistent about file type labels.
+
2026-07-16 Pádraig Brady <P@draigBrady.com>
physmem: fix typo causing configure failure
# gendocs.sh -- generate a GNU manual in many formats. This script is
# mentioned in maintain.texi. See the help message below for usage details.
-scriptversion=2026-07-17.13
+scriptversion=2026-07-17.17
# Copyright 2003-2026 Free Software Foundation, Inc.
#
exit 1
fi
-# Function to return size of $1 in something resembling kilobytes.
-# We don't use `ls -s` because that can be longer or shorter than
-# the real length of the data (because the file system compresses
-# the file, for example). We don't use `du -k --apparent-size`
-# because we do not want to assume `du` supports that option.
-#
-# Here's an example of different `ls -s` results on different file
-# systems:
-#
-# $ cp /var/tmp/findutils-manual/find.html find.html
-# $ ls -lsh /var/tmp/findutils-manual/find.html find.html
-# 221K -rw-rw-r-- 1 james james 582K Jul 17 13:01 find.html
-# 584K -rw-rw-r-- 1 james james 582K Jul 17 12:54 /var/tmp/findutils-manual/find.html
+# Output $1's size like "7.1 MiB" if du is GNU, "7425707 bytes" otherwise.
calcsize()
{
- # Determine size in bytes
- set `env LC_ALL=C wc -c < "$1"`
- # Emit the size in KiB, rounding up.
- expr '(' "$1" + 1023 ')' / 1024
+ duout=`LC_ALL=C du -h --apparent-size -- "$1" 2>/dev/null` ||
+ duout=`LC_ALL=C wc -c <"$1"`
+ set x $duout
+ printf '%s\n' "$2" | sed 's/[^0-9.].*/ &iB/; s/[0-9]$/& bytes/'
}
# copy_images OUTDIR HTML-FILE...
ln -s ${PACKAGE}.html index.html
tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
)
- eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+ size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
+ eval html_$1_tgz_size=\$size
rm -f "$outdir"/html_$1/*.html
mkdir -p "$outdir/html_$1/"
mv ${split_html_dir}/*.html "$outdir/html_$1/"
cd $split_html_dir || exit 1
tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
)
- eval \
- html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
+ size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
+ eval html_${split}_tgz_size=\$size
rm -rf "$outdir/html_$split/"
mv $split_html_dir "$outdir/html_$split/"
du -s "$outdir/html_$split/"
# eval: (add-hook 'before-save-hook 'time-stamp nil t)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%Y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
# time-stamp-end: "$"
# End:
<ul>
<li><a href="%%PACKAGE%%.html">HTML
- (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+ (%%HTML_MONO_SIZE%%)</a> - entirely on one web page.</li>
%%IF HTML_NODE%%
<li><a href="html_node/index.html">HTML</a> - with one web page per
node.</li>
<li><a href="html_chapter/index.html">HTML</a> - with one web page per
chapter.</li>
%%ENDIF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.html.gz">HTML compressed
- (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+<li><a href="%%PACKAGE%%.html.gz">HTML gzipped
+ (%%HTML_MONO_GZ_SIZE%%)</a> - entirely on
one web page.</li>
%%IF HTML_NODE%%
-<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
- (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML tar file gzipped
+ (%%HTML_NODE_TGZ_SIZE%%)</a> -
with one web page per node.</li>
%%ENDIF HTML_NODE%%
%%IF HTML_SECTION%%
-<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
- (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML tar file gzipped
+ (%%HTML_SECTION_TGZ_SIZE%%)</a> -
with one web page per section.</li>
%%ENDIF HTML_SECTION%%
%%IF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
- (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML tar file gzipped
+ (%%HTML_CHAPTER_TGZ_SIZE%%)</a> -
with one web page per chapter.</li>
%%ENDIF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.info.tar.gz">Info document
- (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document tar file gzipped
+ (%%INFO_TGZ_SIZE%%)</a>.</li>
<li><a href="%%PACKAGE%%.txt">ASCII text
- (%%ASCII_SIZE%%K bytes)</a>.</li>
-<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
- (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
-<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
- (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+ (%%ASCII_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text gzipped
+ (%%ASCII_GZ_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file gzipped
+ (%%DVI_GZ_SIZE%%)</a>.</li>
<li><a href="%%PACKAGE%%.pdf">PDF file
- (%%PDF_SIZE%%K bytes)</a>.</li>
-<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
- (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+ (%%PDF_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source tar file gzipped
+ (%%TEXI_TGZ_SIZE%%).</a></li>
</ul>
<p>You can <a href="https://shop.fsf.org/">buy printed copies of
<ul>
<li><a href="%%PACKAGE%%.html">HTML
- (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
+ (%%HTML_MONO_SIZE%%)</a> - entirely on one web page.</li>
<li><a href="html_node/index.html">HTML</a> - with one web page per
node.</li>
%%IF HTML_SECTION%%
<li><a href="html_chapter/index.html">HTML</a> - with one web page per
chapter.</li>
%%ENDIF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.html.gz">HTML compressed
- (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
+<li><a href="%%PACKAGE%%.html.gz">HTML gzipped
+ (%%HTML_MONO_GZ_SIZE%%)</a> - entirely on
one web page.</li>
-<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
- (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML tar file gzipped
+ (%%HTML_NODE_TGZ_SIZE%%)</a> -
with one web page per node.</li>
%%IF HTML_SECTION%%
-<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
- (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML tar file gzipped
+ (%%HTML_SECTION_TGZ_SIZE%%)</a> -
with one web page per section.</li>
%%ENDIF HTML_SECTION%%
%%IF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
- (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
+<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML tar file gzipped
+ (%%HTML_CHAPTER_TGZ_SIZE%%)</a> -
with one web page per chapter.</li>
%%ENDIF HTML_CHAPTER%%
-<li><a href="%%PACKAGE%%.info.tar.gz">Info document
- (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
+<li><a href="%%PACKAGE%%.info.tar.gz">Info document tar file gzipped
+ (%%INFO_TGZ_SIZE%%)</a>.</li>
<li><a href="%%PACKAGE%%.txt">ASCII text
- (%%ASCII_SIZE%%K bytes)</a>.</li>
-<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
- (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
-<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
- (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
+ (%%ASCII_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.txt.gz">ASCII text gzipped
+ (%%ASCII_GZ_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file gzipped
+ (%%DVI_GZ_SIZE%%)</a>.</li>
<li><a href="%%PACKAGE%%.pdf">PDF file
- (%%PDF_SIZE%%K bytes)</a>.</li>
-<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
- (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
+ (%%PDF_SIZE%%)</a>.</li>
+<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source tar file gzipped
+ (%%TEXI_TGZ_SIZE%%).</a></li>
</ul>
<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%