% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2025-01-31.21}
+\def\texinfoversion{2025-03-22.08}
%
% Copyright 1985, 1986, 1988, 1990-2025 Free Software Foundation, Inc.
%
% Avoid "undefined control sequence" errors.
\def\currentchapterdefs{}
\def\currentsectiondefs{}
-\def\currentsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
\def\currentcolordefs{}
\newif\ifpdf
\newif\ifpdfmakepagedest
+% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
+% can be set). So we test for \relax and 0 as well as being undefined.
+\ifx\pdfoutput\thisisundefined
+\else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+\fi
+
+\newif\ifxetex
+\ifx\XeTeXrevision\thisisundefined\else
+ \xetextrue
+\fi
+
\newif\ifluatex
\ifx\luatexversion\thisisundefined\else
\luatextrue
+ \ifnum\luatexversion>84
+ \pdftrue
+ \fi
\fi
+\newif\ifpdforxetex
+\ifpdf
+ \pdforxetextrue
+\fi
+\ifxetex
+ \pdforxetextrue
+\fi
+
+
+
+% Whether to use non-ASCII bytes in internal link targets. Presently this
+% is almost always on.
+\newif\iftxiuseunicodedestname
+\txiuseunicodedestnametrue
+
%
% For LuaTeX
%
-\newif\iftxiuseunicodedestname
-\txiuseunicodedestnamefalse % For pdfTeX etc.
-
\ifluatex
% Use Unicode destination names
\txiuseunicodedestnametrue
%
\endgroup
\def\pdfescapestring#1{\directlua{PDFescstr('\luaescapestring{#1}')}}
- \ifnum\luatexversion>84
+ \ifpdf
% For LuaTeX >= 0.85
\def\pdfdest{\pdfextension dest}
\let\pdfoutput\outputmode
\fi
\fi
-% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1
-% can be set). So we test for \relax and 0 as well as being undefined.
-\ifx\pdfoutput\thisisundefined
-\else
- \ifx\pdfoutput\relax
- \else
- \ifcase\pdfoutput
- \else
- \pdftrue
- \fi
- \fi
-\fi
-
-\newif\ifxetex
-\ifx\XeTeXrevision\thisisundefined\else
- \xetextrue
-\fi
-
-\newif\ifpdforxetex
-\pdforxetexfalse
-\ifpdf
- \pdforxetextrue
-\fi
-\ifxetex
- \pdforxetextrue
-\fi
-
% Output page labels information.
% See PDF reference v.1.7 p.594, section 8.3.1.
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
}
%
- % used to mark target names; must be expandable.
- \def\pdfmkpgn#1{#1}
- %
% Adding outlines to PDF; macros for calculating structure of outlines
% come from Petr Olsak
\def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0%
\def\pdfdestname{#4}%
\fi
%
- \pdfoutline goto name{\pdfmkpgn{\pdfdestname}}#2{\pdfoutlinetext}%
+ \pdfoutline goto name{\pdfdestname}#2{\pdfoutlinetext}%
}
%
\def\pdfmakeoutlines{%
\def\thischapnum{##2}%
\def\thissecnum{0}%
\def\thissubsecnum{0}%
+ \def\indexlastsec{chap\thischapnum}%
}%
\def\numsecentry##1##2##3##4{%
\advancenumber{chap\thischapnum}%
\def\thissecnum{##2}%
\def\thissubsecnum{0}%
+ \def\indexlastsec{sec\thissecnum}%
}%
\def\numsubsecentry##1##2##3##4{%
\advancenumber{sec\thissecnum}%
\def\thissubsecnum{##2}%
+ \def\indexlastsec{subsec\thissecnum}%
}%
\def\numsubsubsecentry##1##2##3##4{%
\advancenumber{subsec\thissubsecnum}%
\def\thischapnum{0}%
\def\thissecnum{0}%
\def\thissubsecnum{0}%
+ \let\indexlastsec\empty
%
+ % Index initials are subsidiary to whatever sectioning command just
+ % occurred, usually @appendix or @chapter but occasionally a lower level.
+ \def\idxinitialentry##1##2##3##4{%
+ \expandafter\advancenumber\expandafter{\indexlastsec}%
+ }%
% use \def rather than \let here because we redefine \chapentry et
% al. a second time, below.
\def\appentry{\numchapentry}%
\def\unnsubsecentry{\numsubsecentry}%
\def\unnsubsubsecentry{\numsubsubsecentry}%
%
- % Treat index initials like @section. Note that this is the wrong
- % level if the index is not at the level of @appendix or @chapter.
- \def\idxinitialentry{\numsecentry}%
\readdatafile{toc}%
%
% Read toc second time, this time actually producing the outlines.
\def\idxinitialentry##1##2##3##4{%
\dopdfoutline{##1}{}{idx.##1.##2}{##4}}%
%
- % PDF outlines are displayed using system fonts, instead of
- % document fonts. Therefore we cannot use special characters,
- % since the encoding is unknown. For example, the eogonek from
- % Latin 2 (0xea) gets translated to a | character. Info from
- % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
- %
- % TODO this right, we have to translate 8-bit characters to
- % their "best" equivalent, based on the @documentencoding. Too
- % much work for too little return. Just use the ASCII equivalents
- % we use for the index sort strings.
- %
- \indexnofonts
\ifnodeseen\else \dopdfoutlinecontents \fi % for @contents at beginning
\setupdatafile
% We can have normal brace characters in the PDF outlines, unlike
\def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash
- \input \tocreadfilename
+ \input \tocreadfilename\relax
+ \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup
- \ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
}
\def\dopdfoutlinecontents{%
\expandafter\dopdfoutline\expandafter{\putwordTOC}{}{txi.CONTENTS}{}%
%
\def\pdflink#1{\pdflinkpage{#1}{#1}}%
\def\pdflinkpage#1#2{%
- \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
+ \startlink attr{/Border [0 0 0]} goto name{#1}
\setcolor{\linkcolor}#2\endlink}
\else
% non-pdf mode
% horizontal space being required in the PDF viewer.
\def\partentry##1##2##3##4{}% ignore parts in the outlines
\def\numchapentry##1##2##3##4{%
- \dopdfoutline{##2 ##1}{1}{##3}{##4}}%
+ \dopdfoutline{##2 ##1}{1}{##3}{##4}%
+ \def\indexseclevel{2}}%
\def\numsecentry##1##2##3##4{%
- \dopdfoutline{##1}{2}{##3}{##4}}%
+ \dopdfoutline{##1}{2}{##3}{##4}%
+ \def\indexseclevel{3}}%
\def\numsubsecentry##1##2##3##4{%
- \dopdfoutline{##1}{3}{##3}{##4}}%
+ \dopdfoutline{##1}{3}{##3}{##4}%
+ \def\indexseclevel{4}}%
\def\numsubsubsecentry##1##2##3##4{%
- \dopdfoutline{##1}{4}{##3}{##4}}%
+ \dopdfoutline{##1}{4}{##3}{##4}%
+ \def\indexseclevel{5}}%
%
- % Note this is at the wrong level unless the index is in an @appendix
- % or @chapter.
\def\idxinitialentry##1##2##3##4{%
- \dopdfoutline{##1}{2}{idx.##1.##2}{##4}}%
+ \dopdfoutline{##1}{\indexseclevel}{idx.##1.##2}{##4}}%
%
\let\appentry\numchapentry%
\let\appsecentry\numsecentry%
\def\{{\lbracecharliteral}%
\def\}{\rbracecharliteral}%
\catcode`\\=\active \otherbackslash
+ \xetexpreauxfile
\input \tocreadfilename\relax
+ \xetexpostauxfile
\ifnodeseen \dopdfoutlinecontents \fi % for @contents at end
\endgroup
}
%
\uccode`\1=`\{ \uppercase{\def\{{1}}%
\uccode`\1=`\} \uppercase{\def\}{1}}%
- \let\lbracechar\{%
- \let\rbracechar\}%
+ \def\lbracechar##1{\{}%
+ \def\rbracechar##1{\}}%
%
%
% We need to get rid of all macros, leaving only the arguments (if present).
\tolerance = 9500
\plainfrenchspacing
\everypar = {}% don't want the \kern\-parindent from indentation suppression.
+ \let\entry\indexentry
+ \ifxetex\xetexpreauxfile\fi
%
% See comment in \requireopenindexfile.
\def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
\fi
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\endgroup}
% Checked in @bye
}%
\else
\begindoublecolumns
+ \ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s
+ \ifxetex\xetexpostauxfile\fi
\enddoublecolumns
\fi
}{%
% should work because we (hopefully) don't otherwise use @ in index files.
%\catcode`\@=12\relax
\catcode`\@=0\relax
+ \ifxetex\xetexpreauxfile\fi
\input \jobname.\indexname s
+ \ifxetex\xetexpostauxfile\fi
\enddoublecolumns
}%
}
+\def\indexentry#1#2{%
+ \let\entrypagetarget\empty
+ \ifpdforxetex
+ % only link the index text to the page if no comma appears in the
+ % list of pages, i.e. there is only one page
+ \checkpagelistcomma{#2}\pagelistcomma
+ \expandafter\ifcase\pagelistcomma
+ \def\entrypagetarget{#2}%
+ \fi
+ \fi%
+ \entryinternal{#1}{#2}%
+}
+
+\def\checkpagelistcomma#1#2{%
+ \checkpagelistcommaxx#2#1,\finish
+}
+\def\checkpagelistcommaxx#1#2,#3\finish{%
+ \def\tmp{#3}%
+ \ifx\tmp\empty
+ \def#1{0\relax}
+ \else
+ \def#1{1\relax}
+ \fi
+}
+
+
% These macros are used by the sorted index file itself.
% Change them to control the appearance of the index.
\def\doindexinitialentry#1{%
\ifpdforxetex
\global\advance\idxinitialno by 1
- \def\indexlbrace{\{}
- \def\indexrbrace{\}}
- \def\indexbackslash{\realbackslash}
- \def\indexatchar{\@}
+ \def\indexlbrace{\{}%
+ \def\indexrbrace{\}}%
+ \def\indexbackslash{\realbackslash}%
+ \def\indexatchar{\@}%
\writetocentry{idxinitial}{\asis #1}{IDX\the\idxinitialno}%
% The @asis removes a pair of braces around e.g. {@indexatchar} that
% are output by texindex.
%
- \vbox to 0pt{}%
- % This vbox fixes the \pdfdest location for double column formatting.
- % Without it, the \pdfdest is output above topskip glue at the top
- % of a column as this glue is not added until the first box.
\pdfmkdest{idx.\asis #1.IDX\the\idxinitialno}%
\fi
}
\newdimen\entrycontskip
\entrycontskip=1em
-% for PDF output, whether to make the text of the entry a link to the page
-% number. set for @contents and @shortcontents where there is only one
-% page number.
+% for PDF output, whether to make the text of the entry a link to the section.
+% set for @contents and @shortcontents.
\newif\iflinkentrytext
-% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
-% then page number (#2) flushed to the right margin. It is used for index
-% and table of contents entries. The paragraph is indented by \leftskip.
-% If \tocnodetarget is set, link text to the referenced node.
-\def\entry{%
+% \entryinternal typesets a paragraph consisting of the text (#1), dot
+% leaders, and then page number (#2) flushed to the right margin. It is
+% used for index and table of contents entries. The paragraph is indented
+% by \leftskip.
+% For PDF output, if \linkentrytexttrue and \tocnodetarget is set, link text
+% to the referenced node. Else if \entrypagetarget is set, link text to the
+% page.
+\def\entryinternal{%
\begingroup
%
% Start a new paragraph if necessary, so our assignments below can't
\endlink
\fi
\else
- \unhbox\boxA
+ \ifx\entrypagetarget\empty
+ \unhbox\boxA
+ \else
+ \pdflinkpage{\entrypagetarget}{\unhbox\boxA}%
+ \fi
\fi
\else
\unhbox\boxA
\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{}
\suppressfirstparagraphindent}
+% @xrefname - give text with printed name for linking to node and allow
+% referencing node, but do not print any heading.
+\parseargdef\xrefname{\donoderef{Yomitfromtoc}{#1}}%
+
% These macros generate a chapter, section, etc. heading only
% (including whitespace, linebreaking, etc. around it),
% given all the information in convenient, parsed form.
\chapfonts \rm
\let\footnote=\errfootnoteheading % give better error message
%
- % Have to define \currentsection before calling \donoderef, because the
- % xref code eventually uses it. On the other hand, it has to be called
- % after \pchapsepmacro, or the headline will change too soon.
- \gdef\currentsection{#1}%
- %
% Only insert the separating space if we have a chapter/appendix
% number, and don't print the unnumbered ``number''.
\ifx\temptype\Ynothingkeyword
% been typeset. If the destination for the pdf outline is after the
% text, then jumping from the outline may wind up with the text not
% being visible, for instance under high magnification.
- \donoderef{#2}%
+ \donoderef{#2}{#1}%
%
% Typeset the actual heading.
\nobreak % Avoid page breaks at the interline glue.
\ifx\temptype\Ynothingkeyword
\setbox0 = \hbox{}%
\def\toctype{unn}%
- \gdef\currentsection{#1}%
\else\ifx\temptype\Yomitfromtockeyword
- % for @headings -- no section number, don't include in toc,
- % and don't redefine \currentsection.
+ % for @headings -- no section number, don't include in toc.
\setbox0 = \hbox{}%
\def\toctype{omit}%
\let\sectionlevel=\empty
\else\ifx\temptype\Yappendixkeyword
\setbox0 = \hbox{#4\enspace}%
\def\toctype{app}%
- \gdef\currentsection{#1}%
\else
\setbox0 = \hbox{#4\enspace}%
\def\toctype{num}%
- \gdef\currentsection{#1}%
\fi\fi\fi
%
% Write the toc entry (before \donoderef). See comments in \chapmacro.
%
% Write the node reference (= pdf destination for pdftex).
% Again, see comments in \chapmacro.
- \donoderef{#3}%
+ \donoderef{#3}{#1}%
%
% Interline glue will be inserted when the vbox is completed.
% That glue will be a valid breakpoint for the page, since it'll be
%
\def\contents{%
\startcontents{\putwordTOC}{\contentsmkdest}%
+ \ifxetex\xetexpreauxfile\fi
\openin 1 \tocreadfilename\space
\ifeof 1 \else
\findsecnowidths
\pdfmakeoutlines
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\endgroup
\contentsendroman
}
\let\numsubsubsecentry = \numsecentry
\let\appsubsubsecentry = \numsecentry
\let\unnsubsubsecentry = \numsecentry
+ \ifxetex\xetexpreauxfile\fi
\openin 1 \tocreadfilename\space
\ifeof 1 \else
\readtocfile
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
\vfill \eject
\contentsalignmacro % in case @setchapternewpage odd is in effect
\endgroup
\extrasecnoskip=0pt
\let\tocnodetarget\empty
+\let\entrypagetarget\empty
% \tocentry{TITLE}{SEC NO}{NODE}{PAGE}
%
\def\tocnodetarget{#3}%
\def\secno{#2}%
\ifx\empty\secno
- \entry{#1}{#4}%
+ \entryinternal{#1}{#4}%
\else
\ifdim 0pt=\secnowidth
\setbox0=\hbox{#2\hskip\labelspace\hskip\extrasecnoskip}%
#2\hskip\labelspace\hskip\extrasecnoskip\hfill}%
\fi
\entrycontskip=\wd0
- \entry{\box0 #1}{#4}%
+ \entryinternal{\box0 #1}{#4}%
\fi
}
\newdimen\labelspace
}
\fi
-\let\E=\expandafter
-
% Used at the time of macro expansion.
% Argument is macro body with arguments substituted
\def\scanmacro#1{%
\newlinechar`\^^M
- % 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{}%
+ \def\xeatspaces##1{\eatleadingcrthen\eatspaces{##1}}%
%
% Process the macro body under the current catcode regime.
\scantokens{#1@comment}%
\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 leading ^^M off a string, then call #1
+{\catcode`\^^M=\active \catcode`\Q=3%
+\gdef\eatleadingcrthen #1#2{\eatlcra #1Q#2Q^^MQ}%
+\gdef\eatlcra #1#2Q^^M{\eatlcrb #1#2Q}%
+\gdef\eatlcrb #1Q#2Q#3Q{#1{#2}}%
+}
% Trim a single trailing ^^M off a string.
{\catcode`\^^M=\other \catcode`\Q=3%
% <parameter list> is #, then the preceding argument is delimited by
% an opening brace, and that opening brace is not consumed.
+% Make @ a letter, so that we can make private-to-Texinfo macro names.
+\edef\texiatcatcode{\the\catcode`\@}
+\catcode `@=11\relax
+
% Parse the optional {params} list to @macro or @rmacro.
% Set \paramno to the number of arguments,
% and \paramlist to a parameter text for the macro (e.g. #1,#2,#3 for a
% That gets used by \mbodybackslash (above).
%
% If there are 10 or more arguments, a different technique is used: see
-% \parsemmanyargdef.
+% \parsemmanyargdef@@.
%
\def\parsemargdef#1;{%
\paramno=0\def\paramlist{}%
\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
\else \let\next=\parsemargdefxxx
\advance\paramno by 1
\expandafter\edef\csname macarg.\eatspaces{#1}\endcsname
- {\xeatspaces{\hash\the\paramno\noexpand\xempty{}}}%
+ {\xeatspaces{\hash\the\paramno}}%
\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
%
% body to be transformed.
% Set \macrobody to the body of the macro, and call \macrodef.
%
+\catcode `\@\texiatcatcode
{\catcode`\ =\other\long\gdef\parsemacbody#1@end macro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
{\catcode`\ =\other\long\gdef\parsermacbody#1@end rmacro{%
\xdef\macrobody{\eatcr{#1}}\endgroup\macrodef}}%
-
-% Make @ a letter, so that we can make private-to-Texinfo macro names.
-\edef\texiatcatcode{\the\catcode`\@}
-\catcode `@=11\relax
+\catcode `\@=11\relax
%%%%%%%%%%%%%% Code for > 10 arguments only %%%%%%%%%%%%%%%%%%
\noexpand\expandafter
\expandafter\noexpand\csname\the\macname @@\endcsname}%
\expandafter\xdef\csname\the\macname @@\endcsname##1{%
- \noexpand\passargtomacro
- \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
+ \noexpand\passargtomacro
+ \expandafter\noexpand\csname\the\macname @@@\endcsname{##1,}}%
\expandafter\xdef\csname\the\macname @@@\endcsname##1{%
- \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
- \expandafter\expandafter
- \expandafter\xdef
- \expandafter\expandafter
- \csname\the\macname @@@@\endcsname\paramlist{%
- \endgroup\noexpand\scanmacro{\macrobody}}%
+ \expandafter\noexpand\csname\the\macname @@@@\endcsname ##1}%
+ \expandaftergroup{\expandafter\xdef\csname\the\macname @@@@\endcsname}%
+ \paramlist{%
+ \endgroup\noexpand\scanmacro{\macrobody}}%
\else % 10 or more:
\expandafter\xdef\csname\the\macname\endcsname{%
\noexpand\getargvals@{\the\macname}{\argl}%
\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes
+% utility definition to avoid excessive use of \expandafter. call
+% as \expandaftergroup{CONTENT}\WORD to expand \WORD exactly once and remove
+% braces around CONTENT.
+\def\expandaftergroup#1#2{%
+ \expandafter\expandaftergroupx\expandafter{#2}{#1}%
+}
+\def\expandaftergroupx#1#2{%
+ #2#1%
+}
+
\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}}
\expandafter\noexpand
\csname\the\macname @@@\endcsname##1\noexpand\endlinemacro
}
- \expandafter\expandafter
- \expandafter\xdef
- \expandafter\expandafter\csname\the\macname @@@\endcsname\paramlist{%
+ \expandaftergroup{\expandafter\xdef\csname\the\macname @@@\endcsname}%
+ \paramlist{%
\newlinechar=13 % split \macrobody into lines
\noexpand\scantokens{\macrobody}%
}
\let\lastnode=\empty
% Write a cross-reference definition for the current node. #1 is the
-% type (Ynumbered, Yappendix, Ynothing).
+% type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
%
-\def\donoderef#1{%
+\def\donoderef#1#2{%
\ifx\lastnode\empty\else
- \setref{\lastnode}{#1}%
+ \setref{\lastnode}{#1}{#2}%
\global\let\lastnode=\empty
\setnodeseenonce
\fi
%
\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi}
\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi}
-\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces}
-
-% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
-% anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \currentsection,
-% or the anchor name.
-% 2) NAME-snt - section number and type, passed as the SNT arg, or
-% empty for anchors.
+\def\anchor#1{%
+ \savesf \setref{#1}{Yanchor}{#1}\restoresf \ignorespaces
+}
+
+% @namedanchor{NAME, XREFNAME} -- define xref target at arbitrary point
+% with label text for cross-references to it.
+\def\namedanchor#1{\donamedanchor#1\finish}%
+\def\donamedanchor#1,#2\finish{%
+ \savesf \setref{#1}{Yanchor}{\ignorespaces #2\unskip}\restoresf \ignorespaces
+}
+
+% \setref{NAME}{SNT}{TITLE} defines a cross-reference point NAME (a node
+% or an anchor), which consists of three parts:
+% 1) NAME-title - the current sectioning name
+% 2) NAME-snt - section number and type, passed as the SNT arg.
% 3) NAME-pg - the page number.
%
% This is called from \donoderef, \anchor, and \dofloat. In the case of
% floats, there is an additional part, which is not written here:
% 4) NAME-lof - the text as it should appear in a @listoffloats.
%
-\def\setref#1#2{%
+\def\setref#1#2#3{%
\pdfmkdest{#1}%
\iflinks
{%
\write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
##1}{##2}}% these are parameters of \writexrdef
}%
- \toks0 = \expandafter{\currentsection}%
+ \toks0 = {#3}%
\immediate \writexrdef{title}{\the\toks0 }%
\immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
\safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
\setbox\infofilenamebox = \hbox{\infofilename\unskip}%
%
\startxreflink{#1}{#4}%
- {%
- % Have to otherify everything special to allow the \csname to
- % include an _ in the xref name, etc.
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
- \expandafter\global\expandafter\let\expandafter\Xthisreftitle
- \csname XR#1-title\endcsname
- }%
+ \getrefx{#1-title}\Xthisreftitle
%
% Float references are printed completely differently: "Figure 1.2"
% instead of "[somenode], p.3". \iffloat distinguishes them by
% Cross-manual reference with a printed manual name.
%
\crossmanualxref{\cite{\printedmanual\unskip}}%
- %
\else\ifdim \wd\infofilenamebox > 0pt
% Cross-manual reference with only an info filename (arg 4), no
% printed manual name (arg 5). This is essentially the same as
% the case above; we output the filename, since we have nothing else.
%
\crossmanualxref{\code{\infofilename\unskip}}%
- %
\else
% Reference within this manual.
%
- % 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
+ % Only output a following space if the -snt ref is nonempty, as is
+ % the case for @unnumbered and @anchor.
+ \getrefx{#1-snt}\tmp
+ \ifx\tmp\empty\else
+ \ifx\tmp\Yanchor\else
+ \tmp\space
+ \fi
+ \fi
%
% output the `[mynode]' via the macro below so it can be overridden.
\xrefprintnodename\printedrefname
\else
% Otherwise just copy the Info node name.
\def\printedrefname{\ignorespaces #1}%
- \fi%
+ \fi
\fi
\fi
\fi
\ifnum\filenamelength>0
goto file{\the\filename.pdf} name{\pdfdestname}%
\else
- goto name{\pdfmkpgn{\pdfdestname}}%
+ goto name{\pdfdestname}%
\fi
\else % XeTeX
\ifnum\filenamelength>0
%
\def\Ynothing{}
\def\Yomitfromtoc{}
+\def\Yanchor{\isanchor} \let\isanchor\relax
\def\Ynumbered{%
\ifnum\secno=0
\putwordChapter@tie \the\chapno
% \refx{NAME} - reference a cross-reference string named NAME.
\def\refx#1{%
- \requireauxfile
- {%
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
- \expandafter\global\expandafter\let\expandafter\thisrefX
- \csname XR#1\endcsname
- }%
+ \getrefx{#1}\thisrefX
\ifx\thisrefX\relax
% If not defined, say something at least.
\angleleft un\-de\-fined\angleright
\fi
}
+% Set #2 to xref string #1
+\def\getrefx#1#2{%
+ \requireauxfile
+ {%
+ \indexnofonts
+ \turnoffactive
+ \def\value##1{##1}%
+ \expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
+ }%
+}
+
% This is the macro invoked by entries in the aux file. Define a control
% sequence for a cross-reference target (we prepend XR to the control sequence
% name to avoid collisions). The value is the page number. If this is a float
% Read the last existing aux file, if any. No error if none exists.
%
\def\tryauxfile{%
+ \ifxetex\xetexpreauxfile\fi
\openin 1 \jobname.aux
\ifeof 1 \else
\readdatafile{aux}%
\global\havexrefstrue
\fi
\closein 1
+ \ifxetex\xetexpostauxfile\fi
}
\def\setupdatafile{%
\global\advance\floatno by 1
%
{%
- % This magic value for \currentsection is output by \setref as the
- % XREFLABEL-title value. \xrefX uses it to distinguish float
+ % This magic value for the third argument of \setref is output as
+ % the XREFLABEL-title value. \xrefX uses it to distinguish float
% labels (which have a completely different output format) from
% node and anchor labels. And \xrdef uses it to construct the
% lists of floats.
%
- \edef\currentsection{\floatmagic=\safefloattype}%
- \setref{\floatlabel}{Yfloat}%
+ \edef\tmp{\noexpand\setref{\floatlabel}{Yfloat}%
+ {\floatmagic=\safefloattype}}%
+ \tmp
}%
\fi
%
% #1 is the control sequence we are passed; we expand into a conditional
% which is true if #1 represents a float ref. That is, the magic
-% \currentsection value which we \setref above.
+% value which we passed to \setref above.
%
\def\iffloat#1{\expandafter\doiffloat#1==\finish}
%
\toksA = \expandafter{\csname XR#1-lof\endcsname}%
%
% use the same \entry macro we use to generate the TOC and index.
+ \let\entry\entryinternal
\edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}%
\writeentry
}}
\fi
\fi
+\let\xetexpreauxfile\relax
+\let\xetexpostauxfile\relax
+
% Set I/O by bytes instead of UTF-8 sequence for XeTeX and LuaTex
% for non-UTF-8 (byte-wise) encodings.
%
\def\setbytewiseio{%
\ifxetex
- \XeTeXdefaultencoding "bytes" % For subsequent files to be read
- \XeTeXinputencoding "bytes" % For document root file
- % Unfortunately, there seems to be no corresponding XeTeX command for
- % output encoding. This is a problem for auxiliary index and TOC files.
- % The only solution would be perhaps to write out @U{...} sequences in
- % place of non-ASCII characters.
+ % For document root file
+ \XeTeXinputencoding "bytes"
+ %
+ % Setting for subsequent files to be read with @include.
+ \XeTeXdefaultencoding "bytes"
+ %
+ % Use UTF-8 for reading auxiliary index and TOC files, which are
+ % always output in UTF-8 with XeTeX.
+ \def\xetexpreauxfile{\XeTeXdefaultencoding "UTF-8"}%
+ \def\xetexpostauxfile{\XeTeXdefaultencoding "bytes"}%
\fi
\ifluatex
% Suppress ligature creation from adjacent characters.
\ifluatex
- \def\nolig{{}}
-\else
% Braces do not suppress ligature creation in LuaTeX, e.g. in of{}fice
% to suppress the "ff" ligature. Using a kern appears to be the only
% workaround.
\def\nolig{\kern0pt{}}
+\else
+ \def\nolig{{}}
\fi
% https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_M
# include <string.h>
#endif
-#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
return (acl_entries (acl) > 0);
}
-# else /* Linux, FreeBSD, IRIX, Tru64, Cygwin >= 2.5 */
+# else /* Linux, FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
/* ACL is an ACL, from a file, stored as type ACL_TYPE_ACCESS.
Return 1 if the given ACL is non-trivial.
at least, allowing us to write
return (3 < acl_entries (acl));
but the following code is more robust. */
-# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Cygwin >= 2.5 */
+# if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
acl_entry_t ace;
int got_one;
free_permission_context (struct permission_context *ctx)
{
#if USE_ACL
-# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
+# if HAVE_ACL_GET_FILE /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
if (ctx->acl)
acl_free (ctx->acl);
# if !HAVE_ACL_TYPE_EXTENDED
#include <errno.h>
#include <limits.h>
-
-#ifndef SIZE_MAX
-# define SIZE_MAX ((size_t) -1)
-#endif
+#include <stdint.h>
#ifndef HAVE_FCHMOD
# define HAVE_FCHMOD false
# endif
/* Linux-specific */
-/* Cygwin >= 2.5 implements this function, but it returns 1 for all
- directories, thus is unusable. */
+/* Cygwin >= 2.5 implements acl_extended_file(), but it returns 1 for nearly all
+ directories — for reasons explained in
+ <https://sourceware.org/pipermail/cygwin/2025-March/257762.html> —, thus is
+ unusable. For the user, 'ls' should not print a '+' sign, indicating the
+ presence of an ACL, for 99,9% of the files; this would not be useful.
+ Therefore, on Cygwin, we ignore the acl_extended_file function and instead
+ use our own acl_access_nontrivial function. */
# if !defined HAVE_ACL_EXTENDED_FILE || defined __CYGWIN__
# undef HAVE_ACL_EXTENDED_FILE
# define HAVE_ACL_EXTENDED_FILE false
#include "acl-internal.h"
/* This file assumes POSIX-draft like ACLs
- (Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */
+ (Linux, FreeBSD, NetBSD >= 10, Mac OS X, IRIX, Tru64, Cygwin >= 2.5). */
/* Return the number of entries in ACL.
Return -1 and set errno upon failure to determine it. */
if (acl != NULL)
{
-#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, Mac OS X, Cygwin >= 2.5 */
+#if HAVE_ACL_FIRST_ENTRY /* Linux, FreeBSD, NetBSD >= 10, Mac OS X, Cygwin >= 2.5 */
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
/* acl_get_entry returns 0 when it successfully fetches an entry,
and -1/EINVAL at the end. */
got_one >= 0;
got_one = acl_get_entry (acl, ACL_NEXT_ENTRY, &ace))
count++;
-# else /* Linux, FreeBSD, Cygwin >= 2.5 */
+# else /* Linux, FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
/* acl_get_entry returns 1 when it successfully fetches an entry,
and 0 at the end. */
acl_entry_t ace;
#endif
@PRAGMA_COLUMNS@
-#if defined __need_system_fcntl_h
-/* Special invocation convention. */
+#if defined __need_system_fcntl_h || defined _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+/* Special invocation convention:
+ - On Haiku we have a sequence of nested includes
+ <fcntl.h> -> <unistd.h> -> <fcntl.h>
+ In this situation, GNULIB_defined_O_NONBLOCK gets defined before the
+ system's definition of O_NONBLOCK is processed. */
/* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows. */
#ifndef _@GUARD_PREFIX@_FCNTL_H
+#define _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
/* Needed before <sys/stat.h>.
May also define off_t to a 64-bit type on native Windows.
Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */
# include <io.h>
#endif
+#undef _@GUARD_PREFIX@_ALREADY_INCLUDING_FCNTL_H
+
#ifndef _@GUARD_PREFIX@_FCNTL_H
#define _@GUARD_PREFIX@_FCNTL_H
# include <selinux/selinux.h>
# endif
# include <stdckdint.h>
-# include <stdint.h>
# include <string.h>
# include <arpa/inet.h>
# include <sys/xattr.h>
}
#endif
+#if (!USE_LINUX_XATTR && USE_ACL && HAVE_ACL_GET_FD \
+ && !HAVE_ACL_EXTENDED_FILE && !HAVE_ACL_TYPE_EXTENDED \
+ && !HAVE_ACL_GET_LINK_NP)
+# include <fcntl.h>
+# ifdef O_PATH
+
+/* Like acl_get_file, but do not follow symbolic links. */
+static acl_t
+acl_get_link_np (char const *name, acl_type_t type)
+{
+ int fd = open (name, O_PATH | O_NOFOLLOW);
+ if (fd < 0)
+ return NULL;
+ acl_t r = acl_get_fd (fd);
+ int err = errno;
+ close (fd);
+ errno = err;
+ return r;
+}
+# define HAVE_ACL_GET_LINK_NP 1
+# endif
+#endif
+
/* Return 1 if NAME has a nontrivial access control list,
0 if ACLs are not supported, or if NAME has no or only a base ACL,
and -1 (setting errno) on error. Note callers can determine
ret = -1;
# else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
acl_t (*acl_get_file_or_link) (char const *, acl_type_t) = acl_get_file;
-# if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10 */
+# if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10, Cygwin >= 2.5 */
if (! (flags & ACL_SYMLINK_FOLLOW))
acl_get_file_or_link = acl_get_link_np;
# endif
/* This file is not used on systems that already have the __fpending function,
namely glibc >= 2.2, Solaris >= 7, UnixWare >= 7.1.4.MP4, Cygwin >= 1.7.34,
- Android API >= 23. */
+ Android API >= 23, musl libc, Haiku >= hrev58760. */
/* Return the number of pending (aka buffered, unflushed)
bytes on the stream, FP, that is open for writing. */
N_NAME_POINTER The nlist n_name element is a pointer,
not an array.
HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
- LINUX_LDAV_FILE [__linux__, __ANDROID__, __CYGWIN__]: File
- containing load averages.
Specific system predefines this file uses, aside from setting
default values if not emacs:
UMAX4_3
VMS
_WIN32 Native Windows (possibly also defined on Cygwin)
- __linux__, __ANDROID__ Linux: assumes /proc file system mounted.
- Support from Michael K. Johnson.
+ __linux__, __ANDROID__ Linux: assumes sysinfo() call.
__CYGWIN__ Cygwin emulates linux /proc/loadavg.
__NetBSD__ NetBSD: assumes /kern file system mounted.
# endif
/* Same issues as for NeXT apply to the HURD-based GNU system. */
-# ifdef __GNU__
+# if defined __gnu_hurd__ || defined NeXT
# undef BSD
# undef FSCALE
-# endif /* __GNU__ */
+# endif /* __gnu_hurd__ || NeXT */
/* Set values that are different from the defaults, which are
set a little farther down with #ifndef. */
# endif
# endif
-# if defined (__GNU__) && !defined (NeXT)
-/* Note that NeXT Openstep defines __GNU__ even though it should not. */
+# if defined __gnu_hurd__ && !defined NeXT
/* GNU system acts much like NeXT, for load average purposes,
but not exactly. */
# define NeXT
# include <sys/dg_sys_info.h>
# endif
+# if defined __linux__ || defined __ANDROID__
+# include <sys/param.h>
+# include <sys/sysinfo.h>
+# endif
+
# if (defined __linux__ || defined __ANDROID__ \
|| defined __CYGWIN__ || defined SUNOS_5 \
|| (defined LOAD_AVE_TYPE && ! defined __VMS))
}
# endif
-# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || defined __CYGWIN__)
+# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__)
/* Linux without glibc, Android, Cygwin */
# define LDAV_DONE
# undef LOAD_AVE_TYPE
-# ifndef LINUX_LDAV_FILE
-# define LINUX_LDAV_FILE "/proc/loadavg"
-# endif
+ {
+ struct sysinfo info;
+ if (sysinfo (&info) < 0)
+ return -1;
+ loadavg[0] = info.loads[0] / (double)(1U << SI_LOAD_SHIFT);
+ loadavg[1] = info.loads[1] / (double)(1U << SI_LOAD_SHIFT);
+ loadavg[2] = info.loads[2] / (double)(1U << SI_LOAD_SHIFT);
+ elem = 3;
+ }
+# endif /* __linux__ || __ANDROID__ */
+
+# if !defined (LDAV_DONE) && defined __CYGWIN__
+ /* Cygwin */
+# define LDAV_DONE
+# undef LOAD_AVE_TYPE
char ldavgbuf[3 * (INT_STRLEN_BOUND (int) + sizeof ".00 ")];
char const *ptr = ldavgbuf;
int fd, count, saved_errno;
- fd = open (LINUX_LDAV_FILE, O_RDONLY | O_CLOEXEC);
+ fd = open ("/proc/loadavg", O_RDONLY | O_CLOEXEC);
if (fd == -1)
return -1;
count = read (fd, ldavgbuf, sizeof ldavgbuf - 1);
return elem;
-# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */
+# endif /* __CYGWIN__ */
# if !defined (LDAV_DONE) && defined (__NetBSD__) /* NetBSD < 0.9 */
# define LDAV_DONE
# endif
# undef getopt_long
# undef getopt_long_only
-# undef option
# undef _getopt_internal
# define getopt_long __GETOPT_ID (getopt_long)
# define getopt_long_only __GETOPT_ID (getopt_long_only)
-# define option __GETOPT_ID (option)
# define _getopt_internal __GETOPT_ID (getopt_internal)
/* The system's getopt.h may have already included getopt-ext.h to
<getopt.h>; our definitions will be present soon enough. */
#if @HAVE_GETOPT_H@
# define _GL_SYSTEM_GETOPT
+/* Rename the system's 'struct option' to 'struct sys_option',
+ so that we don't have to rename ours to 'struct rpl_option'
+ (which would cause significant trouble in C++ mode). */
+# define option sys_option
# @INCLUDE_NEXT@ @NEXT_GETOPT_H@
+# undef option
# undef _GL_SYSTEM_GETOPT
#endif
# --avoid=iswxdigit \
# --avoid=langinfo-h \
# --avoid=libgmp-mpq \
+# --avoid=locale-h \
# --avoid=localename-unsafe-limited \
# --avoid=lock \
# --avoid=mbrtowc \
GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@
GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@
GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@
+GL_GNULIB_STRERROR_L = @GL_GNULIB_STRERROR_L@
GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@
GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@
GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@
+HAVE_STRERROR_L = @HAVE_STRERROR_L@
HAVE_STRPBRK = @HAVE_STRPBRK@
HAVE_STRPTIME = @HAVE_STRPTIME@
HAVE_STRSEP = @HAVE_STRSEP@
REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
REPLACE_GETLINE = @REPLACE_GETLINE@
REPLACE_GETLOADAVG = @REPLACE_GETLOADAVG@
+REPLACE_GETLOGIN = @REPLACE_GETLOGIN@
REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_GETPASS = @REPLACE_GETPASS@
REPLACE_STRDUP = @REPLACE_STRDUP@
REPLACE_STRERROR = @REPLACE_STRERROR@
REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@
+REPLACE_STRERROR_L = @REPLACE_STRERROR_L@
REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
REPLACE_STRFTIME = @REPLACE_STRFTIME@
REPLACE_STRNCAT = @REPLACE_STRNCAT@
srcdir = @srcdir@
standardlisppath = @standardlisppath@
sysconfdir = @sysconfdir@
+systemduserunitdir = @systemduserunitdir@
target_alias = @target_alias@
version = @version@
with_mailutils = @with_mailutils@
endif
## end gnulib module c-ctype
-## begin gnulib module c-strcase
-ifeq (,$(OMIT_GNULIB_MODULE_c-strcase))
+## begin gnulib module c-strcasecmp
+ifeq (,$(OMIT_GNULIB_MODULE_c-strcasecmp))
-libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c
+libgnu_a_SOURCES += c-strcasecmp.c
+
+EXTRA_DIST += c-strcase.h
+
+endif
+## end gnulib module c-strcasecmp
+
+## begin gnulib module c-strncasecmp
+ifeq (,$(OMIT_GNULIB_MODULE_c-strncasecmp))
+
+libgnu_a_SOURCES += c-strncasecmp.c
+
+EXTRA_DIST += c-strcase.h
endif
-## end gnulib module c-strcase
+## end gnulib module c-strncasecmp
## begin gnulib module canonicalize-lgpl
ifeq (,$(OMIT_GNULIB_MODULE_canonicalize-lgpl))
-e 's/@''GNULIB_STR_STARTSWITH''@/$(GL_GNULIB_STR_STARTSWITH)/g' \
-e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \
-e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \
+ -e 's/@''GNULIB_STRERROR_L''@/$(GL_GNULIB_STRERROR_L)/g' \
-e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \
-e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \
-e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \
-e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \
-e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \
-e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \
+ -e 's|@''HAVE_STRERROR_L''@|$(HAVE_STRERROR_L)|g' \
-e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \
-e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \
-e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \
-e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \
-e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \
-e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \
+ -e 's|@''REPLACE_STRERROR_L''@|$(REPLACE_STRERROR_L)|g' \
-e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \
-e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \
-e 's|@''REPLACE_STRVERSCMP''@|$(REPLACE_STRVERSCMP)|g' \
-e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
-e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \
-e 's|@''REPLACE_GETENTROPY''@|$(REPLACE_GETENTROPY)|g' \
+ -e 's|@''REPLACE_GETLOGIN''@|$(REPLACE_GETLOGIN)|g' \
-e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
-e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
-e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
then 'switch (INT_PROMOTE (E))' pacifies gcc -Wswitch-enum if some
enum values are deliberately omitted from the switch's cases.
Here, unary + is safer than a cast or inline function, as unary +
- does only integer promotions. */
+ does only integer promotions and is disallowed on pointers. */
#define INT_PROMOTE(e) (+ (e))
/* Convert it from positive decimal to 'unsigned long'. */
if (c_isdigit (*threads))
{
- char *endptr = NULL;
+ char *endptr;
unsigned long int value = strtoul (threads, &endptr, 10);
-
- if (endptr != NULL)
- {
- while (*endptr != '\0' && c_isspace (*endptr))
- endptr++;
- if (*endptr == '\0')
- return value;
- /* Also accept the first value in a nesting level,
- since we can't determine the nesting level from env vars. */
- else if (*endptr == ',')
- return value;
- }
+ while (*endptr != '\0' && c_isspace (*endptr))
+ endptr++;
+ if (*endptr == '\0')
+ return value;
+ /* Also accept the first value in a nesting level,
+ since we can't determine the nesting level from env vars. */
+ else if (*endptr == ',')
+ return value;
}
return ret;
query = NPROC_CURRENT;
}
/* Here query is one of NPROC_ALL, NPROC_CURRENT. */
+ if (omp_env_limit == 1)
+ /* No need to even call num_processors_ignoring_omp (query). */
+ return 1;
{
unsigned long nprocs = num_processors_ignoring_omp (query);
return MIN (nprocs, omp_env_limit);
# include <utmp.h>
#endif
-/* Needed for BOOT_TIME and USER_PROCESS. */
+/* Needed for BOOT_TIME, USER_PROCESS, LOGIN_PROCESS. */
#if HAVE_UTMPX_H
# if defined _THREAD_SAFE && defined UTMP_DATA_INIT
/* When including both utmp.h and utmpx.h on AIX 4.3, with _THREAD_SAFE
struct timespec ut_ts; /* time */
pid_t ut_pid; /* process ID of ? */
pid_t ut_session; /* process ID of session leader */
- short ut_type; /* BOOT_TIME, USER_PROCESS, or other */
+ short ut_type; /* BOOT_TIME, USER_PROCESS, LOGIN_PROCESS,
+ or other */
struct { int e_termination; int e_exit; } ut_exit;
};
# define WTMP_FILE "/etc/wtmp"
#endif
-/* In early versions of Android, <utmp.h> did not define BOOT_TIME, only
- USER_PROCESS. We need to use the value that is defined in newer versions
- of Android. */
+/* In early versions of Android, <utmp.h> did not define BOOT_TIME or
+ LOGIN_PROCESS, only USER_PROCESS. We need to use the value that is defined
+ in newer versions of Android. */
#if defined __ANDROID__ && !defined BOOT_TIME
# define BOOT_TIME 2
+# define LOGIN_PROCESS 6
#endif
/* Some platforms, such as OpenBSD, don't have an ut_type field and don't have
- the BOOT_TIME and USER_PROCESS macros. But we want to support them in
- 'struct gl_utmp'. */
+ the BOOT_TIME, USER_PROCESS, and LOGIN_PROCESS macros. But we want to
+ support them in 'struct gl_utmp'. */
#if !(HAVE_UTMPX_H ? HAVE_STRUCT_UTMPX_UT_TYPE : HAVE_STRUCT_UTMP_UT_TYPE)
# define BOOT_TIME 2
# define USER_PROCESS 0
+# define LOGIN_PROCESS 6
#endif
/* Macros that test (UT)->ut_type. */
#else
# define UT_TYPE_USER_PROCESS(UT) 0
#endif
+#ifdef LOGIN_PROCESS
+# define UT_TYPE_LOGIN_PROCESS(UT) ((UT)->ut_type == LOGIN_PROCESS)
+#else
+# define UT_TYPE_LOGIN_PROCESS(UT) 0
+#endif
/* Determines whether an entry *UT corresponds to a user process. */
#define IS_USER_PROCESS(UT) \
if (table_size > pat_len)
break;
- dfa->state_table = calloc (sizeof (struct re_state_table_entry), table_size);
+ dfa->state_table = calloc (table_size, sizeof (struct re_state_table_entry));
dfa->state_hash_mask = table_size - 1;
dfa->mb_cur_max = MB_CUR_MAX;
{
int i, j, ch;
- dfa->sb_char = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
+ dfa->sb_char = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
if (__glibc_unlikely (dfa->sb_char == NULL))
return REG_ESPACE;
_NL_COLLATE_SYMB_EXTRAMB);
}
#endif
- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
- mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
+ sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
+ mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
if (__glibc_unlikely (sbcset == NULL || mbcset == NULL))
{
re_free (sbcset);
reg_errcode_t ret;
bin_tree_t *tree;
- sbcset = (re_bitset_ptr_t) calloc (sizeof (bitset_t), 1);
+ sbcset = (re_bitset_ptr_t) calloc (1, sizeof (bitset_t));
if (__glibc_unlikely (sbcset == NULL))
{
*err = REG_ESPACE;
return NULL;
}
- mbcset = (re_charset_t *) calloc (sizeof (re_charset_t), 1);
+ mbcset = (re_charset_t *) calloc (1, sizeof (re_charset_t));
if (__glibc_unlikely (mbcset == NULL))
{
re_free (sbcset);
/* The following bits are used to determine the regexp syntax we
recognize. The set/not-set meanings are chosen so that Emacs syntax
- remains the value 0. The bits are given in alphabetical order, and
- the definitions shifted by one from the previous bit; thus, when we
- add or remove a bit, only one other definition need change. */
+ is the value 0 for Emacs 20 (2000) and earlier, and the value
+ RE_SYNTAX_EMACS for Emacs 21 (2001) and later. */
typedef unsigned long int reg_syntax_t;
#ifdef __USE_GNU
/* If this bit is not set, then \ inside a bracket expression is literal.
If set, then such a \ quotes the following character. */
-# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
+# define RE_BACKSLASH_ESCAPE_IN_LISTS 1ul
/* If this bit is not set, then + and ? are operators, and \+ and \? are
literals.
(The [[[ comments delimit what gets put into the Texinfo file, so
don't delete them!) */
/* [[[begin syntaxes]]] */
-# define RE_SYNTAX_EMACS 0
+# define RE_SYNTAX_EMACS \
+ (RE_CHAR_CLASSES | RE_INTERVALS)
# define RE_SYNTAX_AWK \
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
\f
/* Declarations for routines. */
-#ifndef _REGEX_NELTS
-# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
- && !defined __STDC_NO_VLA__)
-# define _REGEX_NELTS(n) n
-# else
-# define _REGEX_NELTS(n)
-# endif
-#endif
-
-#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wvla"
-#endif
-
#ifndef _Attr_access_
# ifdef __attr_access
# define _Attr_access_(arg) __attr_access (arg)
extern int regexec (const regex_t *_Restrict_ __preg,
const char *_Restrict_ __String, size_t __nmatch,
- regmatch_t __pmatch[_Restrict_arr_
- _REGEX_NELTS (__nmatch)],
+ regmatch_t __pmatch[_Restrict_arr_],
int __eflags);
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
extern void regfree (regex_t *__preg);
-#if defined __GNUC__ && 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
-# pragma GCC diagnostic pop
-#endif
-
#ifdef __cplusplus
}
#endif /* C++ */
reg_errcode_t err;
re_dfastate_t *newstate;
- newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
+ newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
if (__glibc_unlikely (newstate == NULL))
return NULL;
err = re_node_set_init_copy (&newstate->nodes, nodes);
reg_errcode_t err;
re_dfastate_t *newstate;
- newstate = (re_dfastate_t *) calloc (sizeof (re_dfastate_t), 1);
+ newstate = (re_dfastate_t *) calloc (1, sizeof (re_dfastate_t));
if (__glibc_unlikely (newstate == NULL))
return NULL;
err = re_node_set_init_copy (&newstate->nodes, nodes);
int
regexec (const regex_t *__restrict preg, const char *__restrict string,
- size_t nmatch, regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
+ size_t nmatch, regmatch_t pmatch[], int eflags)
{
reg_errcode_t err;
Idx start, length;
attribute_compat_text_section
__compat_regexec (const regex_t *__restrict preg,
const char *__restrict string, size_t nmatch,
- regmatch_t pmatch[_REGEX_NELTS (nmatch)], int eflags)
+ regmatch_t pmatch[], int eflags)
{
return regexec (preg, string, nmatch, pmatch,
eflags & (REG_NOTBOL | REG_NOTEOL));
continue; /* No. */
if (sub_top->path == NULL)
{
- sub_top->path = calloc (sizeof (state_array_t),
- sl_str - sub_top->str_idx + 1);
+ sub_top->path = calloc (sl_str - sub_top->str_idx + 1,
+ sizeof (state_array_t));
if (sub_top->path == NULL)
return REG_ESPACE;
}
if (ndests == 0)
{
state->trtable = (re_dfastate_t **)
- calloc (sizeof (re_dfastate_t *), SBC_MAX);
+ calloc (SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (state->trtable == NULL))
return false;
return true;
discern by looking at the character code: allocate a
256-entry transition table. */
trtable = state->trtable =
- (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), SBC_MAX);
+ (re_dfastate_t **) calloc (SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (trtable == NULL))
goto out_free;
transition tables, one starting at trtable[0] and one
starting at trtable[SBC_MAX]. */
trtable = state->word_trtable =
- (re_dfastate_t **) calloc (sizeof (re_dfastate_t *), 2 * SBC_MAX);
+ (re_dfastate_t **) calloc (2 * SBC_MAX, sizeof (re_dfastate_t *));
if (__glibc_unlikely (trtable == NULL))
goto out_free;
# endif
#endif
+/* Haiku stdio implementation. */
+#if defined __HAIKU__
+# include <stdint.h>
+/* This FILE structure was made into an incomplete type in 2025.
+ See <https://cgit.haiku-os.org/haiku/tree/src/system/libroot/posix/glibc/libio/libio.h>. */
+# define fp_ ((struct { int _flags; \
+ char *_IO_read_ptr; \
+ char *_IO_read_end; \
+ char *_IO_read_base; \
+ char *_IO_write_base; \
+ char *_IO_write_ptr; \
+ char *_IO_write_end; \
+ char *_IO_buf_base; \
+ char *_IO_buf_end; \
+ char *_IO_save_base; \
+ char *_IO_backup_base; \
+ char *_IO_save_end; \
+ void *_markers; \
+ void *_chain; \
+ int _fileno; \
+ int _flags2; \
+ off_t _old_offset; \
+ unsigned short _cur_column; \
+ signed char _vtable_offset; \
+ char _shortbuf[1]; \
+ void *_lock; \
+ int64_t _offset; \
+ /* More fields, not relevant here. */ \
+ } *) fp)
+# if !defined _IO_UNBUFFERED
+# define _IO_UNBUFFERED 0x2
+# endif
+# if !defined _IO_EOF_SEEN
+# define _IO_EOF_SEEN 0x10
+# endif
+# if !defined _IO_IN_BACKUP
+# define _IO_IN_BACKUP 0x100
+# endif
+# if !defined _IO_LINE_BUF
+# define _IO_LINE_BUF 0x200
+# endif
+#endif
+
/* BSD stdio derived implementations. */
#if defined __NetBSD__ /* NetBSD */
#include <stddef.h>
/* MirBSD 10 defines WEXITSTATUS in <sys/wait.h>, not in <stdlib.h>.
- glibc 2.40 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
+ glibc 2.41 defines WCOREDUMP in <sys/wait.h>, not in <stdlib.h>. */
#if @GNULIB_SYSTEM_POSIX@ && !(defined WEXITSTATUS && defined WCOREDUMP)
# include <sys/wait.h>
#endif
# include <unistd.h>
#endif
-#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun
+#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && (defined __sun || defined _AIX)
/* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro
below, this may cause compilation errors later in the libstdc++ header files
(that are part of GCC), such as:
error: 'rpl_strtol' is not a member of 'std'
To avoid this, include the relevant header files here, before these symbols
- get defined as macros. But do so only on Solaris 11 (where it is needed),
- not on mingw (where it would cause other compilation errors). */
+ get defined as macros. But do so only on Solaris 11 and AIX (where it is
+ needed), not on mingw (where it would cause other compilation errors). */
# include <string>
#endif
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@
# if @REPLACE_REALLOC_FOR_REALLOC_POSIX@ == 2
# define _GL_INLINE_RPL_REALLOC 1
+# ifdef __cplusplus
+extern "C" {
+# endif
_GL_REALLOC_INLINE void *
rpl_realloc (void *ptr, size_t size)
{
return realloc (ptr, size ? size : 1);
}
+# ifdef __cplusplus
+}
+# endif
# endif
# if !((defined __cplusplus && defined GNULIB_NAMESPACE) \
|| _GL_USE_STDLIB_ALLOC)
/* NetBSD 5.0 mis-defines NULL. */
#include <stddef.h>
+#if @GNULIB_STRERROR_L@
+/* Get locale_t. */
+# include <locale.h>
+#endif
+
/* MirBSD defines mbslen as a macro. */
#if @GNULIB_MBSLEN@ && defined __MirBSD__
# include <wchar.h>
# endif
_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (memset_explicit);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef memset_explicit
# if HAVE_RAW_DECL_MEMSET_EXPLICIT
_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
+# ifndef _GL_NO_CONST_GENERICS
+/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
+ compiler warnings for 'const' related mistakes. */
+# ifdef __cplusplus
+extern "C++" { /* needed for AIX */
+template <typename T>
+ T * mbsstr_template (T* haystack, const char *needle);
+template <>
+ inline char * mbsstr_template (char *haystack, const char *needle)
+ { return mbsstr (haystack, needle); }
+template <>
+ inline const char * mbsstr_template (const char *haystack, const char *needle)
+ { return mbsstr (haystack, needle); }
+}
+# undef mbsstr
+# define mbsstr mbsstr_template
+# elif !defined mbsstr
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
+ || defined __ICC || defined __TINYC__ \
+ || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
+# define mbsstr(h,n) \
+ _Generic ((h), \
+ char const *: (char const *) mbsstr ((h), (n)), \
+ default : mbsstr ((h), (n)))
+# endif
+# endif
+# endif
#endif
#if @GNULIB_MBSCASECMP@
_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
+# ifndef _GL_NO_CONST_GENERICS
+/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
+ compiler warnings for 'const' related mistakes. */
+# ifdef __cplusplus
+extern "C++" { /* needed for AIX */
+template <typename T>
+ T * mbspcasecmp_template (T* string, const char *prefix);
+template <>
+ inline char * mbspcasecmp_template (char *string, const char *prefix)
+ { return mbspcasecmp (string, prefix); }
+template <>
+ inline const char * mbspcasecmp_template (const char *string, const char *prefix)
+ { return mbspcasecmp (string, prefix); }
+}
+# undef mbspcasecmp
+# define mbspcasecmp mbspcasecmp_template
+# elif !defined mbspcasecmp
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
+ || defined __ICC || defined __TINYC__ \
+ || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
+# define mbspcasecmp(s,p) \
+ _Generic ((s), \
+ char const *: (char const *) mbspcasecmp ((s), (p)), \
+ default : mbspcasecmp ((s), (p)))
+# endif
+# endif
+# endif
#endif
#if @GNULIB_MBSCASESTR@
_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle)
_GL_ATTRIBUTE_PURE
_GL_ARG_NONNULL ((1, 2));
+# ifndef _GL_NO_CONST_GENERICS
+/* Don't silently convert a 'const char *' to a 'char *'. Programmers want
+ compiler warnings for 'const' related mistakes. */
+# ifdef __cplusplus
+extern "C++" { /* needed for AIX */
+template <typename T>
+ T * mbscasestr_template (T* haystack, const char *needle);
+template <>
+ inline char * mbscasestr_template (char *haystack, const char *needle)
+ { return mbscasestr (haystack, needle); }
+template <>
+ inline const char * mbscasestr_template (const char *haystack, const char *needle)
+ { return mbscasestr (haystack, needle); }
+}
+# undef mbscasestr
+# define mbscasestr mbscasestr_template
+# elif !defined mbscasestr
+# if ((__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) || (__clang_major__ >= 3) \
+ || defined __ICC || defined __TINYC__ \
+ || (__STDC_VERSION__ >= 201112L && !(defined __GNUC__ || defined __clang__)))
+# define mbscasestr(h,n) \
+ _Generic ((h), \
+ char const *: (char const *) mbscasestr ((h), (n)), \
+ default : mbscasestr ((h), (n)))
+# endif
+# endif
+# endif
#endif
#if @GNULIB_MBSCSPN@
# endif
#endif
+/* Map any int, typically from errno, into an error message.
+ With locale_t argument. */
+#if @GNULIB_STRERROR_L@
+# if @REPLACE_STRERROR_L@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef strerror_l
+# define strerror_l rpl_strerror_l
+# endif
+_GL_FUNCDECL_RPL (strerror_l, char *, (int errnum, locale_t locale),
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (strerror_l, char *, (int errnum, locale_t locale));
+# else
+# if !@HAVE_STRERROR_L@
+_GL_FUNCDECL_SYS (strerror_l, char *, (int errnum, locale_t locale),
+ _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (strerror_l, char *, (int errnum, locale_t locale));
+# endif
+# if __GLIBC__ >= 2
+_GL_CXXALIASWARN (strerror_l);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strerror_l
+# if HAVE_RAW_DECL_STRERROR_L
+_GL_WARN_ON_USE (strerror_l, "strerror_l is unportable - "
+ "use gnulib module strerror_l for portability");
+# endif
+#endif
+
+/* Map any int, typically from errno, into an error message. Multithread-safe,
+ with locale_t argument.
+ Not portable! Only provided by gnulib. */
+#if @GNULIB_STRERROR_L@
+_GL_FUNCDECL_SYS (strerror_l_r, int,
+ (int errnum, char *buf, size_t buflen, locale_t locale),
+ _GL_ARG_NONNULL ((2, 4)));
+#endif
+
/* Return the name of the system error code ERRNUM. */
#if @GNULIB_STRERRORNAME_NP@
# if @REPLACE_STRERRORNAME_NP@
# endif
_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (strerrorname_np);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef strerrorname_np
# if HAVE_RAW_DECL_STRERRORNAME_NP
# endif
_GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (timespec_getres);
+# endif
# elif defined GNULIB_POSIXCHECK
# undef timespec_getres
# if HAVE_RAW_DECL_TIMESPEC_GETRES
# include <stdio.h>
#endif
+/* FreeBSD 14.0, NetBSD 10.0, OpenBSD 7.5, Solaris 11.4, and glibc 2.41
+ do not define O_CLOEXEC in <unistd.h>. */
/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
<unistd.h>. */
/* But avoid namespace pollution on glibc systems. */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
- && (defined __CYGWIN__ || defined __ANDROID__) \
- && ! defined __GLIBC__
+#if ! defined O_CLOEXEC \
+ || ((@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+ && (defined __CYGWIN__ || defined __ANDROID__) \
+ && ! defined __GLIBC__)
# include <fcntl.h>
#endif
int ofd, off_t *opos,
size_t len, unsigned flags));
# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (copy_file_range);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef copy_file_range
# if HAVE_RAW_DECL_COPY_FILE_RANGE
${LOGNAME-$USER} on Unix platforms,
$USERNAME on native Windows platforms.
*/
-# if !@HAVE_DECL_GETLOGIN@
+# if @REPLACE_GETLOGIN@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define getlogin rpl_getlogin
+# endif
+_GL_FUNCDECL_RPL (getlogin, char *, (void), );
+_GL_CXXALIAS_RPL (getlogin, char *, (void));
+# else
+# if !@HAVE_DECL_GETLOGIN@
_GL_FUNCDECL_SYS (getlogin, char *, (void), );
-# endif
+# endif
_GL_CXXALIAS_SYS (getlogin, char *, (void));
+# endif
+# if __GLIBC__ >= 2
_GL_CXXALIASWARN (getlogin);
+# endif
#elif defined GNULIB_POSIXCHECK
# undef getlogin
# if HAVE_RAW_DECL_GETLOGIN
#if @GNULIB_USLEEP@
/* Pause the execution of the current thread for N microseconds.
Returns 0 on completion, or -1 on range error.
- See the POSIX:2001 specification
+ See the POSIX.1-2004 specification
<https://pubs.opengroup.org/onlinepubs/009695399/functions/usleep.html>. */
# if @REPLACE_USLEEP@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
#include <time.h>
#if HAVE_UTIMENS || HAVE_LUTIMENS
-# include <sys/time.h>
+# include <sys/stat.h>
#endif
#ifdef __cplusplus
}
# endif
# endif
-# if defined __APPLE__ && defined __MACH__
- /* macOS 10.13 does not reject invalid tv_nsec values either. */
+# if (defined __APPLE__ && defined __MACH__) || defined __gnu_hurd__
+ /* macOS 10.13 and GNU Hurd do not reject invalid tv_nsec values
+ either. */
if (times
&& ((times[0].tv_nsec != UTIME_OMIT
&& times[0].tv_nsec != UTIME_NOW
errno = EINVAL;
return -1;
}
+# if defined __APPLE__ && defined __MACH__
size_t len = strlen (file);
if (len > 0 && file[len - 1] == '/')
{
return -1;
}
}
+# endif
# endif
result = utimensat (fd, file, times, flag);
/* Linux kernel 2.6.25 has a bug where it returns EINVAL for
#define _GL_CONCAT0(x, y) x##y
/* _GL_COUNTER is an integer, preferably one that changes each time we
- use it. Use __COUNTER__ if it works, falling back on __LINE__
- otherwise. __LINE__ isn't perfect, but it's better than a
- constant. */
+ use it. Use __COUNTER__ if it works (it does so with most compilers,
+ see <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3457.htm>),
+ falling back on __LINE__ otherwise. __LINE__ isn't perfect, but it's
+ better than a constant. */
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
# define _GL_COUNTER __COUNTER__
#else
# builtin-expect.m4
-# serial 2
+# serial 3
dnl Copyright 2016-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
#elif HAVE___BUILTIN_EXPECT == 2
# include <builtins.h>
#endif
- ])
-])
+])])
# futimens.m4
-# serial 11
+# serial 12
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
]GL_MDA_DEFINES],
[[struct timespec ts[2];
int fd = creat ("conftest.file", 0600);
+ int result = 0;
struct stat st;
- if (fd < 0) return 1;
+ if (fd < 0)
+ return 1;
ts[0].tv_sec = 1;
ts[0].tv_nsec = UTIME_OMIT;
ts[1].tv_sec = 1;
ts[1].tv_nsec = UTIME_NOW;
errno = 0;
- if (futimens (AT_FDCWD, NULL) == 0) return 2;
- if (errno != EBADF) return 3;
- if (futimens (fd, ts)) return 4;
+ if (futimens (AT_FDCWD, NULL) == 0 || errno != EBADF)
+ result |= 2;
+ if (futimens (fd, ts))
+ result |= 4;
sleep (1);
ts[0].tv_nsec = UTIME_NOW;
ts[1].tv_nsec = UTIME_OMIT;
- if (futimens (fd, ts)) return 5;
- if (fstat (fd, &st)) return 6;
- if (st.st_ctime < st.st_atime) return 7;
+ if (futimens (fd, ts))
+ result |= 8;
+ if (fstat (fd, &st))
+ result |= 16;
+ if (st.st_ctime < st.st_atime)
+ result |= 32;
+ enum
+ {
+ BILLION = 1000 * 1000 * 1000,
+ /* Bogus positive and negative tv_nsec values closest to valid
+ range, but without colliding with UTIME_NOW or UTIME_OMIT. */
+ UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
+ ? (1 + (UTIME_NOW == BILLION + 1)
+ + (UTIME_OMIT == BILLION + 1))
+ : 0)
+ };
+ ts[0].tv_sec = 1;
+ ts[0].tv_nsec = UTIME_BOGUS_POS;
+ ts[1].tv_sec = 1;
+ ts[1].tv_nsec = 0;
+ if (futimens (fd, ts) == 0)
+ result |= 64;
+ return result;
]])],
[gl_cv_func_futimens_works=yes],
[gl_cv_func_futimens_works=no],
# gnulib-common.m4
-# serial 107
+# serial 109
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AH_VERBATIM([0witness],
[/* Witness that <config.h> has been included. */
#define _GL_CONFIG_H_INCLUDED 1
+])
+ dnl Avoid warnings from gcc -Wtrailing-whitespace.
+ dnl This is a temporary workaround until Autoconf fixes it.
+ dnl Test case:
+ dnl empty1=; empty2=; AC_DEFINE_UNQUOTED([FOO], [$empty1$empty2], [...])
+ dnl should produce "#define FOO /**/", not "#define FOO ".
+ AH_TOP([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wtrailing-whitespace"
+#endif
+])
+ AH_BOTTOM([#if defined __GNUC__ && __GNUC__ >= 15 && !defined __clang__
+# pragma GCC diagnostic pop
+#endif
])
AH_VERBATIM([_GL_GNUC_PREREQ],
[/* True if the compiler says it groks GNU C version MAJOR.MINOR.
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for C compiler option to allow warnings],
[gl_cv_cc_wallow],
- [rm -f conftest*
+ [rm -fr conftest*
echo 'int dummy;' > conftest.c
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null
else
gl_cv_cc_wallow=none
fi
- rm -f conftest*
+ rm -fr conftest*
])
case "$gl_cv_cc_wallow" in
none) GL_CFLAG_ALLOW_WARNINGS='' ;;
if test -n "$CXX" && test "$CXX" != no; then
AC_CACHE_CHECK([for C++ compiler option to allow warnings],
[gl_cv_cxx_wallow],
- [rm -f conftest*
+ [rm -fr conftest*
echo 'int dummy;' > conftest.cc
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null
else
gl_cv_cxx_wallow=none
fi
- rm -f conftest*
+ rm -fr conftest*
])
case "$gl_cv_cxx_wallow" in
none) GL_CXXFLAG_ALLOW_WARNINGS='' ;;
# Code from module byteswap:
# Code from module c-ctype:
# Code from module c-strcase:
+ # Code from module c-strcasecmp:
+ # Code from module c-strncasecmp:
# Code from module c99:
# Code from module canonicalize-lgpl:
# Code from module careadlinkat:
# manywarnings.m4
-# serial 28
+# serial 29
dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# List all gcc warning categories.
# To compare this list to your installed GCC's, run this Bash command:
#
- # comm -3 \
+ # export LC_ALL=C && comm -3 \
# <((sed -n 's/^ *\(-[^ 0-9][^ ]*\).*/\1/p' manywarnings.m4; \
# awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
# <(LC_ALL=C gcc --help=warnings | sed -n 's/^ \(-[^ ]*\) .*/\1/p' | sort)
# regex.m4
-# serial 78
+# serial 81
dnl Copyright (C) 1996-2001, 2003-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
/* Exit with distinguishable exit code. */
static void sigabrt_no_core (int sig) { raise (SIGTERM); }
#endif
+
+ /* There is no need to check whether RE_SYNTAX_EMACS is
+ (RE_CHAR_CLASSES | RE_INTERVALS), corresponding to
+ Emacs 21 (2001) and later, because Gnulib's lib/regex.h
+ is always used and has this value. */
]],
[[int result = 0;
static struct re_pattern_buffer regex;
# stddef_h.m4
-# serial 17
+# serial 19
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
GL_GENERATE_STDDEF_H=true
fi
- AC_CACHE_CHECK([for clean definition of __STDC_VERSION_STDDEF_H__],
- [gl_cv_clean_version_stddef],
- [AC_PREPROC_IFELSE(
- [AC_LANG_SOURCE(
- [[/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870 */
- #include <stddef.h>
- #undef __STDC_VERSION_STDDEF_H__
- #include <time.h>
- #ifdef __STDC_VERSION_STDDEF_H__
- # error "<time.h> defines __STDC_VERSION_STDDEF_H__"
- #endif
- ]])],
- [gl_cv_clean_version_stddef=yes],
- [gl_cv_clean_version_stddef=no])])
- if test "$gl_cv_clean_version_stddef" = no; then
- STDDEF_NOT_IDEMPOTENT=1
- GL_GENERATE_STDDEF_H=true
- fi
+ dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870
+ dnl affects GCC 13 and 14.
+ AC_CACHE_CHECK([whether <stddef.h> is idempotent],
+ [gl_cv_stddef_idempotent],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+ [[
+ #if __GNUC__ == 13 || __GNUC__ == 14
+ #error "bug 114870 is present"
+ #endif
+ ]])],
+ [gl_cv_stddef_idempotent="guessing yes"],
+ [gl_cv_stddef_idempotent="guessing no"])
+ ])
+ case "$gl_cv_stddef_idempotent" in
+ *yes) ;;
+ *) STDDEF_NOT_IDEMPOTENT=1
+ GL_GENERATE_STDDEF_H=true
+ ;;
+ esac
if $GL_GENERATE_STDDEF_H; then
gl_NEXT_HEADERS([stddef.h])
# string_h.m4
-# serial 43
+# serial 44
dnl Copyright (C) 2007-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
rawmemchr stpcpy stpncpy strchrnul
strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
- strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp])
+ strerror_l strerror_r strerrorname_np
+ sigabbrev_np sigdescr_np strsignal strverscmp])
AC_REQUIRE([AC_C_RESTRICT])
])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBS_ENDSWITH])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R])
+ gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_L])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP])
gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP])
HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR])
HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R])
HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R])
+ HAVE_STRERROR_L=1; AC_SUBST([HAVE_STRERROR_L])
HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP])
HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP])
HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP])
REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R])
REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR])
REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R])
+ REPLACE_STRERROR_L=0; AC_SUBST([REPLACE_STRERROR_L])
REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP])
REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL])
REPLACE_STRVERSCMP=0; AC_SUBST([REPLACE_STRVERSCMP])
# unistd_h.m4
-# serial 96
+# serial 97
dnl Copyright (C) 2006-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE])
REPLACE_GETENTROPY=0; AC_SUBST([REPLACE_GETENTROPY])
+ REPLACE_GETLOGIN=0; AC_SUBST([REPLACE_GETLOGIN])
REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
# utimensat.m4
-# serial 12
+# serial 14
dnl Copyright (C) 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
ts[1].tv_sec = 1;
ts[1].tv_nsec = UTIME_OMIT;
if (utimensat (AT_FDCWD, f, ts, 0))
- result |= 16;
+ result |= 8;
if (stat (f, &st))
- result |= 32;
+ result |= 8;
else if (st.st_ctime < st.st_atime)
- result |= 64;
+ result |= 16;
+ }
+ enum
+ {
+ BILLION = 1000 * 1000 * 1000,
+ /* Bogus positive and negative tv_nsec values closest to valid
+ range, but without colliding with UTIME_NOW or UTIME_OMIT. */
+ UTIME_BOGUS_POS = BILLION + ((UTIME_NOW == BILLION || UTIME_OMIT == BILLION)
+ ? (1 + (UTIME_NOW == BILLION + 1)
+ + (UTIME_OMIT == BILLION + 1))
+ : 0)
+ };
+ {
+ struct timespec ts[2];
+ ts[0].tv_sec = 1;
+ ts[0].tv_nsec = UTIME_BOGUS_POS;
+ ts[1].tv_sec = 1;
+ ts[1].tv_nsec = 0;
+ if (utimensat (AT_FDCWD, f, ts, 0) == 0)
+ result |= 32;
}
return result;
]])],
],
[case "$host_os" in
# Guess yes on Linux or glibc systems.
- linux-* | linux | *-gnu* | gnu*)
+ linux*)
gl_cv_func_utimensat_works="guessing yes" ;;
+ # Guess no on GNU/Hurd.
+ gnu*)
+ gl_cv_func_utimensat_works="guessing no" ;;
# Guess yes on systems that emulate the Linux system calls.
midipix*)
gl_cv_func_utimensat_works="guessing yes" ;;
# warnings.m4
-# serial 20
+# serial 21
dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for C compiler option to inhibit all warnings],
[gl_cv_cc_winhibit],
- [rm -f conftest*
+ [rm -fr conftest*
echo 'int dummy;' > conftest.c
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -w -c conftest.c 2>conftest2.err]) >/dev/null
else
gl_cv_cc_winhibit=none
fi
- rm -f conftest*
+ rm -fr conftest*
])
case "$gl_cv_cc_winhibit" in
none) GL_CFLAG_INHIBIT_WARNINGS='' ;;
if test -n "$CXX" && test "$CXX" != no; then
AC_CACHE_CHECK([for C++ compiler option to inhibit all warnings],
[gl_cv_cxx_winhibit],
- [rm -f conftest*
+ [rm -fr conftest*
echo 'int dummy;' > conftest.cc
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null
AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -w -c conftest.cc 2>conftest2.err]) >/dev/null
else
gl_cv_cxx_winhibit=none
fi
- rm -f conftest*
+ rm -fr conftest*
])
case "$gl_cv_cxx_winhibit" in
none) GL_CXXFLAG_INHIBIT_WARNINGS='' ;;