From 269d2040a62e45a35d7f5eef3e868813d44213c0 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 24 Mar 2021 21:07:39 +0200 Subject: Improve online version of the documentation. --- doc/Makefile.am | 10 +- doc/gendocs.sh | 254 ++++++++++++++++++++++++++++----------------------- doc/gendocs_template | 168 +++++++++++++++++----------------- src/copyin.c | 8 +- 4 files changed, 230 insertions(+), 210 deletions(-) diff --git a/doc/Makefile.am b/doc/Makefile.am index 47f481f..61146b5 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -30,11 +30,17 @@ endif EXTRA_DIST = gendocs.sh gendocs_template mt.1 rmt.8 GENDOCS=$(srcdir)/gendocs.sh +TEXI2DVI=texi2dvi -E # Make sure you set TEXINPUT manual: rm -rf manual TEXINPUTS=$(srcdir):$(top_srcdir)/scripts:$$TEXINPUTS \ MAKEINFO="$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS)" \ - TEXI2DVI="texi2dvi -t @finalout" \ - $(GENDOCS) --no-copy-images $(PACKAGE) '$(PACKAGE_NAME) manual' + TEXI2DVI="texi2dvi -t '@set DISTRIB' -t @finalout" \ + $(GENDOCS) --texi2html $(PACKAGE) '$(PACKAGE_NAME) manual' + +manual-rebuild: clean-local manual + +clean-local: + rm -rf manual diff --git a/doc/gendocs.sh b/doc/gendocs.sh index 38c4d05..0828905 100755 --- a/doc/gendocs.sh +++ b/doc/gendocs.sh @@ -2,10 +2,9 @@ # 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=2015-02-28.17 +scriptversion=2021-03-01.13 -# Copyright 2003-2013, 2015, 2017, 2020-2021 Free Software Foundation, -# Inc. +# Copyright 2003-2021 Free Software Foundation, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,20 +17,19 @@ scriptversion=2015-02-28.17 # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # # Original author: Mohit Agarwal. -# Send bug reports and any other correspondence to bug-texinfo@gnu.org. +# Send bug reports and any other correspondence to bug-gnulib@gnu.org. # # The latest version of this script, and the companion template, is -# available from Texinfo CVS: -# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs.sh -# http://savannah.gnu.org/cgi-bin/viewcvs/texinfo/texinfo/util/gendocs_template +# available from the Gnulib repository: # -# An up-to-date copy is also maintained in Gnulib (gnu.org/software/gnulib). +# https://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh +# https://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template # TODO: -# - image importation was only implemented for HTML generated by +# - image importing was only implemented for HTML generated by # makeinfo. But it should be simple enough to adjust. # - images are not imported in the source tarball. All the needed # formats (PDF, PNG, etc.) should be included. @@ -39,12 +37,12 @@ scriptversion=2015-02-28.17 prog=`basename "$0"` srcdir=`pwd` -scripturl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs.sh" -templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/util/gendocs_template" +scripturl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh" +templateurl="https://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template" : ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="} : ${MAKEINFO="makeinfo"} -: ${TEXI2DVI="texi2dvi -t @finalout"} +: ${TEXI2DVI="texi2dvi"} : ${DOCBOOK2HTML="docbook2html"} : ${DOCBOOK2PDF="docbook2pdf"} : ${DOCBOOK2TXT="docbook2txt"} @@ -54,9 +52,28 @@ templateurl="http://savannah.gnu.org/cgi-bin/viewcvs/~checkout~/texinfo/texinfo/ unset CDPATH unset use_texi2html +MANUAL_TITLE= +PACKAGE= +EMAIL=webmasters@gnu.org # please override with --email +commonarg= # passed to all makeinfo/texi2html invcations. +dirargs= # passed to all tools (-I dir). +dirs= # -I directories. +htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual" +default_htmlarg=true +infoarg=--no-split +generate_ascii=true +generate_html=true +generate_info=true +generate_tex=true +outdir=manual +source_extra= +split=node +srcfile= +texarg="-t @finalout" + version="gendocs.sh $scriptversion -Copyright 2013 Free Software Foundation, Inc. +Copyright 2021 Free Software Foundation, Inc. There is NO warranty. You may redistribute this software under the terms of the GNU General Public License. For more information about these matters, see the files named COPYING." @@ -66,7 +83,7 @@ usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE Generate output in various formats from PACKAGE.texinfo (or .texi or .txi) source. See the GNU Maintainers document for a more extensive discussion: - http://www.gnu.org/prep/maintain_toc.html + https://www.gnu.org/prep/maintain_toc.html Options: --email ADR use ADR as contact in generated web pages; always give this. @@ -75,13 +92,16 @@ Options: -o OUTDIR write files into OUTDIR, instead of manual/. -I DIR append DIR to the Texinfo search path. --common ARG pass ARG in all invocations. - --html ARG pass ARG to makeinfo or texi2html for HTML targets. + --html ARG pass ARG to makeinfo or texi2html for HTML targets, + instead of '$htmlarg'. --info ARG pass ARG to makeinfo for Info, instead of --no-split. --no-ascii skip generating the plain text output. - --no-copy-images - don't try to copy images referenced by img HTML tags, + --no-html skip generating the html output. + --no-info skip generating the info output. + --no-tex skip generating the dvi and pdf output. --source ARG include ARG in tar archive of sources. --split HOW make split HTML by node, section, chapter; default node. + --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout. --texi2html use texi2html to make HTML target, with all split versions. --docbook convert through DocBook too (xml, txt, html, pdf). @@ -133,24 +153,9 @@ locale, since that's the language of most Texinfo manuals. If you happen to have a non-English manual and non-English web site, see the SETLANG setting in the source. -Email bug reports or enhancement requests to bug-texinfo@gnu.org. +Email bug reports or enhancement requests to bug-gnulib@gnu.org. " -MANUAL_TITLE= -PACKAGE= -EMAIL=webmasters@gnu.org # please override with --email -commonarg= # passed to all makeinfo/texi2html invcations. -dirargs= # passed to all tools (-I dir). -dirs= # -I's directories. -htmlarg= -infoarg=--no-split -generate_ascii=true -outdir=manual -source_extra= -split=default -srcfile= -no_copy_images= - while test $# -gt 0; do case $1 in -s) shift; srcfile=$1;; @@ -159,13 +164,17 @@ while test $# -gt 0; do --common) shift; commonarg=$1;; --docbook) docbook=yes;; --email) shift; EMAIL=$1;; - --html) shift; htmlarg=$1;; + --html) shift; default_htmlarg=false; htmlarg=$1;; --info) shift; infoarg=$1;; --no-ascii) generate_ascii=false;; + --no-html) generate_ascii=false;; + --no-info) generate_info=false;; + --no-tex) generate_tex=false;; --source) shift; source_extra=$1;; --split) shift; split=$1;; + --tex) shift; texarg=$1;; --texi2html) use_texi2html=1;; - --no-copy-images) no_copy_images=1;; + --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; -*) @@ -191,6 +200,11 @@ commonarg=" $dirargs $commonarg" # For most of the following, the base name is just $PACKAGE base=$PACKAGE +if $default_htmlarg && test -n "$use_texi2html"; then + # The legacy texi2html doesn't support TOP_NODE_UP_URL + htmlarg="--css-ref=/software/gnulib/manual.css" +fi + if test -n "$srcfile"; then # but here, we use the basename of $srcfile base=`basename "$srcfile"` @@ -224,11 +238,11 @@ calcsize() # copy_images OUTDIR HTML-FILE... # ------------------------------- -# Copy all the images needed by the HTML-FILEs into OUTDIR. Look -# for them in the -I directories. +# Copy all the images needed by the HTML-FILEs into OUTDIR. +# Look for them in . and the -I directories; this is simpler than what +# makeinfo supports with -I, but hopefully it will suffice. copy_images() { - test -n "$no_copy_images" && return local odir odir=$1 shift @@ -236,7 +250,7 @@ copy_images() BEGIN { \$me = '$prog'; \$odir = '$odir'; - @dirs = qw($dirs); + @dirs = qw(. $dirs); } " -e ' /&2 "$0: ${split_html_dir}/${PACKAGE}.html does not exist" - fi + if [ ! -f index.html ]; then + ln -sf ${PACKAGE}.html index.html fi - tar -czf "$abs_outdir/${PACKAGE}.html_$2.tar.gz" -- *.html + tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html ) - eval html_$2_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$2.tar.gz"` - rm -f "$outdir"/html_$2/*.html - mkdir -p "$outdir/html_$2/" - mv ${split_html_dir}/*.html "$outdir/html_$2/" + eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"` + rm -f "$outdir"/html_$1/*.html + mkdir -p "$outdir/html_$1/" + mv ${split_html_dir}/*.html "$outdir/html_$1/" rmdir ${split_html_dir} } @@ -351,41 +371,32 @@ if test -z "$use_texi2html"; then mv $PACKAGE.html "$outdir/" ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz" - version=`makeinfo --version|sed -n '1s/.* \([0-9][0-9]*\)\.[0-9.]*/\1/p'` - case $version in - [0-9]*) ;; - *) version=4;; - esac # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option, # it just always split by node. So if we're splitting by node anyway, # leave it out. - if test $version -lt 5 -o "x$split" != xdefault; then - split_arg=--split=$split - opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg" - cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" - printf "\nGenerating html by $split... ($cmd)\n" - eval "$cmd" - split_html_dir=$PACKAGE.html - copy_images $split_html_dir/ $split_html_dir/*.html - ( - 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"` - rm -rf "$outdir/html_$split/" - mv $split_html_dir "$outdir/html_$split/" - du -s "$outdir/html_$split/" - ls -l "$outdir/$PACKAGE.html_$split.tar.gz" - CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ - /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" + if test "x$split" = xnode; then + split_arg= else - html_split "$MAKEINFO --html" node - html_split "$MAKEINFO --html" chapter - html_split "$MAKEINFO --html" section - # should take account of --split here. - CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" + split_arg=--split=$split fi + # + opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg" + cmd="$SETLANG $MAKEINFO $opt \"$srcfile\"" + printf "\nGenerating html by $split... ($cmd)\n" + eval "$cmd" + split_html_dir=$PACKAGE.html + copy_images $split_html_dir/ $split_html_dir/*.html + ( + 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"` + rm -rf "$outdir/html_$split/" + mv $split_html_dir "$outdir/html_$split/" + du -s "$outdir/html_$split/" + ls -l "$outdir/$PACKAGE.html_$split.tar.gz" + else # use texi2html: opt="--output $PACKAGE.html $commonarg $htmlarg" cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\"" @@ -397,12 +408,13 @@ else # use texi2html: html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` mv $PACKAGE.html "$outdir/" - html_split "$TEXI2HTML" node - html_split "$TEXI2HTML" chapter - html_split "$TEXI2HTML" section - CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" + html_split node + html_split chapter + html_split section fi +fi # end html +# printf "\nMaking .tar.gz for sources...\n" d=`dirname $srcfile` ( @@ -413,6 +425,8 @@ d=`dirname $srcfile` ) texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"` +# +# Do everything again through docbook. if test -n "$docbook"; then opt="-o - --docbook $commonarg" cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml" @@ -451,7 +465,15 @@ if test -n "$docbook"; then mv $PACKAGE-db.pdf "$outdir/" fi -printf "\nMaking index file...\n" +# +printf "\nMaking index.html for $PACKAGE...\n" +if test -z "$use_texi2html"; then + CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\ + /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d" +else + # should take account of --split here. + CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d" +fi curdate=`$SETLANG date '+%B %d, %Y'` sed \ @@ -483,7 +505,7 @@ $GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html" echo "Done, see $outdir/ subdirectory for new files." # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" diff --git a/doc/gendocs_template b/doc/gendocs_template index e21ba2b..cd9ac38 100755 --- a/doc/gendocs_template +++ b/doc/gendocs_template @@ -1,105 +1,101 @@ - - - - + + - -%%TITLE%% - GNU Project - Free Software Foundation (FSF) - - - - - + - - - - +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. This file is offered as-is, +without any warranty. +--> - - -

%%TITLE%%

+%%TITLE%% - GNU Project - Free Software Foundation + +

%%TITLE%%

Free Software Foundation
last updated %%DATE%%
-

- -  [image of the head of a GNU] - -

-

The manual for %%PACKAGE%% is available in the following formats:

+

This manual (%%PACKAGE%%) is available in the following formats:

-

(This page generated by the %%SCRIPTNAME%% script.) -

+

You can buy printed copies of +some manuals (among other items) from the Free Software Foundation; +this helps support FSF activities.

-

-Valid XHTML 1.0! -

+

(This page generated by the %%SCRIPTNAME%% +script.)

- + + +

This page is licensed under a Creative +Commons Attribution-NoDerivs 3.0 United States License.

+ + + + diff --git a/src/copyin.c b/src/copyin.c index c8ea278..a096048 100644 --- a/src/copyin.c +++ b/src/copyin.c @@ -1212,7 +1212,6 @@ swab_array (char *ptr, int count) void process_copy_in () { - char done = false; /* True if trailer reached. */ FILE *tty_in = NULL; /* Interactive file for rename option. */ FILE *tty_out = NULL; /* Interactive file for rename option. */ FILE *rename_in = NULL; /* Batch file for rename option. */ @@ -1284,7 +1283,7 @@ process_copy_in () change_dir (); /* While there is more input in the collection, process the input. */ - while (!done) + while (1) { swapping_halfwords = swapping_bytes = false; @@ -1318,10 +1317,7 @@ process_copy_in () { /* Is this the header for the TRAILER file? */ if (strcmp (CPIO_TRAILER_NAME, file_hdr.c_name) == 0) - { - done = true; - break; - } + break; cpio_safer_name_suffix (file_hdr.c_name, false, !no_abs_paths_flag, false); -- cgit v1.2.1