bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with GNU Bash source understanding


From: Chet Ramey
Subject: Re: Help with GNU Bash source understanding
Date: Sat, 2 Sep 2017 17:05:39 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 9/2/17 2:16 AM, Jason Mielke wrote:
> The first line of builtins/mkbuiltins.c gives the comment:
> 
> /* mkbuiltins.c - Create builtins.c, builtext.h, and builtdoc.c from
>    a single source file called builtins.def. */
> 
> Where is builtins.def?

This is notational and historical, and mkbuiltins does several different
things.

The first notational part is that builtins are defined in files named
x.def, which gets translated into x.c and compiled as usual.

The second part is that mkbuiltins creates builtins.c, which declares the
array of builtins that is compiled into the shell, and builtext.h, which
provides external definitions for the functions implementing each
builtin and for the help text associated with them, in the build
directory.

mkbuiltins can also be invoked to create separate files containing the
long documentation for the builtins, but we don't use it for that any
more.

The other piece is historical. Way back before mkbuiltins was written --
and I'm talking about almost thirty years ago -- all the builtins were
defined in a single file. That changed fairly early on, around July 1991
or so (bash-1.10), and mkbuiltins was written to do the translation from
the bash-specific .def file format to something the C compiler would like.
The first version of mkbuiltins may have been intended -- I don't remember
-- to recreate that original builtins.c after we defined the .def file format.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]