You are free to add any new features you like to
However, if you want your changes to be incorporated into the
distribution, there are several steps that you need to take in order to
make it possible to include them:
gawkitself, consider writing it as an extension (see section Writing Extensions for
gawk). If that’s not possible, continue with the rest of the steps in this list.
gawk, or better yet, relative to the latest code in the Git repository. If your version of
gawkis very old, I may not be able to integrate your changes at all. (See section Getting the
gawkDistribution, for information on getting the latest version of
gawk. (The GNU Coding Standards are available from the GNU Project’s website. Texinfo, Info, and DVI versions are also available.)
gawk coding style.
The C code for
gawk follows the instructions in the
GNU Coding Standards, with minor exceptions. The code is formatted
using the traditional “K&R” style, particularly as regards to the placement
of braces and the use of TABs. In brief, the coding rules for
are as follows:
#elif’ instead of nesting ‘
#if’ inside ‘
int, on the line above the line with the name and arguments of the function.
forloop initialization and increment parts, and in macro bodies.
'\0'in the conditions of
forstatements, as well as in the
switchstatements, instead of just the plain pointer or character value.
NULLsymbolic constant for pointer values, and the character constant
'\0'where appropriate, instead of
alloca()function for allocating memory off the stack. Its use causes more portability trouble than is worth the minor benefit of not having to free the storage. Instead, use
! strcmp(a, b)’ or similar. As Henry Spencer once said, “
strcmp()is not a boolean!” Instead, use ‘
strcmp(a, b) == 0’.
0x004, and so on) instead of shifting one left by successive amounts (‘
(1<<1)’, and so on).
NOTE: If I have to reformat your code to follow the coding style used in
gawk, I may not bother to integrate your changes at all.
Update the documentation.
Along with your new code, please supply new sections and/or chapters
for this Web page. If at all possible, please use real
Texinfo, instead of just supplying unformatted ASCII text (although
even that is better than no documentation at all).
Conventions to be followed in GAWK: Effective AWK Programming are provided
after the ‘
@bye’ at the end of the Texinfo source file.
If possible, please update the
man page as well.
You will also have to sign paperwork for your documentation changes.
Submit changes as unified diffs.
diff -u -r -N’ to compare
gawk source tree with your version.
I recommend using the GNU version of
diff, or best of all,
git diff’ or ‘
Send the output produced by
diff to me when you
submit your changes.
(See section Reporting Problems and Bugs, for the electronic mail
Using this format makes it easy for me to apply your changes to the
master version of the
gawk source code (using
If I have to apply the changes manually, using a text editor, I may
not do so, particularly if there are lots of changes.
ChangeLogfile with your submission. This helps further minimize the amount of work I have to do, making it easier for me to accept patches. It is simplest if you just make this part of your diff.
Although this sounds like a lot of work, please remember that while you may write the new code, I have to maintain it and support it. If it isn’t possible for me to do that with a minimum of extra work, then I probably will not.