Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • pkg/gnutls28
  • not_a_robot/gnutls28
  • detlev/gnutls28
3 results
Show changes
Showing
with 2088 additions and 348 deletions
......@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
......
# pmccabe2html - AWK script to convert pmccabe output to html -*- awk -*-
# Copyright (C) 2007-2020 Free Software Foundation, Inc.
# Copyright (C) 2007-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
......
#!/bin/sh
# py-compile - Compile a Python program
scriptversion=2021-02-27.01; # UTC
# Copyright (C) 2000-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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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 <https://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
if test -z "$PYTHON"; then
PYTHON=python
fi
me=py-compile
usage_error ()
{
echo "$me: $*" >&2
echo "Try '$me --help' for more information." >&2
exit 1
}
basedir=
destdir=
while test $# -ne 0; do
case "$1" in
--basedir)
if test $# -lt 2; then
usage_error "option '--basedir' requires an argument"
else
basedir=$2
fi
shift
;;
--destdir)
if test $# -lt 2; then
usage_error "option '--destdir' requires an argument"
else
destdir=$2
fi
shift
;;
-h|--help)
cat <<\EOF
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
Byte compile some python scripts FILES. Use --destdir to specify any
leading directory path to the FILES that you don't want to include in the
byte compiled file. Specify --basedir for any additional path information you
do want to be shown in the byte compiled file.
Example:
py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--version)
echo "$me $scriptversion"
exit $?
;;
--)
shift
break
;;
-*)
usage_error "unrecognized option '$1'"
;;
*)
break
;;
esac
shift
done
files=$*
if test -z "$files"; then
usage_error "no files given"
fi
# if basedir was given, then it should be prepended to filenames before
# byte compilation.
if test -z "$basedir"; then
pathtrans="path = file"
else
pathtrans="path = os.path.join('$basedir', file)"
fi
# if destdir was given, then it needs to be prepended to the filename to
# byte compile but not go into the compiled file.
if test -z "$destdir"; then
filetrans="filepath = path"
else
filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
fi
python_major=`$PYTHON -V 2>&1 | sed -e 's/.* //;s/\..*$//;1q'`
if test -z "$python_major"; then
echo "$me: could not determine $PYTHON major version, guessing 3" >&2
python_major=3
fi
# The old way to import libraries was deprecated.
if test "$python_major" -le 2; then
import_lib=imp
import_test="hasattr(imp, 'get_tag')"
import_call=imp.cache_from_source
import_arg2=', False' # needed in one call and not the other
else
import_lib=importlib
import_test="hasattr(sys.implementation, 'cache_tag')"
import_call=importlib.util.cache_from_source
import_arg2=
fi
$PYTHON -c "
import sys, os, py_compile, $import_lib
files = '''$files'''
sys.stdout.write('Byte-compiling python modules...\n')
for file in files.split():
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
sys.stdout.write(file)
sys.stdout.flush()
if $import_test:
py_compile.compile(filepath, $import_call(filepath), path)
else:
py_compile.compile(filepath, filepath + 'c', path)
sys.stdout.write('\n')" || exit $?
# this will fail for python < 1.5, but that doesn't matter ...
$PYTHON -O -c "
import sys, os, py_compile, $import_lib
# pypy does not use .pyo optimization
if hasattr(sys, 'pypy_translation_info'):
sys.exit(0)
files = '''$files'''
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
for file in files.split():
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
sys.stdout.write(file)
sys.stdout.flush()
if $import_test:
py_compile.compile(filepath, $import_call(filepath$import_arg2), path)
else:
py_compile.compile(filepath, filepath + 'o', path)
sys.stdout.write('\n')" 2>/dev/null || exit $?
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
......@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2011-2020 Free Software Foundation, Inc.
# Copyright (C) 2011-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
......@@ -42,11 +42,13 @@ print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
test-driver --test-name NAME --log-file PATH --trs-file PATH
[--expect-failure {yes|no}] [--color-tests {yes|no}]
[--enable-hard-errors {yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
See the GNU Automake documentation for information.
END
}
......@@ -103,8 +105,11 @@ trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
# Test script is run here. We create the file first, then append to it,
# to ameliorate tests themselves also writing to the log file. Our tests
# don't, but others can (automake bug#35762).
: >"$log_file"
"$@" >>"$log_file" 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
......@@ -126,7 +131,7 @@ esac
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
......
......@@ -3,9 +3,9 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
\def\texinfoversion{2020-10-24.12}
\def\texinfoversion{2021-02-20.11}
%
% Copyright 1985, 1986, 1988, 1990-2020 Free Software Foundation, Inc.
% Copyright 1985, 1986, 1988, 1990-2021 Free Software Foundation, Inc.
%
% This texinfo.tex file is free software: you can redistribute it and/or
% modify it under the terms of the GNU General Public License as
......@@ -572,10 +572,9 @@
\fi
}
% @end foo executes the definition of \Efoo.
% But first, it executes a specialized version of \checkenv
%
\parseargdef\end{%
% @end foo calls \checkenv and executes the definition of \Efoo.
\parseargdef\end{
\if 1\csname iscond.#1\endcsname
\else
% The general wording of \badenverr may not be ideal.
......@@ -2673,8 +2672,6 @@ end
\definetextfontsizexi
\message{markup,}
% Check if we are currently using a typewriter font. Since all the
% Computer Modern typewriter fonts have zero interword stretch (and
% shrink), and it is reasonable to expect all typewriter fonts to have
......@@ -2682,68 +2679,14 @@ end
%
\def\ifmonospace{\ifdim\fontdimen3\font=0pt }
% Markup style infrastructure. \defmarkupstylesetup\INITMACRO will
% define and register \INITMACRO to be called on markup style changes.
% \INITMACRO can check \currentmarkupstyle for the innermost
% style.
\let\currentmarkupstyle\empty
\def\setupmarkupstyle#1{%
\def\currentmarkupstyle{#1}%
\markupstylesetup
}
\let\markupstylesetup\empty
\def\defmarkupstylesetup#1{%
\expandafter\def\expandafter\markupstylesetup
\expandafter{\markupstylesetup #1}%
\def#1%
}
% Markup style setup for left and right quotes.
\defmarkupstylesetup\markupsetuplq{%
\expandafter\let\expandafter \temp
\csname markupsetuplq\currentmarkupstyle\endcsname
\ifx\temp\relax \markupsetuplqdefault \else \temp \fi
}
\defmarkupstylesetup\markupsetuprq{%
\expandafter\let\expandafter \temp
\csname markupsetuprq\currentmarkupstyle\endcsname
\ifx\temp\relax \markupsetuprqdefault \else \temp \fi
}
{
\catcode`\'=\active
\catcode`\`=\active
\gdef\markupsetuplqdefault{\let`\lq}
\gdef\markupsetuprqdefault{\let'\rq}
\gdef\markupsetcodequoteleft{\let`\codequoteleft}
\gdef\markupsetcodequoteright{\let'\codequoteright}
\gdef\setcodequotes{\let`\codequoteleft \let'\codequoteright}
\gdef\setregularquotes{\let`\lq \let'\rq}
}
\let\markupsetuplqcode \markupsetcodequoteleft
\let\markupsetuprqcode \markupsetcodequoteright
%
\let\markupsetuplqexample \markupsetcodequoteleft
\let\markupsetuprqexample \markupsetcodequoteright
%
\let\markupsetuplqkbd \markupsetcodequoteleft
\let\markupsetuprqkbd \markupsetcodequoteright
%
\let\markupsetuplqsamp \markupsetcodequoteleft
\let\markupsetuprqsamp \markupsetcodequoteright
%
\let\markupsetuplqverb \markupsetcodequoteleft
\let\markupsetuprqverb \markupsetcodequoteright
%
\let\markupsetuplqverbatim \markupsetcodequoteleft
\let\markupsetuprqverbatim \markupsetcodequoteright
% Allow an option to not use regular directed right quote/apostrophe
% (char 0x27), but instead the undirected quote from cmtt (char 0x0d).
% The undirected quote is ugly, so don't make it the default, but it
......@@ -2906,7 +2849,7 @@ end
}
% @samp.
\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
\def\samp#1{{\setcodequotes\lq\tclose{#1}\rq\null}}
% @indicateurl is \samp, that is, with quotes.
\let\indicateurl=\samp
......@@ -2949,8 +2892,7 @@ end
\global\let'=\rq \global\let`=\lq % default definitions
%
\global\def\code{\begingroup
\setupmarkupstyle{code}%
% The following should really be moved into \setupmarkupstyle handlers.
\setcodequotes
\catcode\dashChar=\active \catcode\underChar=\active
\ifallowcodebreaks
\let-\codedash
......@@ -3104,7 +3046,7 @@ end
\urefcatcodes
%
\global\def\urefcode{\begingroup
\setupmarkupstyle{code}%
\setcodequotes
\urefcatcodes
\let&\urefcodeamp
\let.\urefcodedot
......@@ -3225,8 +3167,8 @@ end
\def\kbdsub#1#2#3\par{%
\def\one{#1}\def\three{#3}\def\threex{??}%
\ifx\one\xkey\ifx\threex\three \key{#2}%
\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
\else{\tclose{\kbdfont\setupmarkupstyle{kbd}\look}}\fi
\else{\tclose{\kbdfont\setcodequotes\look}}\fi
\else{\tclose{\kbdfont\setcodequotes\look}}\fi
}
% definition of @key that produces a lozenge. Doesn't adjust to text size.
......@@ -3243,7 +3185,7 @@ end
% monospace, don't change it; that way, we respect @kbdinputstyle. But
% if it isn't monospace, then use \tt.
%
\def\key#1{{\setupmarkupstyle{key}%
\def\key#1{{\setregularquotes
\nohyphenation
\ifmonospace\else\tt\fi
#1}\null}
......@@ -3373,16 +3315,20 @@ end
{\obeylines
\globaldefs=1
\envdef\displaymath{%
\tex
\tex%
\def\thisenv{\displaymath}%
\begingroup\let\end\displaymathend%
$$%
}
\def\Edisplaymath{$$
\def\displaymathend{$$\endgroup\end}%
\def\Edisplaymath{%
\def\thisenv{\tex}%
\end tex
}}
% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
% except specified as a normal braced arg, so no newlines to worry about.
......@@ -7144,7 +7090,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% But \@ or @@ will get a plain @ character.
\envdef\tex{%
\setupmarkupstyle{tex}%
\setregularquotes
\catcode `\\=0 \catcode `\{=1 \catcode `\}=2
\catcode `\$=3 \catcode `\&=4 \catcode `\#=6
\catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie
......@@ -7370,7 +7316,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If you want all examples etc. small: @set dispenvsize small.
% If you want even small examples the full size: @set dispenvsize nosmall.
% This affects the following displayed environments:
% @example, @display, @format, @lisp
% @example, @display, @format, @lisp, @verbatim
%
\def\smallword{small}
\def\nosmallword{nosmall}
......@@ -7416,9 +7362,9 @@ might help (with 'rm \jobname.?? \jobname.??s')%
%
\maketwodispenvdef{lisp}{example}{%
\nonfillstart
\tt\setupmarkupstyle{example}%
\tt\setcodequotes
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
\gobble % eat return
\parsearg\gobble
}
% @display/@smalldisplay: same as @lisp except keep current font.
%
......@@ -7576,7 +7522,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\setupverb{%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\leavevmode\endgraf}%
\setupmarkupstyle{verb}%
\setcodequotes
\tabeightspaces
% Respect line breaks,
% print special symbols as themselves, and
......@@ -7617,7 +7563,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\egroup\leavevmode\box\verbbox\endgraf\starttabbox}%
\tabexpand
\setupmarkupstyle{verbatim}%
\setcodequotes
% Respect line breaks,
% print special symbols as themselves, and
% make each space count.
......@@ -8036,7 +7982,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% leave the code in, but it's strange for @var to lead to typewriter.
% Nowadays we recommend @code, since the difference between a ttsl hyphen
% and a tt hyphen is pretty tiny. @code also disables ?` !`.
\def\var##1{{\setupmarkupstyle{var}\ttslanted{##1}}}%
\def\var##1{{\setregularquotes\ttslanted{##1}}}%
#1%
\sl\hyphenchar\font=45
}
......@@ -8145,11 +8091,18 @@ might help (with 'rm \jobname.?? \jobname.??s')%
}
\fi
\let\E=\expandafter
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
\def\xeatspaces{\eatspaces}%
% expand the expansion of \eatleadingcr twice to maybe remove a leading
% newline (and \else and \fi tokens), then call \eatspaces on the result.
\def\xeatspaces##1{%
\E\E\E\E\E\E\E\eatspaces\E\E\E\E\E\E\E{\eatleadingcr##1%
}}%
\def\xempty##1{}%
%
% Process the macro body under the current catcode regime.
\scantokens{#1@comment}%
......@@ -8202,6 +8155,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\unbrace{\gdef\trim@@@ #1 } #2@{#1}
}
{\catcode`\^^M=\other%
\gdef\eatleadingcr#1{\if\noexpand#1\noexpand^^M\else\E#1\fi}}%
% Warning: this won't work for a delimited argument
% or for an empty argument
% Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3%
\gdef\eatcr #1{\eatcra #1Q^^MQ}%
......@@ -8368,6 +8326,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\let\hash\relax
% \hash is redefined to `#' later to get it into definitions
\let\xeatspaces\relax
\let\xempty\relax
\parsemargdefxxx#1,;,%
\ifnum\paramno<10\relax\else
\paramno0\relax
......@@ -8379,9 +8338,11 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else \let\next=\parsemargdefxxx
\advance\paramno by 1
\expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
{\xeatspaces{\hash\the\paramno}}%
{\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
\edef\paramlist{\paramlist\hash\the\paramno,}%
\fi\next}
% the \xempty{} is to give \eatleadingcr an argument in the case of an
% empty macro argument.
% \parsemacbody, \parsermacbody
%
......@@ -8970,7 +8931,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else
\ifhavexrefs
% We (should) know the real title if we have the xref values.
\def\printedrefname{\refx{#1-title}{}}%
\def\printedrefname{\refx{#1-title}}%
\else
% Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}%
......@@ -9064,7 +9025,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% If the user specified the print name (third arg) to the ref,
% print it instead of our usual "Figure 1.2".
\ifdim\wd\printedrefnamebox = 0pt
\refx{#1-snt}{}%
\refx{#1-snt}%
\else
\printedrefname
\fi
......@@ -9099,28 +9060,30 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\else
% Reference within this manual.
%
% Only output a following space if the -snt ref is nonempty; for
% @unnumbered and @anchor, it won't be.
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
% Only output a following space if the -snt ref is nonempty, as the ref
% will be empty for @unnumbered and @anchor.
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}}%
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
%
% output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname
%
% But we always want a comma and a space:
,\space
%
% output the `page 3'.
\turnoffactive \putwordpage\tie\refx{#1-pg}{}%
% Add a , if xref followed by a space
\if\space\noexpand\tokenafterxref ,%
\else\ifx\ \tokenafterxref ,% @TAB
\else\ifx\*\tokenafterxref ,% @*
\else\ifx\ \tokenafterxref ,% @SPACE
\else\ifx\
\tokenafterxref ,% @NL
\else\ifx\tie\tokenafterxref ,% @tie
\fi\fi\fi\fi\fi\fi
\expandafter\ifx\csname SETtxiomitxrefpg\endcsname\relax
% But we always want a comma and a space:
,\space
%
% output the `page 3'.
\turnoffactive \putwordpage\tie\refx{#1-pg}%
% Add a , if xref followed by a space
\if\space\noexpand\tokenafterxref ,%
\else\ifx\ \tokenafterxref ,% @TAB
\else\ifx\*\tokenafterxref ,% @*
\else\ifx\ \tokenafterxref ,% @SPACE
\else\ifx\
\tokenafterxref ,% @NL
\else\ifx\tie\tokenafterxref ,% @tie
\fi\fi\fi\fi\fi\fi
\fi
\fi\fi
\fi
\endlink
......@@ -9187,9 +9150,8 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\fi\fi\fi
}
% \refx{NAME}{SUFFIX} - reference a cross-reference string named NAME. SUFFIX
% is output afterwards if non-empty.
\def\refx#1#2{%
% \refx{NAME} - reference a cross-reference string named NAME.
\def\refx#1{%
\requireauxfile
{%
\indexnofonts
......@@ -9216,7 +9178,6 @@ might help (with 'rm \jobname.?? \jobname.??s')%
% It's defined, so just use it.
\thisrefX
\fi
#2% Output the suffix in any case.
}
% This is the macro invoked by entries in the aux file. Define a control
......@@ -9326,10 +9287,10 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\catcode`\[=\other
\catcode`\]=\other
\catcode`\"=\other
\catcode`\_=\other
\catcode`\|=\other
\catcode`\<=\other
\catcode`\>=\other
\catcode`\_=\active
\catcode`\|=\active
\catcode`\<=\active
\catcode`\>=\active
\catcode`\$=\other
\catcode`\#=\other
\catcode`\&=\other
......@@ -9550,7 +9511,7 @@ might help (with 'rm \jobname.?? \jobname.??s')%
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
\catcode`\^^M = 5 % in case we're inside an example
\normalturnoffactive % allow _ et al. in names
\def\xprocessmacroarg{\eatspaces}% in case we are being used via a macro
\makevalueexpandable
% If the image is by itself, center it.
\ifvmode
\imagevmodetrue
......@@ -11603,7 +11564,7 @@ directory should work if nowhere else does.}
\let> = \activegtr
\let~ = \activetilde
\let^ = \activehat
\markupsetuplqdefault \markupsetuprqdefault
\setregularquotes
\let\b = \strong
\let\i = \smartitalic
% in principle, all other definitions in \tex have to be undone too.
......@@ -11662,8 +11623,7 @@ directory should work if nowhere else does.}
@let|=@normalverticalbar
@let~=@normaltilde
@let\=@ttbackslash
@markupsetuplqdefault
@markupsetuprqdefault
@setregularquotes
@unsepspaces
}
}
......@@ -11756,8 +11716,7 @@ directory should work if nowhere else does.}
@c Do this last of all since we use ` in the previous @catcode assignments.
@catcode`@'=@active
@catcode`@`=@active
@markupsetuplqdefault
@markupsetuprqdefault
@setregularquotes
@c Local variables:
@c eval: (add-hook 'before-save-hook 'time-stamp)
......
......@@ -4,7 +4,7 @@
# Detect instances of "if (p) free (p);".
# Likewise "if (p != 0)", "if (0 != p)", or with NULL; and with braces.
# Copyright (C) 2008-2020 Free Software Foundation, Inc.
# Copyright (C) 2008-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
......@@ -36,12 +36,14 @@
eval 'exec perl -wSx "$0" "$@"'
if 0;
my $VERSION = '2020-04-04 15:07'; # UTC
my $VERSION = '2021-04-11 10:11'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
my $copyright_year = '2021';
use strict;
use warnings;
use Getopt::Long;
......@@ -118,7 +120,19 @@ sub is_NULL ($)
GetOptions
(
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
version =>
sub
{
print "$ME version $VERSION\n";
print "Copyright (C) $copyright_year Free Software Foundation, Inc.\n";
print "License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.\n"
. "This is free software: you are free to change and redistribute it.\n"
. "There is NO WARRANTY, to the extent permitted by law.\n";
print "\n";
my $author = "Jim Meyering";
print "Written by $author.\n";
exit
},
list => \$list,
'name=s@' => \@name,
) or usage 1;
......
......@@ -4,7 +4,7 @@
# Print a version string.
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 2006-2020 Free Software Foundation, Inc.
# Copyright (C) 2006-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
......
......@@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
#
# Written by Tom Tromey <tromey@cygnus.com>.
#
......
......@@ -25,7 +25,7 @@ PACKAGE ?= gnutls
.PHONY: config glimport
INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./gl/ -e ^./src/libopts/ -e -args.[ch] -e asn1_tab.c -e ^./tests/suite/`
INDENT_SOURCES = `find . -name \*.[ch] -o -name gnutls.h.in | grep -v -e ^./build-aux/ -e ^./lib/minitasn1/ -e ^./lib/build-aux/ -e ^./gl/ -e -args.[ch] -e asn1_tab.c -e ^./tests/suite/`
ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
.DEFAULT_GOAL := bootstrap
......@@ -42,7 +42,7 @@ local-checks-to-skip = sc_GPL_version sc_bindtextdomain \
sc_unmarked_diagnostics sc_useless_cpp_parens \
sc_two_space_separator_in_usage
VC_LIST_ALWAYS_EXCLUDE_REGEX = ^maint.mk|gtk-doc.make|m4/pkg|doc/fdl-1.3.texi|src/.*\.bak|src/crywrap/|(devel/perlasm/|lib/accelerated/x86/|build-aux/|gl/|src/libopts/|tests/suite/ecore/|doc/protocol/).*$$
VC_LIST_ALWAYS_EXCLUDE_REGEX = ^maint.mk|gtk-doc.make|m4/pkg|doc/fdl-1.3.texi|src/.*\.bak|src/crywrap/|(devel/perlasm/|lib/accelerated/x86/|build-aux/|gl/|tests/suite/ecore/|doc/protocol/).*$$
# Explicit syntax-check exceptions.
exclude_file_name_regexp--sc_copyright_check = ^./gnulib/.*$$
......@@ -212,7 +212,7 @@ lib/accelerated/x86/elf/%.s: devel/perlasm/%.pl .submodule.stamp
cat $<.license $@.tmp > $@ && rm -f $@.tmp
echo "" >> $@
echo ".section .note.GNU-stack,\"\",%progbits" >> $@
sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@
sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@
lib/accelerated/x86/coff/%-x86.s: devel/perlasm/%-x86.pl .submodule.stamp
CC=gcc perl $< coff \
......@@ -220,7 +220,7 @@ lib/accelerated/x86/coff/%-x86.s: devel/perlasm/%-x86.pl .submodule.stamp
$@.tmp
cat $<.license $@.tmp > $@ && rm -f $@.tmp
echo "" >> $@
sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@
sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@
lib/accelerated/x86/coff/%-x86_64.s: devel/perlasm/%-x86_64.pl .submodule.stamp
CC=gcc perl $< mingw64 \
......@@ -228,7 +228,7 @@ lib/accelerated/x86/coff/%-x86_64.s: devel/perlasm/%-x86_64.pl .submodule.stamp
$@.tmp
cat $<.license $@.tmp > $@ && rm -f $@.tmp
echo "" >> $@
sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@
sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@
lib/accelerated/x86/macosx/%.s: devel/perlasm/%.pl .submodule.stamp
CC=gcc perl $< macosx \
......@@ -236,7 +236,7 @@ lib/accelerated/x86/macosx/%.s: devel/perlasm/%.pl .submodule.stamp
$@.tmp
cat $<.license $@.tmp > $@ && rm -f $@.tmp
echo "" >> $@
sed -i 's/OPENSSL_ia32cap_P/_gnutls_x86_cpuid_s/g' $@
sed -i 's/OPENSSL_ia32cap_P/GNUTLS_x86_cpuid_s/g' $@
lib/accelerated/aarch64/elf/%.s: devel/perlasm/%.pl .submodule.stamp
rm -f $@tmp
......
#!/usr/bin/python
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
import argparse
import cligen.package
import cligen.types
import cligen.code
import json
parser = argparse.ArgumentParser(description='generate option parsing code')
parser.add_argument('json', type=argparse.FileType('r'))
parser.add_argument('c', type=argparse.FileType('w'))
parser.add_argument('h', type=argparse.FileType('w'))
parser.add_argument('--package', help='package', required=True)
parser.add_argument('--version', help='version', required=True)
parser.add_argument('--license', help='license')
parser.add_argument('--authors', help='authors')
parser.add_argument('--copyright-year', help='copyright year')
parser.add_argument('--copyright-holder', help='copyright holder')
parser.add_argument('--bug-email', help='bug report email address')
args = parser.parse_args()
kwargs = {
'name': args.package,
'version': args.version
}
if args.license:
kwargs['license'] = args.license
if args.copyright_year:
kwargs['copyright_year'] = args.copyright_year
if args.copyright_holder:
kwargs['copyright_holder'] = args.copyright_holder
if args.bug_email:
kwargs['bug_email'] = args.bug_email
info = cligen.package.Info(**kwargs)
desc = cligen.types.Desc.from_json(json.load(args.json))
cligen.code.generate_source(desc, info, args.c)
cligen.code.generate_header(desc, info, args.h)
#!/usr/bin/python
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
import argparse
import cligen.package
import cligen.types
import json
import sys
parser = argparse.ArgumentParser(description='generate documentation')
parser.add_argument('json', type=argparse.FileType('r'))
parser.add_argument('outfile', type=argparse.FileType('w'))
parser.add_argument('--format', choices=['man', 'texi'])
parser.add_argument('--level', type=int, default=0)
parser.add_argument('--section-node', action='store_true')
parser.add_argument('--include', action='append')
parser.add_argument('--package', help='package', required=True)
parser.add_argument('--version', help='version')
parser.add_argument('--license', help='license')
parser.add_argument('--authors', help='authors')
parser.add_argument('--copyright-year', help='copyright year')
parser.add_argument('--copyright-holder', help='copyright holder')
parser.add_argument('--bug-email', help='bug report email address')
args = parser.parse_args()
kwargs = {
'name': args.package,
'version': args.version
}
if args.license:
kwargs['license'] = args.license
if args.copyright_year:
kwargs['copyright_year'] = args.copyright_year
if args.copyright_holder:
kwargs['copyright_holder'] = args.copyright_holder
if args.bug_email:
kwargs['bug_email'] = args.bug_email
info = cligen.package.Info(**kwargs)
desc = cligen.types.Desc.from_json(json.load(args.json))
includes = dict()
if args.include:
for i in args.include:
(section, infile) = i.split('=')
includes[section] = open(infile, 'r')
if args.format == 'man':
import cligen.doc.man
cligen.doc.man.generate(desc, info, includes, args.outfile)
elif args.format == 'texi':
import cligen.doc.texi
cligen.doc.texi.generate(desc, info, includes, args.outfile,
level=args.level, section_node=args.section_node)
else:
sys.stderr.write(f'Unknown format {args.format}\n')
sys.exit(1)
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
cligen_sources = \
cligen/cli-codegen.py cligen/cli-docgen.py \
cligen/cligen/__init__.py cligen/cligen/code.py \
cligen/cligen/package.py cligen/cligen/types.py \
cligen/cligen/doc/__init__.py cligen/cligen/doc/man.py \
cligen/cligen/doc/texi.py
File moved
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
from typing import Mapping, MutableMapping, MutableSequence, Sequence
from typing import TextIO, Union
import io
from cligen.types import ArgumentType, Desc, OptionDesc
from cligen.package import Info, version
import sys
import textwrap
INDENT = ' '
def get_aliases(options: Sequence[OptionDesc]) -> Mapping[str, Sequence[str]]:
aliases: MutableMapping[str, MutableSequence[str]] = dict()
for option in options:
if option.aliases:
val = aliases.get(option.aliases, list())
val.append(option.long_option)
aliases[option.aliases] = val
return aliases
def get_chars(options: Sequence[OptionDesc]) -> Mapping[str, Union[str, int]]:
chars: MutableMapping[str, Union[str, int]] = dict()
chars_counter = 1
short_opts: MutableMapping[str, str] = dict()
for option in options:
# If the short option is already taken, do not register twice
if option.short_option and (option.short_option not in short_opts):
chars[option.long_option] = option.short_option
short_opts[option.short_option] = option.long_option
else:
if option.short_option:
print((f'short option {option.short_option} for '
f'{option.long_option} is already '
f'taken by {short_opts[option.short_option]}'),
file=sys.stderr)
chars[option.long_option] = chars_counter
chars_counter += 1
if option.disable_prefix:
chars[
f'{option.disable_prefix}{option.long_option}'
] = chars_counter
chars_counter += 1
return chars
# Reserved keywords in C, from 6.4.1 of N1570
KEYWORDS = {
'auto', 'break', 'case', 'char', 'const', 'continue', 'default', 'do',
'double', 'else', 'enum', 'extern', 'float', 'for', 'goto', 'if', 'inline',
'int', 'long', 'register', 'restrict', 'return', 'short', 'signed',
'sizeof', 'static', 'struct', 'switch', 'typedef', 'union', 'unsigned',
'void', 'volatile', 'while', '_Alignas', '_Alignof', '_Atomic', '_Bool',
'_Complex', '_Generic', '_Imaginary', '_Noreturn', '_Static_assert',
'_Thread_local',
}
def escape_c_keyword(name: str) -> str:
while name in KEYWORDS:
name += '_'
return name
def mangle(name: str) -> str:
return ''.join([c if c in 'abcdefghijklmnopqrstuvwxyz0123456789_' else '_'
for c in name.lower()])
def format_long_opt(c: Union[str, int], long_opt: str, has_arg: str) -> str:
if isinstance(c, str):
return f"{INDENT}{{ \"{long_opt}\", {has_arg}, 0, '{c}' }},\n"
else:
return f'{INDENT}{{ "{long_opt}", {has_arg}, 0, CHAR_MAX + {c} }},\n'
def format_switch_case(c: Union[str, int], long_opt: str) -> str:
if isinstance(c, str):
return f"{INDENT*3}case '{c}':\n"
else:
return f'{INDENT*3}case CHAR_MAX + {c}: /* --{long_opt} */\n'
def usage(desc: Desc, info: Info) -> str:
out = io.StringIO()
out.write(f'{desc.tool.name} - {desc.tool.title}\n')
out.write(
f'Usage: {desc.tool.name} '
f'[ -<flag> [<val>] | --<name>[{{=| }}<val>] ]... '
f'{desc.tool.argument if desc.tool.argument else ""}\n'
)
for section in desc.sections:
out.write('\n')
if section.description != '':
out.write(f'{section.description}:\n\n')
for option in section.options:
if option.deprecated:
continue
if option.short_option:
header = f' -{option.short_option}, --{option.long_option}'
else:
header = f' --{option.long_option}'
if option.argument_type:
if option.argument_type:
arg = option.argument_type.get_name()
else:
arg = 'arg'
if option.argument_optional:
header += f'[={arg}]'
else:
header += f'={arg}'
if len(header) < 30:
header = header.ljust(30)
elif option.argument_type:
header += ' '
else:
header += ' '
if option.aliases:
out.write(f'{header}an alias for the '
f"'{option.aliases}' option\n")
else:
out.write(f'{header}{option.description}\n')
if len(option.conflicts) == 1:
out.write(
f"\t\t\t\t- prohibits the option '{option.conflicts[0]}'\n"
)
elif len(option.conflicts) > 1:
conflict_opts_concatenated = '\n'.join([
f'\t\t\t\t{o}' for o in option.conflicts
])
out.write(
'\t\t\t\t- prohibits these options:\n' +
conflict_opts_concatenated + '\n'
)
if len(option.requires) == 1:
out.write(
f"\t\t\t\t- requires the option '{option.requires[0]}'\n"
)
elif len(option.requires) > 1:
require_opts_concatenated = '\n'.join([
f'\t\t\t\t{o}' for o in option.requires
])
out.write(
'\t\t\t\t- requires these options:\n' +
require_opts_concatenated + '\n'
)
if option.file_exists:
out.write('\t\t\t\t- file must pre-exist\n')
if option.enabled:
out.write('\t\t\t\t- enabled by default\n')
if option.disable_prefix:
out.write(
'\t\t\t\t- disabled as '
f"'--{option.disable_prefix}{option.long_option}'\n"
)
if option.argument_range:
out.write(
'\t\t\t\t- it must be in the range:\n'
f'\t\t\t\t {option.argument_range.minimum} to '
f'{option.argument_range.maximum}\n'
)
out.write(textwrap.dedent('''
Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.
'''))
if desc.tool.argument:
out.write(('Operands and options may be intermixed. '
'They will be reordered.\n'))
if desc.tool.detail:
out.write(f'\n{desc.tool.detail}\n')
if info.bug_email:
out.write(f'\nPlease send bug reports to: <{info.bug_email}>\n')
return out.getvalue()
def generate_source(desc: Desc, info: Info, outfile: TextIO):
long_opts = io.StringIO()
short_opts = list()
default_definitions = io.StringIO()
default_statements = io.StringIO()
switch_cases = io.StringIO()
enable_statements = io.StringIO()
constraint_statements = io.StringIO()
has_list_arg = False
has_number_arg = False
has_default_arg = False
options = [option for section in desc.sections
for option in section.options]
chars = get_chars(options)
aliases = get_aliases(options)
struct_name = f'{mangle(desc.tool.name)}_options'
global_name = f'{mangle(desc.tool.name)}_options'
switch_cases.write(f"{INDENT*3}case '\\0': /* Long option. */\n")
switch_cases.write(f'{INDENT*4}break;\n')
for option in options:
long_opt = option.long_option
arg_type = option.argument_type
lower_opt = mangle(long_opt)
upper_opt = lower_opt.upper()
lower_opt = escape_c_keyword(lower_opt)
# aliases are handled differently
if option.aliases:
continue
if arg_type:
if option.argument_optional:
has_arg = 'optional_argument'
else:
has_arg = 'required_argument'
else:
has_arg = 'no_argument'
c = chars[long_opt]
if isinstance(c, str):
if arg_type:
short_opts.append(c + ':')
else:
short_opts.append(c)
long_opts.write(format_long_opt(c, long_opt, has_arg))
switch_cases.write(format_switch_case(c, long_opt))
for alias in aliases.get(long_opt, list()):
c = chars[alias]
long_opts.write(format_long_opt(c, alias, has_arg))
switch_cases.write(format_switch_case(c, alias))
switch_cases.write(f'{INDENT*4}opts->present.{lower_opt} = true;\n')
if arg_type:
if option.multiple:
has_list_arg = True
switch_cases.write((
f'{INDENT*4}append_to_list (&opts->list.{lower_opt}, '
f'"{long_opt}", optarg);\n'
))
else:
switch_cases.write(
f'{INDENT*4}opts->arg.{lower_opt} = optarg;\n'
)
if arg_type == ArgumentType.NUMBER:
has_number_arg = True
switch_cases.write((
f'{INDENT*4}opts->value.{lower_opt} = '
'parse_number(optarg);\n'
))
if option.argument_default:
has_default_arg = True
default_definitions.write(
f'static const char *{lower_opt}_default = '
f'"{option.argument_default}";\n'
)
default_statements.write(
f'{INDENT}opts->arg.{lower_opt} = '
f'{lower_opt}_default;\n'
)
if arg_type == ArgumentType.NUMBER:
assert isinstance(option.argument_default, int)
default_statements.write((
f'{INDENT}opts->value.{lower_opt} = '
f'{option.argument_default};\n'
))
switch_cases.write(
f'{INDENT*4}opts->enabled.{lower_opt} = true;\n'
)
switch_cases.write(f'{INDENT*4}break;\n')
if option.enabled:
enable_statements.write(
f'{INDENT}opts->enabled.{lower_opt} = true;\n'
)
if option.disable_prefix:
disable_opt = f'{option.disable_prefix}{long_opt}'
c = chars[disable_opt]
long_opts.write(format_long_opt(c, disable_opt, has_arg))
switch_cases.write(format_switch_case(c, disable_opt))
switch_cases.write(
f'{INDENT*4}opts->present.{lower_opt} = true;\n'
)
switch_cases.write(
f'{INDENT*4}opts->enabled.{lower_opt} = false;\n'
)
switch_cases.write(f'{INDENT*4}break;\n')
for conflict_opt in option.conflicts:
constraint_statements.write(f'''\
{INDENT}if (HAVE_OPT({upper_opt}) && HAVE_OPT({mangle(conflict_opt).upper()}))
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "the '%s' and '%s' options conflict",
{INDENT*3} "{long_opt}", "{mangle(conflict_opt)}");
{INDENT*2}}}
''')
for require_opt in option.requires:
constraint_statements.write(f'''\
{INDENT}if (HAVE_OPT({upper_opt}) && !HAVE_OPT({mangle(require_opt).upper()}))
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "%s option requires the %s options",
{INDENT*3} "{long_opt}", "{mangle(require_opt)}");
{INDENT*2}}}
''')
arg_range = option.argument_range
if arg_range:
constraint_statements.write(f'''\
{INDENT}if (HAVE_OPT({upper_opt}) && \
OPT_VALUE_{upper_opt} < {arg_range.minimum})
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "%s option value %d is out of range.",
{INDENT*3} "{long_opt}", opts->value.{lower_opt});
{INDENT*2}}}
''')
constraint_statements.write(f'''\
{INDENT}if (HAVE_OPT({upper_opt}) && \
OPT_VALUE_{upper_opt} > {arg_range.maximum})
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "%s option value %d is out of range",
{INDENT*3} "{long_opt}", opts->value.{lower_opt});
{INDENT*2}}}
''')
long_opts.write(f'{INDENT}{{ 0, 0, 0, 0 }}\n')
switch_cases.write(f'{INDENT*3}default:\n')
switch_cases.write(f'{INDENT*4}usage (stderr, EXIT_FAILURE);\n')
switch_cases.write(f'{INDENT*4}break;\n')
argument = desc.tool.argument
if argument:
if argument.startswith('[') and argument.endswith(']'):
argument = argument[1:-1]
argument_statement = ''
else:
argument_statement = f'''\
{INDENT}if (optind == argc)
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "Command line arguments required");
{INDENT*2}}}
'''
else:
argument_statement = f'''\
{INDENT}if (optind < argc)
{INDENT*2}{{
{INDENT*3}error (EXIT_FAILURE, 0, "Command line arguments are not allowed.");
{INDENT*2}}}
'''
short_opts_concatenated = ''.join(sorted(short_opts))
usage_stringified = '\n'.join([
f'{INDENT*2}"{line}\\n"' for line in usage(desc, info).split('\n')
])
version_v = version(desc, info, 'v')
version_c = version(desc, info, 'c')
version_n = version(desc, info, 'n')
version_v_stringified = '\n'.join([
f'{INDENT*6}"{line}\\n"' for line in version_v.split('\n')
])
version_c_stringified = '\n'.join([
f'{INDENT*6}"{line}\\n"' for line in version_c.split('\n')
])
version_n_stringified = '\n'.join([
f'{INDENT*6}"{line}\\n"' for line in version_n.split('\n')
])
if outfile.name.endswith('.c'):
outfile_base = outfile.name[:-len('.c')]
else:
outfile_base = outfile.name
outfile.write(f'''\
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "{outfile_base}.h"
#include <errno.h>
#include <error.h>
#include <getopt.h>
#include <limits.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifndef _WIN32
#include <unistd.h>
#endif /* !_WIN32 */
#include <limits.h>
struct {struct_name} {global_name};
''')
if has_list_arg:
outfile.write(f'''\
/* Copied from xsize.h in Gnulib */
/* Sum of two sizes, with overflow check. */
static inline size_t
xsum (size_t size1, size_t size2)
{{
{INDENT}size_t sum = size1 + size2;
{INDENT}return (sum >= size1 ? sum : SIZE_MAX);
}}
/* Check for overflow. */
#define size_overflow_p(SIZE) \
{INDENT}((SIZE) == SIZE_MAX)
static void
append_to_list (struct {mangle(desc.tool.name)}_list *list,
const char *name, const char *arg)
{{
{INDENT}const char **tmp;
{INDENT}size_t new_count = xsum (list->count, 1);
{INDENT}if (size_overflow_p (new_count))
{INDENT*2}error (EXIT_FAILURE, 0, "too many arguments for %s",
{INDENT*2} name);
{INDENT}tmp = reallocarray (list->args, new_count, sizeof (char *));
{INDENT}if (!tmp)
{INDENT*2}error (EXIT_FAILURE, 0, "unable to allocate memory for %s",
{INDENT*2} name);
{INDENT}list->args = tmp;
{INDENT}list->args[list->count] = optarg;
{INDENT}list->count = new_count;
}}
''')
if has_number_arg:
outfile.write(f'''\
static long
parse_number (const char *arg)
{{
{INDENT}char *endptr = NULL;
{INDENT}errno = 0;
{INDENT}long result;
{INDENT}if (strncmp (arg, "0x", 2) == 0)
{INDENT*2}result = strtol (arg + 2, &endptr, 16);
{INDENT}else if (strncmp (arg, "0", 1) == 0
{INDENT} && strspn (arg, "012345678") == strlen (optarg))
{INDENT*2}result = strtol (arg + 1, &endptr, 8);
{INDENT}else
{INDENT*2}result = strtol (arg, &endptr, 10);
{INDENT}if (errno != 0 || (endptr && *endptr != '\\0'))
{INDENT*2}error (EXIT_FAILURE, errno, "'%s' is not a recognizable number.",
{INDENT*2} arg);
{INDENT}return result;
}}
''')
outfile.write(f'''\
/* Long options. */
static const struct option long_options[] =
{{
{long_opts.getvalue()}
}};
''')
if has_default_arg:
outfile.write(f'''\
/* Default options. */
{default_definitions.getvalue().rstrip()}
''')
outfile.write(f'''\
int
process_options (int argc, char **argv)
{{
{INDENT}struct {struct_name} *opts = &{global_name};
{INDENT}int opt;
''')
if has_default_arg:
outfile.write(f'''\
{default_statements.getvalue().rstrip()}
''')
outfile.write(f'''\
{enable_statements.getvalue().rstrip()}
{INDENT}while ((opt = getopt_long (argc, argv, "{short_opts_concatenated}",
{INDENT} long_options, NULL)) != EOF)
{INDENT*2}switch (opt)
{INDENT*3}{{
{switch_cases.getvalue().rstrip()}
{INDENT*3}}}
{constraint_statements.getvalue().rstrip()}
{argument_statement}
{INDENT}if (HAVE_OPT(HELP))
{INDENT*2}{{
{INDENT*3}USAGE(0);
{INDENT*2}}}
{INDENT}if (HAVE_OPT(MORE_HELP))
#ifdef _WIN32
{INDENT*2}{{
{INDENT*3}USAGE(0);
{INDENT*2}}}
#else /* _WIN32 */
{INDENT*2}{{
{INDENT*3}pid_t pid;
{INDENT*3}int pfds[2];
{INDENT*3}if (pipe (pfds) < 0)
{INDENT*4}error (EXIT_FAILURE, errno, "pipe");
{INDENT*3}pid = fork ();
{INDENT*3}if (pid < 0)
{INDENT*4}error (EXIT_FAILURE, errno, "fork");
{INDENT*3}if (pid == 0)
{INDENT*4}{{
{INDENT*5}close (pfds[0]);
{INDENT*5}dup2 (pfds[1], STDOUT_FILENO);
{INDENT*5}close (pfds[1]);
{INDENT*5}usage (stdout, 0);
{INDENT*4}}}
{INDENT*3}else
{INDENT*4}{{
{INDENT*5}const char *args[2];
{INDENT*5}const char *envvar;
{INDENT*5}close (pfds[1]);
{INDENT*5}dup2 (pfds[0], STDIN_FILENO);
{INDENT*5}close (pfds[0]);
{INDENT*5}envvar = secure_getenv ("PAGER");
{INDENT*5}if (!envvar || *envvar == '\\0')
{INDENT*6}args[0] = "more";
{INDENT*5}else
{INDENT*6}args[0] = envvar;
{INDENT*5}args[1] = NULL;
{INDENT*5}execvp (args[0], (char * const *)args);
{INDENT*5}exit (EXIT_FAILURE);
{INDENT*4}}}
{INDENT*2}}}
#endif /* !_WIN32 */
{INDENT}if (HAVE_OPT(VERSION))
{INDENT*2}{{
{INDENT*3}if (!OPT_ARG_VERSION || !strcmp (OPT_ARG_VERSION, "c"))
{INDENT*4}{{
{INDENT*5}const char str[] =
{version_c_stringified};
{INDENT*5}fprintf (stdout, "%s", str);
{INDENT*5}exit(0);
{INDENT*4}}}
{INDENT*3}else if (!strcmp (OPT_ARG_VERSION, "v"))
{INDENT*4}{{
{INDENT*5}const char str[] =
{version_v_stringified};
{INDENT*5}fprintf (stdout, "%s", str);
{INDENT*5}exit(0);
{INDENT*4}}}
{INDENT*3}else if (!strcmp (OPT_ARG_VERSION, "n"))
{INDENT*4}{{
{INDENT*5}const char str[] =
{version_n_stringified};
{INDENT*5}fprintf (stdout, "%s", str);
{INDENT*5}exit(0);
{INDENT*4}}}
{INDENT*3}else
{INDENT*4}{{
{INDENT*5}error (EXIT_FAILURE, 0,
{INDENT*5} "version option argument 'a' invalid. Use:\\n"
{INDENT*5} " 'v' - version only\\n"
{INDENT*5} " 'c' - version and copyright\\n"
{INDENT*5} " 'n' - version and full copyright notice");
{INDENT*4}}}
{INDENT*2}}}
{INDENT}return optind;
}}
void
usage (FILE *out, int status)
{{
{INDENT}const char str[] =
{usage_stringified};
{INDENT}fprintf (out, "%s", str);
{INDENT}exit (status);
}}
''')
def generate_header(desc: Desc, info: Info, outfile: TextIO):
struct_members_present = io.StringIO()
struct_members_arg = io.StringIO()
struct_members_value = io.StringIO()
struct_members_enabled = io.StringIO()
struct_members_list = io.StringIO()
have_opts = io.StringIO()
opt_args = io.StringIO()
opt_values = io.StringIO()
enabled_opts = io.StringIO()
opts_count = io.StringIO()
opts_array = io.StringIO()
has_list_arg = False
struct_name = f'{mangle(desc.tool.name)}_options'
global_name = f'{mangle(desc.tool.name)}_options'
list_struct_name = f'{mangle(desc.tool.name)}_list'
options = [option for section in desc.sections
for option in section.options]
for option in options:
long_opt = option.long_option
arg_type = option.argument_type
lower_opt = mangle(long_opt)
upper_opt = lower_opt.upper()
lower_opt = escape_c_keyword(lower_opt)
# aliases are handled differently
if option.aliases:
continue
struct_members_present.write(f'{INDENT*2}bool {lower_opt};\n')
if arg_type:
if option.multiple:
has_list_arg = True
struct_members_list.write(
f'{INDENT*2}struct {list_struct_name} {lower_opt};\n'
)
opts_count.write((
f'#define OPTS_COUNT_{upper_opt} '
f'{global_name}.list.{lower_opt}.count\n'
))
opts_array.write((
f'#define OPTS_ARRAY_{upper_opt} '
f'{global_name}.list.{lower_opt}.args\n'
))
else:
struct_members_arg.write(
f'{INDENT*2}const char *{lower_opt};\n'
)
if arg_type == ArgumentType.NUMBER:
struct_members_value.write(f'{INDENT*2}int {lower_opt};\n')
opt_values.write((
f'#define OPT_VALUE_{upper_opt} '
f'{global_name}.value.{lower_opt}\n'
))
struct_members_enabled.write(f'{INDENT*2}bool {lower_opt};\n')
enabled_opts.write((
f'#define ENABLED_OPT_{upper_opt} '
f'{global_name}.enabled.{lower_opt}\n'
))
have_opts.write((
f'#define HAVE_OPT_{upper_opt} '
f'{global_name}.present.{lower_opt}\n'
))
opt_args.write((
f'#define OPT_ARG_{upper_opt} '
f'{global_name}.arg.{lower_opt}\n'
))
header_guard = f'{mangle(outfile.name).upper()}_'
outfile.write(f'''\
#include <stdbool.h>
#include <stdio.h>
#ifndef {header_guard}
#define {header_guard} 1
struct {list_struct_name}
{{
{INDENT}const char **args;
{INDENT}unsigned int count;
}};
struct {struct_name}
{{
{INDENT}/* Options present in the command line */
{INDENT}struct
{INDENT}{{
{struct_members_present.getvalue().rstrip()}
{INDENT}}} present;
{INDENT}/* Option arguments in raw string form */
{INDENT}struct
{INDENT}{{
{struct_members_arg.getvalue().rstrip()}
{INDENT}}} arg;
{INDENT}/* Option arguments parsed as integer */
{INDENT}struct
{INDENT}{{
{struct_members_value.getvalue().rstrip()}
{INDENT}}} value;
''')
if has_list_arg:
outfile.write(f'''
{INDENT}/* Option arguments parsed as list */
{INDENT}struct
{INDENT}{{
{struct_members_list.getvalue().rstrip()}
{INDENT}}} list;
''')
outfile.write(f'''
{INDENT}/* Option enablement status */
{INDENT}struct
{INDENT}{{
{struct_members_enabled.getvalue().rstrip()}
{INDENT}}} enabled;
}};
#define HAVE_OPT(name) HAVE_OPT_ ## name
#define OPT_ARG(name) OPT_ARG_ ## name
#define ENABLED_OPT(name) ENABLED_OPT_ ## name
#define OPTS_COUNT(name) OPTS_COUNT_ ## name
#define OPTS_ARRAY(name) OPTS_ARRAY_ ## name
#define USAGE(status) usage (stdout, (status))
{have_opts.getvalue()}
{opt_args.getvalue()}
{opt_values.getvalue()}
{enabled_opts.getvalue()}
{opts_count.getvalue()}
{opts_array.getvalue()}
extern struct {struct_name} {global_name};
int process_options (int argc, char **argv);
void usage (FILE *out, int status);
#endif /* {header_guard} */
''')
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
from typing import Mapping, Optional, TextIO, Sequence
import datetime
import io
import re
from cligen.types import ArgumentType, Desc, ToolDesc, OptionDesc
from cligen.package import Info, license
def generate_options(tool: ToolDesc,
options: Sequence[OptionDesc]) -> str:
docs = io.StringIO()
for option in options:
long_opt = option.long_option
long_opt_escaped = long_opt.replace('-', '\\-')
short_opt = option.short_option
desc = option.description
disable_prefix = option.disable_prefix
if disable_prefix:
disable_opt: Optional[str] = f'{disable_prefix}{long_opt}'
else:
disable_opt = None
if option.aliases:
docs.write(f'''\
.TP
.NOP \\f\\*[B-Font]\\-\\-{long_opt_escaped}\\f[]
This is an alias for the \\fI--{option.aliases}\\fR option.
''')
if option.deprecated:
docs.write('''\
.sp
.B
NOTE: THIS OPTION IS DEPRECATED
''')
continue
if option.argument_type:
if option.argument_name:
arg_name = option.argument_name.lower()
else:
arg_name = option.argument_type.get_name()
arg = f'\\f\\*[I-Font]{arg_name}\\f[]'
long_arg = f'={arg}'
short_arg = f' {arg}'
else:
long_arg = ''
short_arg = ''
formatted_options = list()
if short_opt:
formatted_options.append(
f'\\f\\*[B-Font]\\-{short_opt}\\f[]{short_arg}'
)
formatted_options.append(
f'\\f\\*[B-Font]\\-\\-{long_opt_escaped}\\f[]{long_arg}'
)
if disable_opt:
disable_opt_escaped = disable_opt.replace('-', '\\-')
formatted_options.append(
f'\\f\\*[B-Font]\\-\\-{disable_opt_escaped}\\f[]'
)
docs.write(f'''\
.TP
.NOP {', '.join(formatted_options)}
''')
if desc and desc[0].isupper():
docs.write(f'{desc}.\n')
if option.multiple:
docs.write(
'This option may appear an unlimited number of times.\n'
)
if option.argument_type == ArgumentType.NUMBER:
docs.write(
'This option takes an integer number as its argument.\n'
)
if option.argument_range:
docs.write(f'''\
The value of
\\f\\*[I-Font]{arg_name}\\f[]
is constrained to being:
.in +4
.nf
.na
in the range {option.argument_range.minimum} through \
{option.argument_range.maximum}
.fi
.in -4
''')
if option.argument_default:
docs.write(f'''\
The default
\\f\\*[I-Font]number\\f[]
for this option is:
.ti +4
{option.argument_default}
.sp
''')
if len(option.conflicts) > 0:
docs.write(f'''\
This option must not appear in combination with any of the following options:
{', '.join(option.conflicts)}.
''')
if len(option.requires) > 0:
docs.write(f'''\
This option must appear in combination with the following options:
{', '.join(option.requires)}.
''')
if disable_opt:
disable_opt_escaped = disable_opt.replace('-', '\\-')
docs.write((
f'The \\fI{disable_opt_escaped}\\fP form '
'will disable the option.\n'
))
if option.enabled:
docs.write('This option is enabled by default.\n')
if desc and desc[0].isupper():
docs.write('.sp\n')
if option.detail:
docs.write(f'{text_to_man(option.detail)}\n')
if option.deprecated:
docs.write('''\
.sp
.B
NOTE: THIS OPTION IS DEPRECATED
''')
return docs.getvalue()
def text_to_man(s: str) -> str:
s = re.sub(r'-', r'\\-', s)
s = re.sub(r'(?m)^$', r'.sp', s)
s = re.sub(r"``(.*)''", r'\\(lq\1\\(rq', s)
return s
def texi_to_man(s: str) -> str:
s = text_to_man(s)
s = re.sub(r'@([{}@])', r'\1', s)
s = re.sub(r'@code\{(.*?)\}', r'\\fB\1\\fP', s)
s = re.sub(r'@file\{(.*?)\}', r'\\fI\1\\fP', s)
s = re.sub(r'@subheading (.*)', r'''.br
\\fB\1\\fP
.br''', s)
s = re.sub(r'@example', r'''.br
.in +4
.nf''', s)
s = re.sub(r'@end example', r'''.in -4
.fi''', s)
return s
def include(name: str, includes: Mapping[str, TextIO]) -> str:
docs = io.StringIO()
f = includes.get(name)
if f:
docs.write(texi_to_man(f.read().strip()))
return docs.getvalue()
def generate(desc: Desc, info: Info,
includes: Mapping[str, TextIO],
outfile: TextIO):
description = includes.get('description')
if description:
detail = texi_to_man(description.read())
elif desc.tool.detail:
detail = desc.tool.detail
else:
detail = ''
section_docs = io.StringIO()
for section in desc.sections:
if section.ref:
option_docs = generate_options(desc.tool, section.options)
section_docs.write(f'''\
.SS "{section.description}"
{option_docs}\
''')
else:
section_docs.write(generate_options(desc.tool, section.options))
formatted_date = datetime.date.today().strftime('%d %b %Y')
detail_concatenated = '\n.sp\n'.join(detail.strip().split('\n\n'))
outfile.write(f'''\
.de1 NOP
. it 1 an-trap
. if \\\\n[.$] \\,\\\\$*\\/
..
.ie t \\
.ds B-Font [CB]
.ds I-Font [CI]
.ds R-Font [CR]
.el \\
.ds B-Font B
.ds I-Font I
.ds R-Font R
.TH {desc.tool.name} 1 "{formatted_date}" "{info.version}" "User Commands"
.SH NAME
\\f\\*[B-Font]{desc.tool.name}\\fP
\\- {desc.tool.title}
.SH SYNOPSIS
\\f\\*[B-Font]{desc.tool.name}\\fP
.\\" Mixture of short (flag) options and long options
[\\f\\*[B-Font]\\-flags\\f[]]
[\\f\\*[B-Font]\\-flag\\f[] [\\f\\*[I-Font]value\\f[]]]
[\\f\\*[B-Font]\\-\\-option-name\\f[][[=| ]\\f\\*[I-Font]value\\f[]]]
''')
if desc.tool.argument:
outfile.write(f'''\
{desc.tool.argument}
.sp \\n(Ppu
.ne 2
Operands and options may be intermixed. They will be reordered.
.sp \\n(Ppu
.ne 2
''')
else:
outfile.write('''\
.sp \\n(Ppu
.ne 2
All arguments must be options.
.sp \\n(Ppu
.ne 2
''')
outfile.write(f'''\
.SH "DESCRIPTION"
{detail_concatenated}
.sp
.SH "OPTIONS"
{section_docs.getvalue()}
''')
if 'files' in includes:
outfile.write(f'''\
.SH FILES
{include('files', includes)}
''')
if 'examples' in includes:
outfile.write(f'''\
.sp
.SH EXAMPLES
{include('examples', includes)}
''')
outfile.write('''\
.SH "EXIT STATUS"
One of the following exit values will be returned:
.TP
.NOP 0 " (EXIT_SUCCESS)"
Successful program execution.
.TP
.NOP 1 " (EXIT_FAILURE)"
The operation failed or the command syntax was not valid.
.PP
''')
if 'see-also' in includes:
outfile.write(f'''\
.SH "SEE ALSO"
{include('see-also', includes)}
''')
outfile.write(f'''\
.SH "AUTHORS"
{', '.join(info.authors)}
.SH "COPYRIGHT"
Copyright (C) {info.copyright_year} {info.copyright_holder}
{license(desc, info, 'brief')}.
''')
if info.bug_email:
outfile.write(f'''\
.SH "BUGS"
Please send bug reports to: {info.bug_email}
''')
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
from typing import Mapping, Sequence, TextIO
import io
import cligen.code
from cligen.types import Desc, ToolDesc, OptionDesc
from cligen.package import Info
HEADINGS = ['@heading', '@subheading', '@subsubheading']
def get_heading(level: int) -> str:
return HEADINGS[min(level, len(HEADINGS)-1)]
SECTIONS = ['@section', '@subsection', '@subsubsection']
def get_section(level: int) -> str:
return SECTIONS[min(level, len(SECTIONS)-1)]
def shift_headings(s: str, level: int) -> str:
for (i, h) in reversed(list(enumerate(HEADINGS))):
r = get_heading(level+i)
s = s.replace(h, r)
return s
def generate_options(tool: ToolDesc,
options: Sequence[OptionDesc],
level: int) -> str:
docs = io.StringIO()
for option in options:
if option.aliases:
docs.write(f'''\
{get_heading(level+1)} {option.long_option} option.
@anchor{{{tool.name} {option.long_option}}}
This is an alias for the @code{{{option.aliases}}} option,
@pxref{{{tool.name} {option.aliases}, \
the {option.aliases} option documentation}}.
''')
continue
if not option.detail or not option.description:
continue
if option.short_option:
docs.write(
f'{get_heading(level+1)} {option.long_option} option '
f'(-{option.short_option}).\n'
)
else:
docs.write(
f'{get_heading(level+1)} {option.long_option} option.\n'
)
docs.write(f'''\
@anchor{{{tool.name} {option.long_option}}}
This is the ``{option.description.lower()}'' option.
''')
if option.argument_type:
if option.argument_name:
docs.write((
f'This option takes a {option.argument_type} argument '
f'@file{{{option.argument_name}}}.\n'
))
else:
docs.write(f'This option takes '
f'a {option.argument_type} argument.\n')
if len(option.conflicts) > 0 or len(option.requires) > 0 or \
option.enabled:
docs.write('''
@noindent
This option has some usage constraints. It:
@itemize @bullet
''')
if len(option.conflicts) > 0:
docs.write(f'''\
@item
must not appear in combination with any of the following options:
{', '.join(option.conflicts)}.
''')
if len(option.requires) > 0:
docs.write(f'''\
@item
must appear in combination with the following options:
{', '.join(option.requires)}.
''')
if option.disable_prefix:
docs.write(f'''\
@item
can be disabled with --{option.disable_prefix}{option.long_option}.
''')
if option.enabled:
docs.write('''\
@item
It is enabled by default.
''')
docs.write('@end itemize\n\n')
docs.write(f'''\
{option.detail}
''')
if option.deprecated:
docs.write('\n@strong{NOTE}@strong{: THIS OPTION IS DEPRECATED}\n')
return docs.getvalue()
LABELS = {
'see-also': 'See Also',
'examples': 'Examples',
'files': 'Files'
}
def include(tool: ToolDesc,
name: str,
includes: Mapping[str, TextIO],
level: int) -> str:
docs = io.StringIO()
f = includes.get(name)
if f:
docs.write(f'''\
@anchor{{{tool.name} {LABELS[name]}}}
{get_heading(level+2)} {tool.name} {LABELS[name]}
{shift_headings(f.read(), level)}\
''')
return docs.getvalue()
def escape_texi(s: str) -> str:
for c in ['@', '{', '}']:
s = s.replace(c, f'@{c}')
return s
def generate(desc: Desc, info: Info,
includes: Mapping[str, TextIO],
outfile: TextIO,
level: int = 0,
section_node: bool = True):
description = includes.get('description')
if description:
detail = description.read()
elif desc.tool.detail:
detail = desc.tool.detail
else:
detail = ''
section_docs = io.StringIO()
for section in desc.sections:
if section.ref:
option_docs = generate_options(desc.tool,
section.options,
level+1)
assert section.description
section_docs.write(f'''\
@anchor{{{desc.tool.name} {section.ref}}}
{get_heading(level+1)} {section.ref} options
{section.description.strip('.')}.
{option_docs}\
''')
else:
section_docs.write(generate_options(desc.tool,
section.options,
level))
heading = get_section(level) if section_node else get_heading(level)
outfile.write(f'''\
@node {desc.tool.name} Invocation
{heading} Invoking {desc.tool.name}
@pindex {desc.tool.name}
{detail}
@anchor{{{desc.tool.name} usage}}
{get_heading(level+1)} {desc.tool.name} help/usage (@option{{-?}})
@cindex {desc.tool.name} help
The text printed is the same whether selected with the @code{{help}} option
(@option{{--help}}) or the @code{{more-help}} option \
(@option{{--more-help}}). @code{{more-help}} will print
the usage text by passing it through a pager program.
@code{{more-help}} is disabled on platforms without a working
@code{{fork(2)}} function. The @code{{PAGER}} environment variable is
used to select the program, defaulting to @file{{more}}. Both will exit
with a status code of 0.
@exampleindent 0
@example
{escape_texi(cligen.code.usage(desc, info))}
@end example
@exampleindent 4
{section_docs.getvalue()}\
@anchor{{{desc.tool.name} exit status}}
{get_heading(level+1)} {desc.tool.name} exit status
One of the following exit values will be returned:
@table @samp
@item 0 (EXIT_SUCCESS)
Successful program execution.
@item 1 (EXIT_FAILURE)
The operation failed or the command syntax was not valid.
@end table
''')
if 'see-also' in includes:
outfile.write(include(desc.tool, 'see-also', includes, level))
if 'examples' in includes:
outfile.write(include(desc.tool, 'examples', includes, level))
if 'files' in includes:
outfile.write(include(desc.tool, 'files', includes, level))
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
from typing import NamedTuple, Optional, Sequence
from cligen.types import Desc
import datetime
import io
import os
import textwrap
try:
import pwd
def get_default_copyright_holder():
return pwd.getpwuid(os.getuid()).pw_gecos
except ImportError:
def get_default_copyright_holder():
return 'COPYRIGHT HOLDER'
class Info(NamedTuple):
name: str
version: str
license: str = 'gpl3+'
copyright_year: str = str(datetime.date.today().year)
copyright_holder: str = get_default_copyright_holder()
bug_email: Optional[str] = None
authors: Sequence[str] = list()
BRIEF_LICENSES = {
'gpl3+': textwrap.dedent('''\
This program is released under the terms of
the GNU General Public License, version 3 or later
''')
}
SHORT_LICENSES = {
'gpl3+': textwrap.dedent('''\
This is free software. It is licensed for use, modification and
redistribution under the terms of the GNU General Public License,
version 3 or later <http://gnu.org/licenses/gpl.html>
''')
}
FULL_LICENSES = {
'gpl3+': textwrap.dedent('''\
This is free software. It is licensed for use, modification and
redistribution under the terms of the GNU General Public License,
version 3 or later <http://gnu.org/licenses/gpl.html>
@PACKAGE_NAME@ is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.
@PACKAGE_NAME@ is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the 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 <http://www.gnu.org/licenses/>.
''')
}
def license(desc: Desc, info: Info, what='short') -> str:
if what == 'brief':
license_text = BRIEF_LICENSES[info.license]
elif what == 'short':
license_text = SHORT_LICENSES[info.license]
elif what == 'full':
license_text = FULL_LICENSES[info.license]
return license_text.replace('@PACKAGE_NAME@', info.name)
def version(desc: Desc, info: Info, what='c') -> str:
out = io.StringIO()
if what == 'v':
out.write(f'{desc.tool.name} {info.version}')
elif what == 'c':
out.write(textwrap.dedent(f'''\
{desc.tool.name} {info.version}
Copyright (C) {info.copyright_year} {info.copyright_holder}
'''))
out.write(license(desc, info, 'short'))
if info.bug_email:
out.write(textwrap.dedent(f'''\
Please send bug reports to: <{info.bug_email}>\
'''))
elif what == 'n':
out.write(textwrap.dedent(f'''\
{desc.tool.name} {info.version}
Copyright (C) {info.copyright_year} {info.copyright_holder}
'''))
out.write(license(desc, info, 'full'))
if info.bug_email:
out.write(textwrap.dedent(f'''\
Please send bug reports to: <{info.bug_email}>\
'''))
return out.getvalue()
# Copyright (C) 2021-2022 Daiki Ueno
# SPDX-License-Identifier: LGPL-2.1-or-later
from typing import NamedTuple, Optional, Sequence, Union
from enum import Enum, auto
import textwrap
class ToolDesc(NamedTuple):
name: str
title: str
description: str
short_usage: str
detail: Optional[str] = None
argument: Optional[str] = None
reorder_arguments: bool = False
@classmethod
def from_json(cls, obj):
return cls(name=obj['name'],
title=obj['title'],
description=obj['description'],
detail=obj['detail'],
short_usage=obj['short-usage'],
argument=obj.get('argument'),
reorder_arguments=obj.get('reorder-arguments', False))
class ArgumentType(Enum):
STRING = auto()
NUMBER = auto()
FILE = auto()
KEYWORD = auto()
@classmethod
def from_json(cls, obj):
return cls.__members__[obj.upper()]
def get_name(self) -> str:
ARG_TYPE_TO_VALUE = {
ArgumentType.STRING: 'str',
ArgumentType.NUMBER: 'num',
ArgumentType.FILE: 'file',
ArgumentType.KEYWORD: 'arg',
}
return ARG_TYPE_TO_VALUE[self]
class Range(NamedTuple):
minimum: Optional[int]
maximum: Optional[int]
@classmethod
def from_json(cls, obj):
default = cls.default()
return cls(minimum=obj.get('min', default.minimum),
maximum=obj.get('max', default.maximum))
class SignedRange(Range):
@classmethod
def default(cls):
return cls(minimum=-2**31-1, maximum=2**31)
class UnsignedRange(Range):
@classmethod
def default(cls):
return cls(minimum=0, maximum=2**32)
class OptionDesc(NamedTuple):
long_option: str
short_option: Optional[str] = None
description: Optional[str] = None
detail: Optional[str] = None
argument_optional: bool = False
file_exists: bool = False
deprecated: bool = False
aliases: Optional[str] = None
conflicts: Sequence[str] = list()
requires: Sequence[str] = list()
argument_range: Optional[Range] = None
argument_type: Optional[ArgumentType] = None
argument_name: Optional[str] = None
argument_default: Optional[Union[str, int]] = None
multiple: bool = False
occur_range: Optional[Range] = None
enabled: bool = False
disable_prefix: Optional[str] = None
enable_prefix: Optional[str] = None
@classmethod
def from_json(cls, obj):
return cls(long_option=obj['long-option'],
short_option=obj.get('short-option'),
description=obj.get('description'),
detail=obj.get('detail'),
argument_optional=obj.get('argument-optional', False),
file_exists=obj.get('file-exists', False),
deprecated=obj.get('deprecated', False),
aliases=obj.get('aliases'),
conflicts=obj.get('conflicts', list()),
requires=obj.get('requires', list()),
argument_range=SignedRange.from_json(
obj['argument-range']
) if 'argument-range' in obj else None,
argument_type=ArgumentType.from_json(
obj['argument-type']
) if 'argument-type' in obj else None,
argument_name=obj.get('argument-name'),
argument_default=obj.get('argument-default'),
multiple=obj.get('multiple'),
occur_range=UnsignedRange.from_json(
obj['occurrences']
) if 'occurrences' in obj else None,
enabled=obj.get('enabled', False),
disable_prefix=obj.get('disable-prefix'),
enable_prefix=obj.get('enable-prefix'))
class SectionDesc(NamedTuple):
ref: Optional[str] = None
description: Optional[str] = None
options: Sequence[OptionDesc] = list()
@classmethod
def from_json(cls, obj):
return cls(ref=obj.get('ref'),
description=obj.get('description'),
options=[OptionDesc.from_json(option)
for option in obj['options']])
@classmethod
def default(cls):
return DEFAULT_SECTION
class Desc(NamedTuple):
tool: ToolDesc
sections: Sequence[SectionDesc] = list()
@classmethod
def from_json(cls, obj):
return cls(tool=ToolDesc.from_json(obj['tool']),
sections=[
SectionDesc.from_json(section)
for section in obj['sections']
] + [
SectionDesc.default()
])
DEFAULT_SECTION = SectionDesc(
description='Version, usage and configuration options',
options=[
OptionDesc(
long_option='version',
short_option='v',
argument_type=ArgumentType.KEYWORD,
argument_optional=True,
description='output version information and exit',
detail=textwrap.fill(textwrap.dedent("""\
Output version of program and exit.
The default mode is `v', a simple version.
The `c' mode will print copyright information and
`n' will print the full copyright notice.\
"""), width=72, fix_sentence_endings=True)
),
OptionDesc(
long_option='help',
short_option='h',
description='display extended usage information and exit',
detail='Display usage information and exit.'
),
OptionDesc(
long_option='more-help',
short_option='!',
description='extended usage information passed thru pager',
detail='Pass the extended usage information through a pager.'
)
]
)
......@@ -61,6 +61,9 @@
/* Dynamic use of ncrypt API (win32) */
#undef DYN_NCRYPT
/* Enable AF_ALG support */
#undef ENABLE_AFALG
/* enable ALPN support */
#undef ENABLE_ALPN
......@@ -88,7 +91,11 @@
/* enable heartbeat support */
#undef ENABLE_HEARTBEAT
/* nls support in libopts */
/* Enable KTLS support */
#undef ENABLE_KTLS
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Enable all curves */
......@@ -121,6 +128,12 @@
/* The FIPS140-2 integrity key */
#undef FIPS_KEY
/* The FIPS140 module name */
#undef FIPS_MODULE_NAME
/* The FIPS140 module version */
#undef FIPS_MODULE_VERSION
/* Define to nothing if C supports flexible array members, and to 1 if it does
not. That way, with a declaration like 'struct s { int n; short
d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99
......@@ -128,18 +141,15 @@
the size in bytes of such a struct containing an N-element array. */
#undef FLEXIBLE_ARRAY_MEMBER
/* fopen(3) accepts a 'b' in the mode flag */
#undef FOPEN_BINARY_FLAG
/* fopen(3) accepts a 't' in the mode flag */
#undef FOPEN_TEXT_FLAG
/* Define to 1 if fopen() fails to recognize a trailing slash. */
#undef FOPEN_TRAILING_SLASH_BUG
/* Define to 1 if the system's ftello function has the Solaris bug. */
#undef FTELLO_BROKEN_AFTER_SWITCHING_FROM_READ_TO_WRITE
/* Define to 1 if the system's ftello function has the macOS bug. */
#undef FTELLO_BROKEN_AFTER_UNGETC
/* Define to 1 if ungetc is broken when used on arbitrary bytes. */
#undef FUNC_UNGETC_BROKEN
......@@ -181,6 +191,10 @@
"__gnu_printf__" instead of "__printf__" */
#undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module reallocarray shall be considered present. */
#undef GNULIB_REALLOCARRAY
/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
whether the gnulib module scanf shall be considered present. */
#undef GNULIB_SCANF
......@@ -206,6 +220,9 @@
/* Define to 1 when the gnulib module bind should be tested. */
#undef GNULIB_TEST_BIND
/* Define to 1 when the gnulib module calloc-posix should be tested. */
#undef GNULIB_TEST_CALLOC_POSIX
/* Define to 1 when the gnulib module cloexec should be tested. */
#undef GNULIB_TEST_CLOEXEC
......@@ -230,9 +247,33 @@
/* Define to 1 when the gnulib module fdopen should be tested. */
#undef GNULIB_TEST_FDOPEN
/* Define to 1 when the gnulib module fgetc should be tested. */
#undef GNULIB_TEST_FGETC
/* Define to 1 when the gnulib module fgets should be tested. */
#undef GNULIB_TEST_FGETS
/* Define to 1 when the gnulib module fopen should be tested. */
#undef GNULIB_TEST_FOPEN
/* Define to 1 when the gnulib module fprintf should be tested. */
#undef GNULIB_TEST_FPRINTF
/* Define to 1 when the gnulib module fputc should be tested. */
#undef GNULIB_TEST_FPUTC
/* Define to 1 when the gnulib module fputs should be tested. */
#undef GNULIB_TEST_FPUTS
/* Define to 1 when the gnulib module fread should be tested. */
#undef GNULIB_TEST_FREAD
/* Define to 1 when the gnulib module free-posix should be tested. */
#undef GNULIB_TEST_FREE_POSIX
/* Define to 1 when the gnulib module fscanf should be tested. */
#undef GNULIB_TEST_FSCANF
/* Define to 1 when the gnulib module fseek should be tested. */
#undef GNULIB_TEST_FSEEK
......@@ -251,9 +292,18 @@
/* Define to 1 when the gnulib module ftruncate should be tested. */
#undef GNULIB_TEST_FTRUNCATE
/* Define to 1 when the gnulib module fwrite should be tested. */
#undef GNULIB_TEST_FWRITE
/* Define to 1 when the gnulib module getaddrinfo should be tested. */
#undef GNULIB_TEST_GETADDRINFO
/* Define to 1 when the gnulib module getc should be tested. */
#undef GNULIB_TEST_GETC
/* Define to 1 when the gnulib module getchar should be tested. */
#undef GNULIB_TEST_GETCHAR
/* Define to 1 when the gnulib module getcwd should be tested. */
#undef GNULIB_TEST_GETCWD
......@@ -317,18 +367,33 @@
/* Define to 1 when the gnulib module pipe should be tested. */
#undef GNULIB_TEST_PIPE
/* Define to 1 when the gnulib module printf should be tested. */
#undef GNULIB_TEST_PRINTF
/* Define to 1 when the gnulib module pthread_sigmask should be tested. */
#undef GNULIB_TEST_PTHREAD_SIGMASK
/* Define to 1 when the gnulib module pthread-thread should be tested. */
#undef GNULIB_TEST_PTHREAD_THREAD
/* Define to 1 when the gnulib module putc should be tested. */
#undef GNULIB_TEST_PUTC
/* Define to 1 when the gnulib module putchar should be tested. */
#undef GNULIB_TEST_PUTCHAR
/* Define to 1 when the gnulib module putenv should be tested. */
#undef GNULIB_TEST_PUTENV
/* Define to 1 when the gnulib module puts should be tested. */
#undef GNULIB_TEST_PUTS
/* Define to 1 when the gnulib module raise should be tested. */
#undef GNULIB_TEST_RAISE
/* Define to 1 when the gnulib module reallocarray should be tested. */
#undef GNULIB_TEST_REALLOCARRAY
/* Define to 1 when the gnulib module realloc-posix should be tested. */
#undef GNULIB_TEST_REALLOC_POSIX
......@@ -338,6 +403,12 @@
/* Define to 1 when the gnulib module recvfrom should be tested. */
#undef GNULIB_TEST_RECVFROM
/* Define to 1 when the gnulib module scanf should be tested. */
#undef GNULIB_TEST_SCANF
/* Define to 1 when the gnulib module sched_yield should be tested. */
#undef GNULIB_TEST_SCHED_YIELD
/* Define to 1 when the gnulib module secure_getenv should be tested. */
#undef GNULIB_TEST_SECURE_GETENV
......@@ -446,6 +517,12 @@
/* Define to 1 when the gnulib module vasprintf should be tested. */
#undef GNULIB_TEST_VASPRINTF
/* Define to 1 when the gnulib module vfprintf should be tested. */
#undef GNULIB_TEST_VFPRINTF
/* Define to 1 when the gnulib module vprintf should be tested. */
#undef GNULIB_TEST_VPRINTF
/* Define to 1 when the gnulib module vsnprintf should be tested. */
#undef GNULIB_TEST_VSNPRINTF
......@@ -507,8 +584,7 @@
may be supplied by this distribution. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/* Define to 1 if <alloca.h> works. */
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <arpa/inet.h> header file. */
......@@ -529,16 +605,9 @@
/* Define to 1 if you have the <byteswap.h> header file. */
#undef HAVE_BYTESWAP_H
/* Define to 1 if you have the `canonicalize_file_name' function. */
#undef HAVE_CANONICALIZE_FILE_NAME
/* Define to 1 if you have the `catgets' function. */
#undef HAVE_CATGETS
/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the
CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYCURRENT
/* Define to 1 if you have the Mac OS X function
CFLocaleCopyPreferredLanguages in the CoreFoundation framework. */
#undef HAVE_CFLOCALECOPYPREFERREDLANGUAGES
......@@ -547,9 +616,6 @@
the CoreFoundation framework. */
#undef HAVE_CFPREFERENCESCOPYAPPVALUE
/* Define to 1 if you have the `chmod' function. */
#undef HAVE_CHMOD
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
......@@ -763,28 +829,15 @@
don't. */
#undef HAVE_DECL___FSETLOCKING
/* Define this if /dev/zero is readable device */
#undef HAVE_DEV_ZERO
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
/* Define to 1 if you have the `duplocale' function. */
#undef HAVE_DUPLOCALE
/* Define if you have the declaration of environ. */
#undef HAVE_ENVIRON_DECL
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the `explicit_bzero' function. */
#undef HAVE_EXPLICIT_BZERO
......@@ -795,15 +848,9 @@
OpenBSD. */
#undef HAVE_FAKE_LOCALES
/* Define to 1 if you have the `fchmod' function. */
#undef HAVE_FCHMOD
/* Define to 1 if you have the `fcntl' function. */
#undef HAVE_FCNTL
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the <features.h> header file. */
#undef HAVE_FEATURES_H
......@@ -819,12 +866,12 @@
/* Define to 1 if you have the `freelocale' function. */
#undef HAVE_FREELOCALE
/* Define if the 'free' function is guaranteed to preserve errno. */
#undef HAVE_FREE_POSIX
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
/* Define to 1 if you have the `fstat' function. */
#undef HAVE_FSTAT
/* Define to 1 if you have the `ftruncate' function. */
#undef HAVE_FTRUNCATE
......@@ -897,6 +944,10 @@
/* use __get_cpuid_count */
#undef HAVE_GET_CPUID_COUNT
/* Define if the uselocale exists, may be safely called, and returns
sufficient information. */
#undef HAVE_GOOD_USELOCALE
/* Define if you have the iconv() function and it works. */
#undef HAVE_ICONV
......@@ -911,21 +962,9 @@
*/
#undef HAVE_INLINE
/* Define to 1 if the system has the type `int16_t'. */
#undef HAVE_INT16_T
/* Define to 1 if the system has the type `int32_t'. */
#undef HAVE_INT32_T
/* Define to 1 if the system has the type `int8_t'. */
#undef HAVE_INT8_T
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
#undef HAVE_INTMAX_T
/* Define to 1 if the system has the type `intptr_t'. */
#undef HAVE_INTPTR_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
......@@ -951,6 +990,9 @@
/* Enable the BSD sysctl(KERN_ARND) function */
#undef HAVE_KERN_ARND
/* KTLS headers found at compile time */
#undef HAVE_KTLS
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
......@@ -960,6 +1002,9 @@
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define if BROTLI compression is enabled. */
#undef HAVE_LIBBROTLI
/* Define if you have the libcrypto library. */
#undef HAVE_LIBCRYPTO
......@@ -969,21 +1014,9 @@
/* Define if you have the libev library. */
#undef HAVE_LIBEV
/* Define to 1 if you have the `gen' library (-lgen). */
#undef HAVE_LIBGEN
/* Define to 1 if you have the <libgen.h> header file. */
#undef HAVE_LIBGEN_H
/* Define if IDNA 2008 support is enabled. */
#undef HAVE_LIBIDN2
/* Define to 1 if you have the `intl' library (-lintl). */
#undef HAVE_LIBINTL
/* Define to 1 if you have the <libintl.h> header file. */
#undef HAVE_LIBINTL_H
/* nettle is enabled */
#undef HAVE_LIBNETTLE
......@@ -996,9 +1029,18 @@
/* Define if you have the libseccomp library. */
#undef HAVE_LIBSECCOMP
/* Define if you have the libz library. */
#undef HAVE_LIBZ
/* Define if ZSTD compression is enabled. */
#undef HAVE_LIBZSTD
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <linux/tls.h> header file. */
#undef HAVE_LINUX_TLS_H
/* Define to 1 if you have the `localtime' function. */
#undef HAVE_LOCALTIME
......@@ -1015,7 +1057,7 @@
/* Define to 1 if you have the `lstat' function. */
#undef HAVE_LSTAT
/* Define if the 'malloc' function is POSIX compliant. */
/* Define if malloc, realloc, and calloc set errno on allocation failure. */
#undef HAVE_MALLOC_POSIX
/* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including
......@@ -1028,9 +1070,6 @@
/* Define to 1 if you have the `memmem' function. */
#undef HAVE_MEMMEM
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset_s' function. */
#undef HAVE_MEMSET_S
......@@ -1063,9 +1102,6 @@
/* Define to 1 if you have the `nanosleep' function. */
#undef HAVE_NANOSLEEP
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define to 1 if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
......@@ -1102,12 +1138,6 @@
/* Define to 1 if you have the <OS.h> header file. */
#undef HAVE_OS_H
/* Define this if pathfind(3) works */
#undef HAVE_PATHFIND
/* Define to 1 if the system has the type `pid_t'. */
#undef HAVE_PID_T
/* Define to 1 if you have the `pipe' function. */
#undef HAVE_PIPE
......@@ -1145,20 +1175,14 @@
/* Define to 1 if the system has the type `pthread_t'. */
#undef HAVE_PTHREAD_T
/* Define to 1 if the system has the type `ptrdiff_t'. */
#undef HAVE_PTRDIFF_T
/* Define to 1 if you have the `raise' function. */
#undef HAVE_RAISE
/* Define if the 'realloc' function is POSIX compliant. */
#undef HAVE_REALLOC_POSIX
/* Define this if we have a functional realpath(3C) */
#undef HAVE_REALPATH
/* Define to 1 if you have the `reallocarray' function. */
#undef HAVE_REALLOCARRAY
/* Define to 1 if you have the <runetype.h> header file. */
#undef HAVE_RUNETYPE_H
/* Define to 1 if you have the <sanitizer/asan_interface.h> header file. */
#undef HAVE_SANITIZER_ASAN_INTERFACE_H
/* Define to 1 if the system has the type `sa_family_t'. */
#undef HAVE_SA_FAMILY_T
......@@ -1190,9 +1214,6 @@
/* Define to 1 if you have the `setitimer' function. */
#undef HAVE_SETITIMER
/* Define to 1 if you have the <setjmp.h> header file. */
#undef HAVE_SETJMP_H
/* Define to 1 if you have the `shutdown' function. */
#undef HAVE_SHUTDOWN
......@@ -1220,9 +1241,6 @@
/* Define to 1 if the system has the type `sigset_t'. */
#undef HAVE_SIGSET_T
/* Define to 1 if the system has the type `size_t'. */
#undef HAVE_SIZE_T
/* Define to 1 if you have the `sleep' function. */
#undef HAVE_SLEEP
......@@ -1241,15 +1259,9 @@
/* Define if the locale_t type is as on Solaris 11.4. */
#undef HAVE_SOLARIS114_LOCALES
/* Define to 1 if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define to 1 if you have the <stdatomic.h> header file. */
#undef HAVE_STDATOMIC_H
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
......@@ -1260,6 +1272,9 @@
/* Define to 1 if you have the <stdio_ext.h> header file. */
#undef HAVE_STDIO_EXT_H
/* Define to 1 if you have the <stdio.h> header file. */
#undef HAVE_STDIO_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
......@@ -1269,18 +1284,9 @@
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define this if strftime() works */
#undef HAVE_STRFTIME
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
......@@ -1296,12 +1302,6 @@
/* Define to 1 if you have the `strnlen' function. */
#undef HAVE_STRNLEN
/* Define to 1 if you have the `strrchr' function. */
#undef HAVE_STRRCHR
/* Define to 1 if you have the `strsignal' function. */
#undef HAVE_STRSIGNAL
/* Define to 1 if you have the `strtok_r' function. */
#undef HAVE_STRTOK_R
......@@ -1356,44 +1356,24 @@
/* Define to 1 if you have the `symlink' function. */
#undef HAVE_SYMLINK
/* Define to 1 if you have the <sysexits.h> header file. */
#undef HAVE_SYSEXITS_H
/* Define to 1 if you have the <sys/bitypes.h> header file. */
#undef HAVE_SYS_BITYPES_H
/* Define to 1 if you have the <sys/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_H
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/inttypes.h> header file. */
#undef HAVE_SYS_INTTYPES_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/limits.h> header file. */
#undef HAVE_SYS_LIMITS_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/poll.h> header file. */
#undef HAVE_SYS_POLL_H
/* Define to 1 if you have the <sys/procset.h> header file. */
#undef HAVE_SYS_PROCSET_H
/* Define to 1 if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
......@@ -1406,9 +1386,6 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/stropts.h> header file. */
#undef HAVE_SYS_STROPTS_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
......@@ -1418,9 +1395,6 @@
/* Define to 1 if you have the <sys/uio.h> header file. */
#undef HAVE_SYS_UIO_H
/* Define to 1 if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have the <sys/wait.h> header file. */
#undef HAVE_SYS_WAIT_H
......@@ -1458,25 +1432,13 @@
/* Define to 1 if you have the `tsearch' function. */
#undef HAVE_TSEARCH
/* Have TSS2 */
#undef HAVE_TSS2
/* Define to 1 if you don't have `tm_zone' but do have the external array
`tzname'. */
#undef HAVE_TZNAME
/* Define to 1 if the system has the type `uint16_t'. */
#undef HAVE_UINT16_T
/* Define to 1 if the system has the type `uint32_t'. */
#undef HAVE_UINT32_T
/* Define to 1 if the system has the type `uint8_t'. */
#undef HAVE_UINT8_T
/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
/* Define to 1 if the system has the type `uint_t'. */
#undef HAVE_UINT_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
......@@ -1492,18 +1454,9 @@
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define to 1 if you have the <valgrind/memcheck.h> header file. */
#undef HAVE_VALGRIND_MEMCHECK_H
/* Define to 1 if you have the <values.h> header file. */
#undef HAVE_VALUES_H
/* Define to 1 if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
/* Define if you have a global __progname variable */
#undef HAVE_VAR___PROGNAME
......@@ -1513,26 +1466,17 @@
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 or 0, depending whether the compiler supports simple visibility
declarations. */
#undef HAVE_VISIBILITY
/* Define to 1 if you have the `vprintf' function. */
#undef HAVE_VPRINTF
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if the system has the type `wchar_t'. */
/* Define if you have the 'wchar_t' type. */
#undef HAVE_WCHAR_T
/* Define to 1 if you have the `wcrtomb' function. */
......@@ -1551,24 +1495,18 @@
/* Define to 1 if you have the <winsock2.h> header file. */
#undef HAVE_WINSOCK2_H
/* Define to 1 if the system has the type `wint_t'. */
/* Define if you have the 'wint_t' type. */
#undef HAVE_WINT_T
/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK
/* Define to 1 if O_NOATIME works. */
#undef HAVE_WORKING_O_NOATIME
/* Define to 1 if O_NOFOLLOW works. */
#undef HAVE_WORKING_O_NOFOLLOW
/* Define if the uselocale function exists any may safely be called. */
/* Define if the uselocale function exists and may safely be called. */
#undef HAVE_WORKING_USELOCALE
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
/* Define to 1 if you have the <ws2tcpip.h> header file. */
#undef HAVE_WS2TCPIP_H
......@@ -1618,6 +1556,9 @@
/* The soname of hogweed library */
#undef HOGWEED_LIBRARY_SONAME
/* The enabled hardware features */
#undef HW_FEATURES
/* whether to allowin inline comments */
#undef INI_ALLOW_INLINE_COMMENTS
......@@ -1633,6 +1574,9 @@
/* whether to stop on first error */
#undef INI_STOP_ON_FIRST_ERROR
/* Define if localename.c overrides newlocale(), duplocale(), freelocale(). */
#undef LOCALENAME_ENHANCE_LOCALE_FUNCS
/* Define to 1 if lseek does not detect pipes. */
#undef LSEEK_PIPE_BROKEN
......@@ -1675,9 +1619,6 @@
/* The soname of nettle library */
#undef NETTLE_LIBRARY_SONAME
/* Define this if optional arguments are disallowed */
#undef NO_OPTIONAL_OPT_ARGS
/* Define to 1 if open() fails to recognize a trailing slash. */
#undef OPEN_TRAILING_SLASH_BUG
......@@ -1702,8 +1643,8 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* define to a working POSIX compliant shell */
#undef POSIX_SHELL
/* The iteration count for PKCS\#12 key derivation */
#undef PKCS12_ITER_COUNT
/* Define to the type that is the result of default argument promotions of
type mode_t. */
......@@ -1729,9 +1670,6 @@
'ptrdiff_t'. */
#undef PTRDIFF_T_SUFFIX
/* name of regex header file */
#undef REGEX_HEADER
/* Define to 1 if stat needs help when passed a file name with a trailing
slash */
#undef REPLACE_FUNC_STAT_FILE
......@@ -1752,9 +1690,6 @@
'sig_atomic_t'. */
#undef SIG_ATOMIC_T_SUFFIX
/* The size of `char *', as computed by sizeof. */
#undef SIZEOF_CHAR_P
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
......@@ -1764,9 +1699,6 @@
/* The size of `long long', as computed by sizeof. */
#undef SIZEOF_LONG_LONG
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `time_t', as computed by sizeof. */
#undef SIZEOF_TIME_T
......@@ -1792,15 +1724,17 @@
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at runtime.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define to 1 if you have the ANSI C header files. */
/* Define to 1 if all of the C90 standard headers exist (not just the ones
required in a freestanding environment). This macro is provided for
backward compatibility; new code need not use it. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
......@@ -1809,12 +1743,18 @@
/* force strict DER time constraints */
#undef STRICT_DER_TIME
/* Enable stricter sanity checks for x509 certificates */
#undef STRICT_X509
/* The system-wide gnutls configuration file */
#undef SYSTEM_PRIORITY_FILE
/* Define to 1 if time_t is signed. */
#undef TIME_T_IS_SIGNED
/* The enabled TLS features */
#undef TLS_FEATURES
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
......@@ -1950,9 +1890,6 @@
'wint_t'. */
#undef WINT_T_SUFFIX
/* Define this if a working libregex can be found */
#undef WITH_LIBREGEX
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
......@@ -1977,6 +1914,9 @@
#endif
/* Define to enable the declarations of ISO C 11 types and functions. */
#undef _ISOC11_SOURCE
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
#undef _LARGEFILE_SOURCE
......@@ -2000,11 +1940,12 @@
this syntax with 'extern'. */
# define _Noreturn [[noreturn]]
# elif ((!defined __cplusplus || defined __clang__) \
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| _GL_GNUC_PREREQ (4, 7) \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))
&& (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \
|| (!defined __STRICT_ANSI__ \
&& (_GL_GNUC_PREREQ (4, 7) \
|| (defined __apple_build_version__ \
? 6000000 <= __apple_build_version__ \
: 3 < __clang_major__ + (5 <= __clang_minor__))))))
/* _Noreturn works as-is. */
# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C
# define _Noreturn __attribute__ ((__noreturn__))
......@@ -2063,7 +2004,9 @@
/* Attributes. */
#ifdef __has_attribute
#if (defined __has_attribute \
&& (!defined __clang_minor__ \
|| 3 < __clang_major__ + (5 <= __clang_minor__)))
# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__)
#else
# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr
......@@ -2471,6 +2414,3 @@
/* Define to an unsigned 32-bit type if <sys/types.h> lacks this type. */
#undef useconds_t
/* Define as `fork' if `vfork' does not work. */
#undef vfork