From bc70de7b3302d5a81515b901cae376b8b51d2004 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 16 Jul 2010 13:09:56 +0300 Subject: Move to gawk-3.1.0. --- pc/ChangeLog | 77 +++++++- pc/Makefile | 37 ++-- pc/Makefile.tst | 571 +++++++++++++++++++++++++++++++++++++------------------- pc/config.h | 182 +++++++++++++++--- pc/gawkmisc.pc | 84 ++++++++- pc/popen.c | 95 +++++----- pc/popen.h | 2 +- 7 files changed, 749 insertions(+), 299 deletions(-) mode change 100755 => 100644 pc/Makefile mode change 100755 => 100644 pc/Makefile.tst mode change 100755 => 100644 pc/config.h (limited to 'pc') diff --git a/pc/ChangeLog b/pc/ChangeLog index 84c48ecb..c572b1bb 100644 --- a/pc/ChangeLog +++ b/pc/ChangeLog @@ -1,3 +1,70 @@ +Sun Jun 3 13:04:44 2001 Arnold D. Robbins + + * Release 3.1.0: Release tar file made. And there was + rejoicing. + +Tue Jan 30 10:56:05 2001 Arnold D. Robbins + + * config.h: Per Kay Uwe Rommel, turn on HAVE_FCNTL_H for + all PC platforms so that BINMODE works on all. + +Sun Jan 28 15:50:02 2001 Eli Zaretskii + + * gawkmisc.pc (gawk_name): Support file names with mixed forward- + and back-slashes. + (orig_tty_mode): New variable. + (os_setbinmode): Save the original mode of the console device. + [__DJGPP__]: Allow the program to be interrupted with Ctrl-C even + though the console was switched to binary mode. + (os_restore_mode): New function. + +Wed Jan 17 10:59:32 2001 Eli Zaretskii + + * gawkmisc.pc (os_close_on_exec) [__DJGPP__]: Don't print the + warning about failure to set close-on-exec bit, unless it's DJGPP + 2.04 or later. + +Wed Jan 3 19:11:00 2001 Darrel Hankerson + + * popen.c: write script files in binary only if the shell is + unix-like. + * Makefile: set threshold (-Gt) on MSC 16bit versions to obtain + sufficient stack. 3.0.91 builtin.c compiles with optimization, + in MSC[67], so remove the special compile + +Wed Jan 3 19:54:12 2001 Arnold D. Robbins + + * config.h, gawkmisc.pc: Allow fcntl if DGJPP. From Scott. + +Sun Dec 3 16:53:37 2000 Arnold D. Robbins + + * gawkmisc.pc (os_setbinmode): new function. + +Sun Dec 3 14:56:38 2000 Arnold D. Robbins + + * Makefile, Makefile.tst, gawkmisc.pc: updated from Scottd. + * popen.c: updated from Darrell Hankerson. + +Wed Nov 22 11:47:00 2000 Arnold D. Robbins + + * gawk.rsp, pc_popen.c, pc_popen.h, Makefile, Makefile.tst, + gawkmisc.pc: Synched with diffs from Scott Deifik. + * config.h: Updated from main dist, best guess by me, will + probably need tweaking. + +Tue Nov 7 14:09:14 2000 Arnold D. Robbins + + * gawkmisc.pc (os_is_setuid): new function. + +Thu Nov 5 16:50:09 1998 Arnold D. Robbins + + * gawkmisc.pc (os_devopen): handle "/dev/null". + +Wed Jul 30 19:53:52 1997 Arnold D. Robbins + + * Close-on-exec changes: + gawkmisc.pc: (os_close_on_exec, os_isdir): new functions. + Mon Aug 7 15:23:00 2000 Arnold D. Robbins * Release 3.0.6: Release tar file made. @@ -16,7 +83,7 @@ Thu May 18 14:07:52 2000 Scott Deifik * config.h: Define HAVE_LIMITS_H as 1. Wed Jun 30 16:14:36 1999 Arnold D. Robbins - + * Release 3.0.4: Release tar file made. This time for sure. Sun Jun 27 12:27:00 1999 Darrel Hankerson @@ -65,14 +132,6 @@ Thu Nov 08 09:11:44 1998 Scott Deifik test/Makefile.in. In addition, made to work in Windows 9x with non-LFN tools. -Wed Nov 4 11:32:24 1998 Arnold D. Robbins - - * BETA Release 3.0.41: Release tar file made. - -Thu Oct 8 19:36:57 1998 Arnold D. Robbins - - * BETA Release 3.0.40: Release tar file made. - Thu May 15 12:49:08 1997 Arnold D. Robbins * Release 3.0.3: Release tar file made. diff --git a/pc/Makefile b/pc/Makefile old mode 100755 new mode 100644 index 627a9612..9dd8f350 --- a/pc/Makefile +++ b/pc/Makefile @@ -1,4 +1,4 @@ -# Makefile for gawk (GNU awk) 31 Oct 1998 +# Makefile for gawk (GNU awk) Dec 2000 # # - for GNU C (djgpp) [32bit executable for DOS] # - for GNU C (emx) [32bit executable for OS/2 or DOS or Win32] @@ -182,8 +182,8 @@ STDARGV = setargv.obj # Optimization and library options: # Os == optimize for size, Ot == optimize for speed, G2 == 286 or better -#MSCOPT = -Os -G2 -MSCOPT = -Ot # -G2 +#MSCOPT = -Gt3600 -Os -G2 +MSCOPT = -Gt3600 -Ot # -G2 # Alternate lib, does not use math coprocessor. #MSCLIB = llibca #MSCCL = -FPa @@ -192,7 +192,8 @@ MSCLIB = llibce MSCCL = -FPi #MSCCL = -FPc -LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x4990,nul +# If the stack gets much smaller than 3000, the "longwrds" test fails. +LMSC = link $(LF) $(LNKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x4320,nul # CLMSC-linking works when building under OS/2 CLMSC = $(CC) -o $@ $(LF) $(GAWKOBJS) $(STDARGV) $(LF2) -link /NOE/NOI/STACK:0x6f00 @@ -225,8 +226,8 @@ msc-debug: LNK=LMSC LF2=/CO P=+ msc6: - $(MAK) builtin.obj \ - "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT) -Od" +# $(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 \ @@ -235,15 +236,15 @@ 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) 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) 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 \ @@ -288,10 +289,10 @@ CFLAGS = $(CF) -DGAWK -I. -DHAVE_CONFIG_H # object files AWKOBJS1 = array$O builtin$O eval$O field$O gawkmisc$O io$O main$O -AWKOBJS2 = missing$O msg$O node$O re$O version$O +AWKOBJS2 = ext$O msg$O node$O profile$O re$O version$O AWKOBJS = $(AWKOBJS1) $(AWKOBJS2) -ALLOBJS = $(AWKOBJS) awktab$O getid$O $(OBJ) +ALLOBJS = $(AWKOBJS) awkgram$O getid$O $(OBJ) # LIBOBJS # GNU and other stuff that gawk uses as library routines. @@ -316,7 +317,7 @@ gawk.exe:: $(GAWKOBJS) $(RSP) $(RSPFILE) : $(GAWKOBJS) echo $(AWKOBJS1)$P > $@ echo $(AWKOBJS2)$P >> $@ - echo awktab$O getid$O $(OBJ) $(LIBOBJS)$P >> $@ + echo awkgram$O getid$O $(OBJ) $(LIBOBJS)$P >> $@ $(ALLOBJS): awk.h dfa.h regex.h config.h @@ -326,14 +327,14 @@ getopt$O: getopt.h getopt1$O: getopt.h -main$O: patchlevel.h +main$O: patchlev.h # A bug in ndmake requires the following rule -awktab$O: awk.h awktab.c - $(CC) -c $(CFLAGS) awktab.c +awkgram$O: awk.h awkgram.c + $(CC) -c $(CFLAGS) awkgram.c -awktab.c: awk.y - bison -o $@ awk.y +awkgram.c: awkgram.y + bison -o $@ awkgram.y alloca$O: alloca.c diff --git a/pc/Makefile.tst b/pc/Makefile.tst old mode 100755 new mode 100644 index 4ad5d2ef..af62e8b8 --- a/pc/Makefile.tst +++ b/pc/Makefile.tst @@ -1,6 +1,6 @@ # Makefile for GNU Awk test suite. # -# Copyright (C) 1988-2000 the Free Software Foundation, Inc. +# Copyright (C) 1988-2001 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. @@ -41,37 +41,18 @@ # need: rm, tr, cmp (or diff, see above), cat, wc, and sh. # You should also have a UNIX-compatible date program. # -# 3. You will need a \tmp directory on the same drive as the test directory -# for the poundba (called poundbang in the UNIX makefile) test. -# # The makefile has only been tested with dmake 3.8 and DJGPP Make 3.74 or # later. After making all of these changes, typing "dmake bigtest extra" # or "make bigtest extra" (with DJGPP Make) should run successfully. -# So far, most of the testing has been with Stewartson's sh 2.3 under -# MS-DOS & OS/2. That version of sh will sometimes send long -# command-line arguments to programs using the @ notation. You may need -# to disable this feature of sh for programs that you have which don't support -# that feature. The DJGPP response file facility is incompatible with the -# one used by Stewartson's sh, so you will certainly need to disable it if you -# use DJGPP tools to run the tests. For more information about the @ notation -# please refer to the sh documentation. -# -# A beta of the Bash shell (compiled with djgpp) was tested for gawk-3.0.1, -# and worked very well with the djgpp-compiled gawk. See README.pc for +# The Bash shell (compiled with djgpp) works very well with the +# MSC & djgpp-compiled gawks. It is currently the recommended shell to use +# for testing, along with DJGPP make. See README.pc for # more information on OS/2 and DOS shells. # You will almost certainly need to change some of the values (MACROS) # defined on the next few lines. -# .USESHELL is used by dmake. -.USESHELL = yes - -# Using EMXSHELL=/bin/sh with emx versions can exhaust lower mem. -# Lower mem can also be exhausted on some of the tests even with MSC gawk. -# The .SWAP setting forces (DOS-only) dmake to swap itself out. -.SWAP: childin fflush getlnhd tweakfld pipeio1 pipeio2 getlnbuf - # This won't work unless you have "sh" and set SHELL equal to it (Make 3.74 # or later which comes with DJGPP will work with SHELL=/bin/sh if you have # sh.exe anywhere on your PATH). @@ -80,6 +61,9 @@ SHELL = /bin/sh # Point to gawk AWK = ../gawk.exe +# Also point to gawk but for DOS commands needing backslashes. We need +# the forward slash version too or 'arrayparam' fails. +AWK2 = '..\gawk.exe' # Set your cmp command here (you can use most versions of diff instead of cmp # if you don't want to convert the .ok files to the DOS CR/LF format). @@ -100,20 +84,20 @@ CMP = env LFN=n diff #CMP = diff -c #CMP = gcmp -# Set your "cp" and "mkdir" commands here. Note: cp must take forward -# slashes. Using "command -c" may work for MS-DOS with Stewartson's shell -# (but not bash) if "command=noexpand switch export" is set in extend.lst. -# `true &&' is needed to force DJGPP Make to call the shell, or else the -# conversion of `command -c' won't work. +# Set your "cp" and "mkdir" commands here. Note: DOS's copy must take forward +# slashes. #CP = cp -CP = true && command -c copy +#CP = : && command -c copy +CP = command.com /c copy #MKDIR = mkdir -MKDIR = true && command -c mkdir +#MKDIR = gmkdir +#MKDIR = : && command -c mkdir +MKDIR = command.com /c mkdir # Set your unix-style date function here -DATE = gdate #DATE = date +DATE = gdate # ============================================================================ # You shouldn't need to modify anything below this line. @@ -121,39 +105,39 @@ DATE = gdate srcdir = . -bigtest: basic unix-tests gawk.extensions +bigtest: basic unix-tests gawk-extensions -basic: msg swaplns messages argarray longwrds \ - getline fstabplus compare arrayref rs fsrs rand \ - fsbs negexp asgext anchgsub splitargv awkpath nfset reparse \ - convfmt arrayparm paramdup nonl defref nofmtch litoct resplit \ - rswhite prmarscl sclforin sclifin intprec childin noeffect \ - numsubstr pcntplus prmreuse math fldchg fldchgnf reindops \ - sprintfc backgsub tweakfld clsflnam mmap8k fnarray \ - dynlj substr eofsplit prt1eval gsubasgn prtoeval gsubtest splitwht \ - back89 tradanch nlfldsep splitvar intest nfldstr nors fnarydel \ - noparms funstack clobber delarprm prdupval nasty zeroflag \ - getnr2tm getnr2tb printf1 funsmnam fnamedat numindex subslash \ - opasnslf opasnidx arynocls getlnbuf arysubnm fnparydl +# message stuff is to make it a little easier to follow +check: msg \ + basic-msg-start basic basic-msg-end \ + unix-msg-start unix-tests unix-msg-end \ + extend-msg-start gawk-extensions extend-msg-end -unix-tests: poundba fflush getlnhd pipeio1 pipeio2 strftlng pid +# try to keep these sorted +basic: addcomma anchgsub argarray arrayparm arrayref arynasty arynocls \ + arysubnm asgext awkpath back89 backgsub childin clobber clsflnam \ + compare convfmt datanonl defref delarprm dynlj eofsplit fldchg \ + fldchgnf fnamedat fnarray fnarydel fnaryscl fnasgnm fnparydl \ + fsbs fsrs fstabplus funsmnam funstack getline getlnbuf getnr2tb \ + getnr2tm gsubasgn gsubtest hsprint intest intprec leaddig litoct \ + longwrds math messages mmap8k nasty nasty2 negexp nfldstr nfset \ + nlfldsep nlinstr nlstrina noeffect nofmtch nonl noparms nors \ + numindex numsubstr octsub ofmt ofmtbig ofmts opasnidx opasnslf \ + paramdup paramtyp parseme pcntplus prdupval printf1 prmarscl \ + prmreuse prt1eval prtoeval psx96sub rand rebt8b1 rebt8b2 redfilnm \ + regeq reindops reparse resplit rs rsnul1nl rswhite sclforin \ + sclifin splitargv splitdef splitvar splitwht sprintfc strtod \ + subslash substr swaplns tradanch tweakfld zeroflag -gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ - badargs strftime gensub gnureops reint igncdym -# add this back for 3.1 -# nondec +unix-tests: fflush getlnhd pid pipeio1 pipeio2 poundba strftlng -extra: regtes inftest +gawk-extensions: argtest badargs clos1way fieldwdth fsfwfs gensub \ + gnuops2 gnureops igncdym igncfs ignrcase lint manyfiles nondec \ + posix procinfs regx8bit reint shadow sort1 strftime -poundba:: -# The need for "basename" has been removed for MS-DOS & OS/2 systems which -# lack it. -# @cp $(AWK) /tmp/gawk && $(srcdir)/poundbang $(srcdir)/poundbang >_`basename $@` - $(CP) $(AWK) /tmp/gawk.exe && $(srcdir)/poundbang $(srcdir)/poundbang >_$@ -# @rm -f /tmp/gawk - rm -f /tmp/gawk.exe -# $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` - $(CMP) $(srcdir)/poundbang.ok _$@ && rm -f _$@ +extra: regtes inftest inet + +inet: inetmesg inetechu inetecht inetdayu inetdayt msg:: @echo 'Any output from "cmp" is bad news, although some differences' @@ -161,21 +145,55 @@ msg:: @echo 'some systems may omit a leading zero and the floating point' @echo 'precision may lead to slightly different output in a few cases.' +basic-msg-start: + @echo "======== Starting basic tests ========" + +basic-msg-end: + @echo "======== Done with basic tests ========" + +unix-msg-start: + @echo "======== Starting Unix tests ========" + +unix-msg-end: + @echo "======== Done with Unix tests ========" + +extend-msg-start: + @echo "======== Starting gawk extension tests ========" + +extend-msg-end: + @echo "======== Done with gawk extension tests ========" + +# This test is a PITA because increasingly, /tmp is getting +# mounted noexec. So, we'll test it. Sigh. +poundba:: +# @cp $(AWK) /tmp/gawk + @$(CP) $(AWK2) '\tmp\gawk.exe' +# @if /tmp/gawk 'BEGIN { print "OK" }' | grep OK > /dev/null ; \ +# then \ +# $(srcdir)/poundbang.awk $(srcdir)/poundbang.awk >_`basename $@` ; \ +# $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` && echo poundbang is ok ; \ +# else \ +# echo "*** /tmp is apparently mounted noexec, skipping poundbang test." ; \ +# fi + @if /tmp/gawk 'BEGIN { print "OK" }' | grep OK > NUL ; \ + then \ + $(srcdir)/poundbang.awk $(srcdir)/poundbang.awk >_`basename $@` ; \ + $(CMP) $(srcdir)/poundbang.ok _`basename $@` && rm -f _`basename $@` && echo poundbang is ok ; \ + else \ + echo "*** /tmp is apparently mounted noexec, skipping poundbang test." ; \ + fi +# @rm -f /tmp/gawk + @rm -f /tmp/gawk.exe + swaplns:: @echo 'If swaplns fails make sure that all of the .ok files have CR/LFs.' + @echo 'Or, set CMP to use diff.' @$(AWK) -f $(srcdir)/swaplns.awk $(srcdir)/swaplns.in >_$@ - $(CMP) $(srcdir)/swaplns.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/swaplns.ok _$@ && rm -f _$@ messages:: - @echo 'If messages fails, set sh to swap to disk only (in sh.rc).' @$(AWK) -f $(srcdir)/messages.awk >out2 2>out3 -# { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && \ -# $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3; } || \ -# { { test -d /dev/fd || test -d /proc/self/fd; } && \ -# echo IT IS OK THAT THIS TEST FAILED; } - { $(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && \ - $(CMP) $(srcdir)/out3.ok out3; } || test -d /dev/fd - rm -f out1 out2 out3 + -$(CMP) $(srcdir)/out1.ok out1 && $(CMP) $(srcdir)/out2.ok out2 && $(CMP) $(srcdir)/out3.ok out3 && rm -f out1 out2 out3 argarray:: @case $(srcdir) in \ @@ -183,47 +201,43 @@ argarray:: *) cp $(srcdir)/argarray.in . ;; \ esac @TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@ - @echo 'If argarray fails, set try setting LFN=n in your environment' - @echo "before running make. If that still doesn't work, read the" - @echo 'the comment in this makefile about setting CMP for information' - @echo 'about what may be happenning.' - $(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@ fstabplus:: @echo '1 2' | $(AWK) -f $(srcdir)/fstabplus.awk >_$@ - $(CMP) $(srcdir)/fstabplus.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fstabplus.ok _$@ && rm -f _$@ fsrs:: @$(AWK) -f $(srcdir)/fsrs.awk $(srcdir)/fsrs.in >_$@ - $(CMP) $(srcdir)/fsrs.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fsrs.ok _$@ && rm -f _$@ igncfs:: @$(AWK) -f $(srcdir)/igncfs.awk $(srcdir)/igncfs.in >_$@ - $(CMP) $(srcdir)/igncfs.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/igncfs.ok _$@ && rm -f _$@ longwrds:: @$(AWK) -f $(srcdir)/longwrds.awk $(srcdir)/manpage | (LC_ALL=C sort) >_$@ - $(CMP) $(srcdir)/longwrds.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/longwrds.ok _$@ && rm -f _$@ fieldwdth:: @echo '123456789' | $(AWK) -v FIELDWIDTHS="2 3 4" '{ print $$2}' >_$@ - $(CMP) $(srcdir)/fieldwdth.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fieldwdth.ok _$@ && rm -f _$@ ignrcase:: @echo xYz | $(AWK) -v IGNORECASE=1 '{ sub(/y/, ""); print}' >_$@ - $(CMP) $(srcdir)/ignrcase.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/ignrcase.ok _$@ && rm -f _$@ regtes:: @echo 'Some of the output from regtest is very system specific, do not' @echo 'be distressed if your output differs from that distributed.' @echo 'Manual inspection is called for.' +# AWK=`pwd`/$(AWK) $(srcdir)/regtest.awk AWK=`pwd`/$(AWK) CMP="$(CMP)" $(srcdir)/regtest posix:: @echo 'posix test may fail due to 1.500000e+000 not being equal to' @echo '1.500000e+00 for MSC gawk.' @echo '1:2,3 4' | $(AWK) -f $(srcdir)/posix.awk >_$@ -# $(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@ -$(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@ manyfiles:: @@ -237,208 +251,203 @@ manyfiles:: @echo 'without quoting the "junk/*" argument.' # @echo "This number better be 1 ->" | tr -d '\012' @echo "This number better be 1 ->" | tr -d '\012\015' -# @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l - @wc -l "junk/*" | $(AWK) '$$1 != 2' | wc -l -# The quotes above are for people with a "wc" that doesn't support sh's "@" -# argument passing. + @wc -l junk/* | $(AWK) '$$1 != 2' | wc -l +# @wc -l "junk/*" | $(AWK) '$$1 != 2' | wc -l +# The quotes above are for people with a "wc" that doesn't too long a command +# line. @rm -rf junk _$@ compare:: @$(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@ - $(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@ arrayref:: @$(AWK) -f $(srcdir)/arrayref.awk >_$@ - $(CMP) $(srcdir)/arrayref.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/arrayref.ok _$@ && rm -f _$@ rs:: @$(AWK) -v RS="" '{ print $$1, $$2}' $(srcdir)/rs.in >_$@ - $(CMP) $(srcdir)/rs.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/rs.ok _$@ && rm -f _$@ fsbs:: @$(AWK) -v FS='\' '{ print $$1, $$2 }' $(srcdir)/fsbs.in >_$@ - $(CMP) $(srcdir)/fsbs.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fsbs.ok _$@ && rm -f _$@ inftest:: @echo This test is very machine specific... - @echo 'MSC 7.0 gawk generates a floating point exception.' + @echo 'Both MSC 7.0 and 8.0 gawk generate a floating point exception.' @echo 'EMX gawk uses #INF rather than Inf.' # @$(AWK) -f $(srcdir)/inftest.awk >_$@ @-$(AWK) -f $(srcdir)/inftest.awk >_$@ -# $(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ -$(CMP) $(srcdir)/inftest.ok _$@ && rm -f _$@ getline:: @$(AWK) -f $(srcdir)/getline.awk $(srcdir)/getline.awk $(srcdir)/getline.awk >_$@ - $(CMP) $(srcdir)/getline.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/getline.ok _$@ && rm -f _$@ rand:: @$(AWK) -f $(srcdir)/rand.awk >_$@ - $(CMP) $(srcdir)/rand.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/rand.ok _$@ && rm -f _$@ negexp:: @$(AWK) 'BEGIN { a = -2; print 10^a }' >_$@ - $(CMP) $(srcdir)/negexp.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/negexp.ok _$@ && rm -f _$@ asgext:: @$(AWK) -f $(srcdir)/asgext.awk $(srcdir)/asgext.in >_$@ - $(CMP) $(srcdir)/asgext.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/asgext.ok _$@ && rm -f _$@ anchgsub:: @$(AWK) -f $(srcdir)/anchgsub.awk $(srcdir)/anchgsub.in >_$@ - $(CMP) $(srcdir)/anchgsub.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/anchgsub.ok _$@ && rm -f _$@ splitargv:: @$(AWK) -f $(srcdir)/splitargv.awk $(srcdir)/splitargv.in >_$@ - $(CMP) $(srcdir)/splitargv.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/splitargv.ok _$@ && rm -f _$@ awkpath:: # MS-DOS and OS/2 use ; as a PATH delimiter # @AWKPATH="$(srcdir):$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@ @AWKPATH="$(srcdir);$(srcdir)/lib" $(AWK) -f awkpath.awk >_$@ - $(CMP) $(srcdir)/awkpath.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/awkpath.ok _$@ && rm -f _$@ nfset:: @$(AWK) -f $(srcdir)/nfset.awk $(srcdir)/nfset.in >_$@ - $(CMP) $(srcdir)/nfset.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nfset.ok _$@ && rm -f _$@ reparse:: @$(AWK) -f $(srcdir)/reparse.awk $(srcdir)/reparse.in >_$@ - $(CMP) $(srcdir)/reparse.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/reparse.ok _$@ && rm -f _$@ argtest:: @$(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@ - $(CMP) $(srcdir)/argtest.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/argtest.ok _$@ && rm -f _$@ badargs:: # For MS-DOS & OS/2, we use " rather than ' in the usage statement. @-$(AWK) -f 2>&1 | grep -v patchlevel >_$@ # Next line converts " to ' for $(CMP) to work with UNIX badargs.ok @cat _$@ | tr '\042' '\047' > _$@.2 -# $(CMP) $(srcdir)/badargs.ok _$@ && rm -f _$@ - $(CMP) $(srcdir)/badargs.ok _$@.2 && rm -f _$@ _$@.2 +# -$(CMP) $(srcdir)/badargs.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/badargs.ok _$@.2 && rm -f _$@ _$@.2 convfmt:: @$(AWK) -f $(srcdir)/convfmt.awk >_$@ - $(CMP) $(srcdir)/convfmt.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/convfmt.ok _$@ && rm -f _$@ arrayparm:: @-AWKPATH=$(srcdir) $(AWK) -f arrayparm.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/arrayparm.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/arrayparm.ok _$@ && rm -f _$@ paramdup:: @-AWKPATH=$(srcdir) $(AWK) -f paramdup.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/paramdup.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/paramdup.ok _$@ && rm -f _$@ nonl:: # @-AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk /dev/null >_$@ 2>&1 @-AWKPATH=$(srcdir) $(AWK) --lint -f nonl.awk NUL >_$@ 2>&1 - $(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nonl.ok _$@ && rm -f _$@ defref:: @-AWKPATH=$(srcdir) $(AWK) --lint -f defref.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/defref.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/defref.ok _$@ && rm -f _$@ nofmtch:: @-AWKPATH=$(srcdir) $(AWK) --lint -f nofmtch.awk >_$@ 2>&1 - $(CMP) $(srcdir)/nofmtch.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nofmtch.ok _$@ && rm -f _$@ strftime:: : this test could fail on slow machines or on a second boundary, : so if it does, double check the actual results + @echo 'It will also fail using DJGPP because DJGPP does not' + @echo 'have a default timezone.' # @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ # date | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk @LC_ALL=C; export LC_ALL; LANG=C; export LANG; \ $(DATE) | $(AWK) -v OUTPUT=_$@ -f $(srcdir)/strftime.awk - $(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 + -$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok || exit 0 litoct:: @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ - $(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ gensub:: @$(AWK) -f $(srcdir)/gensub.awk $(srcdir)/gensub.in >_$@ - $(CMP) $(srcdir)/gensub.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/gensub.ok _$@ && rm -f _$@ resplit:: - @echo 'If resplit fails, check extend.lst and remove "unix" by the "gawk=" line' @echo a:b:c d:e:f | $(AWK) '{ FS = ":"; $$0 = $$0; print $$2 }' > _$@ - $(CMP) $(srcdir)/resplit.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/resplit.ok _$@ && rm -f _$@ rswhite:: @$(AWK) -f $(srcdir)/rswhite.awk $(srcdir)/rswhite.in > _$@ - $(CMP) $(srcdir)/rswhite.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/rswhite.ok _$@ && rm -f _$@ prmarscl:: @-AWKPATH=$(srcdir) $(AWK) -f prmarscl.awk > _$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/prmarscl.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/prmarscl.ok _$@ && rm -f _$@ sclforin:: @-AWKPATH=$(srcdir) $(AWK) -f sclforin.awk > _$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/sclforin.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/sclforin.ok _$@ && rm -f _$@ sclifin:: @-AWKPATH=$(srcdir) $(AWK) -f sclifin.awk > _$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/sclifin.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/sclifin.ok _$@ && rm -f _$@ intprec:: @-$(AWK) -f $(srcdir)/intprec.awk > _$@ 2>&1 - $(CMP) $(srcdir)/intprec.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/intprec.ok _$@ && rm -f _$@ childin:: @echo hi | $(AWK) 'BEGIN { "cat" | getline; print; close("cat") }' > _$@ - $(CMP) $(srcdir)/childin.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/childin.ok _$@ && rm -f _$@ noeffect:: @-AWKPATH=$(srcdir) $(AWK) --lint -f noeffect.awk > _$@ 2>&1 - $(CMP) $(srcdir)/noeffect.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/noeffect.ok _$@ && rm -f _$@ numsubstr:: @-AWKPATH=$(srcdir) $(AWK) -f numsubstr.awk $(srcdir)/numsubstr.in >_$@ - $(CMP) $(srcdir)/numsubstr.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/numsubstr.ok _$@ && rm -f _$@ gnureops:: @$(AWK) -f $(srcdir)/gnureops.awk >_$@ - $(CMP) $(srcdir)/gnureops.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/gnureops.ok _$@ && rm -f _$@ pcntplus:: @$(AWK) -f $(srcdir)/pcntplus.awk >_$@ - $(CMP) $(srcdir)/pcntplus.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/pcntplus.ok _$@ && rm -f _$@ prmreuse:: @$(AWK) -f $(srcdir)/prmreuse.awk >_$@ - $(CMP) $(srcdir)/prmreuse.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/prmreuse.ok _$@ && rm -f _$@ math:: @$(AWK) -f $(srcdir)/math.awk >_$@ - $(CMP) $(srcdir)/math.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/math.ok _$@ && rm -f _$@ fflush:: @$(srcdir)/fflush.sh >_$@ - $(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@ fldchg:: @$(AWK) -f $(srcdir)/fldchg.awk $(srcdir)/fldchg.in >_$@ - $(CMP) $(srcdir)/fldchg.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fldchg.ok _$@ && rm -f _$@ fldchgnf:: @$(AWK) -f $(srcdir)/fldchgnf.awk $(srcdir)/fldchgnf.in >_$@ - $(CMP) $(srcdir)/fldchgnf.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fldchgnf.ok _$@ && rm -f _$@ reindops:: @$(AWK) -f $(srcdir)/reindops.awk $(srcdir)/reindops.in >_$@ - $(CMP) $(srcdir)/reindops.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/reindops.ok _$@ && rm -f _$@ sprintfc:: @$(AWK) -f $(srcdir)/sprintfc.awk $(srcdir)/sprintfc.in >_$@ - $(CMP) $(srcdir)/sprintfc.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/sprintfc.ok _$@ && rm -f _$@ getlnhd:: - @echo 'Getlnhd is set to ignore errors. However, there should not be any.' - @echo 'If getlnhd fails, set sh to swap to disk only (in sh.rc).' - @echo 'If it still hangs with EMX gawk type ^C, then try the test when' - @echo 'not using DPMI and RSX (in particular, run outside MS-Windows).' - @echo 'If it fails with MSC, run make from the test directory.' # In 3.0.3, COMSPEC=$(SHELL) was used for MSC and MINGW32 which do # not honor SHELL. # COMSPEC=$(SHELL) $(AWK) -f $(srcdir)/getlnhd.awk >_$@ @@ -447,77 +456,77 @@ getlnhd:: backgsub:: @$(AWK) -f $(srcdir)/backgsub.awk $(srcdir)/backgsub.in >_$@ - $(CMP) $(srcdir)/backgsub.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/backgsub.ok _$@ && rm -f _$@ tweakfld:: @$(AWK) -f $(srcdir)/tweakfld.awk $(srcdir)/tweakfld.in >_$@ @rm -f errors.cleanup - $(CMP) $(srcdir)/tweakfld.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/tweakfld.ok _$@ && rm -f _$@ clsflnam:: - @$(AWK) -f $(srcdir)/clsflnam.awk $(srcdir)/clsflnam.in >_$@ - $(CMP) $(srcdir)/clsflnam.ok _$@ && rm -f _$@ + @$(AWK) -f $(srcdir)/clsflnam.awk $(srcdir)/clsflnam.in >_$@ 2>&1 + -$(CMP) $(srcdir)/clsflnam.ok _$@ && rm -f _$@ mmap8k:: @echo 'If mmap8k fails make sure that mmap8k.in has CR/LFs.' @$(AWK) '{ print }' $(srcdir)/mmap8k.in >_$@ - $(CMP) $(srcdir)/mmap8k.in _$@ && rm -f _$@ + -$(CMP) $(srcdir)/mmap8k.in _$@ && rm -f _$@ fnarray:: @-AWKPATH=$(srcdir) $(AWK) -f fnarray.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/fnarray.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fnarray.ok _$@ && rm -f _$@ dynlj:: @$(AWK) -f $(srcdir)/dynlj.awk >_$@ - $(CMP) $(srcdir)/dynlj.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/dynlj.ok _$@ && rm -f _$@ substr:: @$(AWK) -f $(srcdir)/substr.awk >_$@ - $(CMP) $(srcdir)/substr.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/substr.ok _$@ && rm -f _$@ eofsplit:: @$(AWK) -f $(srcdir)/eofsplit.awk >_$@ - $(CMP) $(srcdir)/eofsplit.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/eofsplit.ok _$@ && rm -f _$@ prt1eval:: @$(AWK) -f $(srcdir)/prt1eval.awk >_$@ - $(CMP) $(srcdir)/prt1eval.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/prt1eval.ok _$@ && rm -f _$@ gsubasgn:: @-AWKPATH=$(srcdir) $(AWK) -f gsubasgn.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/gsubasgn.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/gsubasgn.ok _$@ && rm -f _$@ prtoeval:: @$(AWK) -f $(srcdir)/prtoeval.awk >_$@ - $(CMP) $(srcdir)/prtoeval.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/prtoeval.ok _$@ && rm -f _$@ gsubtest:: @$(AWK) -f $(srcdir)/gsubtest.awk >_$@ - $(CMP) $(srcdir)/gsubtest.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/gsubtest.ok _$@ && rm -f _$@ splitwht:: @$(AWK) -f $(srcdir)/splitwht.awk >_$@ - $(CMP) $(srcdir)/splitwht.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/splitwht.ok _$@ && rm -f _$@ back89:: @$(AWK) '/a\8b/' $(srcdir)/back89.in >_$@ - $(CMP) $(srcdir)/back89.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/back89.ok _$@ && rm -f _$@ tradanch:: @$(AWK) --traditional -f $(srcdir)/tradanch.awk $(srcdir)/tradanch.in >_$@ - $(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/tradanch.ok _$@ && rm -f _$@ nlfldsep:: @$(AWK) -f $(srcdir)/nlfldsep.awk $(srcdir)/nlfldsep.in > _$@ - $(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nlfldsep.ok _$@ && rm -f _$@ splitvar:: @$(AWK) -f $(srcdir)/splitvar.awk $(srcdir)/splitvar.in >_$@ - $(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/splitvar.ok _$@ && rm -f _$@ intest:: @$(AWK) -f $(srcdir)/intest.awk >_$@ - $(CMP) $(srcdir)/intest.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/intest.ok _$@ && rm -f _$@ # AIX /bin/sh exec's the last command in a list, therefore issue a ":" # command so that pid.sh is fork'ed as a child before being exec'ed. @@ -535,34 +544,30 @@ strftlng:: @if $(CMP) -s $(srcdir)/strftlng.ok _$@ ; then : ; else \ env TZ=UTC0; $(AWK) -f $(srcdir)/strftlng.awk >_$@ ; \ fi - $(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/strftlng.ok _$@ && rm -f _$@ nfldstr:: @echo | $(AWK) '$$1 == 0 { print "bug" }' > _$@ - $(CMP) $(srcdir)/nfldstr.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nfldstr.ok _$@ && rm -f _$@ nors:: # @echo A B C D E | tr -d '\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ @echo A B C D E | tr -d '\15\12' | $(AWK) '{ print $$NF }' - $(srcdir)/nors.in > _$@ - $(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nors.ok _$@ && rm -f _$@ fnarydel:: @$(AWK) -f $(srcdir)/fnarydel.awk >_$@ - $(CMP) $(srcdir)/fnarydel.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fnarydel.ok _$@ && rm -f _$@ reint:: @$(AWK) --re-interval -f $(srcdir)/reint.awk $(srcdir)/reint.in >_$@ - $(CMP) $(srcdir)/reint.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/reint.ok _$@ && rm -f _$@ noparms:: @-AWKPATH=$(srcdir) $(AWK) -f noparms.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/noparms.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/noparms.ok _$@ && rm -f _$@ pipeio1:: - @echo 'Pipeio1 is set to ignore errors. However, there should not be any.' - @echo 'If pipeio1 fails, set sh to swap to disk only (in sh.rc).' - @echo 'If it still hangs with EMX gawk type ^C, then try the test when' - @echo 'not using DPMI and RSX (in particular, run outside MS-Windows).' @$(AWK) -f $(srcdir)/pipeio1.awk >_$@ @rm -f test1 test2 -$(CMP) $(srcdir)/pipeio1.ok _$@ && rm -f _$@ @@ -570,111 +575,291 @@ pipeio1:: pipeio2:: # This would fail were it not for the "cat" line due to DOS's ECHO command. @echo 'pipeio may fail due to the way that your tr & echo work in DOS' - @echo 'You may also need to set tr=noexpand switch if you use' - @echo "Stewartson's sh." @$(AWK) -v SRCDIR=$(srcdir) -f $(srcdir)/pipeio2.awk >_$@ @cat _$@ | $(AWK) '{ sub("ECHO is.*","",$$0); print $$0 } ' > _$@.2 -# $(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@ +# -$(CMP) $(srcdir)/pipeio2.ok _$@ && rm -f _$@ -diff -w $(srcdir)/pipeio2.ok _$@.2 && rm -f _$@ _$@.2 funstack:: @echo 'Expect funstack to fail with MSC DOS versions.' # @$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@ @-$(AWK) -f $(srcdir)/funstack.awk $(srcdir)/funstack.in >_$@ -# $(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@ -$(CMP) $(srcdir)/funstack.ok _$@ && rm -f _$@ clobber:: @$(AWK) -f $(srcdir)/clobber.awk >_$@ - $(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/clobber.ok seq && $(CMP) $(srcdir)/clobber.ok _$@ && rm -f _$@ @rm -f seq delarprm:: @$(AWK) -f $(srcdir)/delarprm.awk >_$@ - $(CMP) $(srcdir)/delarprm.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/delarprm.ok _$@ && rm -f _$@ prdupval:: @$(AWK) -f $(srcdir)/prdupval.awk $(srcdir)/prdupval.in >_$@ - $(CMP) $(srcdir)/prdupval.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/prdupval.ok _$@ && rm -f _$@ nondec:: +# @if grep BITOP ../config.h | grep define > /dev/null; \ +# then \ +# $(AWK) -f $(srcdir)/nondec.awk >_$@; \ +# else \ +# cp $(srcdir)/nondec.ok _$@; \ +# fi @if grep BITOP ../config.h | grep define > /dev/null; \ then \ $(AWK) -f $(srcdir)/nondec.awk >_$@; \ else \ - cp $(srcdir)/nondec.ok _$@; \ + $(CP) $(srcdir)\\nondec.ok _$@; \ fi - $(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nondec.ok _$@ && rm -f _$@ nasty:: @$(AWK) -f $(srcdir)/nasty.awk >_$@ - $(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/nasty.ok _$@ && rm -f _$@ + +nasty2:: + @$(AWK) -f $(srcdir)/nasty2.awk >_$@ + -$(CMP) $(srcdir)/nasty2.ok _$@ && rm -f _$@ zeroflag:: @$(AWK) -f $(srcdir)/zeroflag.awk >_$@ - $(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/zeroflag.ok _$@ && rm -f _$@ getnr2tm:: @$(AWK) -f $(srcdir)/getnr2tm.awk $(srcdir)/getnr2tm.in >_$@ - $(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/getnr2tm.ok _$@ && rm -f _$@ getnr2tb:: @$(AWK) -f $(srcdir)/getnr2tb.awk $(srcdir)/getnr2tb.in >_$@ - $(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/getnr2tb.ok _$@ && rm -f _$@ printf1:: @$(AWK) -f $(srcdir)/printf1.awk >_$@ - $(CMP) $(srcdir)/printf1.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/printf1.ok _$@ && rm -f _$@ funsmnam:: @-AWKPATH=$(srcdir) $(AWK) -f funsmnam.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/funsmnam.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/funsmnam.ok _$@ && rm -f _$@ fnamedat:: @-AWKPATH=$(srcdir) $(AWK) -f fnamedat.awk < $(srcdir)/fnamedat.in >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/fnamedat.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fnamedat.ok _$@ && rm -f _$@ numindex:: @-AWKPATH=$(srcdir) $(AWK) -f numindex.awk < $(srcdir)/numindex.in >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/numindex.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/numindex.ok _$@ && rm -f _$@ subslash:: @-AWKPATH=$(srcdir) $(AWK) -f subslash.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/subslash.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/subslash.ok _$@ && rm -f _$@ opasnslf:: @-AWKPATH=$(srcdir) $(AWK) -f opasnslf.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/opasnslf.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/opasnslf.ok _$@ && rm -f _$@ opasnidx:: @-AWKPATH=$(srcdir) $(AWK) -f opasnidx.awk >_$@ 2>&1 || exit 0 - $(CMP) $(srcdir)/opasnidx.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/opasnidx.ok _$@ && rm -f _$@ arynocls:: @-AWKPATH=$(srcdir) $(AWK) -v INPUT=$(srcdir)/arynocls.in -f arynocls.awk >_$@ - $(CMP) $(srcdir)/arynocls.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/arynocls.ok _$@ && rm -f _$@ igncdym:: @-AWKPATH=$(srcdir) $(AWK) -f igncdym.awk $(srcdir)/igncdym.in >_$@ - $(CMP) $(srcdir)/igncdym.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/igncdym.ok _$@ && rm -f _$@ getlnbuf:: + @echo getlnbuf runs out of memory with MSC gawk. @-AWKPATH=$(srcdir) $(AWK) -f getlnbuf.awk $(srcdir)/getlnbuf.in > _$@ @-AWKPATH=$(srcdir) $(AWK) -f gtlnbufv.awk $(srcdir)/getlnbuf.in > _2$@ - $(CMP) $(srcdir)/getlnbuf.ok _$@ && $(CMP) $(srcdir)/getlnbuf.ok _2$@ && rm -f _$@ _2$@ + -$(CMP) $(srcdir)/getlnbuf.ok _$@ && $(CMP) $(srcdir)/getlnbuf.ok _2$@ && rm -f _$@ _2$@ arysubnm:: @-AWKPATH=$(srcdir) $(AWK) -f arysubnm.awk >_$@ - $(CMP) $(srcdir)/arysubnm.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/arysubnm.ok _$@ && rm -f _$@ fnparydl:: @-AWKPATH=$(srcdir) $(AWK) -f fnparydl.awk >_$@ - $(CMP) $(srcdir)/fnparydl.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/fnparydl.ok _$@ && rm -f _$@ + +nlstrina:: + @-AWKPATH=$(srcdir) $(AWK) -f nlstrina.awk >_$@ + -$(CMP) $(srcdir)/nlstrina.ok _$@ && rm -f _$@ + +octsub:: + @-AWKPATH=$(srcdir) $(AWK) -f octsub.awk >_$@ + -$(CMP) $(srcdir)/octsub.ok _$@ && rm -f _$@ + +nlinstr:: + @$(AWK) -f $(srcdir)/nlinstr.awk $(srcdir)/nlinstr.in >_$@ + -$(CMP) $(srcdir)/nlinstr.ok _$@ && rm -f _$@ + +ofmt:: + @$(AWK) -f $(srcdir)/ofmt.awk $(srcdir)/ofmt.in >_$@ + -$(CMP) $(srcdir)/ofmt.ok _$@ && rm -f _$@ + +hsprint:: + @echo 'hsprint test may fail due to 1.27e+01 not being equal to' + @echo '1.27e+001 (and similarly for other numbers) for MSC gawk.' + @$(AWK) -f $(srcdir)/hsprint.awk >_$@ + -$(CMP) $(srcdir)/hsprint.ok _$@ && rm -f _$@ + +fsfwfs:: + @$(AWK) -f $(srcdir)/fsfwfs.awk $(srcdir)/fsfwfs.in >_$@ + -$(CMP) $(srcdir)/fsfwfs.ok _$@ && rm -f _$@ + +ofmts:: + @$(AWK) -f $(srcdir)/ofmts.awk $(srcdir)/ofmts.in >_$@ + -$(CMP) $(srcdir)/ofmts.ok _$@ && rm -f _$@ + +parseme:: + @-AWKPATH=$(srcdir) $(AWK) -f parseme.awk >_$@ 2>&1 || exit 0 + -$(CMP) $(srcdir)/parseme.ok _$@ && rm -f _$@ + +splitdef:: + @$(AWK) -f $(srcdir)/splitdef.awk >_$@ + -$(CMP) $(srcdir)/splitdef.ok _$@ && rm -f _$@ + +fnaryscl:: + @-AWKPATH=$(srcdir) $(AWK) -f fnaryscl.awk >_$@ 2>&1 || exit 0 + -$(CMP) $(srcdir)/fnaryscl.ok _$@ && rm -f _$@ + +fnasgnm:: + @-AWKPATH=$(srcdir) $(AWK) -f fnasgnm.awk < $(srcdir)/fnasgnm.in >_$@ 2>&1 || exit 0 + -$(CMP) $(srcdir)/fnasgnm.ok _$@ && rm -f _$@ + +lint:: + @-AWKPATH=$(srcdir) $(AWK) -f lint.awk > _$@ 2>&1 + -$(CMP) $(srcdir)/lint.ok _$@ && rm -f _$@ + +procinfs:: + @-$(AWK) -f $(srcdir)/procinfs.awk > _$@ + -$(CMP) $(srcdir)/procinfs.ok _$@ && rm -f _$@ + +sort1:: + @-$(AWK) -f $(srcdir)/sort1.awk > _$@ + -$(CMP) $(srcdir)/sort1.ok _$@ && rm -f _$@ + +ofmtbig:: + @$(AWK) -f $(srcdir)/ofmtbig.awk $(srcdir)/ofmtbig.in >_$@ 2>&1 || exit 0 + -$(CMP) $(srcdir)/ofmtbig.ok _$@ && rm -f _$@ + +inetmesg:: + @echo These tests only work if your system supports the services + @echo "'discard'" at port 9 and "'daytimed" at port 13. Check your + @echo file /etc/services and do "'netstat -a'". + +inetechu:: + @echo inetechu fails with MSC and DJGPP because "|&" is not supported. + @echo This test is for establishing UDP connections +# @$(AWK) 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}' + @-$(AWK) 'BEGIN {print "" |& "/inet/udp/0/127.0.0.1/9"}' + +inetecht:: + @echo inetecht fails with MSC and DJGPP because "|&" is not supported. + @echo This test is for establishing TCP connections +# @$(AWK) 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}' + @-$(AWK) 'BEGIN {print "" |& "/inet/tcp/0/127.0.0.1/9"}' + +inetdayu:: + @echo inetdayu fails with MSC and DJGPP because "|&" is not supported. + @echo This test is for bidirectional UDP transmission +# @$(AWK) 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \ +# "/inet/udp/0/127.0.0.1/13" |& getline; print $0}' + @-$(AWK) 'BEGIN { print "" |& "/inet/udp/0/127.0.0.1/13"; \ + "/inet/udp/0/127.0.0.1/13" |& getline; print $0}' + +inetdayt:: + @echo inetdayt fails with MSC and DJGPP because "|&" is not supported. + @echo This test is for bidirectional TCP transmission +# @$(AWK) 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \ +# "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' + @-$(AWK) 'BEGIN { print "" |& "/inet/tcp/0/127.0.0.1/13"; \ + "/inet/tcp/0/127.0.0.1/13" |& getline; print $0}' + +paramtyp:: + @$(AWK) -f $(srcdir)/paramtyp.awk >_$@ + -$(CMP) $(srcdir)/paramtyp.ok _$@ && rm -f _$@ + +rsnul1nl:: + @$(AWK) -f $(srcdir)/rsnul1nl.awk $(srcdir)/rsnul1nl.in >_$@ + -$(CMP) $(srcdir)/rsnul1nl.ok _$@ && rm -f _$@ + +datanonl:: + @$(AWK) -f $(srcdir)/datanonl.awk $(srcdir)/datanonl.in >_$@ + -$(CMP) $(srcdir)/datanonl.ok _$@ && rm -f _$@ + +regeq:: + @$(AWK) -f $(srcdir)/regeq.awk $(srcdir)/regeq.in >_$@ + -$(CMP) $(srcdir)/regeq.ok _$@ && rm -f _$@ + +redfilnm:: + @$(AWK) -f $(srcdir)/redfilnm.awk srcdir=$(srcdir) $(srcdir)/redfilnm.in >_$@ + -$(CMP) $(srcdir)/redfilnm.ok _$@ && rm -f _$@ + +strtod:: + @$(AWK) -f $(srcdir)/strtod.awk $(srcdir)/strtod.in >_$@ + -$(CMP) $(srcdir)/strtod.ok _$@ && rm -f _$@ + +leaddig:: + @$(AWK) -v x=2E -f $(srcdir)/leaddig.awk >_$@ + -$(CMP) $(srcdir)/leaddig.ok _$@ && rm -f _$@ + +clos1way:: + @echo clos1way fails with MSC and DJGPP because "|&" is not supported. +# @$(AWK) -f $(srcdir)/clos1way.awk >_$@ + @-$(AWK) -f $(srcdir)/clos1way.awk >_$@ + -$(CMP) $(srcdir)/clos1way.ok _$@ && rm -f _$@ + +arynasty:: + @$(AWK) -f $(srcdir)/arynasty.awk >_$@ + -$(CMP) $(srcdir)/arynasty.ok _$@ && rm -f _$@ + +shadow:: + @-AWKPATH=$(srcdir) $(AWK) --lint -f shadow.awk >_$@ 2>&1 || exit 0 + -$(CMP) $(srcdir)/shadow.ok _$@ && rm -f _$@ + +regx8bit:: + @$(AWK) -f $(srcdir)/regx8bit.awk >_$@ + -$(CMP) $(srcdir)/regx8bit.ok _$@ && rm -f _$@ + +psx96sub:: + @$(AWK) -f $(srcdir)/psx96sub.awk >_$@ + -$(CMP) $(srcdir)/psx96sub.ok _$@ && rm -f _$@ + +addcomma:: + @echo 'If addcomma fails, set try setting LFN=n in your environment' + @echo "before running make. If that still doesn't work, read the" + @echo 'the comment in this makefile about setting CMP for information' + @echo 'about what may be happenning.' + @$(AWK) -f $(srcdir)/addcomma.awk $(srcdir)/addcomma.in >_$@ + -$(CMP) $(srcdir)/addcomma.ok _$@ && rm -f _$@ + +gnuops2:: + @$(AWK) -f $(srcdir)/gnuops2.awk >_$@ + -$(CMP) $(srcdir)/gnuops2.ok _$@ && rm -f _$@ + +rebt8b1:: + @$(AWK) -f $(srcdir)/rebt8b1.awk >_$@ + -$(CMP) $(srcdir)/rebt8b1.ok _$@ && rm -f _$@ + +rebt8b2:: + @$(AWK) -f $(srcdir)/rebt8b2.awk >_$@ + -$(CMP) $(srcdir)/rebt8b2.ok _$@ && rm -f _$@ clean: rm -fr _* core junk out1 out2 out3 strftime.ok test1 test2 seq *~ -distclean: clean - rm -f Makefile - -maintainer-clean: distclean +# This target for my convenience to look at all the results +diffout: + for i in _* ; \ + do \ + echo ============== $$i ============= ; \ + diff -c $${i#_}.ok $$i ; \ + done | more + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pc/config.h b/pc/config.h old mode 100755 new mode 100644 index 3b3a7744..626027cf --- a/pc/config.h +++ b/pc/config.h @@ -1,25 +1,25 @@ /* config.h. Generated automatically by configure. */ -/* configh.in. Generated automatically from configure.in by autoheader. */ +/* config.h.in. Generated automatically from configure.in by autoheader. */ /* * acconfig.h -- configuration definitions for gawk. */ -/* - * Copyright (C) 1995-2000 the Free Software Foundation, Inc. - * +/* + * Copyright (C) 1995-2001 the Free Software Foundation, Inc. + * * This file is part of GAWK, the GNU implementation of the - * AWK Progamming Language. - * + * 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 2 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA @@ -67,9 +67,18 @@ /* Define if you don't have vprintf but do have _doprnt. */ /* #undef HAVE_DOPRNT */ +/* Define if you have a working `mmap' system call. */ +/* #undef HAVE_MMAP */ + /* Define if your struct stat has st_blksize. */ #define HAVE_ST_BLKSIZE 1 +/* Define if you have the ANSI # stringizing operator in cpp. */ +#define HAVE_STRINGIZE 1 + +/* Define if you have that is POSIX.1 compatible. */ +/* #undef HAVE_SYS_WAIT_H */ + /* Define if your struct tm has tm_zone. */ /* #undef HAVE_TM_ZONE */ @@ -80,9 +89,15 @@ /* Define if you have the vprintf function. */ #define HAVE_VPRINTF 1 +/* Define as __inline if that's what the C compiler calls it. */ +/* #undef inline */ + /* Define if on MINIX. */ /* #undef _MINIX */ +/* Define to `long' if doesn't define. */ +/* #undef off_t */ + /* Define to `int' if doesn't define. */ /* #undef pid_t */ @@ -102,9 +117,9 @@ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ /* #undef STACK_DIRECTION */ @@ -120,20 +135,38 @@ /* Define to `int' if doesn't define. */ /* #undef uid_t */ -/* #undef GETPGRP_IS_STANDARD */ /* getpgrp does/does not take an argument */ -/* #undef HAVE_BCOPY */ /* we have the bcopy function */ -#define HAVE_MEMCPY 1 /* we have the memcpy function */ -#define HAVE_STRINGIZE 1 /* can use ANSI # operator in cpp */ -#define HAVE_STRING_H 1 /* the header file */ -#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ -#define SPRINTF_RET int /* return type of sprintf */ +#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ +#define SPRINTF_RET int /* return type of sprintf */ +/* #undef HAVE_MKTIME */ /* we have the mktime function */ +/* #undef HAVE_SOCKETS */ /* we have sockets on this system */ +/* #undef HAVE_PORTALS */ /* we have portals on /p on this system */ +/* #undef DYNAMIC */ /* allow dynamic addition of builtins */ +/* #undef STRTOD_NOT_C89 */ /* strtod doesn't have C89 semantics */ -/* #undef BITOPS */ /* bitwise ops (undocumented feature) */ -/* #undef NONDECDATA */ /* non-decimal input data (undocumented feature) */ +/* Define if you have the __argz_count function. */ +#define HAVE___ARGZ_COUNT 1 + +/* Define if you have the __argz_next function. */ +#define HAVE___ARGZ_NEXT 1 + +/* Define if you have the __argz_stringify function. */ +#define HAVE___ARGZ_STRINGIFY 1 + +/* Define if you have the alarm function. */ +#define HAVE_ALARM 1 + +/* Define if you have the dcgettext function. */ +/* #undef HAVE_DCGETTEXT */ /* Define if you have the fmod function. */ #define HAVE_FMOD 1 +/* Define if you have the getcwd function. */ +/* #undef HAVE_GETCWD */ + +/* Define if you have the getpagesize function. */ +/* #undef HAVE_GETPAGESIZE */ + /* Define if you have the memcmp function. */ #define HAVE_MEMCMP 1 @@ -143,12 +176,30 @@ /* Define if you have the memset function. */ #define HAVE_MEMSET 1 -/* Define if you have the random function. */ -#define HAVE_RANDOM 1 +/* Define if you have the munmap function. */ +/* #undef HAVE_MUNMAP */ + +/* Define if you have the putenv function. */ +/* #undef HAVE_PUTENV */ + +/* Define if you have the setenv function. */ +/* #define HAVE_SETENV */ + +/* Define if you have the setlocale function. */ +/* #undef HAVE_SETLOCALE */ + +/* Define if you have the stpcpy function. */ +/* #undef HAVE_STPCPY */ + +/* Define if you have the strcasecmp function. */ +/* #undef HAVE_STRCASECMP */ /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 +/* Define if you have the strdup function. */ +#define HAVE_STRDUP 1 + /* Define if you have the strerror function. */ #define HAVE_STRERROR 1 @@ -167,24 +218,107 @@ /* Define if you have the tzset function. */ #define HAVE_TZSET 1 +/* Define if you have the header file. */ +/* #undef HAVE_ARGZ_H */ + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +/* #undef HAVE_LIBINTL_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_LIMITS_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_LOCALE_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_MALLOC_H */ + /* Define if you have the header file. */ #define HAVE_MEMORY_H 1 +/* Define if you have the header file. */ +/* #undef HAVE_NETDB_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NETINET_IN_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_NL_TYPES_H */ + /* Define if you have the header file. */ /* #undef HAVE_SIGNUM_H */ /* Define if you have the header file. */ #define HAVE_STDARG_H 1 +/* Define if you have the header file. */ +/* #undef HAVE_STDLIB_H */ + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + /* Define if you have the header file. */ /* #undef HAVE_STRINGS_H */ /* Define if you have the header file. */ #define HAVE_SYS_PARAM_H 1 +/* Define if you have the header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define if you have the header file. */ +/* #undef HAVE_SYS_TIME_H */ + /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Define if you have the i library (-li). */ +/* #undef HAVE_LIBI */ + +/* Define if you have the intl library (-lintl). */ +/* #undef HAVE_LIBINTL */ + +/* Define if you have the m library (-lm). */ +#define HAVE_LIBM 1 + +/* Name of package */ +#define PACKAGE "gawk" + +/* Version number of package */ +#define VERSION "3.0.89" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */ +/* #undef _XOPEN_SOURCE */ + +/* Define if compiler has function prototypes */ +#define PROTOTYPES 1 + +/* Define to 1 if you have the stpcpy function. */ +/* #undef HAVE_STPCPY */ + +/* Define if your locale.h file contains LC_MESSAGES. */ +/* #undef HAVE_LC_MESSAGES */ + +/* Define to 1 if NLS is requested. */ +/* #undef ENABLE_NLS */ + +/* Define to 1 if you have gettext and don't want to use GNU gettext. */ +/* #undef HAVE_GETTEXT */ + +/* Define as 1 if you have catgets and don't want to use GNU gettext. */ +/* #undef HAVE_CATGETS */ /* Library search path */ #define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk" @@ -196,14 +330,10 @@ #undef HAVE_UNISTD_H #undef HAVE_SYS_PARAM_H #undef HAVE_RANDOM -#define RANDOM_MISSING /* msc strftime is incomplete, use supplied version */ #undef HAVE_STRFTIME /* #define HAVE_TM_ZONE */ #define altzone timezone -#if defined(OS2) /* declare alloca for bison */ -void * alloca(unsigned); -#endif #endif # define HAVE_POPEN_H diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc index 9912dcf3..860e6b71 100644 --- a/pc/gawkmisc.pc +++ b/pc/gawkmisc.pc @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 1986, 1988, 1989, 1991 - 96 the Free Software Foundation, Inc. + * Copyright (C) 1986, 1988, 1989, 1991 - 2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming Language. @@ -44,7 +44,8 @@ const char *filespec; /* OS/2 allows / for directory separator too */ if ((q = strrchr(p, '\\')) != NULL) p = q + 1; - if ((q = strrchr(p, '/')) != NULL) + if ((q = strrchr(p, '/')) != NULL + && (p == NULL || q > p)) /* support mixed d:\foo/bar\gawk.exe */ p = q + 1; if ((q = strchr(p, '.')) != NULL) *q = '\0'; @@ -73,7 +74,12 @@ os_devopen(name, flag) const char *name; int flag; { - /* no-op */ + if (strcmp(name, "/dev/null") == 0) + return open("NUL", flag); + /* FIXME: */ + /* else if (strcmp(name, "/dev/tty") == 0) + * return open("???", flag); + */ return -1; } @@ -132,3 +138,75 @@ int c; return (strchr(":\\/", c) != NULL); } +/* os_close_on_exec --- set close on exec flag, print warning if fails */ + +void +os_close_on_exec(fd, name, what, dir) +int fd; +const char *name, *what, *dir; +{ +#if ! defined(_MSC_VER) && ! defined(__MINGW32__) +#if defined(__DJGPP__) && (__DJGPP__ > 2 || __DJGPP_MINOR__ >= 4) + if (fcntl(fd, F_SETFD, 1) < 0) + warning("%s %s `%s': could not set close-on-exec: %s", + what, dir, name, strerror(errno)); +#endif +#endif +} + +/* os_isdir --- is this an fd on a directory? */ + +#if ! defined(S_ISDIR) && defined(S_IFDIR) +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +#endif + +int +os_isdir(fd) +int fd; +{ + struct stat sbuf; + + return (fstat(fd, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)); +} + +/* os_is_setuid --- true if running setuid root */ + +int +os_is_setuid() +{ + return 0; +} + +/* os_setbinmode --- set binary mode on file */ + +#ifdef __DJGPP__ +#include +#endif +static int orig_tty_mode = -1; + +int +os_setbinmode (fd, mode) +int fd, mode; +{ + int prev_mode = setmode(fd, mode); + +#ifdef __DJGPP__ + if ((mode & O_BINARY) != 0) + __djgpp_set_ctrl_c(1); /* allow to interrupt with Ctrl-C */ +#endif + /* Save the original tty mode as we found it. */ + if (orig_tty_mode == -1 && fd >= 0 && fd <= 2) + orig_tty_mode = prev_mode; + return prev_mode; +} + +/* os_restore_mode --- restore the original mode of the console device */ + +void +os_restore_mode (fd) +int fd; +{ + if (orig_tty_mode != -1) { + setmode(fd, orig_tty_mode); + } +} diff --git a/pc/popen.c b/pc/popen.c index 88de3e29..28e1ebd5 100644 --- a/pc/popen.c +++ b/pc/popen.c @@ -21,12 +21,10 @@ #endif static char template[] = "piXXXXXX"; -typedef enum { unopened = 0, reading, writing } pipemode; -static -struct { - char *command; - char *name; - pipemode pmode; +static struct { + char *command; + char *name; + char pmode[4]; } pipes[_NFILE]; @@ -41,8 +39,7 @@ struct { #if defined(_MSC_VER) || defined(__MINGW32__) static int -unixshell(p) -char *p; +unixshell(char *p) { static char *shell[] = {"sh", "bash", "csh", "tcsh", "sh32", "sh16", "ksh", NULL}; char **shellp = shell, *s, *q; @@ -64,8 +61,7 @@ char *p; } static char * -slashify(p, s) -char *p, *s; +slashify(char *p, char *s) { if (unixshell(s)) while (s = strchr(p, '\\')) *s = '/'; @@ -75,8 +71,7 @@ char *p, *s; } static char * -scriptify(command) -char *command; +scriptify(char *command) { FILE *fp; char *cmd, *name, *s, *p; @@ -90,25 +85,26 @@ char *command; p = s; } slashify(name, p); - if (! unixshell(p)) { + if (! (i = unixshell(p))) { realloc(name, strlen(name) + 5); strcat(name, ".bat"); } if (s) sprintf(cmd + strlen(cmd), " %cc ", unixshell(s) ? '-' : '/'); strcpy(p = cmd + strlen(cmd), name); free(name); - i = strlen(command); - if ( ((fp = fopen(p, "wb")) == NULL) || (fwrite(command, 1, i, fp) < i) - || (fputc('\n', fp) == EOF)) { - cmd = NULL; - } + if ((fp = fopen(p, i ? "wb" : "w")) != NULL) { + if (! i) fputs("@echo off\n", fp); + i = strlen(command); + if ((fwrite(command, 1, i, fp) < i) || (fputc('\n', fp) == EOF)) + cmd = NULL; + } else + cmd = NULL; if (fp) fclose(fp); return(cmd); } static void -unlink_and_free(cmd) -char *cmd; +unlink_and_free(char *cmd) { char *s; @@ -120,8 +116,7 @@ char *cmd; } int -os_system(cmd) -char *cmd; +os_system(char *cmd) { char *s; int i; @@ -145,31 +140,26 @@ char *cmd; FILE * -os_popen( char *command, char *mode ) { +os_popen( char *command, char *mode ) +{ FILE *current; char *name; int cur; - pipemode curmode; + char curmode[4]; #if defined(OS2) && (_MSC_VER != 510) if (_osmode == OS2_MODE) return(popen(command, mode)); #endif - /* - ** decide on mode. - */ - if(strcmp(mode,"r") == 0) - curmode = reading; - else if(strcmp(mode,"w") == 0) - curmode = writing; - else - return NULL; + if (*mode != 'r' && *mode != 'w') + return NULL; + strncpy(curmode, mode, 3); curmode[3] = '\0'; #if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32)) current = popen(command = scriptify(command), mode); cur = fileno(current); - pipes[cur].pmode = curmode; + strcpy(pipes[cur].pmode, curmode); pipes[cur].command = command; return(current); #endif @@ -183,32 +173,36 @@ os_popen( char *command, char *mode ) { ** If we're reading, just call system to get a file filled with ** output. */ - if(curmode == reading) { + if (*curmode == 'r') { FILE *fp; if ((cur = dup(fileno(stdout))) == -1) return NULL; - if ((current = freopen(name, "w", stdout)) == NULL) + *curmode = 'w'; + if ((current = freopen(name, curmode, stdout)) == NULL) return NULL; os_system(command); if (dup2(cur, fileno(stdout)) == -1) return NULL; close(cur); - if((current = fopen(name,"r")) == NULL) + *curmode = 'r'; + if ((current = fopen(name, curmode)) == NULL) return NULL; } else { - if((current = fopen(name,"w")) == NULL) + if ((current = fopen(name, curmode)) == NULL) return NULL; } cur = fileno(current); pipes[cur].name = name; - pipes[cur].pmode = curmode; + strcpy(pipes[cur].pmode, curmode); pipes[cur].command = strdup(command); return current; } int -os_pclose( FILE * current) { - int cur = fileno(current),rval; +os_pclose( FILE * current) +{ + int cur = fileno(current); + int fd, rval; #if defined(OS2) && (_MSC_VER != 510) if (_osmode == OS2_MODE) @@ -217,7 +211,7 @@ os_pclose( FILE * current) { #if defined(__MINGW32__) || (defined(_MSC_VER) && defined(WIN32)) rval = pclose(current); - pipes[cur].pmode = unopened; + *pipes[cur].pmode = '\0'; unlink_and_free(pipes[cur].command); return rval; #endif @@ -225,24 +219,24 @@ os_pclose( FILE * current) { /* ** check for an open file. */ - if(pipes[cur].pmode == unopened) - return -1; - if(pipes[cur].pmode == reading) { + switch (*pipes[cur].pmode) { + case 'r': /* ** input pipes are just files we're done with. */ rval = fclose(current); unlink(pipes[cur].name); - } else { + break; + case 'w': /* ** output pipes are temporary files we have ** to cram down the throats of programs. */ - int fd; fclose(current); rval = -1; if ((fd = dup(fileno(stdin))) != -1) { - if (current = freopen(pipes[cur].name, "r", stdin)) { + char *mode = pipes[cur].pmode; *mode = 'r'; + if (current = freopen(pipes[cur].name, mode, stdin)) { rval = os_system(pipes[cur].command); fclose(current); if (dup2(fd, fileno(stdin)) == -1) rval = -1; @@ -250,11 +244,14 @@ os_pclose( FILE * current) { } } unlink(pipes[cur].name); + break; + default: + return -1; } /* ** clean up current pipe. */ - pipes[cur].pmode = unopened; + *pipes[cur].pmode = '\0'; free(pipes[cur].name); free(pipes[cur].command); return rval; diff --git a/pc/popen.h b/pc/popen.h index 3735f455..cc5d7cc3 100644 --- a/pc/popen.h +++ b/pc/popen.h @@ -15,7 +15,7 @@ # endif # define popen(c, m) os_popen(c, m) # define pclose(f) os_pclose(f) - extern FILE *os_popen( char *, char * ); + extern FILE *os_popen( char *, const char * ); extern int os_pclose( FILE * ); # endif #endif -- cgit v1.2.3