summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:22:24 +0300
committerArnold D. Robbins <arnold@skeeve.com>2010-07-16 12:22:24 +0300
commit56815f21bd9f396e53386969c7a00dd801f232fd (patch)
tree1dcf01c7109d6c91f8c789a9e81510e179e826f2
parente1ef22d366abd1f9ec95eb495c727d55181c8584 (diff)
downloadgawk-56815f21bd9f396e53386969c7a00dd801f232fd.tar.gz
Move to gawk-2.15.1.gawk-2.15.1
-rw-r--r--Makefile.bsd448
-rw-r--r--Makefile.in60
-rw-r--r--NEWS29
-rw-r--r--README.ibmrt-aos20
-rw-r--r--awk.y3
-rw-r--r--awktab.c3
-rw-r--r--builtin.c5
-rw-r--r--config/bsd441
-rw-r--r--config/hpux8x1
-rw-r--r--config/ibmrt-aos19
-rw-r--r--config/sysv31
-rw-r--r--config/sysv41
-rw-r--r--config/ultrix411
-rwxr-xr-xconfigure4
-rw-r--r--getopt.h7
-rw-r--r--io.c17
-rw-r--r--patchlevel.h2
17 files changed, 146 insertions, 36 deletions
diff --git a/Makefile.bsd44 b/Makefile.bsd44
index 269f14b8..a5d968c9 100644
--- a/Makefile.bsd44
+++ b/Makefile.bsd44
@@ -1,8 +1,12 @@
PROG= awk
-SRCS= main.c eval.c builtin.c msg.c iop.c io.c field.c array.c \
+SRCS= main.c eval.c builtin.c msg.c iop.c io.c field.c getopt1.c \
+ getopt.c array.c \
node.c version.c missing.c re.c awk.c regex.c dfa.c
DPADD= ${LIBM}
LDADD= -lm
-CFLAGS+= -g
+CFLAGS+=-I${.CURDIR} -DGAWK
+BINDIR= /usr/bin
+MANDIR= /usr/share/man/cat
+CLEANFILES+=awk.c y.tab.h awk.0
.include <bsd.prog.mk>
diff --git a/Makefile.in b/Makefile.in
index f4792dc3..b32caf44 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -22,10 +22,16 @@
# User tunable macros -- CHANGE THESE IN Makefile.in RATHER THAN IN
# Makefile, OR configure WILL OVERWRITE YOUR CHANGES
-DESTDIR=
-BINDIR= /usr/local/bin
-MANDIR= /usr/local/man/man1
-MANEXT= 1
+prefix = /usr/local
+exec_prefix = $(prefix)
+binprefix =
+manprefix =
+
+bindir = $(exec_prefix)/bin
+libdir = $(exec_prefix)/lib
+mandir = $(prefix)/man/man1
+manext = .1
+infodir = $(prefix)/info
# CFLAGS: options to the C compiler
#
@@ -141,7 +147,7 @@ ALLFILES= $(AWKSRC) $(GNUSRC) $(COPIES) $(MISC) $(DOCS) $(ALLDOC) $(OTHERS) \
REL=2.15
# rules to build gawk
-gawk: $(ALLOBJS) $(GNUOBJS) $(REOBJS)
+gawk: $(ALLOBJS) $(GNUOBJS) $(REOBJS)
$(CC) -o gawk $(CFLAGS) $(ALLOBJS) $(GNUOBJS) $(REOBJS) -lm $(LIBS)
$(AWKOBJS) regex.o dfa.o: awk.h dfa.h regex.h
@@ -150,23 +156,27 @@ getopt.o: getopt.h
getopt1.o: getopt.h
-main.o: patchlevel.h
+main.o: patchlevel.h
-awktab.c: awk.y
+awktab.c: awk.y
$(PARSER) -v awk.y
##MAKE_VMS-Posix## mv ytab.c awktab.c
##MAKE_VMS-Posix## dummy.awk_tab.target:
sed '/^extern char .malloc(), .realloc();$$/d' y.tab.c >awktab.c
rm y.tab.c
-config.h: config.in
+config.h: config.in
@echo You must provide a config.h!
@echo Run \"./configure\" to build it for known systems
@echo or copy config.in to config.h and edit it.; exit 1
-install: gawk
- cp gawk $(DESTDIR)$(BINDIR)
- cp gawk.1 $(DESTDIR)$(MANDIR)/gawk.$(MANEXT)
+install: gawk
+ cp gawk $(bindir) && chmod 755 $(bindir)/gawk
+ cp gawk.1 $(mandir)/gawk$(manext) && chmod 644 $(mandir)/gawk$(manext)
+ cp gawk.info* $(infodir) && chmod 644 $(infodir)/gawk.info*
+
+uninstall:
+ rm -f $(bindir)/gawk $(mandir)/gawk$(manext) $(infodir)/gawk.info*
# ALLOCA: uncomment this if your system (notably System V boxen)
# does not have alloca in /lib/libc.a or /lib/libPW.a
@@ -178,31 +188,39 @@ install: gawk
# One of these rules should have already been selected by running configure.
-##MAKE_ALLOCA_S## alloca.o: alloca.s
+##MAKE_ALLOCA_S## alloca.o: alloca.s
##MAKE_ALLOCA_S## /lib/cpp < alloca.s | sed '/^#/d' > t.s
##MAKE_ALLOCA_S## as t.s -o alloca.o
##MAKE_ALLOCA_S## rm t.s
-##MAKE_ALLOCA_C## alloca.o: alloca.c
+##MAKE_ALLOCA_C## alloca.o: alloca.c
# auxiliary rules for release maintenance
-lint: $(ALLSRC)
+lint: $(ALLSRC)
lint -hcbax $(FLAGS) $(ALLSRC)
xref:
cxref -c $(FLAGS) $(ALLSRC) | grep -v ' /' >xref
clean:
- rm -rf *.o core awk.output gmon.out make.out y.output \
- *.orig *.rej */*.orig */*.rej
+ rm -rf gawk *.o core
+
+distclean: clean
+ rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output gmon.out \
+ make.out y.output config.h
+
+mostlyclean: clean
+
+realclean: distclean
+ rm -f awktab.c $(ALLDOC)
cleaner: clean
- rm -f gawk awktab.c Makefile
+ rm -f gawk awktab.c Makefile config.h
-clobber: clean
- rm -f $(ALLDOC) gawk.log
+clobber: clean
+ rm -f $(ALLDOC) gawk.log config.h
-gawk.dvi: gawk.texi
+gawk.dvi: gawk.texi
tex gawk.texi; texindex gawk.??
tex gawk.texi; texindex gawk.??
tex gawk.texi
@@ -250,7 +268,7 @@ gawk-ps-$(REL).tar.z: gawk.dvi gawk.1
pstroff -man gawk.1 > gawk-ps-$(REL)/gawk.1.ps
tar -cf - gawk-ps-$(REL) | gzip > gawk-ps-$(REL).tar.z
-release: gawk-src-$(REL).tar.z gawk-doc-$(REL).tar.z gawk-ps-$(REL).tar.z \
+release: gawk-src-$(REL).tar.z gawk-doc-$(REL).tar.z gawk-ps-$(REL).tar.z \
gawk-test-$(REL).tar.z
test: gawk
diff --git a/NEWS b/NEWS
index 94d9b11b..8ef69710 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,32 @@
+Changes from 2.15 to 2.15.1
+---------------------------
+
+Close stdout and stderr before all redirections on program exit. This allows
+ detection of write errors and also fixes the messages test on Solaris 2.x.
+
+Removed YYMAXDEPTH define in awk.y which was limiting the parser stack depth.
+
+Changes to config/bsd44, Makefile.bsd44 and configure to bring it into line
+ with the BSD4.4 release.
+
+Changed Makefile to use prefix, exec_prefix, bindir etc.
+
+make install now installs info files.
+
+make install now sets permissions on installed files.
+
+Make targets added: uninstall, distclean, mostlyclean and realclean.
+
+Added config.h to cleaner and clobber make targets.
+
+Changes to config/{hpux8x,sysv3,sysv4,ultrix41} to deal with alloca().
+
+Change to getopt.h for portability.
+
+Added more special cases to the getpgrp() call.
+
+Added README.ibmrt-aos and config/ibmrt-aos.
+
Changes from 2.14 to 2.15
---------------------------
diff --git a/README.ibmrt-aos b/README.ibmrt-aos
index e69de29b..25518e65 100644
--- a/README.ibmrt-aos
+++ b/README.ibmrt-aos
@@ -0,0 +1,20 @@
+From: karl@cs.umb.edu (Karl Berry)
+Newsgroups: gnu.utils.bug
+Subject: gawk 2.15/ibm rt/compile errors
+Date: 17 May 1993 23:16:11 -0400
+Organization: GNUs Not Usenet
+
+gawk 2.15 on an IBM RT running AOS, configured as bsd43, needs the
+following additional definitions (although I suppose this will be
+irrelevant when you switch to Autoconf).
+
+-DTZSET_MISSING -DFMOD_MISSING -DCHAR_UNSIGNED
+
+[ Fixed in 2.15.1 -- configure as ibmrt-aos ]
+
+Also, missing/strftime.c did not compile, because it does not handle the
+case where the system provides neither tzname nor the tm_zone member,
+but instead has the timezone function. I used the strftime.c from the
+find 3.8 distribution.
+
+[ Not fixed in 2.15.1 ]
diff --git a/awk.y b/awk.y
index e737e7fe..6e87f1c4 100644
--- a/awk.y
+++ b/awk.y
@@ -28,9 +28,6 @@
#define YYDEBUG 12
#endif
-#define YYMAXDEPTH 300
-#define YYSSIZE YYMAXDEPTH
-
#include "awk.h"
static void yyerror (); /* va_alist */
diff --git a/awktab.c b/awktab.c
index 74b46822..b7aa7ec2 100644
--- a/awktab.c
+++ b/awktab.c
@@ -47,9 +47,6 @@
#define YYDEBUG 12
#endif
-#define YYMAXDEPTH 300
-#define YYSSIZE YYMAXDEPTH
-
#include "awk.h"
static void yyerror (); /* va_alist */
diff --git a/builtin.c b/builtin.c
index c65bb902..9d5e3b30 100644
--- a/builtin.c
+++ b/builtin.c
@@ -76,13 +76,14 @@ int flush;
if (fwrite(ptr, size, count, fp) != count)
goto wrerror;
if (flush
- && ((fp == stdout && output_is_tty)
- || (rp && (rp->flag & RED_NOBUF)))) {
+ && ((fp == stdout && output_is_tty)
+ || (rp && (rp->flag & RED_NOBUF)))) {
fflush(fp);
if (ferror(fp))
goto wrerror;
}
return;
+
wrerror:
fatal("%s to \"%s\" failed (%s)", from,
rp ? rp->value : "standard output",
diff --git a/config/bsd44 b/config/bsd44
index 4dfcb79d..6c908859 100644
--- a/config/bsd44
+++ b/config/bsd44
@@ -1,5 +1,4 @@
For generic 4.4 alpha
-STRTOD_MISSING 1
HAVE_UNDERSCORE_SETJMP 1
STDC_HEADERS 1
ALLOCA_PROTO 1
diff --git a/config/hpux8x b/config/hpux8x
index 66d347a9..9375e988 100644
--- a/config/hpux8x
+++ b/config/hpux8x
@@ -1,3 +1,4 @@
HPPA running HP-UX 8.x
STDC_HEADERS 1
RANDOM_MISSING 1
+MAKE_ALLOCA_PW
diff --git a/config/ibmrt-aos b/config/ibmrt-aos
index e69de29b..fcec410f 100644
--- a/config/ibmrt-aos
+++ b/config/ibmrt-aos
@@ -0,0 +1,19 @@
+For generic 4.3 BSD machine.
+SIGTYPE int
+HAVE_UNDERSCORE_SETJMP 1
+MEMCMP_MISSING 1
+MEMCPY_MISSING 1
+MEMSET_MISSING 1
+STRCASE_MISSING 1
+STRCHR_MISSING 1
+STRERROR_MISSING 1
+STRFTIME_MISSING 1
+STRTOD_MISSING 1
+STRTOL_MISSING 1
+NON_STD_SPRINTF 1
+VPRINTF_MISSING 1
+BSDSTDIO 1
+TZNAME_MISSING 1
+TZSET_MISSING 1
+FMOD_MISSING 1
+CHAR_UNSIGNED 1
diff --git a/config/sysv3 b/config/sysv3
index 30e19d16..944db233 100644
--- a/config/sysv3
+++ b/config/sysv3
@@ -4,3 +4,4 @@ RANDOM_MISSING 1
STRCASE_MISSING 1
STRERROR_MISSING 1
STRFTIME_MISSING 1
+MAKE_ALLOCA_C
diff --git a/config/sysv4 b/config/sysv4
index dfaf5ce4..0ea9c4ff 100644
--- a/config/sysv4
+++ b/config/sysv4
@@ -2,3 +2,4 @@ System V.4 Systems (generic)
RANDOM_MISSING 1
STRCASE_MISSING 1
STDC_HEADERS 1
+MAKE_ALLOCA_C
diff --git a/config/ultrix41 b/config/ultrix41
index 84348df8..8e82ec40 100644
--- a/config/ultrix41
+++ b/config/ultrix41
@@ -1,3 +1,4 @@
DECstation running Ultrix 4.1 (and 4.2??)
STDC_HEADERS 1
#define Ultrix41 1
+MAKE_ALLOCA_C
diff --git a/configure b/configure
index 7f48e0fd..9594844e 100755
--- a/configure
+++ b/configure
@@ -16,6 +16,10 @@ if [ -f config/$1 ]; then
# echo #echo lines to stdout
sed -n '/^#echo /s///p' config/$1
+ case "$1" in
+ bsd44) ln -s Makefile.bsd44 Makefile ; exit 0 ;;
+ esac
+
sed -n '/^MAKE_.*/s//s,^##&## ,,/p' config/$1 >sedscr
if [ -s sedscr ]
then
diff --git a/getopt.h b/getopt.h
index 5d4300fa..de027434 100644
--- a/getopt.h
+++ b/getopt.h
@@ -94,7 +94,14 @@ enum _argtype
};
#if __STDC__
+#if defined(__GNU_LIBRARY__)
+/* Many other libraries have conflicting prototypes for getopt, with
+ differences in the consts, in stdlib.h. To avoid compilation
+ errors, only prototype getopt for the GNU C library. */
extern int getopt (int argc, char *const *argv, const char *shortopts);
+#else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+#endif /* not __GNU_LIBRARY__ */
extern int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *longopts, int *longind);
extern int getopt_long_only (int argc, char *const *argv,
diff --git a/io.c b/io.c
index bf553c59..18fbb5be 100644
--- a/io.c
+++ b/io.c
@@ -58,6 +58,7 @@ static int gawk_pclose P((struct redirect *rp));
static int do_pathopen P((char *file));
extern FILE *fdopen();
+extern FILE *popen();
static struct redirect *red_head = NULL;
@@ -466,6 +467,8 @@ register struct redirect *rp;
if (rp == NULL)
return 0;
+ if (rp->fp == stdout || rp->fp == stderr)
+ return 0;
errno = 0;
if ((rp->flag & (RED_PIPE|RED_WRITE)) == (RED_PIPE|RED_WRITE))
status = pclose(rp->fp);
@@ -516,7 +519,6 @@ flush_io ()
warning("error writing standard output (%s).", strerror(errno));
status++;
}
- errno = 0;
if (fflush(stderr)) {
warning("error writing standard error (%s).", strerror(errno));
status++;
@@ -524,7 +526,6 @@ flush_io ()
for (rp = red_head; rp != NULL; rp = rp->next)
/* flush both files and pipes, what the heck */
if ((rp->flag & RED_WRITE) && rp->fp != NULL) {
- errno = 0;
if (fflush(rp->fp)) {
warning("%s flush of \"%s\" failed (%s).",
(rp->flag & RED_PIPE) ? "pipe" :
@@ -542,6 +543,15 @@ close_io ()
register struct redirect *next;
int status = 0;
+ errno = 0;
+ if (fclose(stdout)) {
+ warning("error writing standard output (%s).", strerror(errno));
+ status++;
+ }
+ if (fclose(stderr)) {
+ warning("error writing standard error (%s).", strerror(errno));
+ status++;
+ }
for (rp = red_head; rp != NULL; rp = next) {
next = rp->next;
if (close_redir(rp))
@@ -695,7 +705,8 @@ char *name, *mode;
int i;
if (name[6] == 'g')
-#if defined(__svr4__) || defined(i860)
+/* following #if will improve in 2.16 */
+#if defined(__svr4__) || defined(i860) || defined(_AIX) || defined(BSD4_4)
sprintf(tbuf, "%d\n", getpgrp());
#else
sprintf(tbuf, "%d\n", getpgrp(getpid()));
diff --git a/patchlevel.h b/patchlevel.h
index 2867bba9..131713a8 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1 +1 @@
-#define PATCHLEVEL 0
+#define PATCHLEVEL 1