diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-12-18 20:29:22 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-12-18 20:29:22 +0200 |
commit | bd52c816f95a6aec471f194b94c2e195cf7f9988 (patch) | |
tree | 95afa5c273355441df78fdf1aeaa69d078945159 | |
parent | dd4d686a4181448171114d6fc6f4f8ae58394e16 (diff) | |
download | egawk-bd52c816f95a6aec471f194b94c2e195cf7f9988.tar.gz egawk-bd52c816f95a6aec471f194b94c2e195cf7f9988.tar.bz2 egawk-bd52c816f95a6aec471f194b94c2e195cf7f9988.zip |
Cleanup the mainline PC code, and pc/ directory.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | README_d/ChangeLog | 8 | ||||
-rw-r--r-- | README_d/README.pc | 300 | ||||
-rw-r--r-- | array.c | 2 | ||||
-rw-r--r-- | awk.h | 4 | ||||
-rw-r--r-- | awkgram.c | 2 | ||||
-rw-r--r-- | awkgram.y | 2 | ||||
-rw-r--r-- | doc/ChangeLog | 11 | ||||
-rw-r--r-- | doc/gawk.info | 958 | ||||
-rw-r--r-- | doc/gawk.texi | 196 | ||||
-rw-r--r-- | extension/ChangeLog | 4 | ||||
-rw-r--r-- | extension/pcext.def | 2 | ||||
-rw-r--r-- | gawkmisc.c | 4 | ||||
-rw-r--r-- | io.c | 8 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | pc/ChangeLog | 22 | ||||
-rw-r--r-- | pc/Makefile | 190 | ||||
-rw-r--r-- | pc/config.h | 48 | ||||
-rw-r--r-- | pc/dlfcn.c | 84 | ||||
-rw-r--r-- | pc/dlfcn.h | 41 | ||||
-rw-r--r-- | pc/gawkmisc.pc | 36 | ||||
-rw-r--r-- | pc/getid.c | 37 | ||||
-rw-r--r-- | pc/include/fcntl.h | 3 | ||||
-rw-r--r-- | pc/include/process.h | 3 | ||||
-rw-r--r-- | pc/include/stdio.h | 3 | ||||
-rw-r--r-- | pc/include/stdlib.h | 3 | ||||
-rw-r--r-- | pc/include/string.h | 3 | ||||
-rw-r--r-- | pc/include/sys/stat.h | 3 | ||||
-rw-r--r-- | pc/include/sys/types.h | 3 | ||||
-rw-r--r-- | pc/include/time.h | 3 | ||||
-rw-r--r-- | pc/popen.c | 37 | ||||
-rw-r--r-- | pc/popen.h | 26 | ||||
-rw-r--r-- | regex.c | 4 | ||||
-rw-r--r-- | regex_internal.h | 7 |
34 files changed, 675 insertions, 1389 deletions
@@ -1,3 +1,8 @@ +Sat Dec 18 20:12:59 2010 Eli Zaretskii <eliz@gnu.org> + + * array.c, gawkmisc.c, io.c, main.c, regex_internal.h, + awkgram.y, awk.h, array.c: Remove OS2 and _MSC_VER defines. + Sat Dec 18 19:56:17 2010 Arnold D. Robbins <arnold@skeeve.com> * builtin.c, eval.c, floatcomp.c, io.c: Remove all the crufty diff --git a/README_d/ChangeLog b/README_d/ChangeLog new file mode 100644 index 00000000..3ac17c2b --- /dev/null +++ b/README_d/ChangeLog @@ -0,0 +1,8 @@ +2010-12-18 Eli Zaretskii <eliz@gnu.org> + + * README_d/README.pc: Update and simplify. Remove lots of + outdated stuff for systems and configurations no longer supported. + +2010-12-18 Arnold Robbins <arnold@skeeve.com> + + * ChangeLog: Created. diff --git a/README_d/README.pc b/README_d/README.pc index 12e4279a..661f9bd4 100644 --- a/README_d/README.pc +++ b/README_d/README.pc @@ -1,13 +1,10 @@ -This is the README for GNU awk 3.1 under Windows32, OS/2, and DOS. +This is the README for GNU awk 4 under Windows32, OS/2, and DOS. Gawk has been compiled and tested under OS/2, DOS, and Windows32 using the GNU development tools from DJ Delorie (DJGPP; DOS with special -support for long filenames under Win95), Eberhard Mattes (EMX; OS/2, +support for long filenames on Windows), Eberhard Mattes (EMX; OS/2, DOS, and Windows32 with rsxnt), and Jan-Jaap van der Heijden and Mumit Khan -(Mingw32; Windows32). Microsoft Visual C/C++ can be used to build a Windows32 -version for Windows 9x/NT, and MSC can be used to build 16-bit versions -for DOS and OS/2. (As of 3.1.2, the MSC version doesn't work, but the -maintainer for it is working on fixing it.) +(Mingw32; Windows32). The Cygwin environment (http://cygwin.com) may also be used to compile and run gawk under Windows. For Cygwin, building and @@ -27,21 +24,9 @@ The `configure' step takes a long time, but works otherwise. Building gawk ------------- -Building on DOS or Windows environments can be troublesome, in part due -to shell limitations, the long filename issue, and various Windows32 pipe -considerations. The situation is somewhat better on OS/2. The general -recommendation is to use tools (especially make) which are compatible -or built with the compiler to be used on gawk. - -Building versions which do not understand long filenames on systems -that offer long names is a special case. The maintainers unpack the -distribution and process using utilities (unzip, make, cmp) which do not -use long filenames. (For example, the djgpp tools will work if LFN=n is -set in the environment.) - Copy the files in the `pc' directory (EXCEPT for `ChangeLog') to the directory with the rest of the gawk sources. (The subdirectories of -`pc' need not be copied.) The makefile contains a configuration +`pc' need not be copied.) The Makefile contains a configuration section with comments, and may need to be edited in order to work with your make utility. @@ -85,279 +70,17 @@ builds igawk.bat and igawk.cmd, which are used to add an include facility to gawk (and which require sh). -Notes ------ - -1. Collections containing gawk and various utilities for OS/2 or DOS -include the GNUish Project, Rommel's OS/2 collection at LEO, and the -djgpp collection. - -The GNUish Project was designed to bring GNU-like programs to small -systems running OS/2 and DOS. Binary distributions of gawk are -maintained in GNUish, and include 16bit OS/2 and DOS, 32bit djgpp, -and Windows32 versions. Information on GNUish is available via - - http://www.simtel.net/simtel.net/ -or - ftp://ftp.simtel.net/simtelnet/gnu/gnuish - -Documentation appears in gnuish.htm (html) or gnuish.inf (info). - -Kai Uwe Rommel <rommel@leo.org> maintains a (mostly OS/2) collection at - - http://www.leo.org/archiv/os2 or ftp://ftp.leo.org - -It contains emx-compiled (32bit) versions of gawk for OS/2, DOS, and Windows32, -along with many OS/2 utilities. - -The djgpp collection at - - ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/ - -contains a djgpp-compiled (32bit) version of gawk, along with many -djgpp-compiled utilities. - -The Mingw32 collection at http://www.mingw.org contains links to ported -software. The site by Jan-Jaap van der Heijden - - http://agnes.dida.physik.uni-essen.de/~janjaap/ - -is apparently no longer maintained, but it was accessible as of Jan 2001 -and may contain files of interest. - - -2. The following table illustrates some of the differences among the various -compiled versions of gawk. For example, the djgpp version runs on all the -systems, but with differing capabilities: it supports long filenames under -Win-9x but not under NT, and it runs as a DPMI application under OS/2 (which -translates into "works in the DOS-box under OS/2, but not as a true OS/2 -application"). - - DOS Win/WfW Win9x NT OS/2 - ------------------------------------------------------- - djgpp | DPMI DPMI DPMI DPMI,NoLFN DPMI - emx(1) | N N N N OS2 - emxbnd(2) | VCPI,DPMI DPMI DPMI,NoLFN DPMI,NoLFN DPMI,OS2 - emxnt(3) | N N Windows32 Windows32 N - msc(4) | 16 16 16,NoLFN 16,NoLFN 16,DOS - msc6bnd | 16 16 16,NoLFN 16,NoLFN 16,DOS,OS2 - msc6os2 | N N N N 16,OS2 - vcWin32 | N N Windows32 Windows32 N - mingw32 | N N Windows32 Windows32 N - - (1) Requires emxrt. - - (2) May run as a DPMI app in plain DOS and in a DOS-shell under OS/2 - or Windows, and as a true OS/2 application under OS/2. DPMI - requires rsxnt, and VCPI or use as an OS/2 app requires emxrt. - - (3) Requires rsxnt. - - (4) When compiling, MSC 8, when run in Windows 9x, will require that if - files are listed in #include statements with LFNs - (eg. <patchlevel.h>), that the file be named with the LFN. - - 16 16bit; limited capacity, especially under DOS. - - DOS Runs as a DOS application. - - DPMI Dos Protected Mode Interface; program runs as a DOS application. - Under plain DOS, a DPMI server (such as csdpmi from the djgpp - archives) is required. See also VCPI. - - emxrt The emx runtime, available from LEO. - - N Not supported. - - NoLFN No long filename support. - - OS2 Runs as an OS/2 application. - - rsxnt Runtimes for use with DPMI or Windows32. - - VCPI Virtual Control Program Interface; program runs as a DOS app. - Memory managers (such as emm386) may need adjustment. VCPI cannot - be used under OS/2, Win/WfW, Win-95, or NT. See also DPMI. - -Windows32 Uses/supports Windows32 features (such as long filenames). - -Reportedly, NTEmacs (another Windows32 program) can run programs such as -Windows32-gawk asynchronously. Similarly, as native OS/2 versions are a -plus under OS/2 even for command-line programs, native Windows32 versions -may be desired under NT and Win95. - -Users interested in Windows32 applications may also wish to examine the -Red Hat Cygwin project at http://cygwin.com/ or the Mingw32 work at -http://www.mingw.org. Windows32 gawk will often require that utilities run -from within gawk be Windows32 (e.g., the tests place this requirement on the -cat utility). - - -3. An sh-like shell may be useful for awk programming (and is essential -for running "make test"). Stewartson's sh (OS/2 and DOS) is a good -choice, and may be found in GNUish. - -Stewartson's shell uses a configuration file (see "Command Line Building" -in the sh manual page), and it may be necessary to edit the entry for -gawk. The following entries are suggested: - - -- $(EXTENDED_LINE) -- -- Comment only, not part of file -- - gawk = unix ignoretype # emxbnd - gawk = unix # djgpp; msc* with Stewartson's stdargv - # No entry for emx or for msc* without stdargv - gawk = ignoretype # if you want something which which always work - # --but without the use of @-include files. - -However, users of djgpp versions of gawk may prefer "dos" over "unix" -in the above, due to the way djgpp handles @-include files. Entries -for other other utilities (such as sed and wc) may need to be edited -in order to match your specific collection of programs. - -Daisuke Aoyama <jack@st.rim.or.jp> has ported Bash 1.14.7 to djgpp. -This version worked flawlessly in tests with djgpp gawk and make. bash -is now part of the djgpp collection; the older port may be found on - - http://www.neongenesis.com/~jack/djgpp-work/beta/index.html - -Under OS/2, bash should be a good choice; however, there has been some -trouble getting a solid version. As of Feb-95, there are two bash ports, -available at LEO under shells/gnu/. - -LEO also contains a Korn shell (ksh), tcsh, zsh, and a demo of -Hamilton's C shell, but these have not been tested with gawk by the -maintainers. Reports are welcomed. - -Users of the emx versions of gawk may wish to set EMXSHELL, which -overrides COMSPEC when running shells from emx programs. Similarly, -the djgpp version of gawk respects SHELL. - -Compatibility among shells and various utilities (including gawk) -continues to be a problem. Stewartson's shell may be the best choice -for emx-compiled programs (although djgpp-bash almost works with -emx on DOS). GNU make is recommended if using djgpp-bash. - -Beginning with 3.0.4, the MSC (DOS/Windows32) and Mingw32 versions write -pipe and system() commands to a temporary file, and then execute -with SHELL or COMSPEC. The current mechanism defaults to dos-style -shell conventions unless the shell is one of sh, bash, csh, tcsh, sh32, -sh16, or ksh. - - -4. GNU make is available at LEO for OS/2, in the djgpp collection -for DOS, and in the Mingw32 collection for Windows32. - -dmake is by Dennis Vadura (dvadura@watdragon.uwaterloo.ca), CS -Dept., University of Waterloo. OS/2 and DOS versions can be found as -part of the GNUish project. Note that DOS users will need the DOS-only -version (due to the swap requirement). - -Ndmake is by D.G. Kneller. This ShareWare program was later released -as Opus Make (which is available for OS/2 and DOS). Ndmake 4.5 is -available at - - ftp://ftp.simtel.net/simtelnet/msdos/c/ndmake45.zip - - -5. Stewartson's shell contains sources for a setargv-replacement -for MSC, which can add enhanced command-line processing capabilities -to gawk. See the makefile. Note that there is a fatal bug in -stdargv.c, triggered in the case of no closing quote. The following -patch treats this case as if a quote was inserted as the last -character on the command-line. - -478,479c478,482 -< else -< spos = &spos[strlen (cpos)]; ---- -> else { -> /* No matching quote. Fake it. */ -> spos = cpos + strlen (cpos) + 1; -> break; -> } - - -Known bugs ----------- - -1. DJGPP version 1 has known problems with signals, and in the way it -handles command-lines. Older versions of this file contain notes on -other bugs, and on a few bugs uncovered in the v2 betas. Testing of -gawk with DJGPP v1 ended with gawk-3.0. djgpp-2.01 and djgpp ports of -GNU make 3.75 or later are strongly preferred, in part due to enhanced -support for sh-like shells. - -2. emx does not support DST. On 2-Jan-96, Mattes writes: - - Quotation from ISO 9899-1990: - - 7.12.3.5 The strftime function - [...] - %Z is replaced by the time zone name or abbreviation, or by no - characters if no time zone is determinable. - - As emx does not yet support DST, it does not know which one of the two - time zones (with DST vs. without DST) applies. In consequence, `no - time zone is determinable'. - -As a workaround, it may be possible to edit do_strftime() of builtin.c -according to Mattes' recommendation: - - If you happen to know whether DST applies or not for a given struct - tm, just set its tm_isdst to a positive value or to zero, respectively. - Then, strftime() will replace %Z with the name of the time zone. - -However, this probably won't yield a generic solution given that the rules -for when DST starts and stops vary depending upon your location and the -rules have changed over time. Most versions of UNIX maintain this -information in a database (of sorts). In Solaris, for instance, it can be -found in /usr/share/zoneinfo/*. The setting of the TZ environment variable -(eg. TZ=US/Pacific) is then used to lookup the specifics for that locale. - -3. The 16-bit DOS version can exhaust memory on scripts such as Henry -Spencer's "awf". Use GNU C versions if possible. - -4. builtin.c of gawk-3.0.[1-6] triggers a bug in MSC 6.00A. The makefile -works around the bug by compiling builtin.c without optimizations (-Od). -In limited testing, it appears that inserting some dummy code in -builtin.c can provide a better solution than disabling optimizations. - -5. There are problems with system() when using the rsx package with emx -programs (rsx is used in DPMI environments such as MS-Win). The djgpp -versions are preferred in this case. - -6. In contrast to getpid() on UNIX, the getpid() in Microsoft C/C++ 1.52 -(AKA 8.0) sometimes returns negative numbers. The DOS Gawk developers felt -that it was best to use Microsoft's built-in function; but at the same time, -we are placing this warning here, because this behavior will undoubtably be -surprising to many. - -7. MSC 6 fails the strftlng test. The funstack test exhausts memory -on the 16bit DOS versions. - -8. Eli Zaretskii writes: "Make can crash with SIGFPE after finishing all -the tests. This happens on Windows 95 only, and Gawk 3.0.3 does that as -well (as do older versions of Make). The cause for this is the log(-1) -call in the last test. Based on some limited testing, I'd say that the -problem is in sloppy Windows handling of the FPU: it doesn't clean up the -FPU after a program exits, so if Make has SIGFPE unmasked, it crashes." - -9. gawk built from the mingw32 and vcWin32 targets continues to have -problems with pipes; in particular, the pipeio1 test fails. - -10. As mentioned above, `|&' only works with Cygwin. - - Gawk thanks ----------- -The DOS maintainers wish to express their thanks to Eli Zaretskii -<eliz@is.elta.co.il> for his work and for the many conversations -concerning gawk, make, and djgpp. His FAQ for djgpp is essential -reading, and he was always willing to answer our questions (even when -we didn't read the relevant portions of the FAQ :). +The DOS maintainers wish to express their thanks to Eli Zaretskii +<eliz@gnu.org> for his work and for the many conversations concerning +gawk, make, and djgpp. His FAQ for djgpp is essential reading, and he +was always willing to answer our questions (even when we didn't read +the relevant portions of the FAQ :). -We are indebted to Juan Grigera <juan@biophnet.unlp.edu.ar> for the -Visual C++ target, and for additional help on changes for Windows32. +We are indebted to Juan Grigera <juan@biophnet.unlp.edu.ar> for +additional help on changes for Windows32. ---- @@ -369,4 +92,3 @@ or andreas.buening@nexgo.de (OS/2 version) Support for Windows32 started in gawk-3.0.3. -This is no longer supported. @@ -777,12 +777,10 @@ grow_table(NODE *symbol) * just jumping from 8K to 64K. */ static const long sizes[] = { 13, 127, 1021, 8191, 16381, 32749, 65497, -#if ! defined(OS2) 131101, 262147, 524309, 1048583, 2097169, 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827 -#endif }; /* find next biggest hash size */ @@ -72,7 +72,7 @@ #include <signal.h> #include <time.h> #include <errno.h> -#if ! defined(errno) && ! defined(OS2) +#if ! defined(errno) extern int errno; #endif @@ -1367,7 +1367,7 @@ extern uintmax_t adjust_uint(uintmax_t n); #define WEXITSTATUS(stat_val) (stat_val) #else /* ! defined(VMS) */ #define WEXITSTATUS(stat_val) ((((unsigned) (stat_val)) >> 8) & 0xFF) -#endif /* ! (defined(_MSC_VER) || defined(VMS)) */ +#endif /* ! defined(VMS)) */ #endif /* WEXITSTATUS */ /* EXIT_SUCCESS and EXIT_FAILURE normally come from <stdlib.h> */ @@ -5391,7 +5391,7 @@ yylex(void) return lasttok = NEWLINE_EOF; pushback(); -#if defined OS2 || defined __EMX__ +#if defined __EMX__ /* * added for OS/2's extproc feature of cmd.exe * (like #! in BSD sh) @@ -2750,7 +2750,7 @@ yylex(void) return lasttok = NEWLINE_EOF; pushback(); -#if defined OS2 || defined __EMX__ +#if defined __EMX__ /* * added for OS/2's extproc feature of cmd.exe * (like #! in BSD sh) diff --git a/doc/ChangeLog b/doc/ChangeLog index 00d609ef..31e22afd 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,14 @@ +Sat Dec 18 20:14:58 2010 Eli Zaretskii <eliz@gnu.org> + + * gawk.texi (DOS Quoting): Fix a typo. + (Top, PC Installation): Remove "PC Dynamic" from the menus. + (PC Installation, PC Compiling, PC Using): Remove obsolete stuff. + Fix whitespace between sentences. Add indexing. + (PC Testing): New node, stuff moved from "PC Compiling". + (PC Dynamic): Node removed. + (Cygwin): Fix wording. + (MSYS): Fix whitespace between sentences. + Thu Dec 9 22:27:53 2010 Arnold D. Robbins <arnold@skeeve.com> * awkcard.in, gawk.1, gawk.texi, gawkinet.texi: Remove discussion diff --git a/doc/gawk.info b/doc/gawk.info index 75dc02cb..e499337a 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -453,8 +453,8 @@ texts being (a) (see below), and with the Back-Cover Texts being (b) * PC Binary Installation:: Installing a prepared distribution. * PC Compiling:: Compiling `gawk' for MS-DOS, Windows32, and OS/2. -* PC Dynamic:: Compiling `gawk' for dynamic - libraries. +* PC Testing:: Testing `gawk' on PC + Operating Systems. * PC Using:: Running `gawk' on MS-DOS, Windows32 and OS/2. * Cygwin:: Building and running `gawk' for @@ -1567,7 +1567,7 @@ Although this Info file generally only worries about POSIX systems and the POSIX shell, the following issue arises often enough for many users that it is worth addressing. - The "shell" on Microsoft Windows systems use the double-quote + The "shells" on Microsoft Windows systems use the double-quote character for quoting, and make it difficult or impossible to include an escaped double-quote character in a command-line script. The following example, courtesy of Jeroen Brink, shows how to print all lines in a @@ -20115,7 +20115,7 @@ B.3.1 Installation on PC Operating Systems This minor node covers installation and usage of `gawk' on x86 machines running DOS, any version of Windows, or OS/2. In this minor node, the -term "Windows32" refers to any of Windows-95/98/ME/NT/2000. +term "Windows32" refers to any of Windows-95/98/ME/NT/2000/XP/Vista/7. 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 @@ -20129,8 +20129,7 @@ distribution. * PC Binary Installation:: Installing a prepared distribution. * PC Compiling:: Compiling `gawk' for MS-DOS, Windows32, and OS/2. -* PC Dynamic:: Compiling `gawk' for dynamic - libraries. +* PC Testing:: Testing `gawk' on PC systems. * PC Using:: Running `gawk' on MS-DOS, Windows32 and OS/2. * Cygwin:: Building and running `gawk' for @@ -20176,45 +20175,32 @@ set properly. additional or more detailed installation instructions. -File: gawk.info, Node: PC Compiling, Next: PC Dynamic, Prev: PC Binary Installation, Up: PC Installation +File: gawk.info, Node: PC Compiling, Next: PC Testing, Prev: PC Binary Installation, Up: PC Installation B.3.1.2 Compiling `gawk' for PC Operating Systems ................................................. `gawk' can be compiled for MS-DOS, Windows32, and OS/2 using the GNU development tools from DJ Delorie (DJGPP; MS-DOS only) or Eberhard -Mattes (EMX; MS-DOS, Windows32 and OS/2). Microsoft Visual C/C++ can -be used to build a Windows32 version, and Microsoft C/C++ can be used -to build 16-bit versions for MS-DOS and OS/2. *FIXME:* (As of `gawk' -3.1.2, the MSC version doesn't work. However, the maintainer is working -on fixing it.) The file `README_d/README.pc' in the `gawk' -distribution contains additional notes, and `pc/Makefile' contains -important information on compilation options. - - To build `gawk' for MS-DOS, Windows32, and OS/2 (16 bit only; for 32 -bit (EMX) you can use the `configure' script and skip the following -paragraphs; for details see below), copy the files in the `pc' +Mattes (EMX; MS-DOS, Windows32 and OS/2). The file +`README_d/README.pc' in the `gawk' distribution contains additional +notes, and `pc/Makefile' contains important information on compilation +options. + + To build `gawk' for MS-DOS and Windows32, copy the files in the `pc' directory (_except_ for `ChangeLog') to the directory with the rest of -the `gawk' sources. The `Makefile' contains a configuration section -with comments and may need to be edited in order to work with your -`make' utility. - - The `Makefile' contains a number of targets for building various -MS-DOS, Windows32, and OS/2 versions. A list of targets is printed if -the `make' command is given without a target. As an example, to build -`gawk' using the DJGPP tools, enter `make djgpp'. (The DJGPP tools may -be found at `ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/'.) - - Using `make' to run the standard tests and to install `gawk' -requires additional Unix-like tools, including `sh', `sed', and `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'. +the `gawk' sources, then invoke `make' with the appropriate target name +as an argument to build `gawk'. The `Makefile' copied from the `pc' +directory contains a configuration section with comments and may need +to be edited in order to work with your `make' utility. + + The `Makefile' supports a number of targets for building various +MS-DOS and Windows32 versions. A list of targets is printed if the +`make' command is given without a target. As an example, to build +`gawk' using the DJGPP tools, enter `make djgpp'. (The DJGPP tools +needed for the build may be found at +`ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/'.) To build a native +MS-Windows binary of `gawk', type `make mingw32'. The 32 bit EMX version of `gawk' works "out of the box" under OS/2. In principle, it is possible to compile `gawk' the following way: @@ -20222,7 +20208,7 @@ In principle, it is possible to compile `gawk' the following way: $ ./configure $ make - This is not recommended, though. To get an OMF executable you should + This is not recommended, though. To get an OMF executable you should use the following commands at your `sh' prompt: $ CPPFLAGS="-D__ST_MT_ERRNO__" @@ -20236,7 +20222,7 @@ use the following commands at your `sh' prompt: $ ./configure --prefix=c:/usr --without-included-gettext $ make AR=emxomfar - These are just suggestions. You may use any other set of + These are just suggestions. You may use any other set of (self-consistent) environment variables and compiler flags. To get an FHS-compliant file hierarchy it is recommended to use the @@ -20263,86 +20249,51 @@ additional `configure' options `--infodir=c:/usr/share/info', NOTE: Versions later than GCC 2.95, i.e., GCC 3.x using the Innotek libc were not tested. - NOTE: Even if the compiled `gawk.exe' (`a.out') executable - contains a DOS header, it does _not_ work under DOS. To compile an - executable that runs under DOS, `"-DPIPES_SIMULATED"' must be - added to `CPPFLAGS'. But then some nonstandard extensions of - `gawk' (e.g., `|&') do not work! - - After compilation the internal tests can be performed. Enter `make -check CMP="diff -a"' at your command prompt. All tests except for the + After compilation the internal tests can be performed. Enter `make +check CMP="diff -a"' at your command prompt. All tests except for the `pid' test are expected to work properly. The `pid' test fails because child processes are not started by `fork()'. - `make install' works as expected. + `make install' works as expected with the EMX build. NOTE: Most OS/2 ports of GNU `make' are not able to handle the - Makefiles of this package. If you encounter any problems with - `make' try GNU Make 3.79.1 or later versions. You should find the - latest version on `ftp://hobbes.nmsu.edu/pub/os2/'. + Makefiles of this package. If you encounter any problems with + `make', try GNU Make 3.79.1 or later versions. You should find + the latest version on `ftp://hobbes.nmsu.edu/pub/os2/'. -File: gawk.info, Node: PC Dynamic, Next: PC Using, Prev: PC Compiling, Up: PC Installation +File: gawk.info, Node: PC Testing, Next: PC Using, Prev: PC Compiling, Up: PC Installation -B.3.1.3 Compiling `gawk' For Dynamic Libraries +B.3.1.3 Testing `gawk' on PC Operating Systems .............................................. -To compile `gawk' with dynamic extension support, uncomment the -definitions of `DYN_FLAGS', `DYN_EXP', `DYN_OBJ', and `DYN_MAKEXP' in -the configuration section of the `Makefile'. There are two definitions -for `DYN_MAKEXP': pick the one that matches your target. - - To build some of the example extension libraries, `cd' to the -extension directory and copy `Makefile.pc' to `Makefile'. You can then -build using the same two targets. To run the example `awk' scripts, -you'll need to either change the call to the `extension()' function to -match the name of the library (for instance, change `"./ordchr.so"' to -`"ordchr.dll"' or simply `"ordchr"'), or rename the library to match -the call (for instance, rename `ordchr.dll' to `ordchr.so'). - - If you build `gawk.exe' with one compiler but want to build an -extension library with the other, you need to copy the import library. -Visual C uses a library called `gawk.lib', while MinGW uses a library -called `libgawk.a'. These files are equivalent and will interoperate if -you give them the correct name. The resulting shared libraries are -also interoperable. - - To create your own extension library, you can use the examples as -models, but you're essentially on your own. Post to `comp.lang.awk' or -send electronic mail to <ptjm@interlog.com> if you have problems getting -started. If you need to access functions or variables which are not -exported by `gawk.exe', add them to `gawkw32.def' and rebuild. You -should also add `ATTRIBUTE_EXPORTED' to the declaration in `awk.h' of -any variables you add to `gawkw32.def'. - - Note that extension libraries have the name of the `awk' executable -embedded in them at link time, so they will work only with `gawk.exe'. -In particular, they won't work if you rename `gawk.exe' to `awk.exe' or -if you try to use `pgawk.exe'. You can perform profiling by temporarily -renaming `pgawk.exe' to `gawk.exe'. You can resolve this problem by -changing the program name in the definition of `DYN_MAKEXP' for your -compiler. - - On Windows32, libraries are sought first in the current directory, -then in the directory containing `gawk.exe', and finally through the -`PATH' environment variable. - - -File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Dynamic, Up: PC Installation +Using `make' to run the standard tests and to install `gawk' requires +additional Unix-like tools, including `sh', `sed', and `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'. + + +File: gawk.info, Node: PC Using, Next: Cygwin, Prev: PC Testing, Up: PC Installation B.3.1.4 Using `gawk' on PC Operating Systems ............................................ With the exception of the Cygwin environment, the `|&' operator and TCP/IP networking (*note TCP/IP Networking::) are not supported for -MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the `|&' +MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the `|&' operator. - The OS/2 and MS-DOS versions of `gawk' search for program files as -described in *note AWKPATH Variable::. However, semicolons (rather -than colons) separate elements in the `AWKPATH' variable. If `AWKPATH' -is not set or is empty, then the default search path for OS/2 (16 bit) -and MS-DOS versions is `".;c:/lib/awk;c:/gnu/lib/awk"'. + The MS-DOS and MS-Windows versions of `gawk' search for program +files as described in *note AWKPATH Variable::. However, semicolons +(rather than colons) separate elements in the `AWKPATH' variable. If +`AWKPATH' is not set or is empty, then the default search path for +MS-Windows and MS-DOS versions is `".;c:/lib/awk;c:/gnu/lib/awk"'. The search path for OS/2 (32 bit, EMX) is determined by the prefix directory (most likely `/usr' or `c:/usr') that has been specified as @@ -20351,26 +20302,20 @@ versions. If `c:/usr' is the prefix directory then the default search path contains `.' and `c:/usr/share/awk'. Additionally, to support binary distributions of `gawk' for OS/2 systems whose drive `c:' might not support long file names or might not exist at all, there is a -special environment variable. If `UNIXROOT' specifies a drive then this -specific drive is also searched for program files. E.g., if `UNIXROOT' -is set to `e:' the complete default search path is +special environment variable. If `UNIXROOT' specifies a drive then +this specific drive is also searched for program files. E.g., if +`UNIXROOT' is set to `e:' the complete default search path is `".;c:/usr/share/awk;e:/usr/share/awk"'. An `sh'-like shell (as opposed to `command.com' under MS-DOS or -`cmd.exe' under OS/2) may be useful for `awk' programming. Ian -Stewartson has written an excellent shell for MS-DOS and OS/2, Daisuke -Aoyama has ported GNU Bash to MS-DOS using the DJGPP tools, and several -shells are available for OS/2, including `ksh'. The file -`README_d/README.pc' in the `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 `gawk' in the shell configuration may need to be changed and the -`ignoretype' option may also be of interest. - - Under OS/2 and DOS, `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: +`cmd.exe' under Windows or OS/2) may be useful for `awk' programming. +The DJGPP collection of tools includes an MS-DOS port of Bash, and +several shells are available for OS/2, including `ksh'. + + Under Windows, OS/2 and DOS, `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: * If `BINMODE' is `"r"', or one, then binary mode is set on read (i.e., no translations on reads). @@ -20432,10 +20377,10 @@ File: gawk.info, Node: Cygwin, Next: MSYS, Prev: PC Using, Up: PC Installati B.3.1.5 Using `gawk' In The Cygwin Environment .............................................. -`gawk' can be used "out of the box" under Windows if you are using the -Cygwin environment (http://www.cygwin.com). This environment provides -an excellent simulation of Unix, using the GNU tools, such as Bash, the -GNU Compiler Collection (GCC), GNU Make, and other GNU tools. +`gawk' can be built and used "out of the box" under Windows if you are +using the Cygwin environment (http://www.cygwin.com). This environment +provides an excellent simulation of Unix, using the GNU tools, such as +Bash, the GNU Compiler Collection (GCC), GNU Make, and other GNU tools. Compilation and installation for Cygwin is the same as for a Unix system: @@ -20450,7 +20395,7 @@ the `make' proceeds as usual. NOTE: The `|&' operator and TCP/IP networking (*note TCP/IP Networking::) are fully supported in the Cygwin environment. This - is not true for any other environment for MS-Windows. + is not true for any other environment on MS-Windows. File: gawk.info, Node: MSYS, Prev: Cygwin, Up: PC Installation @@ -20459,12 +20404,12 @@ B.3.1.6 Using `gawk' In The MSYS Environment ............................................ In the MSYS environment under Windows, `gawk' automatically uses binary -mode for reading and writing files. Thus there is no need to use the +mode for reading and writing files. Thus there is no need to use the `BINMODE' variable. This can cause problems with other Unix-like components that have been ported to Windows that expect `gawk' to do automatic translation -of `"\r\n"', since it won't. Caveat Emptor! +of `"\r\n"', since it won't. Caveat Emptor! File: gawk.info, Node: VMS Installation, Prev: PC Installation, Up: Non-Unix Installation @@ -25039,7 +24984,7 @@ Index * bindtextdomain() function (gawk): I18N Functions. (line 12) * bindtextdomain() function (gawk), portability and: I18N Portability. (line 33) -* BINMODE variable <1>: PC Using. (line 40) +* BINMODE variable <1>: PC Using. (line 34) * BINMODE variable: User-modified. (line 10) * bits2str user-defined function: Bitwise Functions. (line 68) * bitwise, complement: Bitwise Functions. (line 25) @@ -25184,6 +25129,8 @@ Index * compatibility mode (gawk), specifying: Options. (line 78) * compiled programs <1>: Glossary. (line 155) * compiled programs: Basic High Level. (line 15) +* compiling gawk for DOS and Windows: PC Compiling. (line 13) +* compiling gawk with EMX for OS/2 and Windows: PC Compiling. (line 28) * compl() function (gawk): Bitwise Functions. (line 42) * complement, bitwise: Bitwise Functions. (line 25) * compound statements, control statements and: Statements. (line 10) @@ -25229,6 +25176,7 @@ Index (line 29) * cut utility: Cut Program. (line 6) * cut.awk program: Cut Program. (line 45) +* Cygwin build of gawk: Cygwin. (line 6) * d debugger command (alias for break): Breakpoint Control. (line 57) * d.c., See dark corner: Conventions. (line 37) * dark corner <1>: Glossary. (line 187) @@ -25411,7 +25359,7 @@ Index * differences in awk and gawk, BEGIN/END patterns: I/O And BEGIN/END. (line 16) * differences in awk and gawk, BINMODE variable <1>: PC Using. - (line 40) + (line 34) * differences in awk and gawk, BINMODE variable: User-modified. (line 23) * differences in awk and gawk, close() function: Close Files And Pipes. @@ -27018,6 +26966,7 @@ Index * Unix awk, password files, field separators and: Command Line Field Separator. (line 72) * Unix, awk scripts and: Executable Scripts. (line 6) +* UNIXROOT variable, on OS/2 systems: PC Using. (line 17) * unref internal function: Internals. (line 92) * unsigned integers: Basic Data Typing. (line 28) * until debugger command: Dgawk Execution Control. @@ -27034,6 +26983,7 @@ Index * user-modifiable variables: User-modified. (line 6) * users, information about, printing: Id Program. (line 6) * users, information about, retrieving: Passwd Functions. (line 16) +* using gawk on Cygwin: Cygwin. (line 6) * USR1 signal: Profiling. (line 182) * values, numeric: Basic Data Typing. (line 13) * values, string: Basic Data Typing. (line 13) @@ -27175,381 +27125,381 @@ Ref: Executable Scripts-Footnote-267723 Node: Comments68174 Node: Quoting70542 Node: DOS Quoting75159 -Node: Sample Data Files75827 -Node: Very Simple78859 -Node: Two Rules83456 -Node: More Complex85603 -Ref: More Complex-Footnote-188533 -Node: Statements/Lines88613 -Ref: Statements/Lines-Footnote-192971 -Node: Other Features93236 -Node: When94105 -Node: Invoking Gawk96248 -Node: Command Line97633 -Node: Options98416 -Ref: Options-Footnote-1111612 -Node: Other Arguments111637 -Node: Naming Standard Input114300 -Node: Environment Variables115264 -Node: AWKPATH Variable115708 -Ref: AWKPATH Variable-Footnote-1118445 -Node: Other Environment Variables118705 -Node: Exit Status121053 -Node: Include Files121728 -Node: Obsolete125119 -Node: Undocumented125805 -Node: Regexp126046 -Node: Regexp Usage127498 -Node: Escape Sequences129524 -Node: Regexp Operators135267 -Ref: Regexp Operators-Footnote-1142439 -Ref: Regexp Operators-Footnote-2142586 -Node: Character Lists142684 -Ref: table-char-classes144459 -Node: GNU Regexp Operators147084 -Node: Case-sensitivity150797 -Ref: Case-sensitivity-Footnote-1153752 -Ref: Case-sensitivity-Footnote-2153987 -Node: Leftmost Longest154095 -Node: Computed Regexps155296 -Node: Locales158713 -Node: Reading Files162255 -Node: Records164196 -Ref: Records-Footnote-1172762 -Node: Fields172799 -Ref: Fields-Footnote-1175831 -Node: Nonconstant Fields175917 -Node: Changing Fields178119 -Node: Field Separators183404 -Node: Default Field Splitting186033 -Node: Regexp Field Splitting187150 -Node: Single Character Fields190500 -Node: Command Line Field Separator191551 -Node: Field Splitting Summary194990 -Ref: Field Splitting Summary-Footnote-1198176 -Node: Constant Size198277 -Node: Splitting By Content202839 -Ref: Splitting By Content-Footnote-1206565 -Node: Multiple Line206605 -Ref: Multiple Line-Footnote-1212345 -Node: Getline212524 -Node: Plain Getline214752 -Node: Getline/Variable216841 -Node: Getline/File217982 -Node: Getline/Variable/File219304 -Ref: Getline/Variable/File-Footnote-1220903 -Node: Getline/Pipe220990 -Node: Getline/Variable/Pipe223538 -Node: Getline/Coprocess224645 -Node: Getline/Variable/Coprocess225888 -Node: Getline Notes226602 -Node: Getline Summary228544 -Ref: table-getline-variants228828 -Node: Command line directories229733 -Node: Printing230358 -Node: Print231989 -Node: Print Examples233326 -Node: Output Separators236110 -Node: OFMT237869 -Node: Printf239227 -Node: Basic Printf240133 -Node: Control Letters241670 -Node: Format Modifiers245482 -Node: Printf Examples251493 -Node: Redirection254208 -Node: Special Files261186 -Node: Special FD261719 -Ref: Special FD-Footnote-1265294 -Node: Special Network265368 -Node: Special Caveats266223 -Node: Close Files And Pipes267017 -Ref: Close Files And Pipes-Footnote-1273961 -Ref: Close Files And Pipes-Footnote-2274109 -Node: Expressions274259 -Node: Values275328 -Node: Constants276004 -Node: Scalar Constants276684 -Ref: Scalar Constants-Footnote-1277543 -Node: Nondecimal-numbers277725 -Node: Regexp Constants280784 -Node: Using Constant Regexps281259 -Node: Variables284264 -Node: Using Variables284919 -Node: Assignment Options286646 -Node: Conversion288527 -Ref: table-locale-affects293901 -Ref: Conversion-Footnote-1294525 -Node: All Operators294634 -Node: Arithmetic Ops295264 -Node: Concatenation297763 -Ref: Concatenation-Footnote-1300556 -Node: Assignment Ops300675 -Ref: table-assign-ops305663 -Node: Increment Ops307064 -Node: Truth Values and Conditions310542 -Node: Truth Values311625 -Node: Typing and Comparison312673 -Node: Variable Typing313462 -Ref: Variable Typing-Footnote-1317359 -Node: Comparison Operators317481 -Ref: table-relational-ops317891 -Node: POSIX String Comparison321440 -Ref: POSIX String Comparison-Footnote-1322397 -Node: Boolean Ops322535 -Ref: Boolean Ops-Footnote-1326613 -Node: Conditional Exp326704 -Node: Function Calls328436 -Node: Precedence331995 -Node: Patterns and Actions335648 -Node: Pattern Overview336702 -Node: Regexp Patterns338368 -Node: Expression Patterns338911 -Node: Ranges342485 -Node: BEGIN/END345451 -Node: Using BEGIN/END346201 -Ref: Using BEGIN/END-Footnote-1348932 -Node: I/O And BEGIN/END349046 -Node: Empty351315 -Node: BEGINFILE/ENDFILE351649 -Node: Using Shell Variables354474 -Node: Action Overview356753 -Node: Statements359110 -Node: If Statement360969 -Node: While Statement362468 -Node: Do Statement364512 -Node: For Statement365668 -Node: Switch Statement368820 -Node: Break Statement370917 -Node: Continue Statement372893 -Node: Next Statement374594 -Node: Nextfile Statement376976 -Node: Exit Statement379494 -Node: Built-in Variables381825 -Node: User-modified382920 -Ref: User-modified-Footnote-1390921 -Node: Auto-set390983 -Ref: Auto-set-Footnote-1399966 -Node: ARGC and ARGV400171 -Node: Arrays403930 -Node: Array Basics405501 -Node: Array Intro406212 -Node: Reference to Elements410530 -Node: Assigning Elements412800 -Node: Array Example413291 -Node: Scanning an Array415023 -Node: Delete417300 -Ref: Delete-Footnote-1419698 -Node: Numeric Array Subscripts419755 -Node: Uninitialized Subscripts421938 -Node: Multi-dimensional423566 -Node: Multi-scanning426657 -Node: Array Sorting428241 -Ref: Array Sorting-Footnote-1431439 -Node: Arrays of Arrays431633 -Node: Functions435795 -Node: Built-in436617 -Node: Calling Built-in437631 -Node: Numeric Functions439607 -Ref: Numeric Functions-Footnote-1443316 -Ref: Numeric Functions-Footnote-2443652 -Ref: Numeric Functions-Footnote-3443700 -Node: String Functions443969 -Ref: String Functions-Footnote-1465768 -Ref: String Functions-Footnote-2465897 -Ref: String Functions-Footnote-3466145 -Node: Gory Details466232 -Ref: table-sub-escapes467889 -Ref: table-posix-sub469203 -Ref: table-gensub-escapes470103 -Node: I/O Functions471274 -Ref: I/O Functions-Footnote-1477971 -Node: Time Functions478118 -Ref: Time Functions-Footnote-1488985 -Ref: Time Functions-Footnote-2489053 -Ref: Time Functions-Footnote-3489211 -Ref: Time Functions-Footnote-4489322 -Ref: Time Functions-Footnote-5489434 -Ref: Time Functions-Footnote-6489661 -Node: Bitwise Functions489927 -Ref: table-bitwise-ops490485 -Ref: Bitwise Functions-Footnote-1494645 -Node: I18N Functions494829 -Node: User-defined496459 -Node: Definition Syntax497263 -Ref: Definition Syntax-Footnote-1501893 -Node: Function Example501962 -Node: Function Caveats504556 -Node: Calling A Function504977 -Node: Variable Scope506066 -Node: Pass By Value/Reference507994 -Node: Return Statement511434 -Node: Dynamic Typing514376 -Node: Indirect Calls515113 -Node: Internationalization524798 -Node: I18N and L10N526226 -Node: Explaining gettext526912 -Ref: Explaining gettext-Footnote-1531974 -Ref: Explaining gettext-Footnote-2532157 -Node: Programmer i18n532322 -Node: Translator i18n536585 -Node: String Extraction537378 -Ref: String Extraction-Footnote-1538339 -Node: Printf Ordering538425 -Ref: Printf Ordering-Footnote-1541209 -Node: I18N Portability541273 -Ref: I18N Portability-Footnote-1543722 -Node: I18N Example543785 -Ref: I18N Example-Footnote-1546420 -Node: Gawk I18N546492 -Node: Advanced Features547061 -Node: Nondecimal Data548380 -Node: Two-way I/O549941 -Ref: Two-way I/O-Footnote-1555355 -Node: TCP/IP Networking555432 -Node: Profiling558204 -Node: Library Functions565604 -Ref: Library Functions-Footnote-1568574 -Node: Library Names568745 -Ref: Library Names-Footnote-1572216 -Ref: Library Names-Footnote-2572436 -Node: General Functions572522 -Node: Nextfile Function573585 -Node: Strtonum Function577966 -Node: Assert Function580917 -Node: Round Function584243 -Node: Cliff Random Function585784 -Node: Ordinal Functions586800 -Ref: Ordinal Functions-Footnote-1589870 -Ref: Ordinal Functions-Footnote-2590122 -Node: Join Function590338 -Ref: Join Function-Footnote-1592109 -Node: Gettimeofday Function592309 -Node: Data File Management596024 -Node: Filetrans Function596656 -Node: Rewind Function600893 -Node: File Checking602346 -Node: Empty Files603440 -Node: Ignoring Assigns605670 -Node: Getopt Function607223 -Ref: Getopt Function-Footnote-1618548 -Node: Passwd Functions618751 -Ref: Passwd Functions-Footnote-1627739 -Node: Group Functions627827 -Node: Sample Programs635907 -Node: Running Examples636572 -Node: Clones637300 -Node: Cut Program638423 -Node: Egrep Program648264 -Ref: Egrep Program-Footnote-1656035 -Node: Id Program656145 -Node: Split Program659761 -Ref: Split Program-Footnote-1663280 -Node: Tee Program663408 -Node: Uniq Program666211 -Node: Wc Program673634 -Ref: Wc Program-Footnote-1677898 -Node: Miscellaneous Programs678098 -Node: Dupword Program679218 -Node: Alarm Program681249 -Node: Translate Program685971 -Ref: Translate Program-Footnote-1690350 -Ref: Translate Program-Footnote-2690578 -Node: Labels Program690712 -Ref: Labels Program-Footnote-1694003 -Node: Word Sorting694087 -Node: History Sorting698434 -Node: Extract Program700272 -Node: Simple Sed707635 -Node: Igawk Program710696 -Ref: Igawk Program-Footnote-1725431 -Ref: Igawk Program-Footnote-2725632 -Node: Signature Program725770 -Node: Debugger726850 -Node: Debugging727726 -Node: Debugging Concepts728040 -Node: Debugging Terms729893 -Node: Awk Debugging732441 -Node: Sample dgawk session733333 -Node: dgawk invocation733825 -Node: Finding The Bug735009 -Node: List of Debugger Commands741540 -Node: Breakpoint Control742855 -Node: Dgawk Execution Control746065 -Node: Viewing And Changing Data749414 -Node: Dgawk Stack752710 -Node: Dgawk Info754171 -Node: Miscellaneous Dgawk Commands758109 -Node: Readline Support763825 -Node: Dgawk Limitations764641 -Node: Language History766813 -Node: V7/SVR3.1768190 -Node: SVR4770485 -Node: POSIX771930 -Node: BTL773642 -Node: POSIX/GNU775332 -Node: Contributors785138 -Node: Installation788747 -Node: Gawk Distribution789718 -Node: Getting790202 -Node: Extracting791028 -Node: Distribution contents792416 -Node: Unix Installation797489 -Node: Quick Installation798080 -Node: Additional Configuration Options799782 -Node: Configuration Philosophy801545 -Node: Non-Unix Installation803909 -Node: PC Installation804374 -Node: PC Binary Installation805680 -Node: PC Compiling807523 -Node: PC Dynamic812028 -Node: PC Using814391 -Node: Cygwin818939 -Node: MSYS819923 -Node: VMS Installation820429 -Node: VMS Compilation821033 -Node: VMS Installation Details822610 -Node: VMS Running824240 -Node: VMS POSIX825837 -Node: VMS Old Gawk827135 -Node: Unsupported827604 -Node: Atari Installation828066 -Node: Atari Compiling829353 -Node: Atari Using831242 -Node: BeOS Installation834089 -Node: Tandem Installation835234 -Node: Bugs836913 -Node: Other Versions840745 -Node: Notes846108 -Node: Compatibility Mode846800 -Node: Additions847583 -Node: Adding Code848333 -Node: New Ports854385 -Node: Dynamic Extensions858517 -Node: Internals859898 -Node: Plugin License870303 -Node: Sample Library870937 -Node: Internal File Description871601 -Node: Internal File Ops875296 -Ref: Internal File Ops-Footnote-1880172 -Node: Using Internal File Ops880320 -Node: Future Extensions882345 -Node: Basic Concepts886382 -Node: Basic High Level887139 -Ref: Basic High Level-Footnote-1891258 -Node: Basic Data Typing891452 -Node: Floating Point Issues895889 -Node: String Conversion Precision896972 -Ref: String Conversion Precision-Footnote-1898666 -Node: Unexpected Results898775 -Node: POSIX Floating Point Problems900601 -Ref: POSIX Floating Point Problems-Footnote-1904300 -Node: Glossary904338 -Node: Copying928121 -Node: GNU Free Documentation License965678 -Node: next-edition990822 -Node: unresolved991174 -Node: revision991674 -Node: consistency992097 -Node: Index995450 +Node: Sample Data Files75828 +Node: Very Simple78860 +Node: Two Rules83457 +Node: More Complex85604 +Ref: More Complex-Footnote-188534 +Node: Statements/Lines88614 +Ref: Statements/Lines-Footnote-192972 +Node: Other Features93237 +Node: When94106 +Node: Invoking Gawk96249 +Node: Command Line97634 +Node: Options98417 +Ref: Options-Footnote-1111613 +Node: Other Arguments111638 +Node: Naming Standard Input114301 +Node: Environment Variables115265 +Node: AWKPATH Variable115709 +Ref: AWKPATH Variable-Footnote-1118446 +Node: Other Environment Variables118706 +Node: Exit Status121054 +Node: Include Files121729 +Node: Obsolete125120 +Node: Undocumented125806 +Node: Regexp126047 +Node: Regexp Usage127499 +Node: Escape Sequences129525 +Node: Regexp Operators135268 +Ref: Regexp Operators-Footnote-1142440 +Ref: Regexp Operators-Footnote-2142587 +Node: Character Lists142685 +Ref: table-char-classes144460 +Node: GNU Regexp Operators147085 +Node: Case-sensitivity150798 +Ref: Case-sensitivity-Footnote-1153753 +Ref: Case-sensitivity-Footnote-2153988 +Node: Leftmost Longest154096 +Node: Computed Regexps155297 +Node: Locales158714 +Node: Reading Files162256 +Node: Records164197 +Ref: Records-Footnote-1172763 +Node: Fields172800 +Ref: Fields-Footnote-1175832 +Node: Nonconstant Fields175918 +Node: Changing Fields178120 +Node: Field Separators183405 +Node: Default Field Splitting186034 +Node: Regexp Field Splitting187151 +Node: Single Character Fields190501 +Node: Command Line Field Separator191552 +Node: Field Splitting Summary194991 +Ref: Field Splitting Summary-Footnote-1198177 +Node: Constant Size198278 +Node: Splitting By Content202840 +Ref: Splitting By Content-Footnote-1206566 +Node: Multiple Line206606 +Ref: Multiple Line-Footnote-1212346 +Node: Getline212525 +Node: Plain Getline214753 +Node: Getline/Variable216842 +Node: Getline/File217983 +Node: Getline/Variable/File219305 +Ref: Getline/Variable/File-Footnote-1220904 +Node: Getline/Pipe220991 +Node: Getline/Variable/Pipe223539 +Node: Getline/Coprocess224646 +Node: Getline/Variable/Coprocess225889 +Node: Getline Notes226603 +Node: Getline Summary228545 +Ref: table-getline-variants228829 +Node: Command line directories229734 +Node: Printing230359 +Node: Print231990 +Node: Print Examples233327 +Node: Output Separators236111 +Node: OFMT237870 +Node: Printf239228 +Node: Basic Printf240134 +Node: Control Letters241671 +Node: Format Modifiers245483 +Node: Printf Examples251494 +Node: Redirection254209 +Node: Special Files261187 +Node: Special FD261720 +Ref: Special FD-Footnote-1265295 +Node: Special Network265369 +Node: Special Caveats266224 +Node: Close Files And Pipes267018 +Ref: Close Files And Pipes-Footnote-1273962 +Ref: Close Files And Pipes-Footnote-2274110 +Node: Expressions274260 +Node: Values275329 +Node: Constants276005 +Node: Scalar Constants276685 +Ref: Scalar Constants-Footnote-1277544 +Node: Nondecimal-numbers277726 +Node: Regexp Constants280785 +Node: Using Constant Regexps281260 +Node: Variables284265 +Node: Using Variables284920 +Node: Assignment Options286647 +Node: Conversion288528 +Ref: table-locale-affects293902 +Ref: Conversion-Footnote-1294526 +Node: All Operators294635 +Node: Arithmetic Ops295265 +Node: Concatenation297764 +Ref: Concatenation-Footnote-1300557 +Node: Assignment Ops300676 +Ref: table-assign-ops305664 +Node: Increment Ops307065 +Node: Truth Values and Conditions310543 +Node: Truth Values311626 +Node: Typing and Comparison312674 +Node: Variable Typing313463 +Ref: Variable Typing-Footnote-1317360 +Node: Comparison Operators317482 +Ref: table-relational-ops317892 +Node: POSIX String Comparison321441 +Ref: POSIX String Comparison-Footnote-1322398 +Node: Boolean Ops322536 +Ref: Boolean Ops-Footnote-1326614 +Node: Conditional Exp326705 +Node: Function Calls328437 +Node: Precedence331996 +Node: Patterns and Actions335649 +Node: Pattern Overview336703 +Node: Regexp Patterns338369 +Node: Expression Patterns338912 +Node: Ranges342486 +Node: BEGIN/END345452 +Node: Using BEGIN/END346202 +Ref: Using BEGIN/END-Footnote-1348933 +Node: I/O And BEGIN/END349047 +Node: Empty351316 +Node: BEGINFILE/ENDFILE351650 +Node: Using Shell Variables354475 +Node: Action Overview356754 +Node: Statements359111 +Node: If Statement360970 +Node: While Statement362469 +Node: Do Statement364513 +Node: For Statement365669 +Node: Switch Statement368821 +Node: Break Statement370918 +Node: Continue Statement372894 +Node: Next Statement374595 +Node: Nextfile Statement376977 +Node: Exit Statement379495 +Node: Built-in Variables381826 +Node: User-modified382921 +Ref: User-modified-Footnote-1390922 +Node: Auto-set390984 +Ref: Auto-set-Footnote-1399967 +Node: ARGC and ARGV400172 +Node: Arrays403931 +Node: Array Basics405502 +Node: Array Intro406213 +Node: Reference to Elements410531 +Node: Assigning Elements412801 +Node: Array Example413292 +Node: Scanning an Array415024 +Node: Delete417301 +Ref: Delete-Footnote-1419699 +Node: Numeric Array Subscripts419756 +Node: Uninitialized Subscripts421939 +Node: Multi-dimensional423567 +Node: Multi-scanning426658 +Node: Array Sorting428242 +Ref: Array Sorting-Footnote-1431440 +Node: Arrays of Arrays431634 +Node: Functions435796 +Node: Built-in436618 +Node: Calling Built-in437632 +Node: Numeric Functions439608 +Ref: Numeric Functions-Footnote-1443317 +Ref: Numeric Functions-Footnote-2443653 +Ref: Numeric Functions-Footnote-3443701 +Node: String Functions443970 +Ref: String Functions-Footnote-1465769 +Ref: String Functions-Footnote-2465898 +Ref: String Functions-Footnote-3466146 +Node: Gory Details466233 +Ref: table-sub-escapes467890 +Ref: table-posix-sub469204 +Ref: table-gensub-escapes470104 +Node: I/O Functions471275 +Ref: I/O Functions-Footnote-1477972 +Node: Time Functions478119 +Ref: Time Functions-Footnote-1488986 +Ref: Time Functions-Footnote-2489054 +Ref: Time Functions-Footnote-3489212 +Ref: Time Functions-Footnote-4489323 +Ref: Time Functions-Footnote-5489435 +Ref: Time Functions-Footnote-6489662 +Node: Bitwise Functions489928 +Ref: table-bitwise-ops490486 +Ref: Bitwise Functions-Footnote-1494646 +Node: I18N Functions494830 +Node: User-defined496460 +Node: Definition Syntax497264 +Ref: Definition Syntax-Footnote-1501894 +Node: Function Example501963 +Node: Function Caveats504557 +Node: Calling A Function504978 +Node: Variable Scope506067 +Node: Pass By Value/Reference507995 +Node: Return Statement511435 +Node: Dynamic Typing514377 +Node: Indirect Calls515114 +Node: Internationalization524799 +Node: I18N and L10N526227 +Node: Explaining gettext526913 +Ref: Explaining gettext-Footnote-1531975 +Ref: Explaining gettext-Footnote-2532158 +Node: Programmer i18n532323 +Node: Translator i18n536586 +Node: String Extraction537379 +Ref: String Extraction-Footnote-1538340 +Node: Printf Ordering538426 +Ref: Printf Ordering-Footnote-1541210 +Node: I18N Portability541274 +Ref: I18N Portability-Footnote-1543723 +Node: I18N Example543786 +Ref: I18N Example-Footnote-1546421 +Node: Gawk I18N546493 +Node: Advanced Features547062 +Node: Nondecimal Data548381 +Node: Two-way I/O549942 +Ref: Two-way I/O-Footnote-1555356 +Node: TCP/IP Networking555433 +Node: Profiling558205 +Node: Library Functions565605 +Ref: Library Functions-Footnote-1568575 +Node: Library Names568746 +Ref: Library Names-Footnote-1572217 +Ref: Library Names-Footnote-2572437 +Node: General Functions572523 +Node: Nextfile Function573586 +Node: Strtonum Function577967 +Node: Assert Function580918 +Node: Round Function584244 +Node: Cliff Random Function585785 +Node: Ordinal Functions586801 +Ref: Ordinal Functions-Footnote-1589871 +Ref: Ordinal Functions-Footnote-2590123 +Node: Join Function590339 +Ref: Join Function-Footnote-1592110 +Node: Gettimeofday Function592310 +Node: Data File Management596025 +Node: Filetrans Function596657 +Node: Rewind Function600894 +Node: File Checking602347 +Node: Empty Files603441 +Node: Ignoring Assigns605671 +Node: Getopt Function607224 +Ref: Getopt Function-Footnote-1618549 +Node: Passwd Functions618752 +Ref: Passwd Functions-Footnote-1627740 +Node: Group Functions627828 +Node: Sample Programs635908 +Node: Running Examples636573 +Node: Clones637301 +Node: Cut Program638424 +Node: Egrep Program648265 +Ref: Egrep Program-Footnote-1656036 +Node: Id Program656146 +Node: Split Program659762 +Ref: Split Program-Footnote-1663281 +Node: Tee Program663409 +Node: Uniq Program666212 +Node: Wc Program673635 +Ref: Wc Program-Footnote-1677899 +Node: Miscellaneous Programs678099 +Node: Dupword Program679219 +Node: Alarm Program681250 +Node: Translate Program685972 +Ref: Translate Program-Footnote-1690351 +Ref: Translate Program-Footnote-2690579 +Node: Labels Program690713 +Ref: Labels Program-Footnote-1694004 +Node: Word Sorting694088 +Node: History Sorting698435 +Node: Extract Program700273 +Node: Simple Sed707636 +Node: Igawk Program710697 +Ref: Igawk Program-Footnote-1725432 +Ref: Igawk Program-Footnote-2725633 +Node: Signature Program725771 +Node: Debugger726851 +Node: Debugging727727 +Node: Debugging Concepts728041 +Node: Debugging Terms729894 +Node: Awk Debugging732442 +Node: Sample dgawk session733334 +Node: dgawk invocation733826 +Node: Finding The Bug735010 +Node: List of Debugger Commands741541 +Node: Breakpoint Control742856 +Node: Dgawk Execution Control746066 +Node: Viewing And Changing Data749415 +Node: Dgawk Stack752711 +Node: Dgawk Info754172 +Node: Miscellaneous Dgawk Commands758110 +Node: Readline Support763826 +Node: Dgawk Limitations764642 +Node: Language History766814 +Node: V7/SVR3.1768191 +Node: SVR4770486 +Node: POSIX771931 +Node: BTL773643 +Node: POSIX/GNU775333 +Node: Contributors785139 +Node: Installation788748 +Node: Gawk Distribution789719 +Node: Getting790203 +Node: Extracting791029 +Node: Distribution contents792417 +Node: Unix Installation797490 +Node: Quick Installation798081 +Node: Additional Configuration Options799783 +Node: Configuration Philosophy801546 +Node: Non-Unix Installation803910 +Node: PC Installation804375 +Node: PC Binary Installation805650 +Node: PC Compiling807493 +Node: PC Testing810899 +Node: PC Using811720 +Node: Cygwin815887 +Node: MSYS816880 +Node: VMS Installation817388 +Node: VMS Compilation817992 +Node: VMS Installation Details819569 +Node: VMS Running821199 +Node: VMS POSIX822796 +Node: VMS Old Gawk824094 +Node: Unsupported824563 +Node: Atari Installation825025 +Node: Atari Compiling826312 +Node: Atari Using828201 +Node: BeOS Installation831048 +Node: Tandem Installation832193 +Node: Bugs833872 +Node: Other Versions837704 +Node: Notes843067 +Node: Compatibility Mode843759 +Node: Additions844542 +Node: Adding Code845292 +Node: New Ports851344 +Node: Dynamic Extensions855476 +Node: Internals856857 +Node: Plugin License867262 +Node: Sample Library867896 +Node: Internal File Description868560 +Node: Internal File Ops872255 +Ref: Internal File Ops-Footnote-1877131 +Node: Using Internal File Ops877279 +Node: Future Extensions879304 +Node: Basic Concepts883341 +Node: Basic High Level884098 +Ref: Basic High Level-Footnote-1888217 +Node: Basic Data Typing888411 +Node: Floating Point Issues892848 +Node: String Conversion Precision893931 +Ref: String Conversion Precision-Footnote-1895625 +Node: Unexpected Results895734 +Node: POSIX Floating Point Problems897560 +Ref: POSIX Floating Point Problems-Footnote-1901259 +Node: Glossary901297 +Node: Copying925080 +Node: GNU Free Documentation License962637 +Node: next-edition987781 +Node: unresolved988133 +Node: revision988633 +Node: consistency989056 +Node: Index992409 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 123aa8b2..db59998a 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -647,8 +647,8 @@ particular records in a file and perform operations upon them. * PC Binary Installation:: Installing a prepared distribution. * PC Compiling:: Compiling @command{gawk} for MS-DOS, Windows32, and OS/2. -* PC Dynamic:: Compiling @command{gawk} for dynamic - libraries. +* PC Testing:: Testing @command{gawk} on PC + Operating Systems. * PC Using:: Running @command{gawk} on MS-DOS, Windows32 and OS/2. * Cygwin:: Building and running @command{gawk} for @@ -2266,7 +2266,7 @@ Although this @value{DOCUMENT} generally only worries about POSIX systems and th POSIX shell, the following issue arises often enough for many users that it is worth addressing. -The ``shell'' on Microsoft Windows systems use the double-quote +The ``shells'' on Microsoft Windows systems use the double-quote character for quoting, and make it difficult or impossible to include an escaped double-quote character in a command-line script. The following example, courtesy of Jeroen Brink, shows @@ -27053,7 +27053,7 @@ various non-Unix systems. This @value{SECTION} covers installation and usage of @command{gawk} on x86 machines running DOS, any version of Windows, or OS/2. In this @value{SECTION}, the term ``Windows32'' -refers to any of Windows-95/98/ME/NT/2000. +refers to any of Windows-95/98/ME/NT/2000/XP/Vista/7. 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 @@ -27066,8 +27066,7 @@ distribution. * PC Binary Installation:: Installing a prepared distribution. * PC Compiling:: Compiling @command{gawk} for MS-DOS, Windows32, and OS/2. -* PC Dynamic:: Compiling @command{gawk} for dynamic - libraries. +* PC Testing:: Testing @command{gawk} on PC systems. * PC Using:: Running @command{gawk} on MS-DOS, Windows32 and OS/2. * Cygwin:: Building and running @command{gawk} for @@ -27118,42 +27117,29 @@ or more detailed installation instructions. @command{gawk} can be compiled for MS-DOS, Windows32, and OS/2 using the GNU development tools from DJ Delorie (DJGPP; MS-DOS only) or Eberhard -Mattes (EMX; MS-DOS, Windows32 and OS/2). Microsoft Visual C/C++ can be used -to build a Windows32 version, and Microsoft C/C++ can be -used to build 16-bit versions for MS-DOS and OS/2. -@strong{FIXME:} -(As of @command{gawk} 3.1.2, the MSC version doesn't work. However, -the maintainer is working on fixing it.) -The file +Mattes (EMX; MS-DOS, Windows32 and OS/2). The file @file{README_d/README.pc} in the @command{gawk} distribution contains additional notes, and @file{pc/Makefile} contains important information on compilation options. -To build @command{gawk} for MS-DOS, Windows32, and OS/2 (16 bit only; for 32 bit -(EMX) you can use the @command{configure} script and skip the following paragraphs; -for details see below), copy the files in the @file{pc} directory (@emph{except} -for @file{ChangeLog}) to the directory with the rest of the @command{gawk} -sources. The @file{Makefile} contains a configuration section with comments and -may need to be edited in order to work with your @command{make} utility. - -The @file{Makefile} contains a number of targets for building various MS-DOS, -Windows32, 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 @samp{make djgpp}. -(The DJGPP tools may be found at -@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.) - -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 @file{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 -@file{test/Makefile} is required. It is recommended that you copy the file -@file{pc/Makefile.tst} over the file @file{test/Makefile} as a -replacement. Details can be found in @file{README_d/README.pc} -and in the file @file{pc/Makefile.tst}. - +@cindex compiling @command{gawk} for DOS and Windows +To build @command{gawk} for MS-DOS and Windows32, copy the files in +the @file{pc} directory (@emph{except} for @file{ChangeLog}) to the +directory with the rest of the @command{gawk} sources, then invoke +@command{make} with the appropriate target name as an argument to +build @command{gawk}. The @file{Makefile} copied from the @file{pc} +directory contains a configuration section with comments and may need +to be edited in order to work with your @command{make} utility. + +The @file{Makefile} supports a number of targets for building various +MS-DOS and Windows32 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 @samp{make djgpp}. +(The DJGPP tools needed for the build may be found at +@uref{ftp://ftp.delorie.com/pub/djgpp/current/v2gnu/}.) To build a +native MS-Windows binary of @command{gawk}, type @samp{make mingw32}. + +@cindex compiling @command{gawk} with EMX for OS/2 and Windows The 32 bit EMX version of @command{gawk} works ``out of the box'' under OS/2. In principle, it is possible to compile @command{gawk} the following way: @@ -27162,7 +27148,7 @@ $ ./configure $ make @end example -This is not recommended, though. To get an OMF executable you should +This is not recommended, though. To get an OMF executable you should use the following commands at your @command{sh} prompt: @example @@ -27178,7 +27164,7 @@ $ ./configure --prefix=c:/usr --without-included-gettext $ make AR=emxomfar @end example -These are just suggestions. You may use any other set of (self-consistent) +These are just suggestions. You may use any other set of (self-consistent) environment variables and compiler flags. To get an FHS-compliant file hierarchy it is recommended to use the additional @@ -27214,81 +27200,40 @@ $ make @end example @quotation NOTE -Versions later than GCC 2.95, i.e., GCC 3.x using the Innotek libc were not tested. -@end quotation - -@quotation NOTE -Even if the compiled @command{gawk.exe} (@code{a.out}) executable -contains a DOS header, it does @emph{not} work under DOS. To compile an executable -that runs under DOS, @code{"-DPIPES_SIMULATED"} must be added to @env{CPPFLAGS}. -But then some nonstandard extensions of @command{gawk} (e.g., @samp{|&}) do not work! +Versions later than GCC 2.95, i.e., GCC 3.x using the Innotek libc +were not tested. @end quotation -After compilation the internal tests can be performed. Enter -@samp{make check CMP="diff -a"} at your command prompt. All tests +After compilation the internal tests can be performed. Enter +@samp{make check CMP="diff -a"} at your command prompt. All tests except for the @code{pid} test are expected to work properly. The @code{pid} test fails because child processes are not started by @code{fork()}. -@samp{make install} works as expected. +@samp{make install} works as expected with the EMX build. @quotation NOTE Most OS/2 ports of GNU @command{make} are not able to handle -the Makefiles of this package. If you encounter any problems with @command{make} -try GNU Make 3.79.1 or later versions. You should find the latest -version on +the Makefiles of this package. If you encounter any problems with +@command{make}, try GNU Make 3.79.1 or later versions. You should +find the latest version on @c @uref{http://www.unixos2.org/sw/pub/binary/make/} or on @uref{ftp://hobbes.nmsu.edu/pub/os2/}. @end quotation -@node PC Dynamic -@appendixsubsubsec Compiling @command{gawk} For Dynamic Libraries - -@c From README_d/README.pcdynamic -@c 11 June 2003 - -To compile @command{gawk} with dynamic extension support, -uncomment the definitions of @code{DYN_FLAGS}, @code{DYN_EXP}, -@code{DYN_OBJ}, and @code{DYN_MAKEXP} in the configuration section of -the @file{Makefile}. There are two definitions for @code{DYN_MAKEXP}: -pick the one that matches your target. - -To build some of the example extension libraries, @command{cd} to the -extension directory and copy @file{Makefile.pc} to @file{Makefile}. You -can then build using the same two targets. To run the example -@command{awk} scripts, you'll need to either change the call to -the @code{extension()} function to match the name of the library (for -instance, change @code{"./ordchr.so"} to @code{"ordchr.dll"} or simply -@code{"ordchr"}), or rename the library to match the call (for instance, -rename @file{ordchr.dll} to @file{ordchr.so}). - -If you build @command{gawk.exe} with one compiler but want to build -an extension library with the other, you need to copy the import -library. Visual C uses a library called @file{gawk.lib}, while MinGW uses -a library called @file{libgawk.a}. These files are equivalent and will -interoperate if you give them the correct name. The resulting shared -libraries are also interoperable. - -To create your own extension library, you can use the examples as models, -but you're essentially on your own. Post to @code{comp.lang.awk} or -send electronic mail to @email{ptjm@@interlog.com} if you have problems getting -started. If you need to access functions or variables which are not -exported by @command{gawk.exe}, add them to @file{gawkw32.def} and -rebuild. You should also add @code{ATTRIBUTE_EXPORTED} to the declaration -in @file{awk.h} of any variables you add to @file{gawkw32.def}. - -Note that extension libraries have the name of the @command{awk} -executable embedded in them at link time, so they will work only -with @command{gawk.exe}. In particular, they won't work if you -rename @command{gawk.exe} to @command{awk.exe} or if you try to use -@command{pgawk.exe}. You can perform profiling by temporarily renaming -@command{pgawk.exe} to @command{gawk.exe}. You can resolve this problem -by changing the program name in the definition of @code{DYN_MAKEXP} -for your compiler. - -On Windows32, libraries are sought first in the current directory, then in -the directory containing @command{gawk.exe}, and finally through the -@env{PATH} environment variable. +@node PC Testing +@appendixsubsubsec Testing @command{gawk} on PC Operating Systems + +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 @file{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 +@file{test/Makefile} is required. It is recommended that you copy the file +@file{pc/Makefile.tst} over the file @file{test/Makefile} as a +replacement. Details can be found in @file{README_d/README.pc} +and in the file @file{pc/Makefile.tst}. @node PC Using @appendixsubsubsec Using @command{gawk} on PC Operating Systems @@ -27300,7 +27245,7 @@ the directory containing @command{gawk.exe}, and finally through the With the exception of the Cygwin environment, the @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}) -are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support +are not supported for MS-DOS or MS-Windows. EMX (OS/2 only) does support at least the @samp{|&} operator. @cindex search paths @@ -27309,13 +27254,14 @@ at least the @samp{|&} operator. @cindex @code{;} (semicolon), @code{AWKPATH} variable and @cindex semicolon (@code{;}), @code{AWKPATH} variable and @cindex @code{AWKPATH} environment variable -The OS/2 and MS-DOS versions of @command{gawk} search for program files as -described in @ref{AWKPATH 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 for OS/2 (16 bit) and MS-DOS versions is +The MS-DOS and MS-Windows versions of @command{gawk} search for +program files as described in @ref{AWKPATH 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 for MS-Windows and MS-DOS versions is @code{@w{".;c:/lib/awk;c:/gnu/lib/awk"}}. +@cindex @code{UNIXROOT} variable, on OS/2 systems The search path for OS/2 (32 bit, EMX) is determined by the prefix directory (most likely @file{/usr} or @file{c:/usr}) that has been specified as an option of the @command{configure} script like it is the case for the Unix versions. @@ -27323,25 +27269,19 @@ If @file{c:/usr} is the prefix directory then the default search path contains @ and @file{c:/usr/share/awk}. Additionally, to support binary distributions of @command{gawk} for OS/2 systems whose drive @samp{c:} might not support long file names or might not exist -at all, there is a special environment variable. If @env{UNIXROOT} specifies +at all, there is a special environment variable. If @env{UNIXROOT} specifies a drive then this specific drive is also searched for program files. E.g., if @env{UNIXROOT} is set to @file{e:} the complete default search path is @code{@w{".;c:/usr/share/awk;e:/usr/share/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 Bash to MS-DOS using the DJGPP tools, -and several shells are available for OS/2, including @command{ksh}. The file -@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 @code{ignoretype} option may also be of interest. +or @command{cmd.exe} under Windows or OS/2) may be useful for @command{awk} programming. +The DJGPP collection of tools includes an MS-DOS port of Bash, +and several shells are available for OS/2, including @command{ksh}. @cindex differences in @command{awk} and @command{gawk}, @code{BINMODE} variable @cindex @code{BINMODE} variable -Under OS/2 and DOS, @command{gawk} (and many other text programs) silently +Under Windows, OS/2 and DOS, @command{gawk} (and many other text programs) silently translate end-of-line @code{"\r\n"} to @code{"\n"} on input and @code{"\n"} to @code{"\r\n"} on output. A special @code{BINMODE} variable allows control over these translations and is interpreted as follows: @@ -27428,13 +27368,15 @@ moved into the @code{BEGIN} rule. @node Cygwin @appendixsubsubsec Using @command{gawk} In The Cygwin Environment +@cindex Cygwin build of @command{gawk} +@cindex using @command{gawk} on Cygwin -@command{gawk} can be used ``out of the box'' under Windows if you are -using the @uref{http://www.cygwin.com, Cygwin environment}. +@command{gawk} can be built and used ``out of the box'' under Windows +if you are using the @uref{http://www.cygwin.com, Cygwin environment}. This environment provides an excellent simulation of Unix, using the -GNU tools, such as Bash, the GNU Compiler Collection (GCC), -GNU Make, and other GNU tools. Compilation and installation for Cygwin -is the same as for a Unix system: +GNU tools, such as Bash, the GNU Compiler Collection (GCC), GNU Make, +and other GNU tools. Compilation and installation for Cygwin is the +same as for a Unix system: @example tar -xvpzf gawk-@value{VERSION}.@value{PATCHLEVEL}.tar.gz @@ -27451,19 +27393,19 @@ and then the @samp{make} proceeds as usual. The @samp{|&} operator and TCP/IP networking (@pxref{TCP/IP Networking}) are fully supported in the Cygwin environment. This is not true -for any other environment for MS-Windows. +for any other environment on MS-Windows. @end quotation @node MSYS @appendixsubsubsec Using @command{gawk} In The MSYS Environment In the MSYS environment under Windows, @command{gawk} automatically -uses binary mode for reading and writing files. Thus there is no +uses binary mode for reading and writing files. Thus there is no need to use the @code{BINMODE} variable. This can cause problems with other Unix-like components that have been ported to Windows that expect @command{gawk} to do automatic -translation of @code{"\r\n"}, since it won't. Caveat Emptor! +translation of @code{"\r\n"}, since it won't. Caveat Emptor! @node VMS Installation @appendixsubsec How to Compile and Install @command{gawk} on VMS diff --git a/extension/ChangeLog b/extension/ChangeLog index 22dabf9f..e531d8f7 100644 --- a/extension/ChangeLog +++ b/extension/ChangeLog @@ -1,3 +1,7 @@ +Sat Dec 18 20:22:44 2010 Arnold D. Robbins <arnold@skeeve.com> + + * pcext.def: Removed, since we don't support MSFT compilers. + Wed Nov 24 20:08:13 2010 Arnold D. Robbins <arnold@skeeve.com> * arrayparm.c, dl.c, filefuncs.c, fork.c, ordchr.c, readfile.c, diff --git a/extension/pcext.def b/extension/pcext.def deleted file mode 100644 index 696907f6..00000000 --- a/extension/pcext.def +++ /dev/null @@ -1,2 +0,0 @@ -EXPORTS
-dlload @1
@@ -35,15 +35,11 @@ #ifdef __EMX__ #include "pc/gawkmisc.pc" #else /* not __EMX__ */ -#if defined(OS2) -#include "gawkmisc.pc" -#else /* not OS2 */ #if defined(VMS) #include "vms/gawkmisc.vms" #else /* not VMS */ #include "posix/gawkmisc.c" #endif /* not VMS */ -#endif /* not OS2 */ #endif /* not __EMX__ */ /* xmalloc --- provide this so that other GNU library routines work */ @@ -212,7 +212,7 @@ extern NODE *ARGIND_node; extern NODE *ERRNO_node; extern NODE **fields_arr; -#if defined(OS2) || defined(__EMX__) || defined(__CYGWIN__) +#if defined(__EMX__) || defined(__CYGWIN__) /* binmode --- convert BINMODE to string for fopen */ static const char * @@ -2074,7 +2074,7 @@ gawk_pclose(struct redirect *rp) * except if popen() provides real pipes too */ -#if defined(VMS) || defined(OS2) || defined(__EMX__) +#if defined(VMS) || defined(__EMX__) /* gawk_popen --- open an IOBUF on a child process */ @@ -2115,7 +2115,7 @@ gawk_pclose(struct redirect *rp) rp->ifp = NULL; return (rval < 0 ? rval : aval); } -#else /* not (VMS || OS2) */ +#else /* not (VMS || __EMX__) */ static struct pipeinfo { char *command; @@ -2169,7 +2169,7 @@ gawk_pclose(struct redirect *rp) efree(pipes[cur].command); return rval; } -#endif /* not (VMS || OS2) */ +#endif /* not (VMS || __EMX__) */ #endif /* PIPES_SIMULATED */ @@ -994,7 +994,7 @@ init_vars() static NODE * load_environ() { -#if ! defined(OS2) && ! (defined(VMS) && defined(__DECC)) +#if ! (defined(VMS) && defined(__DECC)) extern char **environ; #endif char *var, *val; diff --git a/pc/ChangeLog b/pc/ChangeLog index 9da36a16..bcccabfe 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,25 @@ +Sat Dec 18 20:13:35 2010 Eli Zaretskii <eliz@gnu.org> + + * popen.h: Remove the parts conditioned by _MSC_VER and OS2. Use + __DJGPP__ instead of __GO32__. + + * popen.c (popen, pclose) [OS2, _MSC_VER]: Remove definitions. + (unixshell, scriptify, os_pclose): Remove OS2 parts. + + * getid.c: Remove the parts conditioned by _MSC_VER and OS2. + + * config.h: Remove the parts conditioned by _MSC_VER. + + * Makefile: Drop support for DJGPP v1.x and for Microsoft + compilers on DOS/Windows. + + * gawkmisc.pc (setenv, unsetenv) [__MINGW32__]: Emulations for MinGW. + + * Makefile (DLMINGW32): New variable. + (mingw32): Pass it to sub-Make. + + * dlfnc.h, dlfcn.c, include/*: Removed. + Mon Nov 29 20:10:00 2010 Eli Zaretskii <eliz@gnu.org> * config.h (HAVE_STRFTIME): Don't define for __MINGW32__. Define diff --git a/pc/Makefile b/pc/Makefile index 33afe284..4e0511a7 100644 --- a/pc/Makefile +++ b/pc/Makefile @@ -1,35 +1,34 @@ -# Makefile for gawk (GNU awk) Dec 2000 +# Makefile for gawk (GNU awk) Dec 2010 # -# - for GNU C (djgpp) [32bit executable for DOS] +# - for GNU C (djgpp) [32bit protected-mode executable for DOS] # - for GNU C (emx) [32bit executable for OS/2 or DOS or Windows32] -# - for GNU C (mingw32) [Windows32 executable for Windows 9x/NT] -# - for MS-Visual C/C++ 4.x [Windows32 executable for Windows 9x/NT] -# - for Microsoft C 7 [16bit ececutable for DOS] -# - for Microsoft C 6.00A [16bit executable for OS/2 or DOS] +# - for GNU C (mingw32) [Windows32 executable for Windows 9x/NT/2K/XP/7] -# Tested with GNU make and dmake-3.8 under OS/2 and DOS, and ndmake and -# Microsoft nmake under DOS. Compiling with dmake under DOS may require the -# DOS-only version of dmake (so that swapping works). nmake requires a -# few edits in the configuration section below. +# Tested with GNU make on Windows, OS/2 and DOS. default: @echo "Enter $(MAK) target " - @echo " where 'target' is chosen from " + @echo " where 'target' is chosen from " @echo " djgpp ... DOS 32-bit exe [GNU C, Delorie, v2] " - @echo " djgppv1 . DOS 32-bit exe [GNU C, Delorie, v1] " @echo " emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] " @echo " emxnt ... NT exe [emx/gcc with RSXNT] " @echo " emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc] " @echo " mingw32 . Windows32 exe [Mingw32 GNU C] " - @echo " msc ..... DOS exe [Microsoft C 7 & 8 (AKA 1.52)] " - @echo " msc6 .... DOS exe [Microsoft C 6.00a] " - @echo " msc6os2 . OS/2 exe [Microsoft C 6.00a] " - @echo " msc6bnd . OS/2 and DOS exe [Microsoft C 6.00a] " - @echo " vcWin32 . Windows32 exe [Microsoft Visual C] " @echo " ----------------------------------------------------- " @echo " test .... Perform tests (see README_d/README.pc) " @echo " install . Install gawk under $(prefix)/ " +# Support dropped in 4.0 +# - for DJGPP v1.x [DOS 32bit protected-mode executable] +# - for MS-Visual C/C++ 4.x [Windows32 executable for Windows 9x/NT] +# - for Microsoft C 7 [16bit ececutable for DOS] +# - for Microsoft C 6.00A [16bit executable for OS/2 or DOS] +# @echo " djgppv1 . DOS 32-bit exe [GNU C, Delorie, v1] " +# @echo " msc ..... DOS exe [Microsoft C 7 & 8 (AKA 1.52)] " +# @echo " msc6 .... DOS exe [Microsoft C 6.00a] " +# @echo " msc6os2 . OS/2 exe [Microsoft C 6.00a] " +# @echo " msc6bnd . OS/2 and DOS exe [Microsoft C 6.00a] " +# @echo " vcWin32 . Windows32 exe [Microsoft Visual C] " # Support dropped in 3.0 # - for Microsoft C 5.1 [16bit executable for OS/2 or DOS] # @echo " msc51 DOS exe [Microsoft C 5.1] " @@ -46,14 +45,6 @@ DRSPFILE = dgawk.rsp #LDRSP = $(GAWKOBJS) #LNKRSP = $(LDRSP) # -# else if make == dmake -# Response files for linker: dmake allows the macro expansion -# $(macro_name:modifier_list:modifier_list:...) -# The macro mktmp creates a temporary file for the linker. -# The 't' modifier is for tokenization. -#LDRSP = @$(mktmp $(<:t"\n")) -#LNKRSP = @$(mktmp $(<:t"+\n") ) # Space before final paren req -# # else use brain-dead approach (emxbnd will need 'tr'). RSP = $(RSPFILE) PRSP = $(PRSPFILE) @@ -83,27 +74,13 @@ pkgdatadir = $(prefix)/lib/awk install = 1 #------------------------------------------------------------------------ # To work around command-line length problems, this makefile assumes -# that $($X) can be expanded. If using a make (such as nmake) which -# cannot handle such macros, define DO_LNK and DO_BIND for your target -# as $(L<target>) and $(B<target>), resp.; e.g., -#DO_LNK = $(LvcWin32) -#DO_PLNK = $(PLvcWin32) -# and then comment the following: +# that $($X) can be expanded. DO_LNK = $($(LNK)) DO_BIND= $($(BIND)) DO_PLNK = $($(PLNK)) DO_PBIND= $($(PBIND)) DO_DLNK = $($(DLNK)) DO_DBIND= $($(DBIND)) -#------------------------------------------------------------------------ -# For dynamic extension support, uncomment these lines -# pick the appropriate .def file entry for your compiler -#DYN_FLAGS=-DDYNAMIC -#DYN_EXP=gawk.exp -#DYN_OBJ=dlfcn$O $(DYN_EXP) -#DYN_MAKEXP=$(DMEvcWin32) -#DYN_MAKEXP=$(DMEmingw32) -# #======================================================================== # End of general configuration. Some platform-specific configuration # notes appear below. @@ -133,16 +110,6 @@ djgpp-debug: LNK=LDJG PLNK=PLDJG DLNK=DLDJG LF2=-lm \ BIND=BDJG PBIND='' DBIND='' -LDJGv1 = $(CC) $(LF) -o gawk $(LDRSP) $(LF2) -#BDJGv1 = coff2exe -s /djgpp/bin/go32.exe gawk -BDJGv1 = coff2exe gawk - -djgppv1: - $(MAK) all \ - CC=gcc O=.o CF=-O \ - LNK=LDJGv1 LF=-s LF2=-lm \ - BIND=BDJGv1 - #======================================================================== #========================== EMX ========================================= #======================================================================== @@ -187,132 +154,17 @@ emxbnd-debug: #========================== MINGW32 ===================================== #======================================================================== -DMEmingw32 = dlltool -D gawk.exe -d gawkw32.def -e gawk.exp -l libgawk.a - LMINGW32 = $(CC) $(LF) -o $@ $(GAWKOBJS) $(LF2) PLMINGW32 = $(CC) $(LF) -o $@ $(PGAWKOBJS) $(LF2) +DLMINGW32 = $(CC) $(LF) -o $@ $(DGAWKOBJS) $(LF2) # The following might work around command-line length limitations: #LMINGW32 = $(CC) $(LF) -o $@ *.o $(LF2) mingw32: $(MAK) all \ CC=gcc O=.o CF="-O2 -gdwarf-2 -g3" OBJ=popen.o \ - LNK=LMINGW32 PLNK=PLMINGW32 LF="-gdwarf-2 -g3" LF2=-lmsvcp60 RSP= - -#======================================================================== -#========================== MSC ========================================= -#======================================================================== - -# stdargv, glob, and director are from Stewartson's sh. These provide -# globbing and enhanced argument-passing. MSC setargv.obj is a -# more limited alternative (and it will permit a bound version). -#STDARGV = stdargv.obj glob.obj director.obj -STDARGV = setargv.obj - -# Optimization and library options: -# Os == optimize for size, Ot == optimize for speed, G2 == 286 or better -#MSCOPT = -Gt3600 -Os -G2 -# MSC seems to be more stable with -Od than with -Ot, but then regexec.c gives -# "code segment too large" error when compiling. Adding -G2y fixes this and -# lets us keep the -Od. -MSCOPT = -Gt3600 -Od -G2y -# Alternate lib, does not use math coprocessor. -#MSCLIB = llibca -#MSCCL = -FPa -# Emulator lib, uses math coprocessor if present. -MSCLIB = llibce -MSCCL = -FPi -#MSCCL = -FPc - -# If the stack gets much smaller than 3000, the "longwrds" test fails. -LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x2eb0,nul - - -# CLMSC-linking works when building under OS/2 -CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00 - -BMSC = bind $@ /n DOSMAKEPIPE DOSCWAIT - - -# Ugly hack: config.h defines __STDC__ if not defined on command-line. -# OS/2 versions can't use -Za in getid.c. MSC7 uses stub headers in pc/ -# due to ANSI conflicts. MSC 5.1 defines __STDC__=0 regardless of ANSI flag. - -# dmake-3.8 runs out of memory under DOS. Request that dmake -# swap itself out on these targets. Note that this won't have -# any affect on the bound OS/2 and DOS version of dmake-3.8. - -.SWAP: msc msc-debug msc6 msc6os2 msc6bnd msc51 check - -msc: - $(MAK) all \ - "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include $(MSCOPT)" \ - OBJ=popen.obj \ - LNK=LMSC P=+ -Lmsc = $(LMSC) # for broken makes (nmake) which cannot expand $($X) -Bmsc = - -msc-debug: - $(MAK) all \ - "CC=cl $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include -W2 -Zi -Od" \ - OBJ=popen.obj \ - LNK=LMSC LF2=/CO P=+ - -msc6: -# $(MAK) builtin.obj \ -# "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT) -Od" - $(MAK) all \ - "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT)" \ - OBJ=popen.obj \ - LNK=LMSC P=+ -Lmsc6 = $(LMSC) # for broken makes (nmake) which cannot expand $($X) -Bmsc6 = - -msc6os2: -# $(MAK) builtin.obj \ -# "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -DOS2 -UMSDOS $(MSCOPT) -Od" - $(MAK) all \ - "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 -UMSDOS $(MSCOPT)" \ - LNK=LMSC "LF2=p,gawk.def" P=+ - -msc6bnd: -# $(MAK) builtin.obj \ -# "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -DOS2 $(MSCOPT) -Od" - $(MAK) all \ - "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 $(MSCOPT)" \ - OBJ=popen.obj \ - LNK=LMSC "LF2=p,gawk.def" P=+ \ - BIND=BMSC -Lmsc6bnd = $(LMSC) # for broken makes (nmake) which cannot expand $($X) -Bmsc6bnd = $(BMSC) - - -# Windows '9x / NT -DMEvcWin32 = lib /def:gawkw32.def /name:gawk.exe /out:gawk.lib -LvcWin32 = link -nologo -subsystem:console -release -out:$@ $(LNKRSP) -PLvcWin32 = link -nologo -subsystem:console -release -out:$@ $(PLDRSP) - -vcWin32: - $(MAK) all \ - "CC=cl -nologo" O=.obj "CF=-o2 -DWIN32 -D__STDC__=0" \ - OBJ=popen.obj \ - LNK=LvcWin32 - - -# Support dropped in 3.0 -#msc51: -# $(MAK) all \ -# "CC=cl $(MSCCL)" O=.obj "CF=-AL -Za -D_MSC_VER=510 $(MSCOPT)" \ -# OBJ=popen.obj \ -# LNK=LMSC P=+ -# -#msc51bnd: -# $(MAK) all \ -# "CC=cl -AL ($MSCCL)" O=.obj "CF=-DOS2 -D_MSC_VER=510 $(MSCOPT)" \ -# OBJ=popen.obj \ -# LNK=CLMSC "LF=-Lp -Fb" "LF2=gawk.def" - -#======================================================================== + LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32 \ + LF="-gdwarf-2 -g3" LF2=-lmsvcp60 RSP= # Define BIND for BINDless compiles, otherwise $($(BIND)) may break. BIND = EMPTY @@ -408,7 +260,7 @@ alloca$O: alloca.c install: install$(install) -install1: +install1: echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd echo shift >> igawk.cmd cat pc/awklib/igawk >> igawk.cmd diff --git a/pc/config.h b/pc/config.h index 76250eac..04ab519d 100644 --- a/pc/config.h +++ b/pc/config.h @@ -166,11 +166,6 @@ /* Define if you have the vprintf function. */ #define HAVE_VPRINTF 1 -/* Define as __inline if that's what the C compiler calls it. */ -#if defined (_MSC_VER) -#define inline -#endif - #ifdef __GNUC__ #define inline __inline__ /* Define to 1 if you have the <stddef.h> header file. */ @@ -474,7 +469,7 @@ /* #undef HAVE_CATGETS */ /* The size of `unsigned int' & `unsigned long', as computed by sizeof. */ -#if defined(DJGPP) || defined(_MSC_VER) || defined(__MINGW32__) +#if defined(DJGPP) || defined(__MINGW32__) # include <limits.h> #endif @@ -497,32 +492,9 @@ # define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk" #endif -#if defined (_MSC_VER) -#if !defined(__STDC__) -# define __STDC__ 1 -#endif -#undef HAVE_UNISTD_H -#undef HAVE_SYS_PARAM_H -#undef HAVE_RANDOM -/* msc strftime is incomplete, use supplied version */ -#undef HAVE_STRFTIME -/* #define HAVE_TM_ZONE */ -#define altzone timezone -#endif - #define HAVE_POPEN_H 1 -#if defined(_MSC_VER) && defined(MSDOS) -#define system(s) os_system(s) -#endif - -#ifdef _MSC_VER -#define ssize_t long int /* DJGPP has ssize_t */ -#define intmax_t long -#define uintmax_t unsigned long -#endif - -#if defined (_MSC_VER) || defined(__EMX__) +#if defined(__EMX__) #define strcasecmp stricmp #define strncasecmp strnicmp #endif @@ -542,26 +514,14 @@ #include <crtrsxnt.h> #endif -/* For vcWin32 */ -#if defined(WIN32) && defined(_MSC_VER) -#define alloca _alloca -#define system(s) os_system(s) -/* VC++ dosen't supprt restrict keyword */ -#define restrict -/* VC++ have tmpfile */ -#define HAVE_TMPFILE -/* sys/time.h is not exist in VC++? */ -#undef TIME_WITH_SYS_TIME -#endif - #if defined(__MINGW32__) #undef HAVE_SYS_PARAM_H #endif -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(__MINGW32__) # define WEXITSTATUS(stat_val) ((stat_val) & ~0xC0000000) #endif - + #ifdef __MINGW32__ #define HAVE_USLEEP 1 #endif diff --git a/pc/dlfcn.c b/pc/dlfcn.c deleted file mode 100644 index f2394c63..00000000 --- a/pc/dlfcn.c +++ /dev/null @@ -1,84 +0,0 @@ -/*
-** dlfcn.c -- limited implementation of posix dynamic loading functions
-*/
-
-/*
- * Copyright (C) 2003 the Free Software Foundation, Inc.
- *
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- *
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include <dlfcn.h>
-#include <errno.h>
-#include <windows.h>
-
-/* open the library file. We currently ignore flags. */
-void *dlopen(const char * libname, int flags)
-{
- HMODULE libH;
-
-
- /* if libname is specified, we need to load a library of that name */
- if (libname) {
- libH = LoadLibrary(libname);
- }
-
- /* otherwise, we're supposed to return a handle to global symbol
- * information, which includes the executable and all libraries loaded
- * with RTLD_GLOBAL. For our purposes, it doesn't really matter, so
- * we simply return the handle to the .exe */
- else {
- libH = GetModuleHandle(NULL);
- }
-
- return (void *)libH;
-}
-
-
-/* don't need the library any more */
-int dlclose(void * libH)
-{
- int rc;
-
- if (FreeLibrary((HMODULE)libH)) {
- rc = 0;
- }
- else {
- rc = -1;
- }
-
- return rc;
-}
-
-/* find the symbol */
-void *dlsym(void * /*restrict*/ libH, const char * /*restrict*/ fnName)
-{
- return (void *)GetProcAddress((HMODULE)libH, fnName);
-}
-
-char *dlerror(void)
-{
- static char errbuf[1024];
-
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(),
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), errbuf, sizeof(errbuf), NULL);
-
- return errbuf;
-}
-
-
diff --git a/pc/dlfcn.h b/pc/dlfcn.h deleted file mode 100644 index bb7366bc..00000000 --- a/pc/dlfcn.h +++ /dev/null @@ -1,41 +0,0 @@ -/*
-** dlfcn.h -- limited implementation of posix dynamic loading functions
-*/
-
-/*
- * Copyright (C) 2003 the Free Software Foundation, Inc.
- *
- * This file is part of GAWK, the GNU implementation of the
- * AWK Programming Language.
- *
- * GAWK is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef _DLFCN_H
-#define _DLFCN_H
-
-/* symbols required by susv3. These are not supported here (everything is
- * RTLD_NOW, RTLD_GLOBAL) */
-#define RTLD_LAZY 0
-#define RTLD_NOW 1
-#define RTLD_GLOBAL 0
-#define RTLD_LOCAL 2
-
-int dlclose(void *);
-char *dlerror(void);
-void *dlopen(const char *, int);
-void *dlsym(void * /*restrict*/, const char * /*restrict*/);
-
-#endif
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc index 1355449c..0fd3a8f4 100644 --- a/pc/gawkmisc.pc +++ b/pc/gawkmisc.pc @@ -461,3 +461,39 @@ _os2_unixroot_path(const char *path) return (result) ? (const char*) result : path; } #endif /* __EMX__ */ + +#ifdef __MINGW32__ + +extern void *xmalloc (size_t); + +int +setenv (const char *name, const char *value, int rewrite) +{ + char *entry; + + if (*value == '=') + ++value; + + if (getenv (name) && !rewrite) + return 0; + + entry = xmalloc (strlen (name) + 1 + strlen (value) + 1); + strcat (strcat (strcpy (entry, name), "="), value); + if (putenv (entry) != 0) + { + free (entry); + return -1; + } + return 0; +} + +int +unsetenv (const char *name) +{ + if (!name || !*name || strchr (name, '=') != NULL) + return -1; + + return setenv (name, "", 1); +} + +#endif /* __MINGW32__ */ @@ -1,24 +1,6 @@ -#if defined(_MSC_VER) || defined(__MINGW32__) - -#ifdef OS2 -# define INCL_DOSPROCESS -# include <os2.h> -# if _MSC_VER == 510 -# define DosGetPID DosGetPid -# endif -#else -# include <process.h> -#endif - -#ifdef OS2 -int getpid(void) -{ - PIDINFO PidInfo; +#ifdef __MINGW32__ - DosGetPID(&PidInfo); - return(PidInfo.pid); -} -#endif +#include <process.h> unsigned int getuid (void) { @@ -40,23 +22,16 @@ unsigned int getegid (void) return (0); } -#endif +#endif /* __MINGW32__ */ int getpgrp(void) { return (0); } -#if defined(_MSC_VER) || defined(__GO32__) || defined(__MINGW32__) +#if defined(__DJGPP__) || defined(__MINGW32__) int getppid(void) { -#ifdef OS2 - PIDINFO PidInfo; - - DosGetPID(&PidInfo); - return(PidInfo.pidParent); -#else - return(0); -#endif + return (0); } -#endif +#endif /* __DJGPP__ || __MINGW32__ */ diff --git a/pc/include/fcntl.h b/pc/include/fcntl.h deleted file mode 100644 index 5ebc7a6b..00000000 --- a/pc/include/fcntl.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <fcntl.h>
-#define __STDC__ 1
diff --git a/pc/include/process.h b/pc/include/process.h deleted file mode 100644 index f511d5f7..00000000 --- a/pc/include/process.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <process.h>
-#define __STDC__ 1
diff --git a/pc/include/stdio.h b/pc/include/stdio.h deleted file mode 100644 index 25fb7c97..00000000 --- a/pc/include/stdio.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <stdio.h>
-#define __STDC__ 1
diff --git a/pc/include/stdlib.h b/pc/include/stdlib.h deleted file mode 100644 index 0789b242..00000000 --- a/pc/include/stdlib.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <stdlib.h>
-#define __STDC__ 1
diff --git a/pc/include/string.h b/pc/include/string.h deleted file mode 100644 index 48e942fa..00000000 --- a/pc/include/string.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <string.h>
-#define __STDC__ 1
diff --git a/pc/include/sys/stat.h b/pc/include/sys/stat.h deleted file mode 100644 index 904d056e..00000000 --- a/pc/include/sys/stat.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <sys/stat.h>
-#define __STDC__ 1
diff --git a/pc/include/sys/types.h b/pc/include/sys/types.h deleted file mode 100644 index b942dda8..00000000 --- a/pc/include/sys/types.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <sys/types.h>
-#define __STDC__ 1
diff --git a/pc/include/time.h b/pc/include/time.h deleted file mode 100644 index b4a9ea3f..00000000 --- a/pc/include/time.h +++ /dev/null @@ -1,3 +0,0 @@ -#undef __STDC__
-#include <time.h>
-#define __STDC__ 1
@@ -4,18 +4,6 @@ #include <string.h> #include <process.h> -#ifdef OS2 -#ifdef _MSC_VER -#define popen(c,m) _popen(c,m) -#define pclose(f) _pclose(f) -#endif -#endif - -#if defined(WIN32) && defined(_MSC_VER) -#define popen _popen -#define pclose _pclose -#endif - #ifndef _NFILE #define _NFILE 40 #endif @@ -36,7 +24,7 @@ static struct { * Currently, only MSC (running under DOS) and MINGW versions are managed. */ -#if defined(_MSC_VER) || defined(__MINGW32__) +#if defined(__MINGW32__) static int unixshell(char *p) @@ -131,11 +119,6 @@ os_system(const char *cmd) int i; char *cmd1; -#if defined(OS2) - if (_osmode == OS2_MODE) - return(system(cmd)); -#endif - if ((cmd1 = scriptify(cmd)) == NULL) return(1); if (s = getenv("SHELL")) i = spawnlp(P_WAIT, s, s, cmd1 + strlen(s), NULL); @@ -144,7 +127,7 @@ os_system(const char *cmd) unlink_and_free(cmd1); return(i); } -#else +#else /* !__MINGW32__ */ #define os_system(cmd) system(cmd) #endif @@ -156,20 +139,15 @@ os_popen(const char *command, char *mode ) char *name; int cur; char curmode[4]; -#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32)) +#if defined(__MINGW32__) char *cmd; #endif - -#if defined(OS2) && (_MSC_VER != 510) - if (_osmode == OS2_MODE) - return(popen(command, mode)); -#endif if (*mode != 'r' && *mode != 'w') return NULL; strncpy(curmode, mode, 3); curmode[3] = '\0'; -#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32)) +#if defined(__MINGW32__) current = popen(cmd = scriptify(command), mode); cur = fileno(current); strcpy(pipes[cur].pmode, curmode); @@ -217,12 +195,7 @@ os_pclose( FILE * current) int cur = fileno(current); int fd, rval; -#if defined(OS2) && (_MSC_VER != 510) - if (_osmode == OS2_MODE) - return(pclose(current)); -#endif - -#if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32)) +#if defined(__MINGW32__) rval = pclose(current); *pipes[cur].pmode = '\0'; unlink_and_free(pipes[cur].command); @@ -1,21 +1,13 @@ /* ** popen.h -- prototypes for pipe functions */ - -#if defined (OS2) && !defined(MSDOS) /* OS/2, but not family mode */ -# if defined (_MSC_VER) -# define popen(c, m) _popen(c, m) -# define pclose(f) _pclose(f) +#if !defined (__DJGPP__) +# if defined (popen) +# undef popen +# undef pclose # endif -#else -# if !defined (__GO32__) -# if defined (popen) -# undef popen -# undef pclose -# endif -# define popen(c, m) os_popen(c, m) -# define pclose(f) os_pclose(f) - extern FILE *os_popen( const char *, const char * ); - extern int os_pclose( FILE * ); -# endif -#endif +# define popen(c, m) os_popen(c, m) +# define pclose(f) os_pclose(f) + extern FILE *os_popen( const char *, const char * ); + extern int os_pclose( FILE * ); +#endif /* !__DJGPP__ */ @@ -52,10 +52,6 @@ # include "../locale/localeinfo.h" #endif -#if defined (_MSC_VER) -#include <stdio.h> /* for size_t */ -#endif - /* On some systems, limits.h sets RE_DUP_MAX to a lower value than GNU regex allows. Include it before <regex.h>, which correctly #undefs RE_DUP_MAX and sets it to the right value. */ diff --git a/regex_internal.h b/regex_internal.h index 4184d7f5..f87d336d 100644 --- a/regex_internal.h +++ b/regex_internal.h @@ -454,17 +454,12 @@ static unsigned int re_string_context_at (const re_string_t *input, int idx, #ifndef _LIBC # if HAVE_ALLOCA -# if (_MSC_VER) -# include <malloc.h> -# define __libc_use_alloca(n) 0 -# else -# include <alloca.h> +# include <alloca.h> /* The OS usually guarantees only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely allocate anything larger than 4096 bytes. Also care for the possibility of a few compiler-allocated temporary stack slots. */ # define __libc_use_alloca(n) ((n) < 4032) -# endif # else /* alloca is implemented with malloc, so just use malloc. */ # define __libc_use_alloca(n) 0 |