Go to the first, previous, next, last section, table of contents.


Installing @command{gawk}

This appendix provides instructions for installing @command{gawk} on the various platforms that are supported by the developers. The primary developer supports GNU/Linux (and Unix), whereas the other ports are contributed. See section Reporting Problems and Bugs, for the electronic mail addresses of the people who did the respective ports.

The @command{gawk} Distribution

This minor node describes how to get the @command{gawk} distribution, how to extract it, and then what is in the various files and subdirectories.

Getting the @command{gawk} Distribution

There are three ways to get GNU software:

The GNU software archive is mirrored around the world. The up-to-date list of mirror sites is available from the main FSF web site. Try to use one of the mirrors; they will be less busy, and you can usually find one closer to your site.

Extracting the Distribution

@command{gawk} is distributed as a tar file compressed with the GNU Zip program, gzip.

Once you have the distribution (for example, `gawk-3.1.0.tar.gz'), use gzip to expand the file and then use tar to extract it. You can use the following pipeline to produce the @command{gawk} distribution:

# Under System V, add 'o' to the tar options
gzip -d -c gawk-3.1.0.tar.gz | tar -xvpf -

This creates a directory named `gawk-3.1.0' in the current directory.

The distribution file name is of the form `gawk-V.R.P.tar.gz'. The V represents the major version of @command{gawk}, the R represents the current release of version V, and the P represents a patch level, meaning that minor bugs have been fixed in the release. The current patch level is 0, but when retrieving distributions, you should get the version with the highest version, release, and patch level. (Note, however, that patch levels greater than or equal to 80 denote "beta" or non-production software; you might not want to retrieve such a version unless you don't mind experimenting.) If you are not on a Unix system, you need to make other arrangements for getting and extracting the @command{gawk} distribution. You should consult a local expert.

Contents of the @command{gawk} Distribution

The @command{gawk} distribution has a number of C source files, documentation files, subdirectories, and files related to the configuration process (@pxref{Unix Installation, ,Compiling and Installing @command{gawk} on Unix}), as well as several subdirectories related to different non-Unix operating systems:

Various `.c', `.y', and `.h' files:
These files are the actual @command{gawk} source code.
`README'
`README_d/README.*'
Descriptive files: `README' for @command{gawk} under Unix and the rest for the various hardware and software combinations.
`INSTALL'
A file providing an overview of the configuration and installation process.
`ChangeLog'
A detailed list of source code changes as bugs are fixed or improvements made.
`NEWS'
A list of changes to @command{gawk} since the last release or patch.
`COPYING'
The GNU General Public License.
`FUTURES'
A brief list of features and changes being contemplated for future releases, with some indication of the time frame for the feature, based on its difficulty.
`LIMITATIONS'
A list of those factors that limit @command{gawk}'s performance. Most of these depend on the hardware or operating system software, and are not limits in @command{gawk} itself.
`POSIX.STD'
A description of one area where the POSIX standard for @command{awk} is incorrect as well as how @command{gawk} handles the problem.
`doc/awkforai.txt'
A short article describing why @command{gawk} is a good language for AI (Artificial Intelligence) programming.
`doc/README.card'
`doc/ad.block'
`doc/awkcard.in'
`doc/cardfonts'
`doc/colors'
`doc/macros'
`doc/no.colors'
`doc/setter.outline'
The @command{troff} source for a five-color @command{awk} reference card. A modern version of @command{troff} such as GNU @command{troff} (@command{groff}) is needed to produce the color version. See the file `README.card' for instructions if you have an older @command{troff}.
`doc/gawk.1'
The @command{troff} source for a manual page describing @command{gawk}. This is distributed for the convenience of Unix users.
`doc/gawk.texi'
The Texinfo source file for this Info file. It should be processed with TeX to produce a printed document, and with @command{makeinfo} to produce an Info or HTML file.
`doc/gawk.info'
The generated Info file for this Info file.
`doc/gawkinet.texi'
The Texinfo source file for @ifnotinfo TCP/IP Internetworking with @command{gawk}. It should be processed with TeX to produce a printed document and with @command{makeinfo} to produce an Info or HTML file.
`doc/gawkinet.info'
The generated Info file for TCP/IP Internetworking with @command{gawk}.
`doc/igawk.1'
The @command{troff} source for a manual page describing the @command{igawk} program presented in section An Easy Way to Use Library Functions.
`doc/Makefile.in'
The input file used during the configuration process to generate the actual `Makefile' for creating the documentation.
`Makefile.am'
`*/Makefile.am'
Files used by the GNU @command{automake} software for generating the `Makefile.in' files used by @command{autoconf} and @command{configure}.
`Makefile.in'
`acconfig.h'
`acinclude.m4'
`aclocal.m4'
`configh.in'
`configure.in'
`configure'
`custom.h'
`missing_d/*'
`m4/*'
These files and subdirectories are used when configuring @command{gawk} for various Unix systems. They are explained in @ref{Unix Installation, ,Compiling and Installing @command{gawk} on Unix}.
`intl/*'
`po/*'
The `intl' directory provides the GNU gettext library, which implements @command{gawk}'s internationalization features, while the `po' library contains message translations.
`awklib/extract.awk'
`awklib/Makefile.am'
`awklib/Makefile.in'
`awklib/eg/*'
The `awklib' directory contains a copy of `extract.awk' (see section Extracting Programs from Texinfo Source Files), which can be used to extract the sample programs from the Texinfo source file for this Info file. It also contains a `Makefile.in' file, which @command{configure} uses to generate a `Makefile'. `Makefile.am' is used by GNU Automake to create `Makefile.in'. The library functions from @ref{Library Functions, , A Library of @command{awk} Functions}, and the @command{igawk} program from section An Easy Way to Use Library Functions, are included as ready-to-use files in the @command{gawk} distribution. They are installed as part of the installation process. The rest of the programs in this Info file are available in appropriate subdirectories of `awklib/eg'.
`unsupported/atari/*'
Files needed for building @command{gawk} on an Atari ST (@pxref{Atari Installation, ,Installing @command{gawk} on the Atari ST}, for details).
`unsupported/tandem/*'
Files needed for building @command{gawk} on a Tandem (@pxref{Tandem Installation, ,Installing @command{gawk} on a Tandem}, for details).
`posix/*'
Files needed for building @command{gawk} on POSIX-compliant systems.
`pc/*'
Files needed for building @command{gawk} under MS-DOS, MS Windows and OS/2 (see section Installation on PC Operating Systems, for details).
`vms/*'
Files needed for building @command{gawk} under VMS (@pxref{VMS Installation, ,How to Compile and Install @command{gawk} on VMS}, for details).
`test/*'
A test suite for @command{gawk}. You can use `make check' from the top-level @command{gawk} directory to run your version of @command{gawk} against the test suite. If @command{gawk} successfully passes `make check', then you can be confident of a successful port.

Compiling and Installing @command{gawk} on Unix

Usually, you can compile and install @command{gawk} by typing only two commands. However, if you use an unusual system, you may need to configure @command{gawk} for your system yourself.

Compiling @command{gawk} for Unix

After you have extracted the @command{gawk} distribution, @command{cd} to `gawk-3.1.0'. Like most GNU software, @command{gawk} is configured automatically for your Unix system by running the @command{configure} program. This program is a Bourne shell script that is generated automatically using GNU @command{autoconf}. @ifnotinfo (The @command{autoconf} software is described fully in Autoconf--Generating Automatic Configuration Scripts, which is available from the Free Software Foundation.)

To configure @command{gawk}, simply run @command{configure}:

sh ./configure

This produces a `Makefile' and `config.h' tailored to your system. The `config.h' file describes various facts about your system. You might want to edit the `Makefile' to change the CFLAGS variable, which controls the command-line options that are passed to the C compiler (such as optimization levels or compiling for debugging).

Alternatively, you can add your own values for most @command{make} variables on the command line, such as CC and CFLAGS, when running @command{configure}:

CC=cc CFLAGS=-g sh ./configure

See the file `INSTALL' in the @command{gawk} distribution for all the details.

After you have run @command{configure} and possibly edited the `Makefile', type:

make

Shortly thereafter, you should have an executable version of @command{gawk}. That's all there is to it! To verify that @command{gawk} is working properly, run `make check'. All of the tests should succeed. If these steps do not work, or if any of the tests fail, check the files in the `README_d' directory to see if you've found a known problem. If the failure is not described there, please send in a bug report (see section Reporting Problems and Bugs.)

Additional Configuration Options

There are several additional options you may use on the @command{configure} command line when compiling @command{gawk} from scratch.

--enable-portals
This option causes @command{gawk} to treat pathnames that begin with `/p' as BSD portal files when doing two-way I/O with the `|&' operator (@pxref{Portal Files, , Using @command{gawk} with BSD Portals}).
--with-included-gettext
Use the version of the gettext library that comes with @command{gawk}. This option should be used on systems that do not use version 2 (or later) of the GNU C library. All known modern GNU/Linux systems use Glibc 2. Use this option on any other system.
--disable-nls
Disable all message translation facilities. This is usually not desirable, but it may bring you some slight performance improvement. You should also use this option if @option{--with-included-gettext} doesn't work on your system.

The Configuration Process

This minor node is of interest only if you know something about using the C language and the Unix operating system.

The source code for @command{gawk} generally attempts to adhere to formal standards wherever possible. This means that @command{gawk} uses library routines that are specified by the ISO C standard and by the POSIX operating system interface standard. When using an ISO C compiler, function prototypes are used to help improve the compile-time checking.

Many Unix systems do not support all of either the ISO or the POSIX standards. The `missing_d' subdirectory in the @command{gawk} distribution contains replacement versions of those functions that are most likely to be missing.

The `config.h' file that @command{configure} creates contains definitions that describe features of the particular operating system where you are attempting to compile @command{gawk}. The three things described by this file are: what header files are available, so that they can be correctly included, what (supposedly) standard functions are actually available in your C libraries, and various miscellaneous facts about your variant of Unix. For example, there may not be an st_blksize element in the stat structure. In this case, `HAVE_ST_BLKSIZE' is undefined.

It is possible for your C compiler to lie to @command{configure}. It may do so by not exiting with an error when a library function is not available. To get around this, edit the file `custom.h'. Use an `#ifdef' that is appropriate for your system, and either #define any constants that @command{configure} should have defined but didn't, or #undef any constants that @command{configure} defined and should not have. `custom.h' is automatically included by `config.h'.

It is also possible that the @command{configure} program generated by @command{autoconf} will not work on your system in some other fashion. If you do have a problem, the file `configure.in' is the input for @command{autoconf}. You may be able to change this file and generate a new version of @command{configure} that works on your system (see section Reporting Problems and Bugs, for information on how to report problems in configuring @command{gawk}). The same mechanism may be used to send in updates to `configure.in' and/or `custom.h'.

Installation on Other Operating Systems

This minor node describes how to install @command{gawk} on various non-Unix systems.

Installing @command{gawk} on an Amiga

You can install @command{gawk} on an Amiga system using a Unix emulation environment, available via anonymous @command{ftp} from ftp.ninemoons.com in the directory `pub/ade/current'. This includes a shell based on @command{pdksh}. The primary component of this environment is a Unix emulation library, `ixemul.lib'.

A more complete distribution for the Amiga is available on the Geek Gadgets CD-ROM, available from:

CRONUS
1840 E. Warner Road #105-265
Tempe, AZ 85284  USA
US Toll Free: (800) 804-0833
Phone: +1-602-491-0442
FAX: +1-602-491-0048
Email: info@ninemoons.com
WWW: http://www.ninemoons.com
Anonymous @command{ftp} site: ftp.ninemoons.com

Once you have the distribution, you can configure @command{gawk} simply by running @command{configure}:

configure -v m68k-amigaos

Then run @command{make} and you should be all set! If these steps do not work, please send in a bug report (see section Reporting Problems and Bugs).

Installing @command{gawk} on BeOS

Since BeOS DR9, all the tools that you should need to build gawk are included with BeOS. The process is basically identical to the Unix process of running @command{configure} and then @command{make}. Full instructions are given below.

You can compile @command{gawk} under BeOS by extracting the standard sources and running @command{configure}. You must specify the location prefix for the installation directory. For BeOS DR9 and beyond, the best directory to use is `/boot/home/config', so the @command{configure} command is:

configure --prefix=/boot/home/config

This installs the compiled application into `/boot/home/config/bin', which is already specified in the standard @env{PATH}.

Once the configuration process is completed, you can run @command{make}, and then `make install':

$ make
...
$ make install

BeOS uses @command{bash} as its shell; thus, you use @command{gawk} the same way you would under Unix. If these steps do not work, please send in a bug report (see section Reporting Problems and Bugs).

Installation on PC Operating Systems

This minor node covers installation and usage of @command{gawk} on x86 machines running DOS, any version of Windows, or OS/2. In this minor node, the term "Win32" refers to any of Windows-95/98/ME/NT/2000.

The limitations of DOS (and DOS shells under Windows or OS/2) has meant that various "DOS extenders" are often used with programs such as @command{gawk}. The varying capabilities of Microsoft Windows 3.1 and Win32 can add to the confusion. For an overview of the considerations, please refer to `README_d/README.pc' in the distribution.

Installing a Prepared Distribution for PC Systems

If you have received a binary distribution prepared by the DOS maintainers, then @command{gawk} and the necessary support files appear under the `gnu' directory, with executables in `gnu/bin', libraries in `gnu/lib/awk', and manual pages under `gnu/man'. This is designed for easy installation to a `/gnu' directory on your drive--however, the files can be installed anywhere provided @env{AWKPATH} is set properly. Regardless of the installation directory, the first line of `igawk.cmd' and `igawk.bat' (in `gnu/bin') may need to be edited.

The binary distribution contains a separate file describing the contents. In particular, it may include more than one version of the @command{gawk} executable. OS/2 binary distributions may have a different arrangement, but installation is similar.

Compiling @command{gawk} for PC Operating Systems

@command{gawk} can be compiled for MS-DOS, Win32, and OS/2 using the GNU development tools from DJ Delorie (DJGPP; MS-DOS only) or Eberhard Mattes (EMX; MS-DOS, Win32 and OS/2). Microsoft Visual C/C++ can be used to build a Win32 version, and Microsoft C/C++ can be used to build 16-bit versions for MS-DOS and OS/2. The file `README_d/README.pc' in the @command{gawk} distribution contains additional notes, and `pc/Makefile' contains important information on compilation options.

To build @command{gawk}, copy the files in the `pc' directory (except for `ChangeLog') to the directory with the rest of the @command{gawk} sources. The `Makefile' contains a configuration section with comments and may need to be edited in order to work with your @command{make} utility.

The `Makefile' contains a number of targets for building various MS-DOS, Win32, and OS/2 versions. A list of targets is printed if the @command{make} command is given without a target. As an example, to build @command{gawk} using the DJGPP tools, enter `make djgpp'.

Using @command{make} to run the standard tests and to install @command{gawk} requires additional Unix-like tools, including @command{sh}, @command{sed}, and @command{cp}. In order to run the tests, the `test/*.ok' files may need to be converted so that they have the usual DOS-style end-of-line markers. Most of the tests work properly with Stewartson's shell along with the companion utilities or appropriate GNU utilities. However, some editing of `test/Makefile' is required. It is recommended that you copy the file `pc/Makefile.tst' over the file `test/Makefile' as a replacement. Details can be found in `README_d/README.pc' and in the file `pc/Makefile.tst'.

Using @command{gawk} on PC Operating Systems

The OS/2 and MS-DOS versions of @command{gawk} search for program files as described in @ref{AWKPATH Variable, ,The @env{AWKPATH} Environment Variable}. However, semicolons (rather than colons) separate elements in the @env{AWKPATH} variable. If @env{AWKPATH} is not set or is empty, then the default search path is ".;c:/lib/awk;c:/gnu/lib/awk".

An @command{sh}-like shell (as opposed to @command{command.com} under MS-DOS or @command{cmd.exe} under OS/2) may be useful for @command{awk} programming. Ian Stewartson has written an excellent shell for MS-DOS and OS/2, Daisuke Aoyama has ported GNU @command{bash} to MS-DOS using the DJGPP tools, and several shells are available for OS/2, including @command{ksh}. The file `README_d/README.pc' in the @command{gawk} distribution contains information on these shells. Users of Stewartson's shell on DOS should examine its documentation for handling command lines; in particular, the setting for @command{gawk} in the shell configuration may need to be changed and the ignoretype option may also be of interest.

Under OS/2 and DOS, @command{gawk} (and many other text programs) silently translate end-of-line "\r\n" to "\n" on input and "\n" to "\r\n" on output. A special BINMODE variable allows control over these translations and is interpreted as follows.

The modes for standard input and standard output are set one time only (after the command line is read, but before processing any of the @command{awk} program). Setting BINMODE for standard input or standard output is accomplished by using an appropriate `-v BINMODE=N' option on the command line. BINMODE is set at the time a file or pipe is opened and cannot be changed mid-stream.

The name BINMODE was chosen to match @command{mawk} (@pxref{Other Versions, , Other Freely Available @command{awk} Implementations}). Both @command{mawk} and @command{gawk} handle BINMODE similarly; however, @command{mawk} adds a `-W BINMODE=N' option and an environment variable that can set BINMODE, RS, and ORS. The files `binmode[1-3].awk' (under `gnu/lib/awk' in some of the prepared distributions) have been chosen to match @command{mawk}'s @samp{-W BINMODE=N} option. These can be changed or discarded; in particular, the setting of RS giving the fewest "surprises" is open to debate. @command{mawk} uses `RS = "\r\n"' if binary mode is set on read, which is appropriate for files with the DOS-style end-of-line.

To Illustrate, the following examples set binary mode on writes for standard output and other files, and set ORS as the "usual" DOS-style end-of-line:

gawk -v BINMODE=2 -v ORS="\r\n" ...

or:

gawk -v BINMODE=w -f binmode2.awk ...

These give the same result as the `-W BINMODE=2' option in @command{mawk}. The following changes the record separator to "\r\n" and sets binary mode on reads, but does not affect the mode on standard input:

gawk -v RS="\r\n" --source "BEGIN { BINMODE = 1 }" ...

or:

gawk -f binmode1.awk ...

With proper quoting, in the first example the setting of RS can be moved into the BEGIN rule.

How to Compile and Install @command{gawk} on VMS

This node describes how to compile and install @command{gawk} under VMS.

Compiling @command{gawk} on VMS

To compile @command{gawk} under VMS, there is a DCL command procedure that issues all the necessary CC and LINK commands. There is also a `Makefile' for use with the MMS utility. From the source directory, use either:

$ @[.VMS]VMSBUILD.COM

or:

$ MMS/DESCRIPTION=[.VMS]DESCRIP.MMS GAWK

Depending upon which C compiler you are using, follow one of the sets of instructions in this table:

VAX C V3.x
Use either `vmsbuild.com' or `descrip.mms' as is. These use CC/OPTIMIZE=NOLINE, which is essential for Version 3.0.
VAX C V2.x
You must have Version 2.3 or 2.4; older ones won't work. Edit either `vmsbuild.com' or `descrip.mms' according to the comments in them. For `vmsbuild.com', this just entails removing two `!' delimiters. Also edit `config.h' (which is a copy of file `[.config]vms-conf.h') and comment out or delete the two lines `#define __STDC__ 0' and `#define VAXC_BUILTINS' near the end.
GNU C
Edit `vmsbuild.com' or `descrip.mms'; the changes are different from those for VAX C V2.x but equally straightforward. No changes to `config.h' are needed.
DEC C
Edit `vmsbuild.com' or `descrip.mms' according to their comments. No changes to `config.h' are needed.

@command{gawk} has been tested under VAX/VMS 5.5-1 using VAX C V3.2, and GNU C 1.40 and 2.3. It should work without modifications for VMS V4.6 and up.

Installing @command{gawk} on VMS

To install @command{gawk}, all you need is a "foreign" command, which is a DCL symbol whose value begins with a dollar sign. For example:

$ GAWK :== $disk1:[gnubin]GAWK

Substitute the actual location of @command{gawk.exe} for `$disk1:[gnubin]'. The symbol should be placed in the `login.com' of any user who wants to run @command{gawk}, so that it is defined every time the user logs on. Alternatively, the symbol may be placed in the system-wide `sylogin.com' procedure, which allows all users to run @command{gawk}.

Optionally, the help entry can be loaded into a VMS help library:

$ LIBRARY/HELP SYS$HELP:HELPLIB [.VMS]GAWK.HLP

(You may want to substitute a site-specific help library rather than the standard VMS library `HELPLIB'.) After loading the help text, the command:

$ HELP GAWK

provides information about both the @command{gawk} implementation and the @command{awk} programming language.

The logical name `AWK_LIBRARY' can designate a default location for @command{awk} program files. For the @option{-f} option, if the specified file name has no device or directory path information in it, @command{gawk} looks in the current directory first, then in the directory specified by the translation of `AWK_LIBRARY' if the file is not found. If, after searching in both directories, the file still is not found, @command{gawk} appends the suffix `.awk' to the filename and retries the file search. If `AWK_LIBRARY' is not defined, that portion of the file search fails benignly.

Running @command{gawk} on VMS

Command-line parsing and quoting conventions are significantly different on VMS, so examples in this Info file or from other sources often need minor changes. They are minor though, and all @command{awk} programs should run correctly.

Here are a couple of trivial tests:

$ gawk -- "BEGIN {print ""Hello, World!""}"
$ gawk -"W" version
! could also be -"W version" or "-W version"

Note that uppercase and mixed-case text must be quoted.

The VMS port of @command{gawk} includes a DCL-style interface in addition to the original shell-style interface (see the help entry for details). One side effect of dual command-line parsing is that if there is only a single parameter (as in the quoted string program above), the command becomes ambiguous. To work around this, the normally optional @option{--} flag is required to force Unix style rather than DCL parsing. If any other dash-type options (or multiple parameters such as data files to process) are present, there is no ambiguity and @option{--} can be omitted.

The default search path, when looking for @command{awk} program files specified by the @option{-f} option, is "SYS$DISK:[],AWK_LIBRARY:". The logical name `AWKPATH' can be used to override this default. The format of `AWKPATH' is a comma-separated list of directory specifications. When defining it, the value should be quoted so that it retains a single translation and not a multitranslation RMS searchlist.

Building and Using @command{gawk} on VMS POSIX

Ignore the instructions above, although `vms/gawk.hlp' should still be made available in a help library. The source tree should be unpacked into a container file subsystem rather than into the ordinary VMS filesystem. Make sure that the two scripts, `configure' and `vms/posix-cc.sh', are executable; use `chmod +x' on them if necessary. Then execute the following two commands:

psx> CC=vms/posix-cc.sh configure
psx> make CC=c89 gawk

The first command constructs files `config.h' and `Makefile' out of templates, using a script to make the C compiler fit @command{configure}'s expectations. The second command compiles and links @command{gawk} using the C compiler directly; ignore any warnings from @command{make} about being unable to redefine CC. @command{configure} takes a very long time to execute, but at least it provides incremental feedback as it runs.

This has been tested with VAX/VMS V6.2, VMS POSIX V2.0, and DEC C V5.2.

Once built, @command{gawk} works like any other shell utility. Unlike the normal VMS port of @command{gawk}, no special command-line manipulation is needed in the VMS POSIX environment.

Unsupported Operating System Ports

This sections describes systems for which the @command{gawk} port is no longer supported.

Installing @command{gawk} on the Atari ST

The Atari port is no longer supported. It is included for those who might want to use it but it is no longer being actively maintained.

There are no substantial differences when installing @command{gawk} on various Atari models. Compiled @command{gawk} executables do not require a large amount of memory with most @command{awk} programs, and should run on all Motorola processor-based models (called further ST, even if that is not exactly right).

In order to use @command{gawk}, you need to have a shell, either text or graphics, that does not map all the characters of a command line to uppercase. Maintaining case distinction in option flags is very important (see section Command-Line Options). These days this is the default and it may only be a problem for some very old machines. If your system does not preserve the case of option flags, you need to upgrade your tools. Support for I/O redirection is necessary to make it easy to import @command{awk} programs from other environments. Pipes are nice to have but not vital.

Compiling @command{gawk} on the Atari ST

A proper compilation of @command{gawk} sources when sizeof(int) differs from sizeof(void *) requires an ISO C compiler. An initial port was done with @command{gcc}. You may actually prefer executables where ints are four bytes wide but the other variant works as well.

You may need quite a bit of memory when trying to recompile the @command{gawk} sources, as some source files (`regex.c' in particular) are quite big. If you run out of memory compiling such a file, try reducing the optimization level for this particular file, which may help.

With a reasonable shell (@command{bash} will do), you have a pretty good chance that the @command{configure} utility will succeed, and in particular if you run GNU/Linux, MiNT or a similar operating system. Otherwise sample versions of `config.h' and `Makefile.st' are given in the `atari' subdirectory and can be edited and copied to the corresponding files in the main source directory. Even if @command{configure} produces something, it might be advisable to compare its results with the sample versions and possibly make adjustments.

Some @command{gawk} source code fragments depend on a preprocessor define `atarist'. This basically assumes the TOS environment with @command{gcc}. Modify these sections as appropriate if they are not right for your environment. Also see the remarks about @env{AWKPATH} and envsep in @ref{Atari Using, ,Running @command{gawk} on the Atari ST}.

As shipped, the sample `config.h' claims that the system function is missing from the libraries, which is not true, and an alternative implementation of this function is provided in `unsupported/atari/system.c'. Depending upon your particular combination of shell and operating system, you might want to change the file to indicate that system is available.

Running @command{gawk} on the Atari ST

An executable version of @command{gawk} should be placed, as usual, anywhere in your @env{PATH} where your shell can find it.

While executing, the Atari version of @command{gawk} creates a number of temporary files. When using @command{gcc} libraries for TOS, @command{gawk} looks for either of the environment variables, @env{TEMP} or @env{TMPDIR}, in that order. If either one is found, its value is assumed to be a directory for temporary files. This directory must exist, and if you can spare the memory, it is a good idea to put it on a RAM drive. If neither @env{TEMP} nor @env{TMPDIR} are found, then @command{gawk} uses the current directory for its temporary files.

The ST version of @command{gawk} searches for its program files, as described in @ref{AWKPATH Variable, ,The @env{AWKPATH} Environment Variable}. The default value for the @env{AWKPATH} variable is taken from DEFPATH defined in `Makefile'. The sample @command{gcc}/TOS `Makefile' for the ST in the distribution sets DEFPATH to ".,c:\lib\awk,c:\gnu\lib\awk". The search path can be modified by explicitly setting @env{AWKPATH} to whatever you want. Note that colons cannot be used on the ST to separate elements in the @env{AWKPATH} variable, since they have another reserved meaning. Instead, you must use a comma to separate elements in the path. When recompiling, the separating character can be modified by initializing the envsep variable in `unsupported/atari/gawkmisc.atr' to another value.

Although @command{awk} allows great flexibility in doing I/O redirections from within a program, this facility should be used with care on the ST running under TOS. In some circumstances, the OS routines for file-handle pool processing lose track of certain events, causing the computer to crash and requiring a reboot. Often a warm reboot is sufficient. Fortunately, this happens infrequently and in rather esoteric situations. In particular, avoid having one part of an @command{awk} program using print statements explicitly redirected to `/dev/stdout', while other print statements use the default standard output, and a calling shell has redirected standard output to a file.

When @command{gawk} is compiled with the ST version of @command{gcc} and its usual libraries, it accepts both `/' and `\' as path separators. While this is convenient, it should be remembered that this removes one technically valid character (`/') from your file name. It may also create problems for external programs called via the system function, which may not support this convention. Whenever it is possible that a file created by @command{gawk} will be used by some other program, use only backslashes. Also remember that in @command{awk}, backslashes in strings have to be doubled in order to get literal backslashes (see section Escape Sequences).

Installing @command{gawk} on a Tandem

The Tandem port is only minimally supported. The port's contributor no longer has access to a Tandem system.

The Tandem port was done on a Cyclone machine running D20. The port is pretty clean and all facilities seem to work except for the I/O piping facilities (see section Using getline from a Pipe, section Using getline into a Variable from a Pipe, and section Redirecting Output of print and printf), which is just too foreign a concept for Tandem.

To build a Tandem executable from source, download all of the files so that the file names on the Tandem box conform to the restrictions of D20. For example, `array.c' becomes `ARRAYC', and `awk.h' becomes `AWKH'. The totally Tandem-specific files are in the `tandem' "subvolume" (`unsupported/tandem' in the @command{gawk} distribution) and should be copied to the main source directory before building @command{gawk}.

The file `compit' can then be used to compile and bind an executable. Alas, there is no @command{configure} or @command{make}.

Usage is the same as for Unix, except that D20 requires all `{' and `}' characters to be escaped with `~' on the command line (but not in script files). Also, the standard Tandem syntax for `/in filename,out filename/' must be used instead of the usual Unix `<' and `>' for file redirection. (Redirection options on getline, print etc., are supported.)

The `-mr val' option (see section Command-Line Options) has been "stolen" to enable Tandem users to process fixed-length records with no "end-of-line" character. That is, `-mr 74' tells @command{gawk} to read the input file as fixed 74-byte records.

Reporting Problems and Bugs

There is nothing more dangerous than a bored archeologist.
The Hitchhiker's Guide to the Galaxy

If you have problems with @command{gawk} or think that you have found a bug, please report it to the developers; we cannot promise to do anything but we might well want to fix it.

Before reporting a bug, make sure you have actually found a real bug. Carefully reread the documentation and see if it really says you can do what you're trying to do. If it's not clear whether you should be able to do something or not, report that too; it's a bug in the documentation!

Before reporting a bug or trying to fix it yourself, try to isolate it to the smallest possible @command{awk} program and input data file that reproduces the problem. Then send us the program and data file, some idea of what kind of Unix system you're using, the compiler you used to compile @command{gawk}, and the exact results @command{gawk} gave you. Also say what you expected to occur; this helps us decide whether the problem is really in the documentation.

Once you have a precise problem, send email to bug-gawk@gnu.org.

Please include the version number of @command{gawk} you are using. You can get this information with the command `gawk --version'. Using this address automatically sends a carbon copy of your mail to me. If necessary, I can be reached directly at arnold@gnu.org. The bug reporting address is preferred since the email list is archived at the GNU Project. All email should be in English, since that is my native language.

Caution: Do not try to report bugs in @command{gawk} by posting to the Usenet/Internet newsgroup comp.lang.awk. While the @command{gawk} developers do occasionally read this newsgroup, there is no guarantee that we will see your posting. The steps described above are the official recognized ways for reporting bugs.

Non-bug suggestions are always welcome as well. If you have questions about things that are unclear in the documentation or are just obscure features, ask me; I will try to help you out, although I may not have the time to fix the problem. You can send me electronic mail at the Internet address noted previously.

If you find bugs in one of the non-Unix ports of @command{gawk}, please send an electronic mail message to the person who maintains that port. They are named in the following list, as well as in the `README' file in the @command{gawk} distribution. Information in the `README' file should be considered authoritative if it conflicts with this Info file.

The people maintaining the non-Unix ports of @command{gawk} are as follows:

Amiga BeOS MS-DOS MS-Windows OS/2 Tandem VMS
Fred Fish, fnf@ninemoons.com.
Martin Brown, mc@whoever.com.
Scott Deifik, scottd@amgen.com and Darrel Hankerson, hankedr@mail.auburn.edu.
Juan Grigera, juan@biophnet.unlp.edu.ar.
Kai Uwe Rommel, rommel@ars.de.
Stephen Davies, scldad@sdc.com.au.
Pat Rankin, rankin@eql.caltech.edu.
If your bug is also reproducible under Unix, please send a copy of your report to the bug-gawk@gnu.org email list as well.

Other Freely Available @command{awk} Implementations

It's kind of fun to put comments like this in your awk code.
      // Do C++ comments work? answer: yes! of course
Michael Brennan

There are three other freely available @command{awk} implementations. This minor node briefly describes where to get them:

Unix @command{awk}
Brian Kernighan has made his implementation of @command{awk} freely available. You can retrieve this version via the World Wide Web from his home page.(64) It is available in several archive formats:
Shell archive
http://cm.bell-labs.com/who/bwk/awk.shar
Compressed @command{tar file}
http://cm.bell-labs.com/who/bwk/awk.tar.gz
Zip file
http://cm.bell-labs.com/who/bwk/awk.zip
This version requires an ISO C (1990 standard) compiler; the C compiler from GCC (the GNU Compiler Collection) works quite nicely. @xref{BTL, ,Extensions in the Bell Laboratories @command{awk}}, for a list of extensions in this @command{awk} that are not in POSIX @command{awk}.
@command{mawk}
Michael Brennan has written an independent implementation of @command{awk}, called @command{mawk}. It is available under the GPL (see section GNU General Public License), just as @command{gawk} is. You can get it via anonymous @command{ftp} to the host ftp.whidbey.net. Change directory to `/pub/brennan'. Use "binary" or "image" mode, and retrieve `mawk1.3.3.tar.gz' (or the latest version that is there). @command{gunzip} may be used to decompress this file. Installation is similar to @command{gawk}'s (@pxref{Unix Installation, , Compiling and Installing @command{gawk} on Unix}). @command{mawk} has the following extensions that are not in POSIX @command{awk}: The next version of @command{mawk} will support nextfile.
@command{awka}
Written by Andrew Sumner, @command{awka} translates @command{awk} programs into C, compiles them, and links them with a library of functions that provides the core @command{awk} functionality. It also has a number of extensions. The @command{awk} translator is released under the GPL, and the library is under the LGPL. To get @command{awka}, go to http://awka.sourceforge.net. You can reach Andrew Sumner at andrew_sumner@bigfoot.com.


Go to the first, previous, next, last section, table of contents.