xref: /freebsd/contrib/one-true-awk/README.md (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1# The One True Awk
2
3This is the version of `awk` described in _The AWK Programming Language_,
4by Al Aho, Brian Kernighan, and Peter Weinberger
5(Addison-Wesley, 1988, ISBN 0-201-07981-X).
6
7## Copyright
8
9Copyright (C) Lucent Technologies 1997<br/>
10All Rights Reserved
11
12Permission to use, copy, modify, and distribute this software and
13its documentation for any purpose and without fee is hereby
14granted, provided that the above copyright notice appear in all
15copies and that both that the copyright notice and this
16permission notice and warranty disclaimer appear in supporting
17documentation, and that the name Lucent Technologies or any of
18its entities not be used in advertising or publicity pertaining
19to distribution of the software without specific, written prior
20permission.
21
22LUCENT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
23INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
24IN NO EVENT SHALL LUCENT OR ANY OF ITS ENTITIES BE LIABLE FOR ANY
25SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
26WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
27IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
28ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
29THIS SOFTWARE.
30
31## Distribution and Reporting Problems
32
33Changes, mostly bug fixes and occasional enhancements, are listed
34in `FIXES`.  If you distribute this code further, please please please
35distribute `FIXES` with it.
36
37If you find errors, please report them
38to bwk@cs.princeton.edu.
39Please _also_ open an issue in the GitHub issue tracker, to make
40it easy to track issues.
41Thanks.
42
43## Submitting Pull Requests
44
45Pull requests are welcome. Some guidelines:
46
47* Please do not use functions or facilities that are not standard (e.g.,
48`strlcpy()`, `fpurge()`).
49
50* Please run the test suite and make sure that your changes pass before
51posting the pull request. To do so:
52
53  1. Save the previous version of `awk` somewhere in your path. Call it `nawk` (for example).
54  1. Run `oldawk=nawk make check > check.out 2>&1`.
55  1. Search for `BAD` or `error` in the result. In general, look over it manually to make sure there are no errors.
56
57* Please create the pull request with a request
58to merge into the `staging` branch instead of into the `master` branch.
59This allows us to do testing, and to make any additional edits or changes
60after the merge but before merging to `master`.
61
62## Building
63
64The program itself is created by
65
66	make
67
68which should produce a sequence of messages roughly like this:
69
70	yacc -d awkgram.y
71	conflicts: 43 shift/reduce, 85 reduce/reduce
72	mv y.tab.c ytab.c
73	mv y.tab.h ytab.h
74	cc -c ytab.c
75	cc -c b.c
76	cc -c main.c
77	cc -c parse.c
78	cc maketab.c -o maketab
79	./maketab >proctab.c
80	cc -c proctab.c
81	cc -c tran.c
82	cc -c lib.c
83	cc -c run.c
84	cc -c lex.c
85	cc ytab.o b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o -lm
86
87This produces an executable `a.out`; you will eventually want to
88move this to some place like `/usr/bin/awk`.
89
90If your system does not have `yacc` or `bison` (the GNU
91equivalent), you need to install one of them first.
92
93NOTE: This version uses ANSI C (C 99), as you should also.  We have
94compiled this without any changes using `gcc -Wall` and/or local C
95compilers on a variety of systems, but new systems or compilers
96may raise some new complaint; reports of difficulties are
97welcome.
98
99This compiles without change on Macintosh OS X using `gcc` and
100the standard developer tools.
101
102You can also use `make CC=g++` to build with the GNU C++ compiler,
103should you choose to do so.
104
105The version of `malloc` that comes with some systems is sometimes
106astonishly slow.  If `awk` seems slow, you might try fixing that.
107More generally, turning on optimization can significantly improve
108`awk`'s speed, perhaps by 1/3 for highest levels.
109
110## A Note About Releases
111
112We don't do releases.
113
114## A Note About Maintenance
115
116NOTICE! Maintenance of this program is on a ''best effort''
117basis.  We try to get to issues and pull requests as quickly
118as we can.  Unfortunately, however, keeping this program going
119is not at the top of our priority list.
120
121#### Last Updated
122
123Sat Jul 25 14:00:07 EDT 2021
124