On 11/13/25 4:38 PM, Grisha Levit wrote:

I'm not sure why, but the declaration in externs.h is guarded by both
NEED_FPURGE_DECL and !HAVE_DECL_FPURGE.

There are three states: fpurge is available and declared in stdio.h;
fpurge is available and not in stdio.h; and fpurge is not available.
In the first two, you don't want to compile in the replacement from
lib/sh/fpurge.c. In the second and third, you want the declaration in
externs.h, even if you don't want the replacement function. In the
third, you want both.

You use NEED_FPURGE_DECL to uncover the whole mess, since FILE is not
an intrinsic C type, and the caller needs to include <stdio.h> -- not
every file that includes <externs.h> needs stdio.

If you HAVE_DECL_FPURGE, you don't need to do anything else -- fpurge
is available and declared.

If you HAVE_FPURGE but !HAVE_DECL_FPURGE, you need a declaration, but
no replacement function.

If you !HAVE_FPURGE and !HAVE_DECL_FPURGE, you need the replacement
function (bash_fpurge) and a declaration for fpurge.


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [email protected]    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to