diff options
Diffstat (limited to 'pc')
-rw-r--r-- | pc/ChangeLog | 3 | ||||
-rw-r--r-- | pc/Makefile | 299 | ||||
-rw-r--r-- | pc/Makefile.emx | 53 | ||||
-rw-r--r-- | pc/Makefile.msc | 68 | ||||
-rw-r--r-- | pc/Makefile.os2 | 125 | ||||
-rw-r--r-- | pc/Makefile.tst | 376 | ||||
-rw-r--r-- | pc/awklib/igawk | 85 | ||||
-rw-r--r-- | pc/awklib/igawk.awk | 51 | ||||
-rw-r--r-- | pc/awklib/igawk.bat | 1 | ||||
-rw-r--r-- | pc/config.h | 389 | ||||
-rw-r--r-- | pc/gawk-32.def | 3 | ||||
-rw-r--r-- | pc/gawkmisc.pc | 134 | ||||
-rw-r--r-- | pc/getid.c | 131 | ||||
-rw-r--r-- | pc/include/fcntl.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/install.awk | 61 | ||||
-rw-r--r-- | pc/makegawk.bat | 65 | ||||
-rwxr-xr-x | pc/mkconf.cmd | 31 | ||||
-rw-r--r-- | pc/mkinstal.sh | 33 | ||||
-rwxr-xr-x | pc/mungeconf.cmd | 15 | ||||
-rw-r--r-- | pc/names.lnk | 20 | ||||
-rw-r--r-- | pc/names2.lnk | 19 | ||||
-rw-r--r-- | pc/popen.c | 236 |
28 files changed, 1411 insertions, 808 deletions
diff --git a/pc/ChangeLog b/pc/ChangeLog new file mode 100644 index 00000000..570c031b --- /dev/null +++ b/pc/ChangeLog @@ -0,0 +1,3 @@ +Wed Jan 10 22:58:55 1996 Arnold D. Robbins <arnold@skeeve.atl.ga.us> + + * ChangeLog created. diff --git a/pc/Makefile b/pc/Makefile new file mode 100644 index 00000000..cefd9c3d --- /dev/null +++ b/pc/Makefile @@ -0,0 +1,299 @@ +# Makefile for gawk (GNU awk) 1 Sep 1995 +# +# - for GNU C (djgpp) [executable for DOS (32-bit)] +# - for GNU C (emx) [executable for OS/2 2.x or DOS (32-bit)] +# - for Microsoft C 7 [ececutable for DOS (16-bit)] +# - for Microsoft C 6.00A [executable for OS/2 or DOS (16-bit)] +# - for Microsoft C 5.1 [executable for OS/2 or DOS (16-bit)] + +# Tested with ndmake and dmake-3.8 under DOS and dmake and +# GNU make under OS/2. Compiling with dmake under DOS may require +# the DOS-only version of dmake (so that swapping works). + +default: + @echo "Enter $(MAK) target " + @echo " where 'target' is chosen from " + @echo " djgpp ... DOS 32-bit exe [GNU C, Delorie, v1 or v2] " + @echo " emx ..... OS/2 32-bit exe [emx/gcc; uses emxlibc.dll] " + @echo " emxbnd .. OS/2 and DOS 32-bit exe [emx/gcc] " + @echo " msc ..... DOS exe [Microsoft C 7] " + @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 " ----------------------------------------------------- " + @echo " test .... Perform tests (see README_d/README.pc) " + @echo " install . Install gawk under $(prefix)/ " + +# Support dropped in 3.0 +# @echo " msc51 DOS exe [Microsoft C 5.1] " +# @echo " msc51bnd OS/2 and DOS exe [Microsoft C 5.1] " + +#======================= Configuration ================================== +RSPFILE = gawk.rsp +# +# Choose method for passing arguments to the linker. +# +# If compiling under OS/2 or if make can pass long lines +#LDRSP = $(GAWKOBJS) +#LINKRSP = $(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")) +#LINKRSP = @$(mktmp $(<:t"+\n") ) # Space before final paren req +# +# else use brain-dead approach (emxbnd will need 'tr'). +RSP = $(RSPFILE) +LDRSP = @$(RSP) +LINKRSP = $(LDRSP) +#------------------------------------------------------------------------ +# Some makes do not define MAKE (and ndmake does not allow a define). +# Define MAK to be your make command. +#MAK = $(MAKE) $(MAKEFILE) +MAK = $(MAKE) +#MAKEFILE = -f Makefile +#MAK = make45 $(MAKEFILE) +#------------------------------------------------------------------------ +# Define the base directory for the install. "make install" will install +# in bin, lib/awk, man, and info under $(prefix)/. Most likely, you should +# edit config.h so that $(prefix)/lib/awk appears as part of DEFPATH. +#prefix = +prefix = c:/gnu +# +# Define the install method. Method 1 is Unix-like (and requires cat, +# cp, mkdir, sed, and sh); method 2 uses gawk and batch files. +install = 1 +#======================================================================== +# End of general configuration. Some platform-specific configuration +# notes appear below. + + +#======================================================================== +#========================== DJGPP ======================================= +#======================================================================== + +LDJG = $(CC) $(LF) -o gawk $(LDRSP) $(LF2) +#BDJG = coff2exe -s /djgpp/bin/go32.exe gawk +BDJG = coff2exe gawk + +djgpp: + $(MAK) all \ + CC=gcc O=.o CF=-O \ + LINK=LDJG LF=-s LF2=-lm \ + BIND=BDJG + +djgpp-debug: + $(MAK) all \ + CC=gcc O=.o CF=-g \ + LINK=LDJG LF2=-lm \ + BIND=BDJG + +#======================================================================== +#========================== EMX ========================================= +#======================================================================== + +# Link command for OS/2 versions. +LEMX = $(CC) $(LF) -o $@ $(GAWKOBJS) gawk.def -lbsd $(LF2) + +# Link and bind for DOS and OS/2 versions. +# emx-09 needs '-p' emx option here or in EMXOPT environ var. +LEMXBND = $(CC) $(LF) -o a.out $(LDRSP) gawk.def -lbsd $(LF2) +BEMX = emxbind -b /emx/bin/emxl.exe a.out $@ -p +#BEMX = emxbind -b /emx/bin/emx.exe a.out $@ -p + +emx: + $(MAK) all \ + "CC=gcc -Zomf" O=.obj "CF=-O -DOS2" \ + LINK=LEMX "LF=-s -Zcrtdll -Zstack 512" RSP= + +emxbnd: + $(MAK) all \ + CC=gcc O=.o "CF=-O -DOS2 -DMSDOS" OBJ=popen.o \ + LINK=LEMXBND LF=-s \ + BIND=BEMX "P=|tr \" \" \"\n\"" + +emxbnd-debug: + $(MAK) all \ + CC=gcc O=.o CF="-g -DOS2 -DMSDOS" OBJ=popen.o \ + LINK=LEMXBND \ + BIND=BEMX "P=|tr \" \" \"\n\"" + +#======================================================================== +#========================== 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 = -Os -G2 +MSCOPT = -Ot # -G2 +# Alternate lib, does not use math coprocessor. +#MSCLIB = llibca +#MSCCL = -FPa +# Emulator lib, uses math coprocessor if present. +MSCLIB = llibce +MSCCL = -FPi +#MSCCL = -FPc + +LMSC = link $(LF) $(LINKRSP) $(STDARGV)/NOE,$@,,/NOD:llibce $(MSCLIB)$(LF2)/STACK:0x6f00; + +# 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 \ + LINK=LMSC P=+ + +msc-debug: + $(MAK) all \ + "CC=cl $(MSCCL)" O=.obj "CF=-AL -Ze -Ipc/include -W2 -Zi -Od" \ + OBJ=popen.obj \ + LINK=LMSC LF2=/CO P=+ + +msc6: + $(MAK) all \ + "CC=cl -nologo $(MSCCL)" O=.obj "CF=-AL -Za $(MSCOPT)" \ + OBJ=popen.obj \ + LINK=LMSC P=+ + +msc6os2: + $(MAK) all \ + "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 -UMSDOS $(MSCOPT)" \ + LINK=LMSC "LF2=p,gawk.def" P=+ + +msc6bnd: + $(MAK) all \ + "CC=cl $(MSCCL)" O=.obj "CF=-AL -DOS2 $(MSCOPT)" \ + OBJ=popen.obj \ + LINK=LMSC "LF2=p,gawk.def" P=+ \ + BIND=BMSC + +# Support dropped in 3.0 +#msc51: +# $(MAK) all \ +# "CC=cl $(MSCCL)" O=.obj "CF=-AL -Za -D_MSC_VER=510 $(MSCOPT)" \ +# OBJ=popen.obj \ +# LINK=LMSC P=+ +# +#msc51bnd: +# $(MAK) all \ +# "CC=cl -AL ($MSCCL)" O=.obj "CF=-DOS2 -D_MSC_VER=510 $(MSCOPT)" \ +# OBJ=popen.obj \ +# LINK=CLMSC "LF=-Lp -Fb" "LF2=gawk.def" + +#======================================================================== + +# Define BIND for BINDless compiles, otherwise $($(BIND)) may break. +BIND = EMPTY +EMPTY= + +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 +AWKOBJS = $(AWKOBJS1) $(AWKOBJS2) + +ALLOBJS = $(AWKOBJS) awktab$O getid$O $(OBJ) + +# GNUOBJS +# GNU stuff that gawk uses as library routines. +GNUOBJS= getopt$O getopt1$O regex$O dfa$O + +GAWKOBJS = $(ALLOBJS) $(GNUOBJS) + +# clear out suffixes list +# .SUFFIXES: +.SUFFIXES: .c $O + +.c$O: + $(CC) -c $(CFLAGS) $< + +# rules to build gawk +all : gawk.exe + +gawk.exe:: $(ALLOBJS) $(GNUOBJS) $(RSP) + $($(LINK)) + $($(BIND)) + +$(RSPFILE) : $(GAWKOBJS) + echo $(AWKOBJS1)$P > $@ + echo $(AWKOBJS2)$P >> $@ + echo awktab$O getid$O $(OBJ) $(GNUOBJS)$P >> $@ + +$(ALLOBJS): awk.h dfa.h regex.h config.h + +gawkmisc$O: pc/gawkmisc.pc + +getopt$O: getopt.h + +getopt1$O: getopt.h + +main$O: patchlevel.h + +# A bug in ndmake requires the following rule +awktab$O: awk.h awktab.c + $(CC) -c $(CFLAGS) awktab.c + +awktab.c: awk.y + bison -o $@ awk.y + +alloca$O: alloca.c + +#.PRECIOUS: install +#.PHONY: install + +install: install$(install) + +install1: + echo extproc sh $(prefix)/bin/igawk.cmd > igawk.cmd + echo shift >> igawk.cmd + cat pc/awklib/igawk >> igawk.cmd + sed "s;igawk;$(prefix)/bin/igawk;" pc/awklib/igawk.bat > igawk.bat + sh mkinstal.sh $(prefix)/bin + sh mkinstal.sh $(prefix)/lib/awk $(prefix)/man/man1 $(prefix)/info + cp gawk.exe igawk.bat igawk.cmd pc/awklib/igawk $(prefix)/bin + cp awklib/eg/lib/* pc/awklib/igawk.awk $(prefix)/lib/awk + cp doc/*.1 $(prefix)/man/man1 + cp doc/gawk.info $(prefix)/info + +# install2 is equivalent to install1, but doesn't require cp, sed, etc. +install2: + gawk -v prefix=$(prefix) -f install.awk + +clean: + rm -rf gawk gawk.exe *.o *.obj core a.out $(RSPFILE) +# cd doc && $(MAKE) clean +# cd test && $(MAKE) clean +# cd awklib && $(MAKE) clean + +awklib/eg: doc/gawk.texi + rm -fr awklib/eg + sh -c "cd awklib && ../gawk -f extract.awk ../doc/gawk.texi" + +check: + cd test && $(MAK) -k AWK=../gawk.exe + +test: check diff --git a/pc/Makefile.emx b/pc/Makefile.emx deleted file mode 100644 index 3be4a844..00000000 --- a/pc/Makefile.emx +++ /dev/null @@ -1,53 +0,0 @@ -# Makefile for gawk (GNU awk) using EMX/gcc
-#
-# This makefile is designed to work within the limits of the DOS
-# command-line length. OS/2 users can use Makefile.os2, which
-# has additional targets.
-#
-
-
-CC=gcc -O -s
-O=.o
-CFLAGS=-DOS2 -DMSDOS
-
-LFLAGS=
-LFLAGS2=gawk-32.def
-
-#BIND=emxbind -u /emx/bin/emx.exe $@
-BIND=
-
-OBJ2=getid$O popen$O
-
-AWKOBJS = main$O eval$O builtin$O msg$O iop$O io$O field$O array$O \
- node$O version$O missing$O re$O
-ALLOBJS = $(AWKOBJS) awktab$O
-GNUOBJS= getopt$O getopt1$O regex$O dfa$O
-
-.SUFFIXES: $O .c .y
-
-.c$O:
- $(CC) $(CFLAGS) -DGAWK -DHAVE_CONFIG_H -c $<
-
-all: gawk.exe
-
-gawk.exe: $(ALLOBJS) $(GNUOBJS) $(OBJ2)
- $(CC) -o $@ $(LFLAGS) @names2.lnk $(LFLAGS2)
- $(BIND)
-
-$(AWKOBJS): awk.h config.h
-dfa$O: awk.h config.h dfa.h
-regex$O: awk.h config.h regex.h
-main$O: patchlev.h
-awktab$O: awk.h awktab.c
-
-awktab.c: awk.y
- bison -o $@ awk.y
-
-clean:
- rm -f *.o core awk.output gmon.out make.out y.output
-
-.PHONY: test
-test:
- @echo Both dmake and GNU make require modifications to test/Makefile,
- @echo but here we go...
- cd test && $(MAKE) -k
diff --git a/pc/Makefile.msc b/pc/Makefile.msc deleted file mode 100644 index 078aab54..00000000 --- a/pc/Makefile.msc +++ /dev/null @@ -1,68 +0,0 @@ -# Makefile for gawk (GNU awk) using Microsoft C
-#
-# This makefile is designed to work within the limits of the DOS
-# command-line length. OS/2 users can use Makefile.os2, which
-# has additional targets.
-#
-
-DEFS = -D_MSC_VER
-
-# For MSC 5.1
-#DEFS = -D_MSC_VER=510
-
-# MSC 6.00A has _MSC_VER predefined
-#DEFS =
-
-
-#DEBUG = -W3 -Zi -Od
-DEBUG=
-
-MODEL = L
-CC=cl -nologo -A$(MODEL)
-O=.obj
-
-# Disable MSC extensions with -Za so that __STDC__ is defined for MSC 6.00A
-# MSC 5.1 defines __STDC__=0 regardless of the ANSI flag
-CFLAGS = -Za $(DEFS) $(DEBUG)
-
-#LIBS = /NOD:$(MODEL)libce $(MODEL)libcer.lib
-LIBS =
-
-OBJ2=getid$O popen$O
-
-AWKOBJS = main$O eval$O builtin$O msg$O iop$O io$O field$O array$O \
- node$O version$O missing$O re$O
-ALLOBJS = $(AWKOBJS) awktab$O
-GNUOBJS= getopt$O getopt1$O regex$O dfa$O
-
-.SUFFIXES: $O .c .y
-
-.c$O:
- $(CC) $(CFLAGS) -DGAWK -DHAVE_CONFIG_H -c $<
-
-all: gawk.exe
-
-gawk.exe: $(ALLOBJS) $(GNUOBJS) $(OBJ2)
- link @names.lnk, $@,,$(LIBS) /NOE /st:30000;
-
-
-$(AWKOBJS): awk.h config.h
-dfa$O: awk.h config.h dfa.h
-regex$O: awk.h config.h regex.h
-main$O: patchlev.h
-
-# A bug in ndmake requires the following rule
-awktab$O: awk.h awktab.c
- $(CC) $(CFLAGS) -DGAWK -c awktab.c
-
-awktab.c: awk.y
- bison -o $@ awk.y
-
-clean:
- rm -f *.o *.obj core awk.output gmon.out make.out y.output
-
-.PHONY: test
-test:
- @echo Both dmake and GNU make require modifications to test/Makefile,
- @echo but here we go...
- cd test && $(MAKE) -k
diff --git a/pc/Makefile.os2 b/pc/Makefile.os2 deleted file mode 100644 index 635f12a8..00000000 --- a/pc/Makefile.os2 +++ /dev/null @@ -1,125 +0,0 @@ -# Makefile for gawk (GNU awk) 17 Sep 1993
-#
-# - for GNU gcc (emx 0.8g kit) [executables for OS/2 2.x or DOS (32-bit)]
-# - for Microsoft C 6.00A [executables for OS/2 or MSDOS (16-bit)]
-# - for Microsoft C 5.1 [executable for OS/2 or DOS (16-bit)]
-
-# To use, enter "make -f Makefile.os2" (this makefile depends on its
-# name being "Makefile.os2").
-#
-# Tested with dmake 3.8 and GNU make 3.68 under OS/2
-
-default:
- @echo "Enter $(MAKE) -f Makefile.os2 target "
- @echo " where 'target' is chosen from "
- @echo " msc OS/2 exe [Microsoft C 6.00a] "
- @echo " mscbnd OS/2 and DOS exe [Microsoft C 6.00a] "
- @echo " mscdos DOS exe [Microsoft C 6.00a] "
- @echo " msc51bnd OS/2 and DOS exe [Microsoft C 5.1] "
- @echo " emx OS/2 32-bit exe [EMX/gcc; uses emxlibc.dll] "
- @echo " emxbnd OS/2 and DOS 32-bit exe [EMX/gcc] "
-
-
-# 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
-
-msc:
- $(MAKE) -f Makefile.os2 all \
- CC="cl -nologo -AL" O=".obj" \
- CFLAGS="-D__STDC__ -DOS2 -UMSDOS" \
- OBJ2="" \
- LFLAGS="-Lp" \
- LFLAGS2="$(STDARGV) gawk.def -link /NOE /st:30000"
-
-mscbnd:
- $(MAKE) -f Makefile.os2 all \
- CC="cl -nologo -AL" O=".obj" \
- CFLAGS="-D__STDC__ -DOS2" \
- OBJ2="popen.obj" \
- LFLAGS="-Lp" \
- LFLAGS2="setargv.obj gawk.def -link /NOE /st:30000" \
- BIND="bind gawk /n DOSMAKEPIPE DOSCWAIT"
-
-msc-debug:
- $(MAKE) -f Makefile.os2 all \
- CC="cl -nologo -AL" O=".obj" \
- CFLAGS="-DOS2 -D__STDC__ -DDEBUG -DFUNC_TRACE -DMEMDEBUG -Zi -Od" \
- OBJ2="popen.obj" \
- LFLAGS="-Lp" \
- LFLAGS2="$(STDARGV) gawk.def -link /CO /NOE /st:30000"
-
-mscdos:
- $(MAKE) -f Makefile.os2 all \
- CC="cl -nologo -AL" O=".obj" \
- CFLAGS="-D__STDC__" \
- OBJ2="popen.obj" \
- LFLAGS="-Lr" \
- LFLAGS2="$(STDARGV) -link /NOE /st:30000"
-
-msc51bnd:
- $(MAKE) -f Makefile.os2 all \
- CC="cl -AL" O=".obj" \
- CFLAGS="-DOS2 -D_MSC_VER=510" \
- OBJ2="popen.obj" \
- LFLAGS="-Lp -Fb" \
- LFLAGS2="setargv.obj gawk.def -link /NOE /NOI /st:30000"
-
-emx:
- $(MAKE) -f Makefile.os2 all \
- CC="gcc -Zomf -Zmtd -O -s" O=".obj" \
- CFLAGS="-DOS2" \
- LFLAGS="" \
- LFLAGS2="gawk-32.def"
-
-emx-debug:
- $(MAKE) -f Makefile.os2 all \
- CC="gcc -g" O=".o" \
- CFLAGS="-DOS2" \
- LFLAGS="" \
- LFLAGS2="gawk-32.def"
-
-emxbnd:
- $(MAKE) -f Makefile.os2 all \
- CC="gcc -O -s" O=".o" \
- CFLAGS="-DOS2 -DMSDOS" \
- OBJ2="popen.o" \
- LFLAGS="" \
- LFLAGS2="gawk-32.def"
-
-AWKOBJS = main$O eval$O builtin$O msg$O iop$O io$O field$O array$O \
- node$O version$O missing$O re$O
-ALLOBJS = $(AWKOBJS) awktab$O getid$O
-GNUOBJS= getopt$O getopt1$O regex$O dfa$O
-
-.SUFFIXES: $O .c .y
-
-.c$O:
- $(CC) $(CFLAGS) -DGAWK -DHAVE_CONFIG_H -c $<
-
-all: gawk.exe
-
-gawk.exe: $(ALLOBJS) $(GNUOBJS) $(OBJ2)
- $(CC) -o $@ $(LFLAGS) $(ALLOBJS) $(GNUOBJS) $(OBJ2) $(LFLAGS2)
- $(BIND)
-
-$(AWKOBJS): awk.h config.h
-dfa$O: awk.h config.h dfa.h
-regex$O: awk.h config.h regex.h
-main$O: patchlevel.h
-awktab$O: awk.h awktab.c
-
-awktab.c: awk.y
- bison -o $@ awk.y
-
-clean:
- rm -f *.o *.obj core awk.output gmon.out make.out y.output
-
-.PHONY: test
-test:
- @echo Both dmake and GNU make require modifications to test/Makefile,
- @echo but here we go...
- cd test && $(MAKE) -k
diff --git a/pc/Makefile.tst b/pc/Makefile.tst new file mode 100644 index 00000000..749d83ab --- /dev/null +++ b/pc/Makefile.tst @@ -0,0 +1,376 @@ +# Makefile for GNU Awk test suite. +# +# Copyright (C) 1988-1995 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 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 + +# ============================================================================ +# MS-DOS & OS/2 Notes: READ THEM! +# ============================================================================ + +# As of version 2.91, efforts to make this makefile run in MS-DOS and OS/2 +# have started in earnest. The following steps need to be followed in order +# to run this makefile: +# +# 1. The first thing that you will need to do is to convert all of the +# files ending in ".ok" in the test directory and all of the files ending +# in ".good" (or ".goo") in the test/reg directory from having a linefeed +# to having carriage return/linefeed at the end of each line. There are +# various public domain UNIX to DOS converters and any should work. +# +# 2. You will need an sh-compatible shell. Please refer to the "README.pc" +# file in the README_d directory for information about obtaining a copy. +# You will also need various UNIX utilities. At a minimum, you will +# need: rm, tr, cmp, 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. After making all of these +# changes, typing "dmake bigtest extra" should run successfully. + +# So far, the only MS-DOS & OS/2 shell that this has been found to work with +# is Stewartson's sh 2.3. 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. For more information about the @ notation please refer to +# the sh documentation. + +# 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. +# The .SWAP setting forces (DOS-only) dmake to swap itself out. +#.SWAP: childin fflush + +# This won't work unless you have "sh" and set SHELL equal to it. +#SHELL = e:\bin\sh.exe +SHELL = /bin/sh + +# Point to gawk +AWK = ../gawk.exe + +# Set your cmp command here +CMP = cmp +#CMP = gcmp + +# Set your "cp" command here. Note: It must take forward slashes. +# 'command -c copy' will work for MS-DOS if "command=noexpand switch export" is +# set in extend.lst. +#CP = cp +#CP = gcp +CP = command -c copy + +# Set your unix-style date function here +#DATE = date +DATE = gdate + +# Set your mkdir command here. +#MKDIR = /bin/mkdir +MKDIR = command -c mkdir + +# ============================================================================ +# You shouldn't need to modify anything below this line. +# ============================================================================ + +srcdir = . + +bigtest: basic poundba 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 fflush fldchg + +gawk.extensions: fieldwdth ignrcase posix manyfiles igncfs argtest \ + badargs strftime gensub gnureops + +extra: regtes inftest + +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 _$@ + +msg:: + @echo 'Any output from "cmp" is bad news, although some differences' + @echo 'in floating point values are probably benign -- in particular,' + @echo 'some systems may omit a leading zero and the floating point' + @echo 'precision may lead to slightly different output in a few cases.' + +swaplns:: + @echo 'If swaplns fails make sure that all of the .ok files have CR/LFs.' + @$(AWK) -f $(srcdir)/swaplns.awk $(srcdir)/swaplns.in >_$@ + $(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 && 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 && echo OK TEST FAILED; } + rm -f out1 out2 out3 + +argarray:: + @case $(srcdir) in \ + .) : ;; \ + *) cp $(srcdir)/argarray.in . ;; \ + esac + @TEST=test echo just a test | $(AWK) -f $(srcdir)/argarray.awk ./argarray.in - >_$@ + $(CMP) $(srcdir)/argarray.ok _$@ && rm -f _$@ + +fstabplus:: + @echo '1 2' | $(AWK) -f $(srcdir)/fstabplus.awk >_$@ + $(CMP) $(srcdir)/fstabplus.ok _$@ && rm -f _$@ + +fsrs:: + @$(AWK) -f $(srcdir)/fsrs.awk $(srcdir)/fsrs.in >_$@ + $(CMP) $(srcdir)/fsrs.ok _$@ && rm -f _$@ + +igncfs:: + @$(AWK) -f $(srcdir)/igncfs.awk $(srcdir)/igncfs.in >_$@ + $(CMP) $(srcdir)/igncfs.ok _$@ && rm -f _$@ + +longwrds:: + @$(AWK) -f $(srcdir)/longwrds.awk $(srcdir)/manpage | sort >_$@ + $(CMP) $(srcdir)/longwrds.ok _$@ && rm -f _$@ + +fieldwdth:: + @echo '123456789' | $(AWK) -v FIELDWIDTHS="2 3 4" '{ print $$2}' >_$@ + $(CMP) $(srcdir)/fieldwdth.ok _$@ && rm -f _$@ + +ignrcase:: + @echo xYz | $(AWK) -v IGNORECASE=1 '{ sub(/y/, ""); print}' >_$@ + $(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 + +posix:: + @echo 'posix test may fail due to 1.500000e+000 not being equal to' + @echo '1.500000e+00 for MSC 7.0 gawk.' + @echo '1:2,3 4' | $(AWK) -f $(srcdir)/posix.awk >_$@ +# $(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@ + -$(CMP) $(srcdir)/posix.ok _$@ && rm -f _$@ + +manyfiles:: + @rm -rf junk +# @mkdir junk + @$(MKDIR) junk + @$(AWK) 'BEGIN { for (i = 1; i <= 300; i++) print i, i}' >_$@ + @$(AWK) -f $(srcdir)/manyfiles.awk _$@ _$@ +# @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. + @rm -rf junk _$@ + +compare:: + @$(AWK) -f $(srcdir)/compare.awk 0 1 $(srcdir)/compare.in >_$@ + $(CMP) $(srcdir)/compare.ok _$@ && rm -f _$@ + +arrayref:: + @$(AWK) -f $(srcdir)/arrayref.awk >_$@ + $(CMP) $(srcdir)/arrayref.ok _$@ && rm -f _$@ + +rs:: + @$(AWK) -v RS="" '{ print $$1, $$2}' $(srcdir)/rs.in >_$@ + $(CMP) $(srcdir)/rs.ok _$@ && rm -f _$@ + +fsbs:: + @$(AWK) -v FS='\' '{ print $$1, $$2 }' $(srcdir)/fsbs.in >_$@ + $(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 '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 _$@ + +rand:: + @echo The following line should just be 19 random numbers between 1 and 100 + @$(AWK) -f $(srcdir)/rand.awk + +negexp:: + @$(AWK) 'BEGIN { a = -2; print 10^a }' >_$@ + $(CMP) $(srcdir)/negexp.ok _$@ && rm -f _$@ + +asgext:: + @$(AWK) -f $(srcdir)/asgext.awk $(srcdir)/asgext.in >_$@ + $(CMP) $(srcdir)/asgext.ok _$@ && rm -f _$@ + +anchgsub:: + @$(AWK) -f $(srcdir)/anchgsub.awk $(srcdir)/anchgsub.in >_$@ + $(CMP) $(srcdir)/anchgsub.ok _$@ && rm -f _$@ + +splitargv:: + @$(AWK) -f $(srcdir)/splitargv.awk $(srcdir)/splitargv.in >_$@ + $(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 _$@ + +nfset:: + @$(AWK) -f $(srcdir)/nfset.awk $(srcdir)/nfset.in >_$@ + $(CMP) $(srcdir)/nfset.ok _$@ && rm -f _$@ + +reparse:: + @$(AWK) -f $(srcdir)/reparse.awk $(srcdir)/reparse.in >_$@ + $(CMP) $(srcdir)/reparse.ok _$@ && rm -f _$@ + +argtest:: + @$(AWK) -f $(srcdir)/argtest.awk -x -y abc >_$@ + $(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 + +convfmt:: + @$(AWK) -f $(srcdir)/convfmt.awk >_$@ + $(CMP) $(srcdir)/convfmt.ok _$@ && rm -f _$@ + +arrayparm:: + @-AWKPATH=$(srcdir) $(AWK) -f arrayparm.awk >_$@ 2>&1 + $(CMP) $(srcdir)/arrayparm.ok _$@ && rm -f _$@ + +paramdup:: + @-AWKPATH=$(srcdir) $(AWK) -f paramdup.awk >_$@ 2>&1 + $(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 _$@ + +defref:: + @-AWKPATH=$(srcdir) $(AWK) --lint -f defref.awk >_$@ 2>&1 + $(CMP) $(srcdir)/defref.ok _$@ && rm -f _$@ + +nofmtch:: + @-AWKPATH=$(srcdir) $(AWK) --lint -f nofmtch.awk >_$@ 2>&1 + $(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 +# @date | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; print }' > strftime.ok + @$(DATE) | $(AWK) '{ $$3 = sprintf("%02d", $$3 + 0) ; print }' > strftime.ok + @$(AWK) 'BEGIN { print strftime() }' >_$@ + -$(CMP) strftime.ok _$@ && rm -f _$@ strftime.ok + +litoct:: + @echo ab | $(AWK) --traditional -f $(srcdir)/litoct.awk >_$@ + $(CMP) $(srcdir)/litoct.ok _$@ && rm -f _$@ + +gensub:: + @$(AWK) -f $(srcdir)/gensub.awk $(srcdir)/gensub.in >_$@ + $(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 _$@ + +rswhite:: + @$(AWK) -f $(srcdir)/rswhite.awk $(srcdir)/rswhite.in > _$@ + $(CMP) $(srcdir)/rswhite.ok _$@ && rm -f _$@ + +prmarscl:: + @-AWKPATH=$(srcdir) $(AWK) -f prmarscl.awk > _$@ 2>&1 + $(CMP) $(srcdir)/prmarscl.ok _$@ && rm -f _$@ + +sclforin:: + @-AWKPATH=$(srcdir) $(AWK) -f sclforin.awk > _$@ 2>&1 + $(CMP) $(srcdir)/sclforin.ok _$@ && rm -f _$@ + +sclifin:: + @-AWKPATH=$(srcdir) $(AWK) -f sclifin.awk > _$@ 2>&1 + $(CMP) $(srcdir)/sclifin.ok _$@ && rm -f _$@ + +intprec:: + @-$(AWK) -f $(srcdir)/intprec.awk > _$@ 2>&1 + $(CMP) $(srcdir)/intprec.ok _$@ && rm -f _$@ + +childin:: + @echo hi | $(AWK) 'BEGIN { "cat" | getline; print; close("cat") }' > _$@ + $(CMP) $(srcdir)/childin.ok _$@ && rm -f _$@ + +noeffect:: + @-AWKPATH=$(srcdir) $(AWK) --lint -f noeffect.awk > _$@ 2>&1 + $(CMP) $(srcdir)/noeffect.ok _$@ && rm -f _$@ + +numsubstr:: + @-AWKPATH=$(srcdir) $(AWK) -f numsubstr.awk $(srcdir)/numsubstr.in >_$@ + $(CMP) $(srcdir)/numsubstr.ok _$@ && rm -f _$@ + +gnureops:: + @$(AWK) -f $(srcdir)/gnureops.awk >_$@ + $(CMP) $(srcdir)/gnureops.ok _$@ && rm -f _$@ + +pcntplus:: + @$(AWK) -f $(srcdir)/pcntplus.awk >_$@ + $(CMP) $(srcdir)/pcntplus.ok _$@ && rm -f _$@ + +prmreuse:: + @$(AWK) -f $(srcdir)/prmreuse.awk >_$@ + $(CMP) $(srcdir)/prmreuse.ok _$@ && rm -f _$@ + +math:: + @$(AWK) -f $(srcdir)/math.awk >_$@ + $(CMP) $(srcdir)/math.ok _$@ && rm -f _$@ + +fflush:: + @$(srcdir)/fflush.sh >_$@ + $(CMP) $(srcdir)/fflush.ok _$@ && rm -f _$@ + +fldchg:: + @$(AWK) -f $(srcdir)/fldchg.awk $(srcdir)/fldchg.in >_$@ + $(CMP) $(srcdir)/fldchg.ok _$@ && rm -f _$@ + +clean: + rm -fr _* core junk diff --git a/pc/awklib/igawk b/pc/awklib/igawk new file mode 100644 index 00000000..7c599dca --- /dev/null +++ b/pc/awklib/igawk @@ -0,0 +1,85 @@ +#! /bin/sh + +# igawk --- like gawk but do @include processing +# Arnold Robbins, arnold@gnu.ai.mit.edu, Public Domain +# July 1993 + +igs=${TMP:-/tmp}/igs$$ +ige=${TMP:-/tmp}/ige$$ + +if [ "$1" = debug ] +then + set -x + shift +else + # cleanup on exit, hangup, interrupt, quit, termination + #trap 'rm -f $igs $ige' 0 1 2 3 15 + trap 'rm -f $igs $ige' 0 2 15 +fi + +while [ $# -ne 0 ] # loop over arguments +do + case $1 in + --) shift; break;; + + -W) shift + set -- -W"$@" + continue;; + + -[vF]) opts="$opts $1 '$2'" + shift;; + + -[vF]*) opts="$opts '$1'" ;; + + -f) echo @include "$2" >> $igs + shift;; + + -f*) f=`echo "$1" | sed 's/-f//'` + echo @include "$f" >> $igs ;; + + -?file=*) # -Wfile or --file + f=`echo "$1" | sed 's/-.file=//'` + echo @include "$f" >> $igs ;; + + -?file) # get arg, $2 + echo @include "$2" >> $igs + shift;; + + -?source=*) # -Wsource or --source + t=`echo "$1" | sed 's/-.source=//'` + echo "$t" >> $igs ;; + + -?source) # get arg, $2 + echo "$2" >> $igs + shift;; + + -?version) + echo igawk: version 1.0 1>&2 + gawk --version + exit 0 ;; + + -[W-]*) opts="$opts '$1'" ;; + + *) break;; + esac + + shift +done + +if [ ! -s $igs ] +then + if [ -z "$1" ] + then + echo igawk: no program! 1>&2 + exit 1 + else + echo "$1" > $igs + shift + fi +fi + +# at this point, $igs has the program +gawk -f igawk.awk $igs > $ige +eval gawk -f '$ige' $opts -- "$@" + +exit $? diff --git a/pc/awklib/igawk.awk b/pc/awklib/igawk.awk new file mode 100644 index 00000000..dc0ba405 --- /dev/null +++ b/pc/awklib/igawk.awk @@ -0,0 +1,51 @@ +# igawk.awk +# process @include directives + +function pathto(file, i, t, junk) +{ + if (index(file, "/") != 0) + return file + + for (i = 1; i <= ndirs; i++) { + t = (pathlist[i] "/" file) + if ((getline junk < t) > 0) { + # found it + close(t) + return t + } + } + return "" +} +BEGIN { + path = ENVIRON["AWKPATH"] + ndirs = split(path, pathlist, ";") + for (i = 1; i <= ndirs; i++) { + if (pathlist[i] == "") + pathlist[i] = "." + } + stackptr = 0 + input[stackptr] = ARGV[1] # ARGV[1] is first file + + for (; stackptr >= 0; stackptr--) { + while ((getline < input[stackptr]) > 0) { + if (tolower($1) != "@include") { + print + continue + } + fpath = pathto($2) + if (fpath == "") { + printf("igawk:%s:%d: cannot find %s\n", \ + input[stackptr], FNR, $2) > "/dev/stderr" + continue + } + if (! (fpath in processed)) { + processed[fpath] = input[stackptr] + input[++stackptr] = fpath + } else + print $2, "included in", input[stackptr], \ + "already included in", \ + processed[fpath] > "/dev/stderr" + } + close(input[stackptr]) + } +} diff --git a/pc/awklib/igawk.bat b/pc/awklib/igawk.bat new file mode 100644 index 00000000..bfc9b2a3 --- /dev/null +++ b/pc/awklib/igawk.bat @@ -0,0 +1 @@ +@sh igawk %1 %2 %3 %4 %5 %6 %7 %8 %9
\ No newline at end of file diff --git a/pc/config.h b/pc/config.h index 06b3beca..00255c42 100644 --- a/pc/config.h +++ b/pc/config.h @@ -1,19 +1,19 @@ +/* config.h. Generated automatically by configure. */ +/* configh.in. Generated automatically from configure.in by autoheader. */ /* - * config.h -- configuration definitions for gawk. - * - * OS/2 or MS-DOS systems using emx/gcc or MSC + * acconfig.h -- configuration definitions for gawk. */ /* - * Copyright (C) 1991-1993 the Free Software Foundation, Inc. + * Copyright (C) 1995 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Progamming 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, or (at your option) - * any later version. + * 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 @@ -21,260 +21,193 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with GAWK; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ -/* - * This file isolates configuration dependencies for gnu awk. - * You should know something about your system, perhaps by having - * a manual handy, when you edit this file. You should copy config.h-dist - * to config.h, and edit config.h. Do not modify config.h-dist, so that - * it will be easy to apply any patches that may be distributed. - * - * The general idea is that systems conforming to the various standards - * should need to do the least amount of changing. Definining the various - * items in ths file usually means that your system is missing that - * particular feature. - * - * The order of preference in standard conformance is ANSI C, POSIX, - * and the SVID. - * - * If you have no clue as to what's going on with your system, try - * compiling gawk without editing this file and see what shows up - * missing in the link stage. From there, you can probably figure out - * which defines to turn on. - */ -/**************************/ -/* Miscellanious features */ -/**************************/ +/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +#ifndef _ALL_SOURCE +/* #undef _ALL_SOURCE */ +#endif -/* - * BLKSIZE_MISSING - * - * Check your /usr/include/sys/stat.h file. If the stat structure - * does not have a member named st_blksize, define this. (This will - * most likely be the case on most System V systems prior to V.4.) - */ -#define BLKSIZE_MISSING 1 +/* Define if using alloca.c. */ +/* #undef C_ALLOCA */ -/* - * SIGTYPE - * - * The return type of the routines passed to the signal function. - * Modern systems use `void', older systems use `int'. - * If left undefined, it will default to void. - */ -/* #define SIGTYPE int */ +/* Define if type char is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* #undef __CHAR_UNSIGNED__ */ +#endif -/* - * SIZE_T_MISSING - * - * If your system has no typedef for size_t, define this to get a default - */ -/* #define SIZE_T_MISSING 1 */ +/* Define to empty if the keyword does not work. */ +/* #undef const */ -/* - * CHAR_UNSIGNED - * - * If your machine uses unsigned characters (IBM RT and RS/6000 and others) - * then define this for use in regex.c - */ -/* #define CHAR_UNSIGNED 1 */ +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. + This function is required for alloca.c support on those systems. */ +/* #undef CRAY_STACKSEG_END */ -/* - * HAVE_UNDERSCORE_SETJMP - * - * Check in your /usr/include/setjmp.h file. If there are routines - * there named _setjmp and _longjmp, then you should define this. - * Typically only systems derived from Berkeley Unix have this. - */ -/* #define HAVE_UNDERSCORE_SETJMP 1 */ +/* Define to the type of elements in the array set by `getgroups'. + Usually this is either `int' or `gid_t'. */ +#define GETGROUPS_T gid_t -/***********************************************/ -/* Missing library subroutines or system calls */ -/***********************************************/ +/* Define if the `getpgrp' function takes no argument. */ +#define GETPGRP_VOID 1 -/* - * MEMCMP_MISSING - * MEMCPY_MISSING - * MEMSET_MISSING - * - * These three routines are for manipulating blocks of memory. Most - * likely they will either all three be present or all three be missing, - * so they're grouped together. - */ -/* #define MEMCMP_MISSING 1 */ -/* #define MEMCPY_MISSING 1 */ -/* #define MEMSET_MISSING 1 */ +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef gid_t */ -/* - * RANDOM_MISSING - * - * Your system does not have the random(3) suite of random number - * generating routines. These are different than the old rand(3) - * routines! - */ -#define RANDOM_MISSING 1 +/* Define if you have alloca, as a function or macro. */ +#define HAVE_ALLOCA 1 -/* - * STRCASE_MISSING - * - * Your system does not have the strcasemp() and strncasecmp() - * routines that originated in Berkeley Unix. - */ -/* #define STRCASE_MISSING 1 */ -#define strcasecmp stricmp -#define strncasecmp strnicmp +/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ +#define HAVE_ALLOCA_H 1 -/* - * STRCHR_MISSING - * - * Your system does not have the strchr() and strrchr() functions. - */ -/* #define STRCHR_MISSING 1 */ +/* Define if you don't have vprintf but do have _doprnt. */ +/* #undef HAVE_DOPRNT */ -/* - * STRERROR_MISSING - * - * Your system lacks the ANSI C strerror() routine for returning the - * strings associated with errno values. - */ -/* #define STRERROR_MISSING 1 */ +/* Define if your struct stat has st_blksize. */ +#define HAVE_ST_BLKSIZE 1 -/* - * STRTOD_MISSING - * - * Your system does not have the strtod() routine for converting - * strings to double precision floating point values. - */ -/* #define STRTOD_MISSING 1 */ +/* Define if your struct tm has tm_zone. */ +/* #undef HAVE_TM_ZONE */ -/* - * STRFTIME_MISSING - * - * Your system lacks the ANSI C strftime() routine for formatting - * broken down time values. - */ -#define STRFTIME_MISSING 1 +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#define HAVE_TZNAME 1 -/* - * TZSET_MISSING - * - * If you have a 4.2 BSD vintage system, then the strftime() routine - * supplied in the missing directory won't be enough, because it relies on the - * tzset() routine from System V / Posix. Fortunately, there is an - * emulation for tzset() too that should do the trick. If you don't - * have tzset(), define this. - */ -/* #define TZSET_MISSING 1 */ +/* Define if you have the vprintf function. */ +#define HAVE_VPRINTF 1 -/* - * TZNAME_MISSING - * - * Some systems do not support the external variables tzname and daylight. - * If this is the case *and* strftime() is missing, define this. - */ -/* #define TZNAME_MISSING 1 */ +/* Define if on MINIX. */ +/* #undef _MINIX */ -/* - * STDC_HEADERS - * - * If your system does have ANSI compliant header files that - * provide prototypes for library routines, then define this. - */ -#define STDC_HEADERS 1 +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef pid_t */ -/* - * NO_TOKEN_PASTING - * - * If your compiler define's __STDC__ but does not support token - * pasting (tok##tok), then define this. - */ -/* #define NO_TOKEN_PASTING 1 */ +/* Define if the system does not provide POSIX.1 features except + with this defined. */ +/* #undef _POSIX_1_SOURCE */ -/*****************************************************************/ -/* Stuff related to the Standard I/O Library. */ -/*****************************************************************/ -/* Much of this is (still, unfortunately) black magic in nature. */ -/* You may have to use some or all of these together to get gawk */ -/* to work correctly. */ -/*****************************************************************/ +/* Define if you need to in order for stat and other things to work. */ +/* #undef _POSIX_SOURCE */ -/* - * NON_STD_SPRINTF - * - * Look in your /usr/include/stdio.h file. If the return type of the - * sprintf() function is NOT `int', define this. - */ -/* #define NON_STD_SPRINTF 1 */ +/* Define as the return type of signal handlers (int or void). */ +#define RETSIGTYPE void -/* - * VPRINTF_MISSING - * - * Define this if your system lacks vprintf() and the other routines - * that go with it. This will trigger an attempt to use _doprnt(). - * If you don't have that, this attempt will fail and you are on your own. - */ -/* #define VPRINTF_MISSING 1 */ +/* Define to `unsigned' if <sys/types.h> doesn't define. */ +/* #undef size_t */ -/* - * Casts from size_t to int and back. These will become unnecessary - * at some point in the future, but for now are required where the - * two types are a different representation. +/* 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 */ -/* #define SZTC */ -/* #define INTC */ +/* #undef STACK_DIRECTION */ -/* - * SYSTEM_MISSING - * - * Define this if your library does not provide a system function - * or you are not entirely happy with it and would rather use - * a provided replacement (atari only). - */ -/* #define SYSTEM_MISSING 1 */ +/* Define if you have the ANSI C header files. */ +#define STDC_HEADERS 1 -/* - * FMOD_MISSING - * - * Define this if your system lacks the fmod() function and modf() will - * be used instead. - */ -/* #define FMOD_MISSING 1 */ +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#define TIME_WITH_SYS_TIME 1 +/* Define if your <sys/time.h> declares struct tm. */ +/* #undef TM_IN_SYS_TIME */ -/*******************************/ -/* Gawk configuration options. */ -/*******************************/ +/* Define to `int' if <sys/types.h> doesn't define. */ +/* #undef uid_t */ -/* - * DEFPATH - * - * The default search path for the -f option of gawk. It is used - * if the AWKPATH environment variable is undefined. The default - * definition is provided here. Most likely you should not change - * this. - */ +/* #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 <string.h> header file */ +#define REGEX_MALLOC 1 /* use malloc instead of alloca in regex.c */ +#define SPRINTF_RET int /* return type of sprintf */ -/* #define DEFPATH ".:/usr/lib/awk:/usr/local/lib/awk" */ -/* #define ENVSEP ':' */ -#define ENVSEP ';' +/* Define if you have the fmod function. */ +/* #undef HAVE_FMOD */ -/* - * alloca already has a prototype defined - don't redefine it - */ -/* #define ALLOCA_PROTO 1 */ +/* Define if you have the memcmp function. */ +#define HAVE_MEMCMP 1 -/* - * srandom already has a prototype defined - don't redefine it - */ -/* #define SRANDOM_PROTO 1 */ +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 -/* - * getpgrp() in sysvr4 and POSIX takes no argument - */ -/* #define GETPGRP_NOARG 0 */ +/* 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 strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the strerror function. */ +#define HAVE_STRERROR 1 + +/* Define if you have the strftime function. */ +#define HAVE_STRFTIME 1 + +/* Define if you have the strncasecmp function. */ +#define HAVE_STRNCASECMP 1 + +/* Define if you have the strtod function. */ +#define HAVE_STRTOD 1 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the tzset function. */ +#define HAVE_TZSET 1 + +/* Define if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the <signum.h> header file. */ +/* #undef HAVE_SIGNUM_H */ + +/* Define if you have the <stdarg.h> header file. */ +#define HAVE_STDARG_H 1 + +/* Define if you have the <strings.h> header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define if you have the <sys/param.h> header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define if you have the <unistd.h> header file. */ +#define HAVE_UNISTD_H 1 + + +/* Library search path */ +#define DEFPATH ".;c:/lib/awk;c:/gnu/lib/awk" + +#if defined (_MSC_VER) +#if !defined(__STDC__) +# define __STDC__ 1 +#endif +#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 + +#if defined (_MSC_VER) || defined(__EMX__) +#define strcasecmp stricmp +#define strncasecmp strnicmp +#endif -/* anything that follows is for system-specific short-term kludges */ +#if defined(DJGPP) +# define HAVE_LIMITS_H +#endif diff --git a/pc/gawk-32.def b/pc/gawk-32.def deleted file mode 100644 index 968a0cb1..00000000 --- a/pc/gawk-32.def +++ /dev/null @@ -1,3 +0,0 @@ -NAME gawk WINDOWCOMPAT NEWFILES
-DESCRIPTION 'GNU awk for OS/2'
-STACKSIZE 0x100000
diff --git a/pc/gawkmisc.pc b/pc/gawkmisc.pc new file mode 100644 index 00000000..05db6c36 --- /dev/null +++ b/pc/gawkmisc.pc @@ -0,0 +1,134 @@ +/* + * gawkmisc.c --- miscellanious gawk routines that are OS specific. + */ + +/* + * Copyright (C) 1986, 1988, 1989, 1991 - 95 the Free Software Foundation, Inc. + * + * This file is part of GAWK, the GNU implementation of the + * AWK Progamming 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 + */ + +char quote = '"'; +char envsep = ';'; +#ifdef DEFPATH +char *defpath = DEFPATH; +#else +char *defpath = ".;c:\\lib\\awk;c:\\gnu\\lib\\awk"; +#endif + +/* gawk_name --- pull out the "gawk" part from how the OS called us */ + +char * +gawk_name(filespec) +const char *filespec; +{ + char *p, *q; + + p = (char *) filespec; /* Sloppy... */ + + /* OS/2 allows / for directory separator too */ + if ((q = strrchr(p, '\\')) != NULL) + p = q + 1; + if ((q = strrchr(p, '/')) != NULL) + p = q + 1; + if ((q = strchr(p, '.')) != NULL) + *q = '\0'; + return strlwr(p); +} + +/* os_arg_fixup --- fixup the command line */ + +void +os_arg_fixup(argcp, argvp) +int *argcp; +char ***argvp; +{ +#ifdef __EMX__ + _response(argcp, argvp); + _wildcard(argcp, argvp); + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); +#endif + return; +} + +/* os_devopen --- open special per-OS devices */ + +int +os_devopen(name, flag) +const char *name; +int flag; +{ + /* no-op */ + return -1; +} + +/* optimal_bufsize --- determine optimal buffer size */ + +int +optimal_bufsize(fd, stb) +int fd; +struct stat *stb; +{ + /* force all members to zero in case OS doesn't use all of them. */ + memset(stb, '\0', sizeof(struct stat)); + + /* + * DOS doesn't have the file system block size in the + * stat structure. So we have to make some sort of reasonable + * guess. We use stdio's BUFSIZ, since that is what it was + * meant for in the first place. + */ +#define DEFBLKSIZE BUFSIZ + + if (isatty(fd)) + return BUFSIZ; + if (fstat(fd, stb) == -1) + fatal("can't stat fd %d (%s)", fd, strerror(errno)); + if (lseek(fd, (off_t)0, 0) == -1) /* not a regular file */ + return DEFBLKSIZE; + if (stb->st_size > 0 && stb->st_size < DEFBLKSIZE) /* small file */ + return stb->st_size; + return DEFBLKSIZE; +} + +/* ispath --- return true if path has directory components */ + +int +ispath(file) +const char *file; +{ + for (; *file; file++) { + switch (*file) { + case '/': + case '\\': + case ':': + return 1; + } + } + return 0; +} + +/* isdirpunct --- return true if char is a directory separator */ + +int +isdirpunct(c) +int c; +{ + return (strchr(":\\/", c) != NULL); +} + @@ -1,69 +1,62 @@ -#ifdef _MSC_VER
-
-#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;
-
- DosGetPID(&PidInfo);
- return(PidInfo.pid);
-}
-#endif
-
-int getppid(void)
-{
-#ifdef OS2
- PIDINFO PidInfo;
-
- DosGetPID(&PidInfo);
- return(PidInfo.pidParent);
-#else
- return(0);
-#endif
-}
-
-unsigned int getuid (void)
-{
- return (0); /* root! */
-}
-
-
-unsigned int geteuid (void)
-{
- return (0);
-}
-
-
-unsigned int getgid (void)
-{
- return (0);
-}
-
-
-unsigned int getegid (void)
-{
- return (0);
-}
-
-
-char *getlogin (void)
-{
- return ("root");
-}
-
-#endif
-
-int getpgrp(void)
-{
- return (0);
-}
+#ifdef _MSC_VER + +#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; + + DosGetPID(&PidInfo); + return(PidInfo.pid); +} +#endif + +unsigned int getuid (void) +{ + return (0); /* root! */ +} + +unsigned int geteuid (void) +{ + return (0); +} + +unsigned int getgid (void) +{ + return (0); +} + +unsigned int getegid (void) +{ + return (0); +} + +#endif + +int getpgrp(void) +{ + return (0); +} + +#if defined(_MSC_VER) || defined(__GO32__) +int getppid(void) +{ +#ifdef OS2 + PIDINFO PidInfo; + + DosGetPID(&PidInfo); + return(PidInfo.pidParent); +#else + return(0); +#endif +} +#endif diff --git a/pc/include/fcntl.h b/pc/include/fcntl.h new file mode 100644 index 00000000..5ebc7a6b --- /dev/null +++ b/pc/include/fcntl.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <fcntl.h>
+#define __STDC__ 1
diff --git a/pc/include/stdio.h b/pc/include/stdio.h new file mode 100644 index 00000000..25fb7c97 --- /dev/null +++ b/pc/include/stdio.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <stdio.h>
+#define __STDC__ 1
diff --git a/pc/include/stdlib.h b/pc/include/stdlib.h new file mode 100644 index 00000000..0789b242 --- /dev/null +++ b/pc/include/stdlib.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <stdlib.h>
+#define __STDC__ 1
diff --git a/pc/include/string.h b/pc/include/string.h new file mode 100644 index 00000000..48e942fa --- /dev/null +++ b/pc/include/string.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <string.h>
+#define __STDC__ 1
diff --git a/pc/include/sys/stat.h b/pc/include/sys/stat.h new file mode 100644 index 00000000..904d056e --- /dev/null +++ b/pc/include/sys/stat.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <sys/stat.h>
+#define __STDC__ 1
diff --git a/pc/include/sys/types.h b/pc/include/sys/types.h new file mode 100644 index 00000000..b942dda8 --- /dev/null +++ b/pc/include/sys/types.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <sys/types.h>
+#define __STDC__ 1
diff --git a/pc/include/time.h b/pc/include/time.h new file mode 100644 index 00000000..b4a9ea3f --- /dev/null +++ b/pc/include/time.h @@ -0,0 +1,3 @@ +#undef __STDC__
+#include <time.h>
+#define __STDC__ 1
diff --git a/pc/install.awk b/pc/install.awk new file mode 100644 index 00000000..1b125d47 --- /dev/null +++ b/pc/install.awk @@ -0,0 +1,61 @@ +# install.awk +# awk script to handle "make install". Goal is to eliminate need for +# extra utilities (such as sh, mkdir, and cp). This is a hack. + +function mkinstalldirs(dir, i, ii, j, jj, s, comp, mkdir) +{ + gsub("/", "\\", dir); ii = split(dir, s, " ") + print "@echo off" > install_bat + print "@echo off" > install_cmd + for (i = 1; i <= ii; i++) { + jj = split(s[i], comp, "\\"); dir = comp[1]; + for (j = 1; j <= jj; dir=dir "\\" comp[++j]) { + if (substr(dir, length(dir)) == ":" || mkdir[dir]) continue; + printf("if not exist %s\\*.* mkdir %s\n", dir, dir) > install_bat + printf("if not exist %s\\* mkdir %s\n", dir, dir) > install_cmd + mkdir[dir] = 1 + } + } + close(install_bat); close(install_cmd) + system(install) +} + +function cp(s, j, n, comp) +{ + gsub("/", "\\", s); n = split(s, comp, " "); + print "@echo off" > install_bat + print "@echo off" > install_cmd + for (j = 1; j < n; j++) { + printf("copy %s %s\n", comp[j], comp[n]) > install_cmd + if (substr(comp[j], length(comp[j]), 1) == "*") + comp[j] = comp[j] ".*" + printf("copy %s %s\n", comp[j], comp[n]) > install_bat + } + close(install_bat); close(install_cmd) + system(install) +} + +BEGIN{ +install = "installg" +install_bat = install ".bat"; install_cmd = install ".cmd" +igawk_cmd = prefix "/bin/igawk.cmd" +igawk_bat = prefix "/bin/igawk.bat" +igawk = "pc/awklib/igawk" + +# Make the bin directory +mkinstalldirs(prefix "/bin"); + +# Create igawk.cmd for OS/2 +printf("extproc sh %s/bin/igawk.cmd\nshift\n", prefix) > igawk_cmd +while (getline < igawk) print $0 > igawk_cmd + +# Create igawk.bat for DOS +printf("@sh %s/bin/igawk %%1 %%2 %%3 %%4 %%5 %%6 %%7 %%8 %%9", prefix) > igawk_bat + +# Do common +cp(igawk " gawk.exe " prefix "/bin") +mkinstalldirs(prefix "/lib/awk " prefix "/man/man1 " prefix "/info") +cp("awklib/eg/lib/* pc/awklib/igawk.awk " prefix "/lib/awk"); +cp("doc/*.1 " prefix "/man/man1"); +cp("doc/gawk.info " prefix "/info"); +} diff --git a/pc/makegawk.bat b/pc/makegawk.bat deleted file mode 100644 index 2e69c7fa..00000000 --- a/pc/makegawk.bat +++ /dev/null @@ -1,65 +0,0 @@ -REM Simple brute force command file for building gawk under msdos
-REM
-REM *** This has only been tested using MSC 5.1 and MSC 6.00A ***
-REM
-REM Written by Arnold Robbins, May 1991
-REM Modified by Scott Deifik, July, 1992, Sep 1993
-REM Based on earlier makefile for dos
-REM
-REM Copyright (C) 1986, 1988, 1989, 1991, 1993 the Free Software Foundation, Inc.
-REM
-REM This file is part of GAWK, the GNU implementation of the
-REM AWK Progamming Language.
-REM
-REM GAWK is free software; you can redistribute it and/or modify
-REM it under the terms of the GNU General Public License as published by
-REM the Free Software Foundation; either version 2 of the License, or
-REM (at your option) any later version.
-REM
-REM GAWK is distributed in the hope that it will be useful,
-REM but WITHOUT ANY WARRANTY; without even the implied warranty of
-REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-REM GNU General Public License for more details.
-REM
-REM You should have received a copy of the GNU General Public License
-REM along with GAWK; see the file COPYING. If not, write to
-REM the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-REM
-REM compile debug flags: -DDEBUG -DFUNC_TRACE -DMEMDEBUG -Zi -Od
-REM
-
-set CFLAGS=-D_MSC_VER
-
-rem MSC 5.1 should use:
-rem set CFLAGS=-D_MSC_VER=510
-
-rem MSC 6.00A predefines _MSC_VER
-rem set CFLAGS=
-
-rem -Za sets ANSI flag so that __STDC__ is defined in MSC 6.00A
-rem (MSC 5.1 sets __STDC__=0 regardless of ANSI switch)
-
-cl -Za -c -AL %CFLAGS% -DGAWK array.c
-cl -Za -c -AL %CFLAGS% -DGAWK awktab.c
-cl -Za -c -AL %CFLAGS% -DGAWK builtin.c
-cl -Za -c -AL %CFLAGS% -DGAWK -DHAVE_CONFIG_H dfa.c
-cl -Za -c -AL %CFLAGS% -DGAWK eval.c
-cl -Za -c -AL %CFLAGS% -DGAWK field.c
-cl -Za -c -AL %CFLAGS% -DGAWK getid.c
-cl -Za -c -AL %CFLAGS% -DGAWK -DHAVE_CONFIG_H getopt.c
-cl -Za -c -AL %CFLAGS% -DGAWK -DHAVE_CONFIG_H getopt1.c
-cl -Za -c -AL %CFLAGS% -DGAWK io.c
-cl -Za -c -AL %CFLAGS% -DGAWK iop.c
-cl -Za -c -AL %CFLAGS% -DGAWK main.c
-cl -Za -c -AL %CFLAGS% -DGAWK missing.c
-cl -Za -c -AL %CFLAGS% -DGAWK msg.c
-cl -Za -c -AL %CFLAGS% -DGAWK node.c
-cl -Za -c -AL %CFLAGS% -DGAWK popen.c
-cl -Za -c -AL %CFLAGS% -DGAWK re.c
-REM You can ignore the warnings you will get
-cl -Za -c -AL %CFLAGS% -DGAWK -DHAVE_CONFIG_H regex.c
-cl -Za -c -AL %CFLAGS% -DGAWK version.c
-REM
-REM link debug flags: /CO /NOE /NOI /st:30000
-REM
-link @names.lnk,gawk.exe /NOE /NOI /st:30000;
diff --git a/pc/mkconf.cmd b/pc/mkconf.cmd deleted file mode 100755 index 3d3eb3d3..00000000 --- a/pc/mkconf.cmd +++ /dev/null @@ -1,31 +0,0 @@ -extproc sh
-
-#! /bin/sh
-#
-# mkconf -- produce a config.h from a known configuration
-
-case "$#" in
-1) ;;
-*) echo "Usage: mkconf system_type" >&2
- echo "Known systems: `cd config; echo ;ls -C`" >&2
- exit 2
- ;;
-esac
-
-if [ -f config/$1 ]; then
- sh ./mungeconf.cmd config/$1 config.h-dist >config.h
- sed -n '/^#echo /s///p' config/$1
- sed -n '/^MAKE_.*/s//s,^##&## ,,/p' config/$1 >sedscr
- if [ -s sedscr ]
- then
- sed -f sedscr Makefile-dist >Makefile
- else
- cp Makefile-dist Makefile
- fi
- cmd /c del sedscr
-else
- echo "\`$1' is not a known configuration."
- echo "Either construct one based on the examples in the config directory,"
- echo "or copy config.h-dist to config.h and edit it."
- exit 1
-fi
diff --git a/pc/mkinstal.sh b/pc/mkinstal.sh new file mode 100644 index 00000000..f5e45f33 --- /dev/null +++ b/pc/mkinstal.sh @@ -0,0 +1,33 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + #set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + set fnord `echo "$file" | sed 's/\([^:]\)\//\1 /g'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/pc/mungeconf.cmd b/pc/mungeconf.cmd deleted file mode 100755 index cbf1d12e..00000000 --- a/pc/mungeconf.cmd +++ /dev/null @@ -1,15 +0,0 @@ -extproc sh
-
-#! /bin/sh
-
-case $# in
-2) ;;
-*) echo "Usage: mungeconf sysfile distfile" >&2 ; exit 2 ;;
-esac
-
-sed '/^#/d; /^MAKE_*/d' $1 |
-sed '1s:.*:s~__SYSTEM__~&~:
-2,$s:^\([^ ]*\)[ ].*:s~^/\\* #define[ ]*\1.*~#define &~:' >sedscr
-sed -f sedscr $2
-
-cmd /c del sedscr
diff --git a/pc/names.lnk b/pc/names.lnk deleted file mode 100644 index 5f02ae54..00000000 --- a/pc/names.lnk +++ /dev/null @@ -1,20 +0,0 @@ -array.obj+
-awktab.obj+
-builtin.obj+
-dfa.obj+
-eval.obj+
-field.obj+
-getid.obj+
-getopt.obj+
-getopt1.obj+
-io.obj+
-iop.obj+
-main.obj+
-missing.obj+
-msg.obj+
-node.obj+
-popen.obj+
-re.obj+
-version.obj+
-regex.obj+
-setargv.obj
diff --git a/pc/names2.lnk b/pc/names2.lnk deleted file mode 100644 index fb9cff4f..00000000 --- a/pc/names2.lnk +++ /dev/null @@ -1,19 +0,0 @@ -main.o
-eval.o
-builtin.o
-msg.o
-iop.o
-io.o
-field.o
-array.o
-node.o
-version.o
-missing.o
-re.o
-awktab.o
-getopt.o
-getopt1.o
-regex.o
-dfa.o
-getid.o
-popen.o
@@ -1,112 +1,124 @@ -#include "popen.h"
-#include <stdlib.h>
-#include <io.h>
-#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
-
-#ifndef _NFILE
-#define _NFILE 40
-#endif
-
-static char template[] = "piXXXXXX";
-typedef enum { unopened = 0, reading, writing } pipemode;
-static
-struct {
- char *command;
- char *name;
- pipemode pmode;
-} pipes[_NFILE];
-
-FILE *
-os_popen( char *command, char *mode ) {
- FILE *current;
- char *name;
- int cur;
- pipemode curmode;
-
-#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;
- /*
- ** get a name to use.
- */
- if((name = tempnam(".","pip"))==NULL)
- return NULL;
- /*
- ** If we're reading, just call system to get a file filled with
- ** output.
- */
- if(curmode == reading) {
- char cmd[256];
- sprintf(cmd,"%s > %s",command,name);
- system(cmd);
- if((current = fopen(name,"r")) == NULL)
- return NULL;
- } else {
- if((current = fopen(name,"w")) == NULL)
- return NULL;
- }
- cur = fileno(current);
- pipes[cur].name = name;
- pipes[cur].pmode = curmode;
- pipes[cur].command = strdup(command);
- return current;
-}
-
-int
-os_pclose( FILE * current) {
- int cur = fileno(current),rval;
-
-#if defined(OS2) && (_MSC_VER != 510)
- if (_osmode == OS2_MODE)
- return(pclose(current));
-#endif
-
- /*
- ** check for an open file.
- */
- if(pipes[cur].pmode == unopened)
- return -1;
- if(pipes[cur].pmode == reading) {
- /*
- ** input pipes are just files we're done with.
- */
- rval = fclose(current);
- unlink(pipes[cur].name);
- } else {
- /*
- ** output pipes are temporary files we have
- ** to cram down the throats of programs.
- */
- char command[256];
- fclose(current);
- sprintf(command,"%s < %s",pipes[cur].command,pipes[cur].name);
- rval = system(command);
- unlink(pipes[cur].name);
- }
- /*
- ** clean up current pipe.
- */
- pipes[cur].pmode = unopened;
- free(pipes[cur].name);
- free(pipes[cur].command);
- return rval;
-}
+#include "popen.h" +#include <stdlib.h> +#include <io.h> +#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 + +#ifndef _NFILE +#define _NFILE 40 +#endif + +static char template[] = "piXXXXXX"; +typedef enum { unopened = 0, reading, writing } pipemode; +static +struct { + char *command; + char *name; + pipemode pmode; +} pipes[_NFILE]; + +FILE * +os_popen( char *command, char *mode ) { + FILE *current; + char *name; + int cur; + pipemode curmode; + +#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; + /* + ** get a name to use. + */ + if((name = tempnam(".","pip"))==NULL) + return NULL; + /* + ** If we're reading, just call system to get a file filled with + ** output. + */ + if(curmode == reading) { + if ((cur = dup(fileno(stdout))) == -1) + return NULL; + if ((current = freopen(name, "w", stdout)) == NULL) + return NULL; + system(command); + if (dup2(cur, fileno(stdout)) == -1) + return NULL; + close(cur); + if((current = fopen(name,"r")) == NULL) + return NULL; + } else { + if((current = fopen(name,"w")) == NULL) + return NULL; + } + cur = fileno(current); + pipes[cur].name = name; + pipes[cur].pmode = curmode; + pipes[cur].command = strdup(command); + return current; +} + +int +os_pclose( FILE * current) { + int cur = fileno(current),rval; + +#if defined(OS2) && (_MSC_VER != 510) + if (_osmode == OS2_MODE) + return(pclose(current)); +#endif + + /* + ** check for an open file. + */ + if(pipes[cur].pmode == unopened) + return -1; + if(pipes[cur].pmode == reading) { + /* + ** input pipes are just files we're done with. + */ + rval = fclose(current); + unlink(pipes[cur].name); + } else { + /* + ** 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)) { + rval = system(pipes[cur].command); + fclose(current); + if (dup2(fd, fileno(stdin)) == -1) rval = -1; + close(fd); + } + } + unlink(pipes[cur].name); + } + /* + ** clean up current pipe. + */ + pipes[cur].pmode = unopened; + free(pipes[cur].name); + free(pipes[cur].command); + return rval; +} |