summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:17:49 +0100
committerAndreas Gruenbacher <agruen@suse.de>2009-03-12 15:17:49 +0100
commit79159942f17994878f48c5437effff94db5bf910 (patch)
treeb5524e1ef1acba50f342aa16265f7b31c8079dfb
parent957f7b6423cc7a1f87e7e6a4cb4b41c46821d804 (diff)
downloadpatch-79159942f17994878f48c5437effff94db5bf910.tar.gz
Import of patch-2.5.4.tar.gzv2.5.4
-rw-r--r--ChangeLog70
-rw-r--r--INSTALL1
-rw-r--r--Makefile.in82
-rw-r--r--acconfig.h26
-rw-r--r--aclocal.m4434
-rw-r--r--addext.c15
-rw-r--r--ansi2knr.136
-rw-r--r--ansi2knr.c260
-rw-r--r--argmatch.c286
-rw-r--r--argmatch.h135
-rw-r--r--backupfile.c80
-rw-r--r--backupfile.h34
-rw-r--r--basename.c47
-rw-r--r--basename.h9
-rw-r--r--common.h46
-rw-r--r--config.guess1088
-rw-r--r--config.hin78
-rw-r--r--config.sub1220
-rwxr-xr-xconfigure1173
-rw-r--r--configure.in119
-rw-r--r--error.c76
-rw-r--r--getopt.c127
-rw-r--r--getopt.h108
-rw-r--r--getopt1.c33
-rw-r--r--inp.c61
-rw-r--r--install-sh13
-rw-r--r--m4/ccstdc.m495
-rw-r--r--m4/d-ino.m442
-rw-r--r--m4/inttypes_h.m422
-rw-r--r--m4/largefile.m4115
-rw-r--r--m4/malloc.m435
-rw-r--r--m4/protos.m425
-rw-r--r--m4/realloc.m435
-rw-r--r--m4/utimbuf.m440
-rw-r--r--maketime.c36
-rw-r--r--malloc.c5
-rw-r--r--memchr.c37
-rw-r--r--mkdir.c108
-rw-r--r--mkinstalldirs4
-rw-r--r--patch.c123
-rw-r--r--patch.man4
-rw-r--r--patchlevel.h1
-rw-r--r--pc/djgpp/README2
-rw-r--r--pc/djgpp/config.sed5
-rw-r--r--pc/djgpp/configure.sed3
-rw-r--r--pch.c136
-rw-r--r--quotearg.c142
-rw-r--r--quotearg.h28
-rw-r--r--rename.c19
-rw-r--r--rmdir.c87
-rw-r--r--util.c243
-rw-r--r--util.h4
-rw-r--r--version.c8
-rw-r--r--xalloc.h53
-rw-r--r--xmalloc.c40
55 files changed, 5578 insertions, 1576 deletions
diff --git a/ChangeLog b/ChangeLog
index a8ee329..41d5c9b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,73 @@
+1999-08-30 Paul Eggert <eggert@twinsun.com>
+
+ Version 2.5.4 fixes a few minor bugs, converts C sources to
+ ANSI prototypes, and modernizes auxiliary sources and autoconf
+ scripts.
+
+ * configure.in (VERSION): Version 2.5.4 released.
+ (AC_CANONICAL_HOST): Add.
+ (AC_SYS_LARGEFILE): Add, replacing inline code.
+ (AC_EXEEXT): Add.
+ (jm_AC_HEADER_INTTYPES_H): Add, replacing inline code.
+ (AC_TYPE_PID_T): Add.
+ (jm_STRUCT_UTIMBUF): Add, replacing inline code.
+ (HAVE_MEMCHR): Remove obsolescent test; nobody uses NetBSD 1.0 now.
+ (getopt_long): Append $U to object file basenames.
+ (AC_CHECK_FUNCS): Add fseeko, setmode. Remove mkdir.
+ (AC_REPLACE_FUNCS): Add mkdir, rmdir.
+ (jm_STRUCT_DIRENT_D_INO): Add, replacing inline code.
+
+ * Makefile.in (EXEEXT): New macro.
+ (mandir): New macro.
+ (man1dir): Define in terms of mandir.
+ (SRCS): Add mkdir.c, rmdir.c.
+ (OBJS): Change .o to $U.o for addext, argmatch, backupfile, basename,
+ error, inp, patch ,,pch, quotearg, util, version, xmalloc.
+ (HDRS): Add basename.h, patchlevel.h.
+ (MISC): Add ansi2knr.1, config.guess, config.sub.
+ (MISC, config.hin): Remove acconfig.h; no longer needed.
+ (DISTFILES_M4): New macro.
+ (all): patch -> patch$(EXEEXT).
+ (patch$(EXEEXT)): Renamed from patch. All uses changed.
+ (uninstall): Remove manual page.
+ (configure): Depend on aclocal.m4.
+ (M4DIR, ACINCLUDE_INPUTS): New macros.
+ ($(srcdir)/aclocal.m4): New rule.
+ (patchlevel.h): Depend on configure.in, not Makefile,
+ since we now distribute it.
+ (distclean): Don't remove patchlevel.h.
+ (dist): Distribute $(DISTFILES_M4).
+ (addext_.c argmatch_.c backupfile_.c basename_.c error_.c
+ getopt_.c getopt1_.c inp_.c malloc_.c mkdir_.c patch_.c pch_.c
+ rename_.c util_.c version_.c xmalloc_.c): Depend on ansi2knr.
+ Update dependencies to match sources.
+
+ * common.h (_LARGEFILE_SOURCE): Remove; now autoconfigured.
+ (file_offset): Depend on HAVE_FSEEKO, not _LFS_LARGEFILE.
+
+ * patch.c (version_control_context): New variable.
+ Convert to ANSI prototypes.
+ Adjust to new argmatch calling convention.
+ Similarly for get_version.
+ Complain about creating an existing file only if
+ pch_says_nonexistent returns 2 (not merely nonzero).
+ Similarly for time mismatch check.
+ (get_some_switches): Adjust to new get_version calling convention.
+ Similarly for argmatch.
+
+ * pch.c (<basename.h>): Include.
+ (intuit_diff_type): Improve quality of test for empty file.
+ (another_hunk): Don't assume off_t is no longer than long.
+
+ * util.h (backup_type): New decl.
+ * util.c (<basename.h>): Include.
+ (move_file): Adjust to new find_backup_file_name convention.
+ (doprogram, mkdir, rmdir): Remove; now in separate files.
+ (fetchame): Match "/dev/null", not NULL_DEVICE.
+ Ignore names that don't have enough slashes to strip off.
+
+ * version.c: Update copyright notice.
+
1998-03-20 Paul Eggert <eggert@twinsun.com>
* configure.in (VERSION): Bump to 2.5.3.
diff --git a/INSTALL b/INSTALL
index 50dbe43..b42a17a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -180,4 +180,3 @@ operates.
script, and exit.
`configure' also accepts some other, not widely useful, options.
-
diff --git a/Makefile.in b/Makefile.in
index 98a1a06..0692a62 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
# Makefile for GNU patch.
-# Copyright 1993, 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1993, 1997-1998, 1999 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -33,6 +33,7 @@ transform = @program_transform_name@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
DEFS = @DEFS@
+EXEEXT = @EXEEXT@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
@@ -46,7 +47,8 @@ exec_prefix = @exec_prefix@
bindir = $(exec_prefix)/bin
# Where to put the manual pages.
-man1dir = $(prefix)/man/man1
+mandir = @mandir@
+man1dir = $(mandir)/man1
# Extension (including `.') for the manual page filenames.
man1ext = .1
@@ -59,25 +61,27 @@ SHELL = /bin/sh
LIBSRCS = getopt.c getopt1.c malloc.c memchr.c realloc.c rename.c
SRCS = addext.c argmatch.c backupfile.c basename.c error.c inp.c maketime.c \
- partime.c patch.c pch.c quotearg.c quotesys.c \
- util.c version.c xmalloc.c $(LIBSRCS)
-OBJS = addext.o argmatch.o backupfile.o basename.o error.o inp.o maketime.o \
- partime.o patch.o pch.o quotearg$U.o quotesys.o \
- util.o version.o xmalloc.o $(LIBOBJS)
-HDRS = argmatch.h backupfile.h common.h error.h getopt.h \
- inp.h maketime.h partime.h pch.h quotearg.h quotesys.h \
+ mkdir.c partime.c patch.c pch.c quotearg.c quotesys.c \
+ rmdir.c util.c version.c xmalloc.c $(LIBSRCS)
+OBJS = addext$U.o argmatch$U.o backupfile$U.o basename$U.o error$U.o inp$U.o \
+ maketime.o partime.o patch$U.o pch$U.o quotearg$U.o quotesys.o \
+ util$U.o version$U.o xmalloc$U.o $(LIBOBJS)
+HDRS = argmatch.h backupfile.h basename.h common.h error.h getopt.h \
+ inp.h maketime.h partime.h patchlevel.h pch.h quotearg.h quotesys.h \
util.h version.h xalloc.h
MISC = AUTHORS COPYING ChangeLog INSTALL Makefile.in NEWS README \
- acconfig.h aclocal.m4 ansi2knr.c config.hin configure configure.in \
+ aclocal.m4 ansi2knr.1 ansi2knr.c \
+ config.guess config.hin config.sub configure configure.in \
install-sh mkinstalldirs patch.man
DISTFILES = $(MISC) $(SRCS) $(HDRS)
+DISTFILES_M4 = $(ACINCLUDE_INPUTS)
DISTFILES_PC = pc/chdirsaf.c
DISTFILES_PC_DJGPP = pc/djgpp/README pc/djgpp/config.sed \
pc/djgpp/configure.bat pc/djgpp/configure.sed
patch_name = `echo patch | sed '$(transform)'`
-all:: patch
+all:: patch$(EXEEXT)
info::
check::
@@ -89,11 +93,11 @@ COMPILE = $(CC) -c $(CPPFLAGS) $(DEFS) -Ded_PROGRAM=\"$(ed_PROGRAM)\" \
.c.o:
$(COMPILE) $<
-patch: $(OBJS)
+patch$(EXEEXT): $(OBJS)
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS)
install:: all installdirs
- $(INSTALL_PROGRAM) patch $(bindir)/$(patch_name)
+ $(INSTALL_PROGRAM) patch$(EXEEXT) $(bindir)/$(patch_name)$(EXEEXT)
-$(INSTALL_DATA) $(srcdir)/patch.man $(man1dir)/$(patch_name)$(man1ext)
installdirs::
@@ -103,18 +107,27 @@ install-strip::
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall::
- rm -f $(bindir)/$(patch_name) $(man1dir)/$(patch_name)$(man1ext)
+ rm -f $(bindir)/$(patch_name)$(EXEEXT)
+ rm -f $(man1dir)/$(patch_name)$(man1ext)
Makefile: Makefile.in $(CONFIG_STATUS)
$(SHELL) $(CONFIG_STATUS)
config.status: configure
$(SHELL) $(CONFIG_STATUS) --recheck
-configure: configure.in
+configure: configure.in $(srcdir)/aclocal.m4
cd $(srcdir) && autoconf
-config.hin: configure.in acconfig.h
+config.hin: configure.in
cd $(srcdir) && rm -f config.hin && autoheader
-patchlevel.h: Makefile
+M4DIR = $(srcdir)/m4
+ACINCLUDE_INPUTS = $(M4DIR)/ccstdc.m4 $(M4DIR)/d-ino.m4 \
+ $(M4DIR)/inttypes_h.m4 $(M4DIR)/largefile.m4 $(M4DIR)/malloc.m4 \
+ $(M4DIR)/protos.m4 $(M4DIR)/realloc.m4 $(M4DIR)/utimbuf.m4
+
+$(srcdir)/aclocal.m4: $(ACINCLUDE_INPUTS)
+ cat $(ACINCLUDE_INPUTS) >$(srcdir)/aclocal.m4
+
+patchlevel.h: configure.in
echo '#define PATCH_VERSION "$(VERSION)"' >patchlevel.h
TAGS: $(HDRS) patchlevel.h $(SRCS)
@@ -124,11 +137,10 @@ mostlyclean::
rm -f ansi2knr core* *core *.o *_.c
clean:: mostlyclean
- rm -f patch
+ rm -f patch$(EXEEXT)
distclean:: clean
rm -f Makefile config.cache config.log config.status config.h
- rm -f patchlevel.h
maintainer-clean::
@echo "This command is intended for maintainers to use;"
@@ -138,10 +150,11 @@ maintainer-clean::
PV = $(PACKAGE)-$(VERSION)
-dist:: $(DISTFILES) $(DISTFILES_PC) $(DISTFILES_PC_DJGPP)
+dist:: $(DISTFILES) $(DISTFILES_M4) $(DISTFILES_PC) $(DISTFILES_PC_DJGPP)
rm -rf $(PV)
- mkdir $(PV) $(PV)/pc $(PV)/pc/djgpp
+ mkdir $(PV) $(PV)/m4 $(PV)/pc $(PV)/pc/djgpp
cp -p $(DISTFILES) $(PV)
+ cp -p $(DISTFILES_M4) $(PV)/m4
cp -p $(DISTFILES_PC) $(PV)/pc
cp -p $(DISTFILES_PC_DJGPP) $(PV)/pc/djgpp
tar -chf - $(PV) | gzip -9 >$(PV).tar.gz
@@ -150,27 +163,28 @@ dist:: $(DISTFILES) $(DISTFILES_PC) $(DISTFILES_PC_DJGPP)
ansi2knr.o: config.h
ansi2knr: ansi2knr.o
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) ansi2knr.o $(LIBS)
-quotearg_.c: ansi2knr
+addext_.c argmatch_.c backupfile_.c basename_.c error_.c \
+getopt_.c getopt1_.c inp_.c malloc_.c mkdir_.c patch_.c pch_.c quotearg_.c \
+rename_.c util_.c version_.c xmalloc_.c: ansi2knr
.SUFFIXES: _.c
.c_.c:
./ansi2knr $< $@
$(OBJS): config.h
-addext.o: backupfile.h
-argmatch.o: argmatch.h quotearg.h
-backupfile.o: argmatch.h backupfile.h
-basename.o: backupfile.h
-error.o: error.h
-getopt.o getopt1.o: getopt.h
+addext$U.o: backupfile.h
+argmatch$U.o: argmatch.h error.h quotearg.h
+backupfile$U.o: argmatch.h backupfile.h
+error$U.o: error.h
+getopt$U.o getopt1$U.o: getopt.h
+inp$U.o: backupfile.h common.h inp.h pch.h quotearg.h util.h xalloc.h
maketime.o: maketime.h partime.h
-inp.o: backupfile.h common.h inp.h pch.h quotearg.h util.h xalloc.h
partime.o: partime.h
-patch.o: argmatch.h backupfile.h common.h getopt.h inp.h \
+patch$U.o: argmatch.h backupfile.h common.h getopt.h inp.h \
pch.h quotearg.h util.h version.h xalloc.h
-pch.o: common.h inp.h pch.h quotearg.h util.h
+pch$U.o: backupfile.h basename.h common.h inp.h pch.h quotearg.h util.h
quotearg$U.o: quotearg.h xalloc.h
quotesys.o: quotesys.h
-xmalloc.o: xalloc.h
-util.o: backupfile.h common.h maketime.h \
+util$U.o: backupfile.h basename.h common.h maketime.h \
partime.h quotearg.h quotesys.h util.h version.h xalloc.h
-version.o: common.h patchlevel.h util.h version.h
+version$U.o: common.h patchlevel.h util.h version.h
+xmalloc$U.o: xalloc.h
diff --git a/acconfig.h b/acconfig.h
deleted file mode 100644
index d7f3c84..0000000
--- a/acconfig.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Local acconfig.h for autoheader.
- Descriptive text for the C preprocessor macros that
- the patch configure.in can define.
- autoheader copies the comments into config.hin. */
-
-/* Define if there is a member named d_ino in the struct describing
- directory headers. */
-#undef D_INO_IN_DIRENT
-
-/* Define if you have a working <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if memchr works. */
-#undef HAVE_MEMCHR
-
-/* Define if `struct utimbuf' is declared -- usually in <utime.h>. */
-#undef HAVE_STRUCT_UTIMBUF
-
-/* Define to rpl_malloc if the replacement function should be used. */
-#undef malloc
-
-/* Define to 1 if ANSI function prototypes are usable. */
-#undef PROTOTYPES
-
-/* Define to rpl_realloc if the replacement function should be used. */
-#undef realloc
diff --git a/aclocal.m4 b/aclocal.m4
index 4ebfbc6..9e45daa 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,115 +1,13 @@
-#serial 1
+# The following is taken from automake 1.4,
+# except that it prefers the compiler option -Ae to "-Aa -D_HPUX_SOURCE"
+# because only the former supports 64-bit integral types on HP-UX 10.20.
-dnl From Jim Meyering.
-dnl Determine whether malloc accepts 0 as its argument.
-dnl If it doesn't, arrange to use the replacement function.
-dnl
-dnl If you use this macro in a package, you should
-dnl add the following two lines to acconfig.h:
-dnl /* Define to rpl_malloc if the replacement function should be used. */
-dnl #undef malloc
-dnl
-
-AC_DEFUN(jm_FUNC_MALLOC,
-[
- if test x = y; then
- dnl This code is deliberately never run via ./configure.
- dnl FIXME: this is a gross hack to make autoheader put an entry
- dnl for this symbol in config.h.in.
- AC_CHECK_FUNCS(DONE_WORKING_MALLOC_CHECK)
- fi
- dnl xmalloc.c requires that this symbol be defined so it doesn't
- dnl mistakenly use a broken malloc -- as it might if this test were omitted.
- ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK
- AC_DEFINE_UNQUOTED($ac_kludge)
-
- AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
- [AC_TRY_RUN([
- char *malloc ();
- int
- main ()
- {
- exit (malloc (0) ? 0 : 1);
- }
- ],
- jm_cv_func_working_malloc=yes,
- jm_cv_func_working_malloc=no,
- dnl When crosscompiling, assume malloc is broken.
- jm_cv_func_working_malloc=no)
- ])
- if test $jm_cv_func_working_malloc = no; then
- LIBOBJS="$LIBOBJS malloc.o"
- AC_DEFINE_UNQUOTED(malloc, rpl_malloc)
- fi
-])
-
-#serial 1
+## ----------------------------------------- ##
+## ANSIfy the C compiler whenever possible. ##
+## From Franc,ois Pinard ##
+## ----------------------------------------- ##
-dnl From Jim Meyering.
-dnl Determine whether realloc works when both arguments are 0.
-dnl If it doesn't, arrange to use the replacement function.
-dnl
-dnl If you use this macro in a package, you should
-dnl add the following two lines to acconfig.h:
-dnl /* Define to rpl_realloc if the replacement function should be used. */
-dnl #undef realloc
-dnl
-
-AC_DEFUN(jm_FUNC_REALLOC,
-[
- if test x = y; then
- dnl This code is deliberately never run via ./configure.
- dnl FIXME: this is a gross hack to make autoheader put an entry
- dnl for this symbol in config.h.in.
- AC_CHECK_FUNCS(DONE_WORKING_REALLOC_CHECK)
- fi
- dnl xmalloc.c requires that this symbol be defined so it doesn't
- dnl mistakenly use a broken realloc -- as it might if this test were omitted.
- ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK
- AC_DEFINE_UNQUOTED($ac_kludge)
-
- AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
- [AC_TRY_RUN([
- char *realloc ();
- int
- main ()
- {
- exit (realloc (0, 0) ? 0 : 1);
- }
- ],
- jm_cv_func_working_realloc=yes,
- jm_cv_func_working_realloc=no,
- dnl When crosscompiling, assume realloc is broken.
- jm_cv_func_working_realloc=no)
- ])
- if test $jm_cv_func_working_realloc = no; then
- LIBOBJS="$LIBOBJS realloc.o"
- AC_DEFINE_UNQUOTED(realloc, rpl_realloc)
- fi
-])
-
-# serial 1
-
-AC_DEFUN(AM_C_PROTOTYPES,
-[AC_REQUIRE([AM_PROG_CC_STDC])
-AC_MSG_CHECKING([for function prototypes])
-if test "$am_cv_prog_cc_stdc" != no; then
- AC_MSG_RESULT(yes)
- AC_DEFINE(PROTOTYPES)
- U= ANSI2KNR=
-else
- AC_MSG_RESULT(no)
- U=_ ANSI2KNR=./ansi2knr
- # Ensure some checks needed by ansi2knr itself.
- AC_HEADER_STDC
- AC_CHECK_HEADERS(string.h)
-fi
-AC_SUBST(U)dnl
-AC_SUBST(ANSI2KNR)dnl
-])
-
-
-# serial 1
+# serial 2
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
@@ -146,7 +44,7 @@ ac_save_CC="$CC"
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
@@ -195,3 +93,317 @@ case "x$am_cv_prog_cc_stdc" in
*) CC="$CC $am_cv_prog_cc_stdc" ;;
esac
])
+#serial 2
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether struct dirent has a member named d_ino.
+dnl
+
+AC_DEFUN(jm_STRUCT_DIRENT_D_INO,
+ [AC_REQUIRE([AC_HEADER_DIRENT])dnl
+ AC_CACHE_CHECK([for d_ino member in directory struct],
+ jm_cv_struct_dirent_d_ino,
+ [AC_TRY_LINK(dnl
+ [
+#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#else /* not HAVE_DIRENT_H */
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* HAVE_SYS_NDIR_H */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* HAVE_SYS_DIR_H */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
+ ],
+ [struct dirent dp; dp.d_ino = 0;],
+
+ jm_cv_struct_dirent_d_ino=yes,
+ jm_cv_struct_dirent_d_ino=no)
+ ]
+ )
+ if test $jm_cv_struct_dirent_d_ino = yes; then
+ AC_DEFINE(D_INO_IN_DIRENT, 1,
+ [Define if there is a member named d_ino in the struct describing
+ directory headers.])
+ fi
+ ]
+)
+#serial 3
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
+[
+ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <inttypes.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ jm_ac_cv_header_inttypes_h=yes,
+ jm_ac_cv_header_inttypes_h=no)])
+ if test $jm_ac_cv_header_inttypes_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
+[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
+#serial 5
+
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert@twinsun.com>.
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
+AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
+ [AC_CACHE_CHECK([for $1 value to request large file support],
+ ac_cv_sys_largefile_$1,
+ [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
+ ac_cv_sys_largefile_$1=no
+ ifelse($1, CFLAGS,
+ [case "$host_os" in
+ # IRIX 6.2 and later require cc -n32.
+changequote(, )dnl
+ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+changequote([, ])dnl
+ if test "$GCC" != yes; then
+ ac_cv_sys_largefile_CFLAGS=-n32
+ fi
+ ac_save_CC="$CC"
+ CC="$CC $ac_cv_sys_largefile_CFLAGS"
+ AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
+ CC="$ac_save_CC"
+ esac])
+ }])])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
+AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
+ [case $2 in
+ no) ;;
+ ?*)
+ case "[$]$1" in
+ '') $1=$2 ;;
+ *) $1=[$]$1' '$2 ;;
+ esac ;;
+ esac])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
+AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
+ [AC_CACHE_CHECK([for $1], $2,
+ [$2=no
+changequote(, )dnl
+ $4
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ -D$1)
+ $2=1 ;;
+ -D$1=*)
+ $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+changequote([, ])dnl
+ ])
+ if test "[$]$2" != no; then
+ AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
+ fi])
+
+AC_DEFUN(AC_SYS_LARGEFILE,
+ [AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+ if test "$enable_largefile" != no; then
+ AC_CHECK_TOOL(GETCONF, getconf)
+ AC_SYS_LARGEFILE_FLAGS(CFLAGS)
+ AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
+ AC_SYS_LARGEFILE_FLAGS(LIBS)
+
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ no) ;;
+ -D_FILE_OFFSET_BITS=*) ;;
+ -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+ -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+ -D?* | -I?*)
+ AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
+ *)
+ AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
+ esac
+ done
+ AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
+ AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
+ AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
+ ac_cv_sys_file_offset_bits,
+ [Number of bits in a file offset, on hosts where this is settable.],
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_file_offset_bits=64 ;;
+ esac])
+ AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
+ ac_cv_sys_largefile_source,
+ [Define to make fseeko etc. visible, on some hosts.],
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_largefile_source=1 ;;
+ esac])
+ AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
+ ac_cv_sys_large_files,
+ [Define for large files, on AIX-style hosts.],
+ [case "$host_os" in
+ # AIX 4.2 and later
+ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+ ac_cv_sys_large_files=1 ;;
+ esac])
+ fi
+ ])
+#serial 3
+
+dnl From Jim Meyering.
+dnl Determine whether malloc accepts 0 as its argument.
+dnl If it doesn't, arrange to use the replacement function.
+dnl
+
+AC_DEFUN(jm_FUNC_MALLOC,
+[
+ dnl xmalloc.c requires that this symbol be defined so it doesn't
+ dnl mistakenly use a broken malloc -- as it might if this test were omitted.
+ AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
+ [Define if the malloc check has been performed. ])
+
+ AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
+ [AC_TRY_RUN([
+ char *malloc ();
+ int
+ main ()
+ {
+ exit (malloc (0) ? 0 : 1);
+ }
+ ],
+ jm_cv_func_working_malloc=yes,
+ jm_cv_func_working_malloc=no,
+ dnl When crosscompiling, assume malloc is broken.
+ jm_cv_func_working_malloc=no)
+ ])
+ if test $jm_cv_func_working_malloc = no; then
+ AC_SUBST(LIBOBJS)
+ LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
+ [Define to rpl_malloc if the replacement function should be used.])
+ fi
+])
+## ------------------------------- ##
+## Check for function prototypes. ##
+## From Franc,ois Pinard ##
+## ------------------------------- ##
+
+# serial 1
+
+AC_DEFUN(AM_C_PROTOTYPES,
+[AC_REQUIRE([AM_PROG_CC_STDC])
+AC_REQUIRE([AC_PROG_CPP])
+AC_MSG_CHECKING([for function prototypes])
+if test "$am_cv_prog_cc_stdc" != no; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
+ U= ANSI2KNR=
+else
+ AC_MSG_RESULT(no)
+ U=_ ANSI2KNR=./ansi2knr
+ # Ensure some checks needed by ansi2knr itself.
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(string.h)
+fi
+AC_SUBST(U)dnl
+AC_SUBST(ANSI2KNR)dnl
+])
+#serial 3
+
+dnl From Jim Meyering.
+dnl Determine whether realloc works when both arguments are 0.
+dnl If it doesn't, arrange to use the replacement function.
+dnl
+
+AC_DEFUN(jm_FUNC_REALLOC,
+[
+ dnl xmalloc.c requires that this symbol be defined so it doesn't
+ dnl mistakenly use a broken realloc -- as it might if this test were omitted.
+ AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
+ [Define if the realloc check has been performed. ])
+
+ AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
+ [AC_TRY_RUN([
+ char *realloc ();
+ int
+ main ()
+ {
+ exit (realloc (0, 0) ? 0 : 1);
+ }
+ ],
+ jm_cv_func_working_realloc=yes,
+ jm_cv_func_working_realloc=no,
+ dnl When crosscompiling, assume realloc is broken.
+ jm_cv_func_working_realloc=no)
+ ])
+ if test $jm_cv_func_working_realloc = no; then
+ AC_SUBST(LIBOBJS)
+ LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
+ [Define to rpl_realloc if the replacement function should be used.])
+ fi
+])
+#serial 2
+
+dnl From Jim Meyering
+
+dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
+dnl usually in <utime.h>.
+dnl Some systems have utime.h but don't declare the struct anywhere.
+
+AC_DEFUN(jm_STRUCT_UTIMBUF,
+[
+ AC_CHECK_HEADERS(utime.h)
+ AC_REQUIRE([AC_HEADER_TIME])
+ AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
+ [AC_TRY_COMPILE(
+ [
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+ ],
+ [static struct utimbuf x; x.actime = x.modtime;],
+ fu_cv_sys_struct_utimbuf=yes,
+ fu_cv_sys_struct_utimbuf=no)
+ ])
+
+ if test $fu_cv_sys_struct_utimbuf = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_STRUCT_UTIMBUF, 1,
+[Define if struct utimbuf is declared -- usually in <utime.h>.
+ Some systems have utime.h but don't declare the struct anywhere. ])
+ fi
+])
diff --git a/addext.c b/addext.c
index 56d0e4f..a075ea3 100644
--- a/addext.c
+++ b/addext.c
@@ -1,5 +1,5 @@
/* addext.c -- add an extension to a file name
- Copyright (C) 1990, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,10 +23,10 @@
#endif
#ifndef HAVE_DOS_FILE_NAMES
-#define HAVE_DOS_FILE_NAMES 0
+# define HAVE_DOS_FILE_NAMES 0
#endif
#ifndef HAVE_LONG_FILE_NAMES
-#define HAVE_LONG_FILE_NAMES 0
+# define HAVE_LONG_FILE_NAMES 0
#endif
#include <backupfile.h>
@@ -35,7 +35,7 @@
# include <limits.h>
#endif
#ifndef _POSIX_NAME_MAX
-#define _POSIX_NAME_MAX 14
+# define _POSIX_NAME_MAX 14
#endif
#include <sys/types.h>
@@ -49,14 +49,13 @@
# include <unistd.h>
#endif
+char *base_name PARAMS ((char const *));
+
/* Append to FILENAME the extension EXT, unless the result would be too long,
in which case just append the character E. */
void
-addext (filename, ext, e)
- char *filename;
- char const *ext;
- int e;
+addext (char *filename, char const *ext, int e)
{
char *s = base_name (filename);
size_t slen = strlen (s), extlen = strlen (ext);
diff --git a/ansi2knr.1 b/ansi2knr.1
new file mode 100644
index 0000000..f9ee5a6
--- /dev/null
+++ b/ansi2knr.1
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments). It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon. These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+ - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+ - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility. The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work. ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/ansi2knr.c b/ansi2knr.c
index c6ee833..dec83ee 100644
--- a/ansi2knr.c
+++ b/ansi2knr.c
@@ -1,4 +1,6 @@
-/* ansi2knr.c */
+/* Copyright (C) 1989, 1997, 1998, 1999 Aladdin Enterprises. All rights reserved. */
+
+/*$Id: ansi2knr.c,v 1.14 1999/04/13 14:44:33 meyering Exp $*/
/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
/*
@@ -11,9 +13,10 @@ License (the "GPL") for full details.
Everyone is granted permission to copy, modify and redistribute ansi2knr,
but only under the conditions described in the GPL. A copy of this license
is supposed to have been given to you along with ansi2knr so you can know
-your rights and responsibilities. It should be in a file named COPYLEFT.
-Among other things, the copyright notice and this notice must be preserved
-on all copies.
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
We explicitly state here what we believe is already implied by the GPL: if
the ansi2knr program is distributed as a separate set of sources and a
@@ -26,7 +29,10 @@ program under the GPL.
/*
* Usage:
- ansi2knr input_file [output_file]
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
* If no output_file is supplied, output goes to stdout.
* There are no error messages.
*
@@ -34,45 +40,71 @@ program under the GPL.
* identifier at the left margin, followed by a left parenthesis,
* with a right parenthesis as the last character on the line,
* and with a left brace as the first token on the following line
- * (ignoring possible intervening comments).
- * It will recognize a multi-line header provided that no intervening
- * line ends with a left or right brace or a semicolon.
+ * (ignoring possible intervening comments), except that a line
+ * consisting of only
+ * identifier1(identifier2)
+ * will not be considered a function definition unless identifier2 is
+ * the word "void", and a line consisting of
+ * identifier1(identifier2, <<arbitrary>>)
+ * will not be considered a function definition.
+ * ansi2knr will recognize a multi-line header provided
+ * that no intervening line ends with a left or right brace or a semicolon.
* These algorithms ignore whitespace and comments, except that
* the function name must be the first thing on the line.
* The following constructs will confuse it:
* - Any other construct that starts at the left margin and
* follows the above syntax (such as a macro or function call).
- * - Some macros that tinker with the syntax of the function header.
+ * - Some macros that tinker with the syntax of function headers.
*/
/*
* The original and principal author of ansi2knr is L. Peter Deutsch
* <ghost@aladdin.com>. Other authors are noted in the change history
* that follows (in reverse chronological order):
- lpd 96-01-21 added code to cope with not HAVE_CONFIG_H and with
+ lpd 1999-04-12 added minor fixes from Pavel Roskin
+ <pavel_roskin@geocities.com> for clean compilation with
+ gcc -W -Wall
+ lpd 1999-03-22 added hack to recognize lines consisting of
+ identifier1(identifier2, xxx) as *not* being procedures
+ lpd 1999-02-03 made indentation of preprocessor commands consistent
+ lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
+ endless loop; quoted strings within an argument list
+ confused the parser
+ lpd 1999-01-24 added a check for write errors on the output,
+ suggested by Jim Meyering <meyering@ascend.com>
+ lpd 1998-11-09 added further hack to recognize identifier(void)
+ as being a procedure
+ lpd 1998-10-23 added hack to recognize lines consisting of
+ identifier1(identifier2) as *not* being procedures
+ lpd 1997-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
compilers that don't understand void, as suggested by
Tom Lane
- lpd 96-01-15 changed to require that the first non-comment token
+ lpd 1996-01-15 changed to require that the first non-comment token
on the line following a function header be a left brace,
to reduce sensitivity to macros, as suggested by Tom Lane
<tgl@sss.pgh.pa.us>
- lpd 95-06-22 removed #ifndefs whose sole purpose was to define
+ lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
undefined preprocessor symbols as 0; changed all #ifdefs
for configuration symbols to #ifs
- lpd 95-04-05 changed copyright notice to make it clear that
+ lpd 1995-04-05 changed copyright notice to make it clear that
including ansi2knr in a program does not bring the entire
program under the GPL
- lpd 94-12-18 added conditionals for systems where ctype macros
+ lpd 1994-12-18 added conditionals for systems where ctype macros
don't handle 8-bit characters properly, suggested by
Francois Pinard <pinard@iro.umontreal.ca>;
removed --varargs switch (this is now the default)
- lpd 94-10-10 removed CONFIG_BROKETS conditional
- lpd 94-07-16 added some conditionals to help GNU `configure',
+ lpd 1994-10-10 removed CONFIG_BROKETS conditional
+ lpd 1994-07-16 added some conditionals to help GNU `configure',
suggested by Francois Pinard <pinard@iro.umontreal.ca>;
properly erase prototype args in function parameters,
contributed by Jim Avera <jima@netcom.com>;
correct error in writeblanks (it shouldn't erase EOLs)
- lpd 89-xx-xx original version
+ lpd 1989-xx-xx original version
*/
/* Most of the conditionals here are to make ansi2knr work with */
@@ -135,19 +167,24 @@ program under the GPL.
#endif
+/* Define NULL (for *very* old compilers). */
+#ifndef NULL
+# define NULL (0)
+#endif
+
/*
* The ctype macros don't always handle 8-bit characters correctly.
* Compensate for this here.
*/
#ifdef isascii
-# undef HAVE_ISASCII /* just in case */
-# define HAVE_ISASCII 1
+# undef HAVE_ISASCII /* just in case */
+# define HAVE_ISASCII 1
#else
#endif
#if STDC_HEADERS || !HAVE_ISASCII
-# define is_ascii(c) 1
+# define is_ascii(c) 1
#else
-# define is_ascii(c) isascii(c)
+# define is_ascii(c) isascii(c)
#endif
#define is_space(c) (is_ascii(c) && isspace(c))
@@ -160,6 +197,7 @@ program under the GPL.
/* Forward references */
char *skipspace();
+char *scanstring();
int writeblanks();
int test1();
int convert1();
@@ -169,11 +207,17 @@ int
main(argc, argv)
int argc;
char *argv[];
-{ FILE *in, *out;
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+ char *program_name = argv[0];
+ char *output_name = 0;
#define bufsize 5000 /* arbitrary size */
char *buf;
char *line;
char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
/*
* In previous versions, ansi2knr recognized a --varargs switch.
* If this switch was supplied, ansi2knr would attempt to convert
@@ -183,44 +227,61 @@ main(argc, argv)
* check for this switch for backward compatibility.
*/
int convert_varargs = 1;
+ int output_error;
- if ( argc > 1 && argv[1][0] == '-' )
- { if ( !strcmp(argv[1], "--varargs") )
- { convert_varargs = 1;
- argc--;
- argv++;
- }
- else
- { fprintf(stderr, "Unrecognized switch: %s\n", argv[1]);
- exit(1);
- }
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
+ convert_varargs = 1;
+ argc--;
+ argv++;
+ continue;
}
- if (argc < 2 || argc > 3)
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
+ argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
+ }
+ switch ( argc )
{
- printf("Usage: ansi2knr input_file [output_file]\n");
- exit(1);
- }
- in = fopen(argv[1], "r");
- if ( in == NULL )
- {
- fprintf(stderr, "Cannot open input file %s\n", argv[1]);
- exit(1);
+ default:
+ fprintf(stderr, usage);
+ exit(0);
+ case 3:
+ output_name = argv[2];
+ out = fopen(output_name, "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "%s: Cannot open output file %s\n",
+ program_name, output_name);
+ exit(1);
+ }
+ /* falls through */
+ case 2:
+ in = fopen(argv[1], "r");
+ if ( in == NULL ) {
+ fprintf(stderr, "%s: Cannot open input file %s\n",
+ program_name, argv[1]);
+ exit(1);
+ }
+ if ( filename == 0 )
+ filename = argv[1];
+ /* falls through */
+ case 1:
+ break;
}
- if (argc == 3)
- {
- out = fopen(argv[2], "w");
- if ( out == NULL )
- {
- fprintf(stderr, "Cannot open output file %s\n", argv[2]);
- exit(1);
- }
- }
- else
- {
- out = stdout;
- }
- fprintf(out, "#line 1 \"%s\"\n", argv[1]);
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
buf = malloc(bufsize);
+ if ( buf == NULL )
+ {
+ fprintf(stderr, "Unable to allocate read buffer!\n");
+ exit(1);
+ }
line = buf;
while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
{
@@ -271,12 +332,24 @@ wl: fputs(buf, out);
if ( line != buf )
fputs(buf, out);
free(buf);
- fclose(out);
- fclose(in);
+ if ( output_name ) {
+ output_error = ferror(out);
+ output_error |= fclose(out);
+ } else { /* out == stdout */
+ fflush(out);
+ output_error = ferror(out);
+ }
+ if ( output_error ) {
+ fprintf(stderr, "%s: error writing to %s\n", program_name,
+ (output_name ? output_name : "stdout"));
+ exit(1);
+ }
+ if ( in != stdin )
+ fclose(in);
return 0;
}
-/* Skip over space and comments, in either direction. */
+/* Skip over whitespace and comments, in either direction. */
char *
skipspace(p, dir)
register char *p;
@@ -297,6 +370,17 @@ skipspace(p, dir)
return p;
}
+/* Scan over a quoted string, in either direction. */
+char *
+scanstring(p, dir)
+ register char *p;
+ register int dir;
+{
+ for (p += dir; ; p += dir)
+ if (*p == '"' && p[-dir] != '\\')
+ return p + dir;
+}
+
/*
* Write blanks over part of a string.
* Don't overwrite end-of-line characters.
@@ -365,7 +449,7 @@ test1(buf)
};
char **key = words;
char *kp;
- int len = endfn - buf;
+ unsigned len = endfn - buf;
while ( (kp = *key) != 0 )
{ if ( strlen(kp) == len && !strncmp(kp, buf, len) )
@@ -373,6 +457,36 @@ test1(buf)
key++;
}
}
+ {
+ char *id = p;
+ int len;
+ /*
+ * Check for identifier1(identifier2) and not
+ * identifier1(void), or identifier1(identifier2, xxxx).
+ */
+
+ while ( isidchar(*p) )
+ p++;
+ len = p - id;
+ p = skipspace(p, 1);
+ if (*p == ',' ||
+ (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
+ )
+ return 0; /* not a function */
+ }
+ /*
+ * If the last significant character was a ), we need to count
+ * parentheses, because it might be part of a formal parameter
+ * that is a procedure.
+ */
+ if (contin > 0) {
+ int level = 0;
+
+ for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
+ level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
+ if (level > 0)
+ contin = -1;
+ }
return contin;
}
@@ -402,7 +516,7 @@ convert1(buf, out, header, convert_varargs)
;
top: p = endfn;
breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
- if ( breaks == 0 )
+ if ( breaks == NULL )
{ /* Couldn't allocate break table, give up */
fprintf(stderr, "Unable to allocate break table!\n");
fputs(buf, out);
@@ -414,7 +528,7 @@ top: p = endfn;
do
{ int level = 0;
char *lp = NULL;
- char *rp;
+ char *rp = NULL;
char *end = NULL;
if ( bp >= btop )
@@ -441,14 +555,18 @@ top: p = endfn;
else rp = p;
break;
case '/':
- p = skipspace(p, 1) - 1;
+ if (p[1] == '*')
+ p = skipspace(p, 1) - 1;
break;
+ case '"':
+ p = scanstring(p, 1) - 1;
+ break;
default:
;
}
}
/* Erase any embedded prototype parameters. */
- if ( lp )
+ if ( lp && rp )
writeblanks(lp + 1, rp);
p--; /* back up over terminator */
/* Find the name being declared. */
@@ -464,9 +582,19 @@ top: p = endfn;
while ( level )
switch ( *--p )
{
- case ']': case ')': level++; break;
- case '[': case '(': level--; break;
- case '/': p = skipspace(p, -1) + 1; break;
+ case ']': case ')':
+ level++;
+ break;
+ case '[': case '(':
+ level--;
+ break;
+ case '/':
+ if (p > buf && p[-1] == '*')
+ p = skipspace(p, -1) + 1;
+ break;
+ case '"':
+ p = scanstring(p, -1) + 1;
+ break;
default: ;
}
}
diff --git a/argmatch.c b/argmatch.c
index 5b22d6f..9642706 100644
--- a/argmatch.c
+++ b/argmatch.c
@@ -1,5 +1,5 @@
/* argmatch.c -- find a match for a string in an array
- Copyright (C) 1990, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -12,39 +12,86 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; see the file COPYING.
- If not, write to the Free Software Foundation,
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
-/* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
+/* Written by David MacKenzie <djm@ai.mit.edu>
+ Modified by Akim Demaille <demaille@inf.enst.fr> */
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#include <argmatch.h>
-#include <quotearg.h>
+#include "argmatch.h"
#include <stdio.h>
-#if HAVE_STRING_H
+#ifdef STDC_HEADERS
# include <string.h>
+#endif
+
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(Text) gettext (Text)
#else
-# include <strings.h>
+# define _(Text) Text
+#endif
+
+#include "error.h"
+#include "quotearg.h"
+
+/* When reporting an invalid argument, show nonprinting characters
+ by using the quoting style ARGMATCH_QUOTING_STYLE. Do not use
+ literal_quoting_style. */
+#ifndef ARGMATCH_QUOTING_STYLE
+# define ARGMATCH_QUOTING_STYLE locale_quoting_style
+#endif
+
+/* The following test is to work around the gross typo in
+ systems like Sony NEWS-OS Release 4.0C, whereby EXIT_FAILURE
+ is defined to 0, not 1. */
+#if !EXIT_FAILURE
+# undef EXIT_FAILURE
+# define EXIT_FAILURE 1
+#endif
+
+/* Non failing version of argmatch call this function after failing. */
+#ifndef ARGMATCH_DIE
+# define ARGMATCH_DIE exit (EXIT_FAILURE)
#endif
+#ifdef ARGMATCH_DIE_DECL
+ARGMATCH_DIE_DECL;
+#endif
+
+static void
+__argmatch_die (void)
+{
+ ARGMATCH_DIE;
+}
+
+/* Used by XARGMATCH and XARGCASEMATCH. See description in argmatch.h.
+ Default to __argmatch_die, but allow caller to change this at run-time. */
+argmatch_exit_fn argmatch_die = __argmatch_die;
+
+
/* If ARG is an unambiguous match for an element of the
- null-terminated array OPTLIST, return the index in OPTLIST
+ null-terminated array ARGLIST, return the index in ARGLIST
of the matched element, else -1 if it does not match any element
- or -2 if it is ambiguous (is a prefix of more than one element). */
+ or -2 if it is ambiguous (is a prefix of more than one element).
+ If SENSITIVE, comparison is case sensitive.
-int
-argmatch (arg, optlist)
- const char *arg;
- const char *const *optlist;
+ If VALLIST is none null, use it to resolve ambiguities limited to
+ synonyms, i.e., for
+ "yes", "yop" -> 0
+ "no", "nope" -> 1
+ "y" is a valid argument, for `0', and "n" for `1'. */
+
+static int
+__argmatch_internal (const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize,
+ int case_sensitive)
{
- int i; /* Temporary index in OPTLIST. */
+ int i; /* Temporary index in ARGLIST. */
size_t arglen; /* Length of ARG. */
int matchind = -1; /* Index of first nonexact match. */
int ambiguous = 0; /* If nonzero, multiple nonexact match(es). */
@@ -52,19 +99,30 @@ argmatch (arg, optlist)
arglen = strlen (arg);
/* Test all elements for either exact match or abbreviated matches. */
- for (i = 0; optlist[i]; i++)
+ for (i = 0; arglist[i]; i++)
{
- if (!strncmp (optlist[i], arg, arglen))
+ if (case_sensitive
+ ? !strncmp (arglist[i], arg, arglen)
+ : !strncasecmp (arglist[i], arg, arglen))
{
- if (strlen (optlist[i]) == arglen)
+ if (strlen (arglist[i]) == arglen)
/* Exact match found. */
return i;
else if (matchind == -1)
/* First nonexact match found. */
matchind = i;
else
- /* Second nonexact match found. */
- ambiguous = 1;
+ {
+ /* Second nonexact match found. */
+ if (vallist == NULL
+ || memcmp (vallist + valsize * matchind,
+ vallist + valsize * i, valsize))
+ {
+ /* There is a real ambiguity, or we could not
+ disambiguate. */
+ ambiguous = 1;
+ }
+ }
}
}
if (ambiguous)
@@ -73,18 +131,176 @@ argmatch (arg, optlist)
return matchind;
}
+/* argmatch - case sensitive version */
+int
+argmatch (const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize)
+{
+ return __argmatch_internal (arg, arglist, vallist, valsize, 1);
+}
+
+/* argcasematch - case insensitive version */
+int
+argcasematch (const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize)
+{
+ return __argmatch_internal (arg, arglist, vallist, valsize, 0);
+}
+
/* Error reporting for argmatch.
- KIND is a description of the type of entity that was being matched.
+ CONTEXT is a description of the type of entity that was being matched.
VALUE is the invalid value that was given.
PROBLEM is the return value from argmatch. */
void
-invalid_arg (kind, value, problem)
- const char *kind;
- const char *value;
- int problem;
+argmatch_invalid (const char *context, const char *value, int problem)
{
- fprintf (stderr,
- problem == -1 ? "%s: invalid %s %s\n" : "%s: ambiguous %s %s\n",
- program_name, kind, quotearg (value));
+ char const *format = (problem == -1
+ ? _("invalid argument %s for `%s'")
+ : _("ambiguous argument %s for `%s'"));
+
+ error (0, 0, format, quotearg_style (ARGMATCH_QUOTING_STYLE, value), context);
+}
+
+/* List the valid arguments for argmatch.
+ ARGLIST is the same as in argmatch.
+ VALLIST is a pointer to an array of values.
+ VALSIZE is the size of the elements of VALLIST */
+void
+argmatch_valid (const char *const *arglist,
+ const char *vallist, size_t valsize)
+{
+ int i;
+ const char *last_val = NULL;
+
+ /* We try to put synonyms on the same line. The assumption is that
+ synonyms follow each other */
+ fprintf (stderr, _("Valid arguments are:"));
+ for (i = 0; arglist[i]; i++)
+ if ((i == 0)
+ || memcmp (last_val, vallist + valsize * i, valsize))
+ {
+ fprintf (stderr, "\n - `%s'", arglist[i]);
+ last_val = vallist + valsize * i;
+ }
+ else
+ {
+ fprintf (stderr, ", `%s'", arglist[i]);
+ }
+ putc ('\n', stderr);
}
+
+/* Never failing versions of the previous functions.
+
+ CONTEXT is the context for which argmatch is called (e.g.,
+ "--version-control", or "$VERSION_CONTROL" etc.). Upon failure,
+ calls the (supposed never to return) function EXIT_FN. */
+
+int
+__xargmatch_internal (const char *context,
+ const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize,
+ int case_sensitive,
+ argmatch_exit_fn exit_fn)
+{
+ int res = __argmatch_internal (arg, arglist,
+ vallist, valsize,
+ case_sensitive);
+ if (res >= 0)
+ /* Success. */
+ return res;
+
+ /* We failed. Explain why. */
+ argmatch_invalid (context, arg, res);
+ argmatch_valid (arglist, vallist, valsize);
+ (*exit_fn) ();
+
+ return -1; /* To please the compilers. */
+}
+
+/* Look for VALUE in VALLIST, an array of objects of size VALSIZE and
+ return the first corresponding argument in ARGLIST */
+const char *
+argmatch_to_argument (const char *value,
+ const char *const *arglist,
+ const char *vallist, size_t valsize)
+{
+ int i;
+
+ for (i = 0; arglist[i]; i++)
+ if (!memcmp (value, vallist + valsize * i, valsize))
+ return arglist[i];
+ return NULL;
+}
+
+#ifdef TEST
+/*
+ * Based on "getversion.c" by David MacKenzie <djm@gnu.ai.mit.edu>
+ */
+char *program_name;
+extern const char *getenv ();
+
+/* When to make backup files. */
+enum backup_type
+{
+ /* Never make backups. */
+ none,
+
+ /* Make simple backups of every file. */
+ simple,
+
+ /* Make numbered backups of files that already have numbered backups,
+ and simple backups of the others. */
+ numbered_existing,
+
+ /* Make numbered backups of every file. */
+ numbered
+};
+
+/* Two tables describing arguments (keys) and their corresponding
+ values */
+static const char *const backup_args[] =
+{
+ "no", "none", "off",
+ "simple", "never",
+ "existing", "nil",
+ "numbered", "t",
+ 0
+};
+
+static const enum backup_type backup_vals[] =
+{
+ none, none, none,
+ simple, simple,
+ numbered_existing, numbered_existing,
+ numbered, numbered
+};
+
+int
+main (int argc, const char *const *argv)
+{
+ const char *cp;
+ enum backup_type backup_type = none;
+
+ program_name = (char *) argv[0];
+
+ if (argc > 2)
+ {
+ fprintf (stderr, "Usage: %s [VERSION_CONTROL]\n", program_name);
+ exit (1);
+ }
+
+ if ((cp = getenv ("VERSION_CONTROL")))
+ backup_type = XARGCASEMATCH ("$VERSION_CONTROL", cp,
+ backup_args, backup_vals);
+
+ if (argc == 2)
+ backup_type = XARGCASEMATCH (program_name, argv[1],
+ backup_args, backup_vals);
+
+ printf ("The version control is `%s'\n",
+ ARGMATCH_TO_ARGUMENT (backup_type, backup_args, backup_vals));
+
+ return 0;
+}
+#endif
diff --git a/argmatch.h b/argmatch.h
index e95ff62..d3f25cc 100644
--- a/argmatch.h
+++ b/argmatch.h
@@ -1,12 +1,129 @@
-/* argmatch.h -- declarations for matching arguments against option lists */
+/* argmatch.h -- definitions and prototypes for argmatch.c
+ Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
-#if defined __STDC__ || __GNUC__
-# define __ARGMATCH_P(args) args
-#else
-# define __ARGMATCH_P(args) ()
-#endif
+ This program 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.
-int argmatch __ARGMATCH_P ((const char *, const char * const *));
-void invalid_arg __ARGMATCH_P ((const char *, const char *, int));
+ This program 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.
-extern char const program_name[];
+ 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. */
+
+/* Written by David MacKenzie <djm@ai.mit.edu>
+ Modified by Akim Demaille <demaille@inf.enst.fr> */
+
+#ifndef ARGMATCH_H_
+# define ARGMATCH_H_ 1
+
+# if HAVE_CONFIG_H
+# include <config.h>
+# endif
+
+# include <sys/types.h>
+
+# ifndef PARAMS
+# if PROTOTYPES || (defined (__STDC__) && __STDC__)
+# define PARAMS(args) args
+# else
+# define PARAMS(args) ()
+# endif /* GCC. */
+# endif /* Not PARAMS. */
+
+/* Assert there are as many real arguments as there are values
+ (argument list ends with a NULL guard). There is no execution
+ cost, since it will be statically evalauted to `assert (0)' or
+ `assert (1)'. Unfortunately there is no -Wassert-0. */
+
+# undef ARRAY_CARDINALITY
+# define ARRAY_CARDINALITY(Array) (sizeof ((Array)) / sizeof (*(Array)))
+
+# define ARGMATCH_ASSERT(Arglist, Vallist) \
+ assert (ARRAY_CARDINALITY ((Arglist)) == ARRAY_CARDINALITY ((Vallist)) + 1)
+
+/* Return the index of the element of ARGLIST (NULL terminated) that
+ matches with ARG. If VALLIST is not NULL, then use it to resolve
+ false ambiguities (i.e., different matches of ARG but corresponding
+ to the same values in VALLIST). */
+
+int argmatch
+ PARAMS ((const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize));
+int argcasematch
+ PARAMS ((const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize));
+
+# define ARGMATCH(Arg, Arglist, Vallist) \
+ argmatch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
+
+# define ARGCASEMATCH(Arg, Arglist, Vallist) \
+ argcasematch ((Arg), (Arglist), (const char *) (Vallist), sizeof (*(Vallist)))
+
+/* xargmatch calls this function when it fails. This function should not
+ return. By default, this is a function that calls ARGMATCH_DIE which
+ in turn defaults to `exit (EXIT_FAILURE)'. */
+typedef void (*argmatch_exit_fn) PARAMS ((void));
+extern argmatch_exit_fn argmatch_die;
+
+/* Report on stderr why argmatch failed. Report correct values. */
+
+void argmatch_invalid
+ PARAMS ((const char *context, const char *value, int problem));
+
+/* Left for compatibility with the old name invalid_arg */
+
+# define invalid_arg(Context, Value, Problem) \
+ argmatch_invalid ((Context), (Value), (Problem))
+
+
+
+/* Report on stderr the list of possible arguments. */
+
+void argmatch_valid
+ PARAMS ((const char *const *arglist,
+ const char *vallist, size_t valsize));
+
+# define ARGMATCH_VALID(Arglist, Vallist) \
+ argmatch_valid (Arglist, (const char *) Vallist, sizeof (*(Vallist)))
+
+
+
+/* Same as argmatch, but upon failure, reports a explanation on the
+ failure, and exits using the function EXIT_FN. */
+
+int __xargmatch_internal
+ PARAMS ((const char *context,
+ const char *arg, const char *const *arglist,
+ const char *vallist, size_t valsize,
+ int case_sensitive, argmatch_exit_fn exit_fn));
+
+/* Programmer friendly interface to __xargmatch_internal. */
+
+# define XARGMATCH(Context, Arg, Arglist, Vallist) \
+ (Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
+ (const char *) (Vallist), \
+ sizeof (*(Vallist)), \
+ 1, argmatch_die)])
+
+# define XARGCASEMATCH(Context, Arg, Arglist, Vallist) \
+ (Vallist [__xargmatch_internal ((Context), (Arg), (Arglist), \
+ (const char *) (Vallist), \
+ sizeof (*(Vallist)), \
+ 0, argmatch_die)])
+
+/* Convert a value into a corresponding argument. */
+
+const char *argmatch_to_argument
+ PARAMS ((char const *value, const char *const *arglist,
+ const char *vallist, size_t valsize));
+
+# define ARGMATCH_TO_ARGUMENT(Value, Arglist, Vallist) \
+ argmatch_to_argument ((char const *) &(Value), (Arglist), \
+ (const char *) (Vallist), sizeof (*(Vallist)))
+
+#endif /* ARGMATCH_H_ */
diff --git a/backupfile.c b/backupfile.c
index 4b0f2ec..7f4da17 100644
--- a/backupfile.c
+++ b/backupfile.c
@@ -1,5 +1,5 @@
/* backupfile.c -- make Emacs style backup file names
- Copyright (C) 1990,1991,1992,1993,1995,1997 Free Software Foundation, Inc.
+ Copyright (C) 1990-1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -64,6 +64,12 @@
char *malloc ();
#endif
+#ifndef HAVE_DECL_GETENV
+char *getenv ();
+#endif
+
+char *base_name PARAMS ((char const *));
+
#if HAVE_DIRENT_H || HAVE_NDIR_H || HAVE_SYS_DIR_H || HAVE_SYS_NDIR_H
# define HAVE_DIR 1
#else
@@ -74,7 +80,7 @@ char *malloc ();
# include <limits.h>
#endif
#ifndef CHAR_BIT
-#define CHAR_BIT 8
+# define CHAR_BIT 8
#endif
/* Upper bound on the string length of an integer converted to string.
302 / 1000 is ceil (log10 (2.0)). Subtract 1 for the sign bit;
@@ -97,15 +103,12 @@ char *malloc ();
# define REAL_DIR_ENTRY(dp) 1
#endif
-/* Which type of backup file names are generated. */
-enum backup_type backup_type = none;
-
/* The extension added to file names to produce a simple (as opposed
to numbered) backup file name. */
-const char *simple_backup_suffix = ".orig";
+const char *simple_backup_suffix = "~";
-static int max_backup_version __BACKUPFILE_P ((const char *, const char *));
-static int version_number __BACKUPFILE_P ((const char *, const char *, size_t));
+static int max_backup_version PARAMS ((const char *, const char *));
+static int version_number PARAMS ((const char *, const char *, size_t));
/* Return the name of the new backup file for file FILE,
allocated with malloc. Return 0 if out of memory.
@@ -113,8 +116,7 @@ static int version_number __BACKUPFILE_P ((const char *, const char *, size_t));
Do not call this function if backup_type == none. */
char *
-find_backup_file_name (file)
- const char *file;
+find_backup_file_name (const char *file, enum backup_type backup_type)
{
size_t backup_suffix_size_max;
size_t file_len = strlen (file);
@@ -163,9 +165,7 @@ find_backup_file_name (file)
*/
static int
-max_backup_version (file, dir)
- const char *file;
- const char *dir;
+max_backup_version (const char *file, const char *dir)
{
DIR *dirp;
struct dirent *dp;
@@ -199,10 +199,7 @@ max_backup_version (file, dir)
*/
static int
-version_number (base, backup, base_length)
- const char *base;
- const char *backup;
- size_t base_length;
+version_number (const char *base, const char *backup, size_t base_length)
{
int version;
const char *p;
@@ -223,30 +220,49 @@ version_number (base, backup, base_length)
static const char * const backup_args[] =
{
- "never", "simple", "nil", "existing", "t", "numbered", 0
+ /* In a series of synonyms, present the most meaning full first, so
+ that argmatch_valid be more readable. */
+ "none", "off",
+ "simple", "never",
+ "existing", "nil",
+ "numbered", "t",
+ 0
};
static const enum backup_type backup_types[] =
{
- simple, simple, numbered_existing, numbered_existing, numbered, numbered
+ none, none,
+ simple, simple,
+ numbered_existing, numbered_existing,
+ numbered, numbered
};
-/* Return the type of backup indicated by VERSION.
- Unique abbreviations are accepted. */
+/* Return the type of backup specified by VERSION.
+ If VERSION is NULL or the empty string, return numbered_existing.
+ If VERSION is invalid or ambiguous, fail with a diagnostic appropriate
+ for the specified CONTEXT. Unambiguous abbreviations are accepted. */
enum backup_type
-get_version (version)
- const char *version;
+get_version (const char *context, const char *version)
{
- int i;
-
if (version == 0 || *version == 0)
return numbered_existing;
- i = argmatch (version, backup_args);
- if (i < 0)
- {
- invalid_arg ("version control type", version, i);
- exit (2);
- }
- return backup_types[i];
+ else
+ return XARGMATCH (context, version, backup_args, backup_types);
+}
+
+
+/* Return the type of backup specified by VERSION.
+ If VERSION is NULL, use the value of the envvar VERSION_CONTROL.
+ If the specified string is invalid or ambiguous, fail with a diagnostic
+ appropriate for the specified CONTEXT.
+ Unambiguous abbreviations are accepted. */
+
+enum backup_type
+xget_version (const char *context, const char *version)
+{
+ if (version && *version)
+ return get_version (context, version);
+ else
+ return get_version ("$VERSION_CONTROL", getenv ("VERSION_CONTROL"));
}
diff --git a/backupfile.h b/backupfile.h
index dad1984..b9b973c 100644
--- a/backupfile.h
+++ b/backupfile.h
@@ -1,5 +1,5 @@
/* backupfile.h -- declarations for making Emacs style backup file names
- Copyright (C) 1990, 1991, 1992, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1990-1992, 1997-1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -16,6 +16,9 @@
If not, write to the Free Software Foundation,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+#ifndef BACKUPFILE_H_
+# define BACKUPFILE_H_
+
/* When to make backup files. */
enum backup_type
{
@@ -33,18 +36,25 @@ enum backup_type
numbered
};
-extern enum backup_type backup_type;
+# define VALID_BACKUP_TYPE(Type) \
+ ((Type) == none \
+ || (Type) == simple \
+ || (Type) == numbered_existing \
+ || (Type) == numbered)
+
extern char const *simple_backup_suffix;
-#ifndef __BACKUPFILE_P
-# if defined __STDC__ || __GNUC__
-# define __BACKUPFILE_P(args) args
-# else
-# define __BACKUPFILE_P(args) ()
+# ifndef PARAMS
+# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
# endif
-#endif
-char *base_name __BACKUPFILE_P ((char const *));
-char *find_backup_file_name __BACKUPFILE_P ((char const *));
-enum backup_type get_version __BACKUPFILE_P ((char const *));
-void addext __BACKUPFILE_P ((char *, char const *, int));
+char *find_backup_file_name PARAMS ((char const *, enum backup_type));
+enum backup_type get_version PARAMS ((char const *context, char const *arg));
+enum backup_type xget_version PARAMS ((char const *context, char const *arg));
+void addext PARAMS ((char *, char const *, int));
+
+#endif /* ! BACKUPFILE_H_ */
diff --git a/basename.c b/basename.c
index 8d18a8f..e648b1a 100644
--- a/basename.c
+++ b/basename.c
@@ -1,32 +1,55 @@
-/* basename.c -- return the last element in a path */
+/* basename.c -- return the last element in a path
+ Copyright (C) 1990, 1998, 1999 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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. */
#if HAVE_CONFIG_H
# include <config.h>
#endif
-#include <backupfile.h>
-
#ifndef FILESYSTEM_PREFIX_LEN
-#define FILESYSTEM_PREFIX_LEN(f) 0
+# define FILESYSTEM_PREFIX_LEN(Filename) 0
#endif
#ifndef ISSLASH
-#define ISSLASH(c) ((c) == '/')
+# define ISSLASH(C) ((C) == '/')
#endif
/* In general, we can't use the builtin `basename' function if available,
since it has different meanings in different environments.
- In some environments the builtin `basename' modifies its argument. */
+ In some environments the builtin `basename' modifies its argument.
+ If NAME is all slashes, be sure to return `/'. */
char *
-base_name (name)
- char const *name;
+base_name (char const *name)
{
char const *base = name += FILESYSTEM_PREFIX_LEN (name);
-
- for (; *name; name++)
- if (ISSLASH (*name))
- base = name + 1;
+ int all_slashes = 1;
+ char const *p;
+
+ for (p = name; *p; p++)
+ {
+ if (ISSLASH (*p))
+ base = p + 1;
+ else
+ all_slashes = 0;
+ }
+
+ /* If NAME is all slashes, arrange to return `/'. */
+ if (*base == '\0' && ISSLASH (*name) && all_slashes)
+ --base;
return (char *) base;
}
diff --git a/basename.h b/basename.h
new file mode 100644
index 0000000..90f7654
--- /dev/null
+++ b/basename.h
@@ -0,0 +1,9 @@
+#ifndef PARAMS
+# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
+#endif
+
+char *base_name PARAMS ((char const *name));
diff --git a/common.h b/common.h
index d10330c..0b040cf 100644
--- a/common.h
+++ b/common.h
@@ -1,26 +1,24 @@
/* common definitions for `patch' */
-/* $Id: common.h,v 1.19 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: common.h,v 1.20 1999/08/30 06:20:08 eggert Exp $ */
-/*
-Copyright 1986, 1988 Larry Wall
-Copyright 1990, 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright 1986, 1988 Larry Wall
+ Copyright 1990, 1991-1993, 1997-1998, 1999 Free Software Foundation, Inc.
-This program 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.
+ This program 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.
-This program 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.
+ This program 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; see the file COPYING.
-If not, write to the Free Software Foundation,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+ If not, write to the Free Software Foundation,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef DEBUGGING
#define DEBUGGING 1
@@ -34,11 +32,6 @@ If not, write to the Free Software Foundation,
# endif
#endif
-/* Enable support for fseeko and ftello on hosts
- where it is available but is turned off by default.
- This must be defined before any system file is included. */
-#define _LARGEFILE_SOURCE 1
-
#include <config.h>
#include <assert.h>
@@ -265,9 +258,10 @@ GENERIC_OBJECT *realloc ();
#if HAVE_UNISTD_H
# include <unistd.h>
-#endif
-#ifndef lseek
-off_t lseek ();
+#else
+# ifndef lseek
+ off_t lseek ();
+# endif
#endif
#ifndef SEEK_SET
#define SEEK_SET 0
@@ -281,7 +275,7 @@ off_t lseek ();
#ifndef STDERR_FILENO
#define STDERR_FILENO 2
#endif
-#if _LFS_LARGEFILE
+#if HAVE_FSEEKO
typedef off_t file_offset;
# define file_seek fseeko
# define file_tell ftello
diff --git a/config.guess b/config.guess
new file mode 100644
index 0000000..cca6757
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1088 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
+# Free Software Foundation, Inc.
+#
+# This file 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.
+#
+# This program 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Written by Per Bothner <bothner@cygnus.com>.
+# The master version of this file is at the FSF in /home/gd/gnu/lib.
+# Please send patches to <autoconf-patches@gnu.org>.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit system type (host/target name).
+#
+# Only a few systems have been added to this list; please add others
+# (but try to keep the structure clean).
+#
+
+# Use $HOST_CC if defined. $CC may point to a cross-compiler
+if test x"$CC_FOR_BUILD" = x; then
+ if test x"$HOST_CC" != x; then
+ CC_FOR_BUILD="$HOST_CC"
+ else
+ if test x"$CC" != x; then
+ CC_FOR_BUILD="$CC"
+ else
+ CC_FOR_BUILD=cc
+ fi
+ fi
+fi
+
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 8/24/94.)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+dummy=dummy-$$
+trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ alpha:OSF1:*:*)
+ if test $UNAME_RELEASE = "V4.0"; then
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ fi
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ cat <<EOF >$dummy.s
+ .globl main
+ .ent main
+main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit 0 ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit 0 ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit 0 ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-cbm-sysv4
+ exit 0;;
+ amiga:NetBSD:*:*)
+ echo m68k-cbm-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ amiga:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit 0 ;;
+ arc64:OpenBSD:*:*)
+ echo mips64el-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hkmips:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ pmax:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sgi:OpenBSD:*:*)
+ echo mips-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ wgrisc:OpenBSD:*:*)
+ echo mipsel-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit 0;;
+ arm32:NetBSD:*:*)
+ echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ SR2?01:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit 0;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit 0 ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit 0 ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ i86pc:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit 0 ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit 0 ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:NetBSD:*:*)
+ echo m68k-atari-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit 0 ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit 0 ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit 0 ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:NetBSD:*:*)
+ echo m68k-sun-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ sun3*:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:NetBSD:*:*)
+ echo m68k-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mac68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme68k:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ mvme88k:OpenBSD:*:*)
+ echo m88k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit 0 ;;
+ macppc:NetBSD:*:*)
+ echo powerpc-apple-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit 0 ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit 0 ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit 0 ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy \
+ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+ && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit 0 ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit 0 ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit 0 ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit 0 ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \
+ -o ${TARGET_BINARY_INTERFACE}x = x ] ; then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit 0 ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit 0 ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit 0 ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit 0 ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit 0 ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i?86:AIX:*:*)
+ echo i386-ibm-aix
+ exit 0 ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo rs6000-ibm-aix3.2.5
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit 0 ;;
+ *:AIX:*:4)
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=4.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit 0 ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit 0 ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit 0 ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit 0 ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit 0 ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit 0 ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit 0 ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit 0 ;;
+ 9000/[34678]??:HP-UX:*:*)
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ sed 's/^ //' << EOF >$dummy.c
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ ($CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
+ rm -f $dummy.c $dummy
+ esac
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit 0 ;;
+ 3050*:HI-UX:*:*)
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ echo unknown-hitachi-hiuxwe2
+ exit 0 ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit 0 ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit 0 ;;
+ *9??*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit 0 ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit 0 ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit 0 ;;
+ i?86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit 0 ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit 0 ;;
+ hppa*:OpenBSD:*:*)
+ echo hppa-unknown-openbsd
+ exit 0 ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ CRAY*X-MP:*:*:*)
+ echo xmp-cray-unicos
+ exit 0 ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
+ exit 0 ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY*T3E:*:*:*)
+ echo alpha-cray-unicosmk${UNAME_RELEASE}
+ exit 0 ;;
+ CRAY-2:*:*:*)
+ echo cray2-cray-unicos
+ exit 0 ;;
+ F300:UNIX_System_V:*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit 0 ;;
+ F301:UNIX_System_V:*:*)
+ echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
+ exit 0 ;;
+ hp3[0-9][05]:NetBSD:*:*)
+ echo m68k-hp-netbsd${UNAME_RELEASE}
+ exit 0 ;;
+ hp300:OpenBSD:*:*)
+ echo m68k-unknown-openbsd${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit 0 ;;
+ *:FreeBSD:*:*)
+ if test -x /usr/bin/objformat; then
+ if test "elf" = "`/usr/bin/objformat`"; then
+ echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
+ exit 0
+ fi
+ fi
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit 0 ;;
+ *:NetBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ *:OpenBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ exit 0 ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit 0 ;;
+ i*:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit 0 ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i386-pc-interix
+ exit 0 ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit 0 ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit 0 ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit 0 ;;
+ *:GNU:*:*)
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit 0 ;;
+ *:Linux:*:*)
+ # uname on the ARM produces all sorts of strangeness, and we need to
+ # filter it out.
+ case "$UNAME_MACHINE" in
+ armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
+ arm* | sa110*) UNAME_MACHINE="arm" ;;
+ esac
+
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ ld_help_string=`cd /; ld --help 2>&1`
+ ld_supported_emulations=`echo $ld_help_string \
+ | sed -ne '/supported emulations:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported emulations: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_emulations" in
+ *ia64) echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 ;;
+ i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;;
+ i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;;
+ sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;;
+ elf32ppc | elf32ppclinux)
+ # Determine Lib Version
+ cat >$dummy.c <<EOF
+#include <features.h>
+#if defined(__GLIBC__)
+extern char __libc_version[];
+extern char __libc_release[];
+#endif
+main(argc, argv)
+ int argc;
+ char *argv[];
+{
+#if defined(__GLIBC__)
+ printf("%s %s\n", __libc_version, __libc_release);
+#else
+ printf("unkown\n");
+#endif
+ return 0;
+}
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy | grep 1\.99 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.c $dummy
+ echo powerpc-unknown-linux-gnu${LIBC} ; exit 0 ;;
+ esac
+
+ if test "${UNAME_MACHINE}" = "alpha" ; then
+ sed 's/^ //' <<EOF >$dummy.s
+ .globl main
+ .ent main
+ main:
+ .frame \$30,0,\$26,0
+ .prologue 0
+ .long 0x47e03d80 # implver $0
+ lda \$2,259
+ .long 0x47e20c21 # amask $2,$1
+ srl \$1,8,\$2
+ sll \$2,2,\$2
+ sll \$0,3,\$0
+ addl \$1,\$0,\$0
+ addl \$2,\$0,\$0
+ ret \$31,(\$26),1
+ .end main
+EOF
+ LIBC=""
+ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+ if test "$?" = 0 ; then
+ ./$dummy
+ case "$?" in
+ 7)
+ UNAME_MACHINE="alpha"
+ ;;
+ 15)
+ UNAME_MACHINE="alphaev5"
+ ;;
+ 14)
+ UNAME_MACHINE="alphaev56"
+ ;;
+ 10)
+ UNAME_MACHINE="alphapca56"
+ ;;
+ 16)
+ UNAME_MACHINE="alphaev6"
+ ;;
+ esac
+
+ objdump --private-headers $dummy | \
+ grep ld.so.1 > /dev/null
+ if test "$?" = 0 ; then
+ LIBC="libc1"
+ fi
+ fi
+ rm -f $dummy.s $dummy
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0
+ elif test "${UNAME_MACHINE}" = "mips" ; then
+ cat >$dummy.c <<EOF
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __MIPSEB__
+ printf ("%s-unknown-linux-gnu\n", argv[1]);
+#endif
+#ifdef __MIPSEL__
+ printf ("%sel-unknown-linux-gnu\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ else
+ # Either a pre-BFD a.out linker (linux-gnuoldld)
+ # or one that does not give us useful --help.
+ # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout.
+ # If ld does not provide *any* "supported emulations:"
+ # that means it is gnuoldld.
+ echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:"
+ test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0
+
+ case "${UNAME_MACHINE}" in
+ i?86)
+ VENDOR=pc;
+ ;;
+ *)
+ VENDOR=unknown;
+ ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ cat >$dummy.c <<EOF
+#include <features.h>
+#ifdef __cplusplus
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+#ifdef __ELF__
+# ifdef __GLIBC__
+# if __GLIBC__ >= 2
+ printf ("%s-${VENDOR}-linux-gnu\n", argv[1]);
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+# else
+ printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]);
+# endif
+#else
+ printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]);
+#endif
+ return 0;
+}
+EOF
+ $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
+ rm -f $dummy.c $dummy
+ fi ;;
+# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
+# are messed up and put the nodename in both sysname and nodename.
+ i?86:DYNIX/ptx:4*:*)
+ echo i386-sequent-sysv4
+ exit 0 ;;
+ i?86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit 0 ;;
+ i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ i?86:*:5:7*)
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent.*II' >/dev/null) && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) && UNAME_MACHINE=i585
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}${UNAME_VERSION}-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ i?86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit 0 ;;
+ pc:*:*:*)
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit 0 ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit 0 ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit 0 ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit 0 ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit 0 ;;
+ M68*:*:R3V[567]*:*)
+ test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+ 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && echo i486-ncr-sysv4 && exit 0 ;;
+ m68*:LynxOS:2.*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit 0 ;;
+ i?86:LynxOS:2.*:* | i?86:LynxOS:3.[01]*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit 0 ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit 0 ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit 0 ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit 0 ;;
+ PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit 0 ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit 0 ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit 0 ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit 0 ;;
+ news*:NEWS-OS:*:6*)
+ echo mips-sony-newsos6
+ exit 0 ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit 0 ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit 0 ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit 0 ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit 0 ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit 0 ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+ printf ("vax-dec-bsd\n"); exit (0);
+#else
+ printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
+rm -f $dummy.c $dummy
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit 0 ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit 0 ;;
+ c34*)
+ echo c34-convex-bsd
+ exit 0 ;;
+ c38*)
+ echo c38-convex-bsd
+ exit 0 ;;
+ c4*)
+ echo c4-convex-bsd
+ exit 0 ;;
+ esac
+fi
+
+#echo '(Unable to guess system type)' 1>&2
+
+exit 1
diff --git a/config.hin b/config.hin
index e18abfa..b591cec 100644
--- a/config.hin
+++ b/config.hin
@@ -31,6 +31,9 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef pid_t
+
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
@@ -47,37 +50,15 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define if there is a member named d_ino in the struct describing
- directory headers. */
-#undef D_INO_IN_DIRENT
-
-/* Define if you have a working <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define if memchr works. */
-#undef HAVE_MEMCHR
-
-/* Define if `struct utimbuf' is declared -- usually in <utime.h>. */
-#undef HAVE_STRUCT_UTIMBUF
-
-/* Define to rpl_malloc if the replacement function should be used. */
-#undef malloc
-
-/* Define to 1 if ANSI function prototypes are usable. */
-#undef PROTOTYPES
-
-/* Define to rpl_realloc if the replacement function should be used. */
-#undef realloc
-
-/* Define if you have the DONE_WORKING_MALLOC_CHECK function. */
-#undef HAVE_DONE_WORKING_MALLOC_CHECK
-
-/* Define if you have the DONE_WORKING_REALLOC_CHECK function. */
-#undef HAVE_DONE_WORKING_REALLOC_CHECK
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
/* Define if you have the _doprintf function. */
#undef HAVE__DOPRINTF
+/* Define if you have the fseeko function. */
+#undef HAVE_FSEEKO
+
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
@@ -102,6 +83,12 @@
/* Define if you have the rename function. */
#undef HAVE_RENAME
+/* Define if you have the rmdir function. */
+#undef HAVE_RMDIR
+
+/* Define if you have the setmode function. */
+#undef HAVE_SETMODE
+
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
@@ -143,3 +130,40 @@
/* Define if you have the <varargs.h> header file. */
#undef HAVE_VARARGS_H
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define to make fseeko etc. visible, on some hosts. */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define if compiler has function prototypes */
+#undef PROTOTYPES
+
+/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. */
+#undef HAVE_INTTYPES_H
+
+/* Define if struct utimbuf is declared -- usually in <utime.h>.
+ Some systems have utime.h but don't declare the struct anywhere. */
+#undef HAVE_STRUCT_UTIMBUF
+
+/* Define if the malloc check has been performed. */
+#undef HAVE_DONE_WORKING_MALLOC_CHECK
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define if the realloc check has been performed. */
+#undef HAVE_DONE_WORKING_REALLOC_CHECK
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define if there is a member named d_ino in the struct describing
+ directory headers. */
+#undef D_INO_IN_DIRENT
+
diff --git a/config.sub b/config.sub
new file mode 100644
index 0000000..ec508a5
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1220 @@
+#! /bin/sh
+# Configuration validation subroutine script, version 1.1.
+# Copyright (C) 1991, 92-97, 1998, 1999 Free Software Foundation, Inc.
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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.
+#
+# This program 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+if [ x$1 = x ]
+then
+ echo Configuration name missing. 1>&2
+ echo "Usage: $0 CPU-MFR-OPSYS" 1>&2
+ echo "or $0 ALIAS" 1>&2
+ echo where ALIAS is a recognized configuration type. 1>&2
+ exit 1
+fi
+
+# First pass through any local machine types.
+case $1 in
+ *local*)
+ echo $1
+ exit 0
+ ;;
+ *)
+ ;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ linux-gnu*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
+ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
+ | 580 | i960 | h8300 \
+ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
+ | alpha | alphaev[4-7] | alphaev56 | alphapca5[67] \
+ | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
+ | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
+ | mips64orion | mips64orionel | mipstx39 | mipstx39el \
+ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
+ | mips64vr5000 | miprs64vr5000el | mcore \
+ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
+ | thumb | d10v)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65)
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i[34567]86)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ # FIXME: clean up the formatting here.
+ vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
+ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
+ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
+ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
+ | xmp-* | ymp-* \
+ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* | hppa2.0n-* \
+ | alpha-* | alphaev[4-7]-* | alphaev56-* | alphapca5[67]-* \
+ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
+ | clipper-* | orion-* \
+ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
+ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
+ | mips64el-* | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
+ | mipstx39-* | mipstx39el-* | mcore-* \
+ | f301-* | armv*-* | t3e-* \
+ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
+ | thumb-* | v850-* | d30v-* | tic30-* | c30-* )
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-cbm
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-cbm
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-cbm
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ cray2)
+ basic_machine=cray2-cray
+ os=-unicos
+ ;;
+ [ctj]90-cray)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i[34567]86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i[34567]86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i[34567]86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i[34567]86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ i386-go32 | go32)
+ basic_machine=i386-unknown
+ os=-go32
+ ;;
+ i386-mingw32 | mingw32)
+ basic_machine=i386-unknown
+ os=-mingw32
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mipsel*-linux*)
+ basic_machine=mipsel-unknown
+ os=-linux-gnu
+ ;;
+ mips*-linux*)
+ basic_machine=mips-unknown
+ os=-linux-gnu
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ msdos)
+ basic_machine=i386-unknown
+ os=-msdos
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-corel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pentium | p5 | k5 | k6 | nexen)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexen-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=rs6000-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sparclite-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=t3e-cray
+ os=-unicos
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xmp)
+ basic_machine=xmp-cray
+ os=-unicos
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ mips)
+ if [ x$os = x-linux-gnu ]; then
+ basic_machine=mips-unknown
+ else
+ basic_machine=mips-mips
+ fi
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sparc | sparcv9)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ c4x*)
+ basic_machine=c4x-none
+ os=-coff
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+ | -macos* | -mpw* | -magic* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -*MiNT)
+ os=-mint
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-corel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f301-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -vxsim* | -vxworks*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -*MiNT)
+ vendor=atari
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
diff --git a/configure b/configure
index 18388cb..f1a5855 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12
+# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
@@ -11,6 +11,8 @@
ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
+ac_help="$ac_help
+ --disable-largefile omit support for large files"
# Initialize some variables set by options.
# The variables have the same names as the options, with
@@ -49,6 +51,7 @@ mandir='${prefix}/man'
# Initialize some other variables.
subdirs=
MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Maximum number of lines to put in a shell here document.
ac_max_here_lines=12
@@ -332,7 +335,7 @@ EOF
verbose=yes ;;
-version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.12"
+ echo "configure generated by autoconf version 2.13"
exit 0 ;;
-with-* | --with-*)
@@ -502,9 +505,11 @@ ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
+ac_exeext=
+ac_objext=o
if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
# Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -538,24 +543,71 @@ test "$program_suffix" != NONE &&
# sed with no file args requires a program.
test "$program_transform_name" = "" && program_transform_name="s,x,x,"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+ if test -f $ac_dir/install-sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f $ac_dir/install.sh; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+fi
+ac_config_guess=$ac_aux_dir/config.guess
+ac_config_sub=$ac_aux_dir/config.sub
+ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+
+
+# Make sure we can run config.sub.
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
+else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
+fi
+
+echo $ac_n "checking host system type""... $ac_c" 1>&6
+echo "configure:573: checking host system type" >&5
+
+host_alias=$host
+case "$host_alias" in
+NONE)
+ case $nonopt in
+ NONE)
+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
+ else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
+ fi ;;
+ *) host_alias=$nonopt ;;
+ esac ;;
+esac
+
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
+host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$host" 1>&6
+
PACKAGE=patch
-VERSION=2.5.3
+VERSION=2.5.4
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:551: checking for $ac_word" >&5
+echo "configure:602: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_prog_CC="gcc"
@@ -576,16 +628,17 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:580: checking for $ac_word" >&5
+echo "configure:632: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
ac_prog_rejected=no
- for ac_dir in $PATH; do
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -620,25 +673,61 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test -z "$CC"; then
+ case "`uname -s`" in
+ *win32* | *WIN32*)
+ # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:683: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_CC="cl"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+ echo "$ac_t""$CC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+ ;;
+ esac
+ fi
test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:628: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:715: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CPP $CPPFLAGS'
ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cc_cross
-cat > conftest.$ac_ext <<EOF
-#line 638 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 726 "configure"
#include "confdefs.h"
+
main(){return(0);}
EOF
-if { (eval echo configure:642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -652,18 +741,24 @@ else
ac_cv_prog_cc_works=no
fi
rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:662: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:757: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:667: checking whether we are using GNU C" >&5
+echo "configure:762: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -672,7 +767,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:771: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -683,11 +778,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
if test $ac_cv_prog_gcc = yes; then
GCC=yes
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:691: checking whether ${CC-cc} accepts -g" >&5
+else
+ GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:790: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -702,20 +801,24 @@ rm -f conftest*
fi
echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
CFLAGS="-g -O2"
else
- CFLAGS="-O2"
+ CFLAGS="-g"
fi
else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:719: checking how to run the C preprocessor" >&5
+echo "configure:822: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -730,14 +833,14 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 734 "configure"
+#line 837 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:740: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -747,14 +850,31 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 751 "configure"
+#line 854 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 871 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:877: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
else
@@ -767,6 +887,8 @@ fi
rm -f conftest*
fi
rm -f conftest*
+fi
+rm -f conftest*
ac_cv_prog_CPP="$CPP"
fi
CPP="$ac_cv_prog_CPP"
@@ -775,25 +897,6 @@ else
fi
echo "$ac_t""$CPP" 1>&6
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f $ac_dir/install.sh; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -801,28 +904,30 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:809: checking for a BSD compatible install" >&5
+echo "configure:913: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
- for ac_prog in ginstall installbsd scoinst install; do
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
- # OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -852,10 +957,12 @@ echo "$ac_t""$INSTALL" 1>&6
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:859: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:966: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -886,7 +993,7 @@ fi
# Extract the first word of "ed", so it can be a program name with args.
set dummy ed; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:890: checking for $ac_word" >&5
+echo "configure:997: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_ed_PROGRAM'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -894,9 +1001,13 @@ else
/*)
ac_cv_path_ed_PROGRAM="$ed_PROGRAM" # Let the user override the test with a path.
;;
+ ?:/*)
+ ac_cv_path_ed_PROGRAM="$ed_PROGRAM" # Let the user override the test with a dos path.
+ ;;
*)
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
- for ac_dir in $PATH; do
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/$ac_word; then
ac_cv_path_ed_PROGRAM="$ac_dir/$ac_word"
@@ -916,43 +1027,269 @@ else
fi
-# If available, prefer support for large files unless the user specified
-# one of the CPPFLAGS, LDFLAGS, or LIBS variables.
-echo $ac_n "checking whether large file support needs explicit enabling""... $ac_c" 1>&6
-echo "configure:923: checking whether large file support needs explicit enabling" >&5
-ac_getconfs=''
-ac_result=yes
-ac_set=''
-ac_shellvars='CPPFLAGS LDFLAGS LIBS'
-for ac_shellvar in $ac_shellvars; do
- case $ac_shellvar in
- CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
- *) ac_lfsvar=LFS_$ac_shellvar ;;
- esac
- eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
- (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
- ac_getconf=`getconf $ac_lfsvar`
- ac_getconfs=$ac_getconfs$ac_getconf
- eval ac_test_$ac_shellvar=\$ac_getconf
-done
-case "$ac_result$ac_getconfs" in
-yes) ac_result=no ;;
-esac
-case "$ac_result$ac_set" in
-yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
-esac
-echo "$ac_t""$ac_result" 1>&6
-case $ac_result in
-yes)
- for ac_shellvar in $ac_shellvars; do
- eval $ac_shellvar=\$ac_test_$ac_shellvar
- done ;;
+echo $ac_n "checking build system type""... $ac_c" 1>&6
+echo "configure:1032: checking build system type" >&5
+
+build_alias=$build
+case "$build_alias" in
+NONE)
+ case $nonopt in
+ NONE) build_alias=$host_alias ;;
+ *) build_alias=$nonopt ;;
+ esac ;;
esac
+build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias`
+build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+echo "$ac_t""$build" 1>&6
+
+if test $host != $build; then
+ ac_tool_prefix=${host_alias}-
+else
+ ac_tool_prefix=
+fi
+
+
+ # Check whether --enable-largefile or --disable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval="$enable_largefile"
+ :
+fi
+
+ if test "$enable_largefile" != no; then
+ # Extract the first word of "${ac_tool_prefix}getconf", so it can be a program name with args.
+set dummy ${ac_tool_prefix}getconf; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1066: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_GETCONF'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$GETCONF"; then
+ ac_cv_prog_GETCONF="$GETCONF" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_GETCONF="${ac_tool_prefix}getconf"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_GETCONF" && ac_cv_prog_GETCONF="getconf"
+fi
+fi
+GETCONF="$ac_cv_prog_GETCONF"
+if test -n "$GETCONF"; then
+ echo "$ac_t""$GETCONF" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+
+
+ echo $ac_n "checking for CFLAGS value to request large file support""... $ac_c" 1>&6
+echo "configure:1096: checking for CFLAGS value to request large file support" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_largefile_CFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_largefile_CFLAGS=`($GETCONF LFS_CFLAGS) 2>/dev/null` || {
+ ac_cv_sys_largefile_CFLAGS=no
+ case "$host_os" in
+ # IRIX 6.2 and later require cc -n32.
+ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+ if test "$GCC" != yes; then
+ ac_cv_sys_largefile_CFLAGS=-n32
+ fi
+ ac_save_CC="$CC"
+ CC="$CC $ac_cv_sys_largefile_CFLAGS"
+ cat > conftest.$ac_ext <<EOF
+#line 1111 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ :
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_sys_largefile_CFLAGS=no
+fi
+rm -f conftest*
+ CC="$ac_save_CC"
+ esac
+ }
+fi
+
+echo "$ac_t""$ac_cv_sys_largefile_CFLAGS" 1>&6
+ echo $ac_n "checking for LDFLAGS value to request large file support""... $ac_c" 1>&6
+echo "configure:1134: checking for LDFLAGS value to request large file support" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_largefile_LDFLAGS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_largefile_LDFLAGS=`($GETCONF LFS_LDFLAGS) 2>/dev/null` || {
+ ac_cv_sys_largefile_LDFLAGS=no
+
+ }
+fi
+
+echo "$ac_t""$ac_cv_sys_largefile_LDFLAGS" 1>&6
+ echo $ac_n "checking for LIBS value to request large file support""... $ac_c" 1>&6
+echo "configure:1146: checking for LIBS value to request large file support" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_largefile_LIBS'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_largefile_LIBS=`($GETCONF LFS_LIBS) 2>/dev/null` || {
+ ac_cv_sys_largefile_LIBS=no
+
+ }
+fi
+
+echo "$ac_t""$ac_cv_sys_largefile_LIBS" 1>&6
+
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ no) ;;
+ -D_FILE_OFFSET_BITS=*) ;;
+ -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+ -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+ -D?* | -I?*)
+ case "$ac_flag" in
+ no) ;;
+ ?*)
+ case "$CPPFLAGS" in
+ '') CPPFLAGS="$ac_flag" ;;
+ *) CPPFLAGS=$CPPFLAGS' '"$ac_flag" ;;
+ esac ;;
+ esac ;;
+ *)
+ case "$ac_flag" in
+ no) ;;
+ ?*)
+ case "$CFLAGS" in
+ '') CFLAGS="$ac_flag" ;;
+ *) CFLAGS=$CFLAGS' '"$ac_flag" ;;
+ esac ;;
+ esac ;;
+ esac
+ done
+ case "$ac_cv_sys_largefile_LDFLAGS" in
+ no) ;;
+ ?*)
+ case "$LDFLAGS" in
+ '') LDFLAGS="$ac_cv_sys_largefile_LDFLAGS" ;;
+ *) LDFLAGS=$LDFLAGS' '"$ac_cv_sys_largefile_LDFLAGS" ;;
+ esac ;;
+ esac
+ case "$ac_cv_sys_largefile_LIBS" in
+ no) ;;
+ ?*)
+ case "$LIBS" in
+ '') LIBS="$ac_cv_sys_largefile_LIBS" ;;
+ *) LIBS=$LIBS' '"$ac_cv_sys_largefile_LIBS" ;;
+ esac ;;
+ esac
+ echo $ac_n "checking for _FILE_OFFSET_BITS""... $ac_c" 1>&6
+echo "configure:1201: checking for _FILE_OFFSET_BITS" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_file_offset_bits=no
+ case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_file_offset_bits=64 ;;
+ esac
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ -D_FILE_OFFSET_BITS)
+ ac_cv_sys_file_offset_bits=1 ;;
+ -D_FILE_OFFSET_BITS=*)
+ ac_cv_sys_file_offset_bits=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$ac_cv_sys_file_offset_bits" 1>&6
+ if test "$ac_cv_sys_file_offset_bits" != no; then
+ cat >> confdefs.h <<EOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+EOF
+
+ fi
+ echo $ac_n "checking for _LARGEFILE_SOURCE""... $ac_c" 1>&6
+echo "configure:1230: checking for _LARGEFILE_SOURCE" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_largefile_source'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_largefile_source=no
+ case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_largefile_source=1 ;;
+ esac
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ -D_LARGEFILE_SOURCE)
+ ac_cv_sys_largefile_source=1 ;;
+ -D_LARGEFILE_SOURCE=*)
+ ac_cv_sys_largefile_source=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$ac_cv_sys_largefile_source" 1>&6
+ if test "$ac_cv_sys_largefile_source" != no; then
+ cat >> confdefs.h <<EOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+EOF
+
+ fi
+ echo $ac_n "checking for _LARGE_FILES""... $ac_c" 1>&6
+echo "configure:1259: checking for _LARGE_FILES" >&5
+if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_cv_sys_large_files=no
+ case "$host_os" in
+ # AIX 4.2 and later
+ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+ ac_cv_sys_large_files=1 ;;
+ esac
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ -D_LARGE_FILES)
+ ac_cv_sys_large_files=1 ;;
+ -D_LARGE_FILES=*)
+ ac_cv_sys_large_files=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+
+fi
+
+echo "$ac_t""$ac_cv_sys_large_files" 1>&6
+ if test "$ac_cv_sys_large_files" != no; then
+ cat >> confdefs.h <<EOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+EOF
+
+ fi
+ fi
+
+
echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:954: checking for AIX" >&5
+echo "configure:1291: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
-#line 956 "configure"
+#line 1293 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
@@ -975,18 +1312,18 @@ rm -f conftest*
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:979: checking for minix/config.h" >&5
+echo "configure:1316: checking for minix/config.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 984 "configure"
+#line 1321 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1326: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1023,7 +1360,7 @@ EOF
fi
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1027: checking for POSIXized ISC" >&5
+echo "configure:1364: checking for POSIXized ISC" >&5
if test -d /etc/conf/kconfig.d &&
grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
then
@@ -1043,12 +1380,107 @@ else
ISC=
fi
+echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6
+echo "configure:1385: checking for Cygwin environment" >&5
+if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1390 "configure"
+#include "confdefs.h"
+
+int main() {
+
+#ifndef __CYGWIN__
+#define __CYGWIN__ __CYGWIN32__
+#endif
+return __CYGWIN__;
+; return 0; }
+EOF
+if { (eval echo configure:1401: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_cygwin=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_cygwin=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_cygwin" 1>&6
+CYGWIN=
+test "$ac_cv_cygwin" = yes && CYGWIN=yes
+echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
+echo "configure:1418: checking for mingw32 environment" >&5
+if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1423 "configure"
+#include "confdefs.h"
+
+int main() {
+return __MINGW32__;
+; return 0; }
+EOF
+if { (eval echo configure:1430: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_mingw32=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_mingw32=no
+fi
+rm -f conftest*
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_mingw32" 1>&6
+MINGW32=
+test "$ac_cv_mingw32" = yes && MINGW32=yes
+
+
+echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
+echo "configure:1449: checking for executable suffix" >&5
+if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$CYGWIN" = yes || test "$MINGW32" = yes; then
+ ac_cv_exeext=.exe
+else
+ rm -f conftest*
+ echo 'int main () { return 0; }' > conftest.$ac_ext
+ ac_cv_exeext=
+ if { (eval echo configure:1459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ for file in conftest.*; do
+ case $file in
+ *.c | *.o | *.obj) ;;
+ *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;;
+ esac
+ done
+ else
+ { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; }
+ fi
+ rm -f conftest*
+ test x"${ac_cv_exeext}" = x && ac_cv_exeext=no
+fi
+fi
+
+EXEEXT=""
+test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext}
+echo "$ac_t""${ac_cv_exeext}" 1>&6
+ac_exeext=$EXEEXT
+
echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
-echo "configure:1052: checking for ${CC-cc} option to accept ANSI C" >&5
+echo "configure:1484: checking for ${CC-cc} option to accept ANSI C" >&5
if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1060,11 +1492,11 @@ ac_save_CC="$CC"
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
cat > conftest.$ac_ext <<EOF
-#line 1068 "configure"
+#line 1500 "configure"
#include "confdefs.h"
#include <stdarg.h>
#include <stdio.h>
@@ -1101,7 +1533,7 @@ return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
; return 0; }
EOF
-if { (eval echo configure:1105: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
am_cv_prog_cc_stdc="$ac_arg"; break
else
@@ -1125,8 +1557,9 @@ case "x$am_cv_prog_cc_stdc" in
esac
+
echo $ac_n "checking for function prototypes""... $ac_c" 1>&6
-echo "configure:1130: checking for function prototypes" >&5
+echo "configure:1563: checking for function prototypes" >&5
if test "$am_cv_prog_cc_stdc" != no; then
echo "$ac_t""yes" 1>&6
cat >> confdefs.h <<\EOF
@@ -1139,12 +1572,12 @@ else
U=_ ANSI2KNR=./ansi2knr
# Ensure some checks needed by ansi2knr itself.
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1143: checking for ANSI C header files" >&5
+echo "configure:1576: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1148 "configure"
+#line 1581 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1152,8 +1585,8 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1156: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1589: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_header_stdc=yes
@@ -1169,7 +1602,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1173 "configure"
+#line 1606 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1187,7 +1620,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1191 "configure"
+#line 1624 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1208,7 +1641,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1212 "configure"
+#line 1645 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1219,7 +1652,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1223: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1246,18 +1679,18 @@ fi
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1250: checking for $ac_hdr" >&5
+echo "configure:1683: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1255 "configure"
+#line 1688 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1693: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1285,12 +1718,12 @@ done
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1289: checking for working const" >&5
+echo "configure:1722: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1294 "configure"
+#line 1727 "configure"
#include "confdefs.h"
int main() {
@@ -1339,7 +1772,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:1343: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -1365,12 +1798,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1369: checking for $ac_hdr that defines DIR" >&5
+echo "configure:1802: checking for $ac_hdr that defines DIR" >&5
if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1374 "configure"
+#line 1807 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
@@ -1378,7 +1811,7 @@ int main() {
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:1382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1815: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
@@ -1403,7 +1836,7 @@ done
# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
if test $ac_header_dirent = dirent.h; then
echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1407: checking for opendir in -ldir" >&5
+echo "configure:1840: checking for opendir in -ldir" >&5
ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1411,7 +1844,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1415 "configure"
+#line 1848 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1422,7 +1855,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1444,7 +1877,7 @@ fi
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1448: checking for opendir in -lx" >&5
+echo "configure:1881: checking for opendir in -lx" >&5
ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1452,7 +1885,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1456 "configure"
+#line 1889 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1463,7 +1896,7 @@ int main() {
opendir()
; return 0; }
EOF
-if { (eval echo configure:1467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1486,12 +1919,12 @@ fi
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1490: checking for ANSI C header files" >&5
+echo "configure:1923: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1495 "configure"
+#line 1928 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1499,8 +1932,8 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
ac_cv_header_stdc=yes
@@ -1516,7 +1949,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1520 "configure"
+#line 1953 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1534,7 +1967,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1538 "configure"
+#line 1971 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1555,7 +1988,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1559 "configure"
+#line 1992 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1566,7 +1999,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1593,18 +2026,18 @@ for ac_hdr in fcntl.h limits.h string.h unistd.h utime.h varargs.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1597: checking for $ac_hdr" >&5
+echo "configure:2030: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1602 "configure"
+#line 2035 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1607: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:2040: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
@@ -1629,50 +2062,49 @@ else
fi
done
-
-# Use <inttypes.h> only if it exists,
-# doesn't clash with <sys/types.h>, and declares intmax_t.
-echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6
-echo "configure:1637: checking for inttypes.h" >&5
-if eval "test \"`echo '$''{'patch_cv_header_inttypes_h'+set}'`\" = set"; then
+
+ echo $ac_n "checking for inttypes.h""... $ac_c" 1>&6
+echo "configure:2068: checking for inttypes.h" >&5
+if eval "test \"`echo '$''{'jm_ac_cv_header_inttypes_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1642 "configure"
+#line 2073 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <inttypes.h>
int main() {
-intmax_t i = -1;
+uintmax_t i = (uintmax_t) -1;
; return 0; }
EOF
-if { (eval echo configure:1650: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- patch_cv_header_inttypes_h=yes
+ jm_ac_cv_header_inttypes_h=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- patch_cv_header_inttypes_h=no
+ jm_ac_cv_header_inttypes_h=no
fi
rm -f conftest*
fi
-echo "$ac_t""$patch_cv_header_inttypes_h" 1>&6
-if test $patch_cv_header_inttypes_h = yes; then
- cat >> confdefs.h <<\EOF
+echo "$ac_t""$jm_ac_cv_header_inttypes_h" 1>&6
+ if test $jm_ac_cv_header_inttypes_h = yes; then
+ cat >> confdefs.h <<EOF
#define HAVE_INTTYPES_H 1
EOF
-fi
+ fi
+
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1671: checking for mode_t" >&5
+echo "configure:2103: checking for mode_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1676 "configure"
+#line 2108 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1681,7 +2113,7 @@ else
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_mode_t=yes
else
@@ -1700,12 +2132,12 @@ EOF
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1704: checking for off_t" >&5
+echo "configure:2136: checking for off_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1709 "configure"
+#line 2141 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1714,7 +2146,7 @@ else
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_off_t=yes
else
@@ -1732,13 +2164,46 @@ EOF
fi
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:2169: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 2174 "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_type_pid_t=yes
+else
+ rm -rf conftest*
+ ac_cv_type_pid_t=no
+fi
+rm -f conftest*
+
+fi
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+ cat >> confdefs.h <<\EOF
+#define pid_t int
+EOF
+
+fi
+
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1737: checking return type of signal handlers" >&5
+echo "configure:2202: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1742 "configure"
+#line 2207 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -1755,7 +2220,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:1759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -1774,12 +2239,12 @@ EOF
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1778: checking for size_t" >&5
+echo "configure:2243: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1783 "configure"
+#line 2248 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -1788,7 +2253,7 @@ else
#endif
EOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
rm -rf conftest*
ac_cv_type_size_t=yes
else
@@ -1806,194 +2271,193 @@ EOF
fi
-
-echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
-echo "configure:1812: checking for struct utimbuf" >&5
-if eval "test \"`echo '$''{'patch_cv_sys_struct_utimbuf'+set}'`\" = set"; then
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:2276: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1817 "configure"
+#line 2281 "configure"
#include "confdefs.h"
#include <sys/types.h>
-#if HAVE_UTIME_H
-#include <utime.h>
-#endif
+#include <sys/time.h>
+#include <time.h>
int main() {
-static struct utimbuf x; x.actime = x.modtime;
+struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1827: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- patch_cv_sys_struct_utimbuf=yes
+ ac_cv_header_time=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- patch_cv_sys_struct_utimbuf=no
+ ac_cv_header_time=no
fi
rm -f conftest*
fi
-echo "$ac_t""$patch_cv_sys_struct_utimbuf" 1>&6
-if test $patch_cv_sys_struct_utimbuf = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_STRUCT_UTIMBUF 1
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+ cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
EOF
fi
-# Check for NetBSD 1.0 bug, where memchr(..., 0) returns nonzero.
-echo $ac_n "checking for working memchr""... $ac_c" 1>&6
-echo "configure:1849: checking for working memchr" >&5
-if eval "test \"`echo '$''{'ac_cv_func_memchr'+set}'`\" = set"; then
+
+ for ac_hdr in utime.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2315: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
- if test "$cross_compiling" = yes; then
- echo "configure: warning: We are cross-compiling so we assume memchr does not work." 1>&2
- ac_cv_func_memchr=no
-else
cat > conftest.$ac_ext <<EOF
-#line 1858 "configure"
+#line 2320 "configure"
#include "confdefs.h"
-#include <string.h>
-main () { exit (memchr ("", 0, 0) != 0 || memchr ("", 1, 0) != 0); }
+#include <$ac_hdr>
EOF
-if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
- ac_cv_func_memchr=yes
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2325: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
else
+ echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
- rm -fr conftest*
- ac_cv_func_memchr=no
-fi
-rm -fr conftest*
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
fi
-
+rm -f conftest*
fi
-echo "$ac_t""$ac_cv_func_memchr" 1>&6
-if test $ac_cv_func_memchr = yes; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MEMCHR 1
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
EOF
-
+
+else
+ echo "$ac_t""no" 1>&6
fi
+done
-echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
-echo "configure:1885: checking for getopt_long" >&5
-if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
+
+ echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
+echo "configure:2353: checking for struct utimbuf" >&5
+if eval "test \"`echo '$''{'fu_cv_sys_struct_utimbuf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1890 "configure"
+#line 2358 "configure"
#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char getopt_long(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char getopt_long();
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
-choke me
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
#else
-getopt_long();
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
#endif
-
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+
+int main() {
+static struct utimbuf x; x.actime = x.modtime;
; return 0; }
EOF
-if { (eval echo configure:1913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2379: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
- eval "ac_cv_func_getopt_long=yes"
+ fu_cv_sys_struct_utimbuf=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func_getopt_long=no"
+ fu_cv_sys_struct_utimbuf=no
fi
rm -f conftest*
+
fi
-if eval "test \"`echo '$ac_cv_func_'getopt_long`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS getopt1.o getopt.o"
-fi
+echo "$ac_t""$fu_cv_sys_struct_utimbuf" 1>&6
+ if test $fu_cv_sys_struct_utimbuf = yes; then
+ cat >> confdefs.h <<EOF
+#define HAVE_STRUCT_UTIMBUF 1
+EOF
-for ac_func in _doprintf isascii memcmp mkdir mktemp pathconf raise sigaction sigprocmask sigsetmask strerror
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1937: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ fi
+
+
+echo $ac_n "checking for getopt_long""... $ac_c" 1>&6
+echo "configure:2403: checking for getopt_long" >&5
+if eval "test \"`echo '$''{'ac_cv_func_getopt_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1942 "configure"
+#line 2408 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
+ which can conflict with char getopt_long(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
-char $ac_func();
+char getopt_long();
int main() {
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined (__stub_getopt_long) || defined (__stub___getopt_long)
choke me
#else
-$ac_func();
+getopt_long();
#endif
; return 0; }
EOF
-if { (eval echo configure:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
+ eval "ac_cv_func_getopt_long=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
+ eval "ac_cv_func_getopt_long=no"
fi
rm -f conftest*
fi
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_func_'getopt_long`\" = yes"; then
echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
+ :
else
echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS getopt1\$U.o getopt\$U.o"
fi
-done
-for ac_func in memchr rename
+
+for ac_func in _doprintf isascii fseeko memcmp mktemp \
+ pathconf raise setmode sigaction sigprocmask sigsetmask strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1992: checking for $ac_func" >&5
+echo "configure:2456: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1997 "configure"
+#line 2461 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2016,7 +2480,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2484: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2037,22 +2501,18 @@ EOF
else
echo "$ac_t""no" 1>&6
-LIBOBJS="$LIBOBJS ${ac_func}.o"
fi
done
-
-
- if test x = y; then
- for ac_func in DONE_WORKING_MALLOC_CHECK
+for ac_func in memchr mkdir rename rmdir
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2051: checking for $ac_func" >&5
+echo "configure:2511: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2056 "configure"
+#line 2516 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2075,7 +2535,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -2096,18 +2556,19 @@ EOF
else
echo "$ac_t""no" 1>&6
+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
fi
done
- fi
- ac_kludge=HAVE_DONE_WORKING_MALLOC_CHECK
- cat >> confdefs.h <<EOF
-#define $ac_kludge 1
+
+
+ cat >> confdefs.h <<EOF
+#define HAVE_DONE_WORKING_MALLOC_CHECK 1
EOF
echo $ac_n "checking for working malloc""... $ac_c" 1>&6
-echo "configure:2111: checking for working malloc" >&5
+echo "configure:2572: checking for working malloc" >&5
if eval "test \"`echo '$''{'jm_cv_func_working_malloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2115,7 +2576,7 @@ else
jm_cv_func_working_malloc=no
else
cat > conftest.$ac_ext <<EOF
-#line 2119 "configure"
+#line 2580 "configure"
#include "confdefs.h"
char *malloc ();
@@ -2126,7 +2587,7 @@ else
}
EOF
-if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
jm_cv_func_working_malloc=yes
else
@@ -2143,7 +2604,8 @@ fi
echo "$ac_t""$jm_cv_func_working_malloc" 1>&6
if test $jm_cv_func_working_malloc = no; then
- LIBOBJS="$LIBOBJS malloc.o"
+
+ LIBOBJS="$LIBOBJS malloc.$ac_objext"
cat >> confdefs.h <<EOF
#define malloc rpl_malloc
EOF
@@ -2151,71 +2613,13 @@ EOF
fi
- if test x = y; then
- for ac_func in DONE_WORKING_REALLOC_CHECK
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2159: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <<EOF
-#line 2164 "configure"
-#include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error. */
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char $ac_func();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2187: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-
-else
- echo "$ac_t""no" 1>&6
-fi
-done
-
- fi
- ac_kludge=HAVE_DONE_WORKING_REALLOC_CHECK
- cat >> confdefs.h <<EOF
-#define $ac_kludge 1
+ cat >> confdefs.h <<EOF
+#define HAVE_DONE_WORKING_REALLOC_CHECK 1
EOF
echo $ac_n "checking for working realloc""... $ac_c" 1>&6
-echo "configure:2219: checking for working realloc" >&5
+echo "configure:2623: checking for working realloc" >&5
if eval "test \"`echo '$''{'jm_cv_func_working_realloc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2223,7 +2627,7 @@ else
jm_cv_func_working_realloc=no
else
cat > conftest.$ac_ext <<EOF
-#line 2227 "configure"
+#line 2631 "configure"
#include "confdefs.h"
char *realloc ();
@@ -2234,7 +2638,7 @@ else
}
EOF
-if { (eval echo configure:2238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2642: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
jm_cv_func_working_realloc=yes
else
@@ -2251,7 +2655,8 @@ fi
echo "$ac_t""$jm_cv_func_working_realloc" 1>&6
if test $jm_cv_func_working_realloc = no; then
- LIBOBJS="$LIBOBJS realloc.o"
+
+ LIBOBJS="$LIBOBJS realloc.$ac_objext"
cat >> confdefs.h <<EOF
#define realloc rpl_realloc
EOF
@@ -2259,7 +2664,7 @@ EOF
fi
echo $ac_n "checking whether closedir returns void""... $ac_c" 1>&6
-echo "configure:2263: checking whether closedir returns void" >&5
+echo "configure:2668: checking whether closedir returns void" >&5
if eval "test \"`echo '$''{'ac_cv_func_closedir_void'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2267,13 +2672,13 @@ else
ac_cv_func_closedir_void=yes
else
cat > conftest.$ac_ext <<EOF
-#line 2271 "configure"
+#line 2676 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_header_dirent>
int closedir(); main() { exit(closedir(opendir(".")) != 0); }
EOF
-if { (eval echo configure:2277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2682: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_closedir_void=no
else
@@ -2296,12 +2701,12 @@ EOF
fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2300: checking for vprintf" >&5
+echo "configure:2705: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2305 "configure"
+#line 2710 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
@@ -2324,7 +2729,7 @@ vprintf();
; return 0; }
EOF
-if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
@@ -2348,12 +2753,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2352: checking for _doprnt" >&5
+echo "configure:2757: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2357 "configure"
+#line 2762 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
@@ -2376,7 +2781,7 @@ _doprnt();
; return 0; }
EOF
-if { (eval echo configure:2380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2785: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
@@ -2402,7 +2807,7 @@ fi
echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:2406: checking for long file names" >&5
+echo "configure:2811: checking for long file names" >&5
if eval "test \"`echo '$''{'ac_cv_sys_long_file_names'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2445,55 +2850,58 @@ EOF
fi
-
-echo $ac_n "checking for d_ino member in directory struct""... $ac_c" 1>&6
-echo "configure:2451: checking for d_ino member in directory struct" >&5
-if eval "test \"`echo '$''{'patch_cv_sys_d_ino_in_dirent'+set}'`\" = set"; then
+ echo $ac_n "checking for d_ino member in directory struct""... $ac_c" 1>&6
+echo "configure:2855: checking for d_ino member in directory struct" >&5
+if eval "test \"`echo '$''{'jm_cv_struct_dirent_d_ino'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2456 "configure"
+#line 2860 "configure"
#include "confdefs.h"
-
+
#include <sys/types.h>
-#if HAVE_DIRENT_H
+#ifdef HAVE_DIRENT_H
# include <dirent.h>
-#else
+#else /* not HAVE_DIRENT_H */
# define dirent direct
-# if HAVE_SYS_NDIR_H
+# ifdef HAVE_SYS_NDIR_H
# include <sys/ndir.h>
-# endif
+# endif /* HAVE_SYS_NDIR_H */
# ifdef HAVE_SYS_DIR_H
# include <sys/dir.h>
-# endif
+# endif /* HAVE_SYS_DIR_H */
# ifdef HAVE_NDIR_H
# include <ndir.h>
-# endif
-#endif
-
+# endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
+
int main() {
struct dirent dp; dp.d_ino = 0;
; return 0; }
EOF
-if { (eval echo configure:2479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
- patch_cv_sys_d_ino_in_dirent=yes
+ jm_cv_struct_dirent_d_ino=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- patch_cv_sys_d_ino_in_dirent=no
+ jm_cv_struct_dirent_d_ino=no
fi
rm -f conftest*
+
+
fi
-echo "$ac_t""$patch_cv_sys_d_ino_in_dirent" 1>&6
-if test $patch_cv_sys_d_ino_in_dirent = yes; then
- cat >> confdefs.h <<\EOF
+echo "$ac_t""$jm_cv_struct_dirent_d_ino" 1>&6
+ if test $jm_cv_struct_dirent_d_ino = yes; then
+ cat >> confdefs.h <<\EOF
#define D_INO_IN_DIRENT 1
EOF
-fi
+ fi
+
+
trap '' 1 2 15
cat > confcache <<\EOF
@@ -2585,7 +2993,7 @@ do
echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.12"
+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
exit 0 ;;
-help | --help | --hel | --he | --h)
echo "\$ac_cs_usage"; exit 0 ;;
@@ -2605,9 +3013,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
$ac_vpsub
$extrasub
+s%@SHELL@%$SHELL%g
s%@CFLAGS@%$CFLAGS%g
s%@CPPFLAGS@%$CPPFLAGS%g
s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
s%@DEFS@%$DEFS%g
s%@LDFLAGS@%$LDFLAGS%g
s%@LIBS@%$LIBS%g
@@ -2626,14 +3036,27 @@ s%@includedir@%$includedir%g
s%@oldincludedir@%$oldincludedir%g
s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
+s%@host@%$host%g
+s%@host_alias@%$host_alias%g
+s%@host_cpu@%$host_cpu%g
+s%@host_vendor@%$host_vendor%g
+s%@host_os@%$host_os%g
s%@PACKAGE@%$PACKAGE%g
s%@VERSION@%$VERSION%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@SET_MAKE@%$SET_MAKE%g
s%@ed_PROGRAM@%$ed_PROGRAM%g
+s%@build@%$build%g
+s%@build_alias@%$build_alias%g
+s%@build_cpu@%$build_cpu%g
+s%@build_vendor@%$build_vendor%g
+s%@build_os@%$build_os%g
+s%@GETCONF@%$GETCONF%g
+s%@EXEEXT@%$EXEEXT%g
s%@U@%$U%g
s%@ANSI2KNR@%$ANSI2KNR%g
s%@LIBOBJS@%$LIBOBJS%g
diff --git a/configure.in b/configure.in
index ef5b09b..b07b76a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,14 +1,15 @@
# Configure `patch'.
-# Copyright 1993, 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1993, 1997-1998, 1999 Free Software Foundation, Inc.
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.12)
AC_INIT(patch.c)
AC_CONFIG_HEADER(config.h:config.hin)
AC_ARG_PROGRAM
+AC_CANONICAL_HOST
PACKAGE=patch
-VERSION=2.5.3
+VERSION=2.5.4
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
@@ -20,41 +21,12 @@ AC_PROG_MAKE_SET
# because <errno.h> reserves symbols starting with `E'.
AC_PATH_PROG(ed_PROGRAM, ed, ed)
-# If available, prefer support for large files unless the user specified
-# one of the CPPFLAGS, LDFLAGS, or LIBS variables.
-AC_MSG_CHECKING(whether large file support needs explicit enabling)
-ac_getconfs=''
-ac_result=yes
-ac_set=''
-ac_shellvars='CPPFLAGS LDFLAGS LIBS'
-for ac_shellvar in $ac_shellvars; do
- case $ac_shellvar in
- CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
- *) ac_lfsvar=LFS_$ac_shellvar ;;
- esac
- eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
- (getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
- ac_getconf=`getconf $ac_lfsvar`
- ac_getconfs=$ac_getconfs$ac_getconf
- eval ac_test_$ac_shellvar=\$ac_getconf
-done
-case "$ac_result$ac_getconfs" in
-yes) ac_result=no ;;
-esac
-case "$ac_result$ac_set" in
-yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
-esac
-AC_MSG_RESULT($ac_result)
-case $ac_result in
-yes)
- for ac_shellvar in $ac_shellvars; do
- eval $ac_shellvar=\$ac_test_$ac_shellvar
- done ;;
-esac
+AC_SYS_LARGEFILE
AC_AIX
AC_MINIX
AC_ISC_POSIX
+AC_EXEEXT
AM_C_PROTOTYPES
AC_C_CONST
@@ -62,91 +34,26 @@ AC_C_CONST
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h limits.h string.h unistd.h utime.h varargs.h)
-
-# Use <inttypes.h> only if it exists,
-# doesn't clash with <sys/types.h>, and declares intmax_t.
-AC_MSG_CHECKING(for inttypes.h)
-AC_CACHE_VAL(patch_cv_header_inttypes_h,
-[AC_TRY_COMPILE(
- [#include <sys/types.h>
-#include <inttypes.h>],
- [intmax_t i = -1;],
- patch_cv_header_inttypes_h=yes,
- patch_cv_header_inttypes_h=no)])
-AC_MSG_RESULT($patch_cv_header_inttypes_h)
-if test $patch_cv_header_inttypes_h = yes; then
- AC_DEFINE(HAVE_INTTYPES_H)
-fi
+jm_AC_HEADER_INTTYPES_H
AC_TYPE_MODE_T
AC_TYPE_OFF_T
+AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
+jm_STRUCT_UTIMBUF
-dnl Some systems have utime.h but don't declare the struct anywhere.
-AC_MSG_CHECKING(for struct utimbuf)
-AC_CACHE_VAL(patch_cv_sys_struct_utimbuf,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#if HAVE_UTIME_H
-#include <utime.h>
-#endif], [static struct utimbuf x; x.actime = x.modtime;],
- patch_cv_sys_struct_utimbuf=yes,
- patch_cv_sys_struct_utimbuf=no)])
-AC_MSG_RESULT($patch_cv_sys_struct_utimbuf)
-if test $patch_cv_sys_struct_utimbuf = yes; then
- AC_DEFINE(HAVE_STRUCT_UTIMBUF)
-fi
-
-# Check for NetBSD 1.0 bug, where memchr(..., 0) returns nonzero.
-AC_MSG_CHECKING(for working memchr)
-AC_CACHE_VAL(ac_cv_func_memchr,
-[AC_TRY_RUN([#include <string.h>
-main () { exit (memchr ("", 0, 0) != 0 || memchr ("", 1, 0) != 0); }],
- ac_cv_func_memchr=yes,
- ac_cv_func_memchr=no,
- AC_MSG_WARN([We are cross-compiling so we assume memchr does not work.])
- ac_cv_func_memchr=no)])dnl
-AC_MSG_RESULT($ac_cv_func_memchr)
-if test $ac_cv_func_memchr = yes; then
- AC_DEFINE(HAVE_MEMCHR)
-fi
-
-AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1.o getopt.o"])
+AC_CHECK_FUNC(getopt_long, , [LIBOBJS="$LIBOBJS getopt1\$U.o getopt\$U.o"])
AC_SUBST(LIBOBJS)
-AC_CHECK_FUNCS(_doprintf isascii memcmp mkdir mktemp pathconf raise sigaction sigprocmask sigsetmask strerror)
-AC_REPLACE_FUNCS(memchr rename)
+AC_CHECK_FUNCS(_doprintf isascii fseeko memcmp mktemp \
+ pathconf raise setmode sigaction sigprocmask sigsetmask strerror)
+AC_REPLACE_FUNCS(memchr mkdir rename rmdir)
jm_FUNC_MALLOC
jm_FUNC_REALLOC
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_VPRINTF
AC_SYS_LONG_FILE_NAMES
-
-AC_MSG_CHECKING([for d_ino member in directory struct])
-AC_CACHE_VAL(patch_cv_sys_d_ino_in_dirent,
-[AC_TRY_LINK([
-#include <sys/types.h>
-#if HAVE_DIRENT_H
-# include <dirent.h>
-#else
-# define dirent direct
-# if HAVE_SYS_NDIR_H
-# include <sys/ndir.h>
-# endif
-# ifdef HAVE_SYS_DIR_H
-# include <sys/dir.h>
-# endif
-# ifdef HAVE_NDIR_H
-# include <ndir.h>
-# endif
-#endif
-],
- [struct dirent dp; dp.d_ino = 0;],
- patch_cv_sys_d_ino_in_dirent=yes,
- patch_cv_sys_d_ino_in_dirent=no)])
-AC_MSG_RESULT($patch_cv_sys_d_ino_in_dirent)
-if test $patch_cv_sys_d_ino_in_dirent = yes; then
- AC_DEFINE(D_INO_IN_DIRENT)
-fi
+jm_STRUCT_DIRENT_D_INO
AC_OUTPUT(Makefile)
diff --git a/error.c b/error.c
index 66a4844..4eff5d0 100644
--- a/error.c
+++ b/error.c
@@ -1,29 +1,28 @@
/* Error handler for noninteractive utilities
- Copyright (C) 1990,91,92,93,94,95,96,97 Free Software Foundation, Inc.
+ Copyright (C) 1990,91,92,93,94,95,96,97,98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library. Its master source is NOT part of
+ the C library, however. The master source lives in /gd/gnu/lib.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- This program 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.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library 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. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@gnu.ai.mit.edu>. */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#include <stdio.h>
@@ -51,7 +50,7 @@ void exit ();
#include "error.h"
#ifndef _
-#define _(String) String
+# define _(String) String
#endif
/* If NULL, error will flush stdout, then print on stderr the program
@@ -69,26 +68,28 @@ unsigned int error_message_count;
#ifdef _LIBC
/* In the GNU C library, there is a predefined variable for this. */
-#define program_name program_invocation_name
-#include <errno.h>
+# define program_name program_invocation_name
+# include <errno.h>
/* In GNU libc we want do not want to use the common name `error' directly.
Instead make it a weak alias. */
-#define error __error
-#define error_at_line __error_at_line
+# define error __error
+# define error_at_line __error_at_line
-#else
+#else /* not _LIBC */
/* The calling program should define program_name and set it to the
name of the executing program. */
extern char *program_name;
-#ifndef HAVE_STRERROR_R
-# if HAVE_STRERROR
-# ifndef strerror /* On some systems, strerror is a macro */
-char *strerror ();
-# endif
+# ifdef HAVE_STRERROR_R
+# define __strerror_r strerror_r
# else
+# if HAVE_STRERROR
+# ifndef strerror /* On some systems, strerror is a macro */
+char *strerror ();
+# endif
+# else
static char *
private_strerror (errnum)
int errnum;
@@ -100,10 +101,10 @@ private_strerror (errnum)
return _(sys_errlist[errnum]);
return _("Unknown system error");
}
-# define strerror private_strerror
-# endif /* HAVE_STRERROR */
-#endif /* HAVE_STRERROR_R */
-#endif /* _LIBC */
+# define strerror private_strerror
+# endif /* HAVE_STRERROR */
+# endif /* HAVE_STRERROR_R */
+#endif /* not _LIBC */
/* Print the program name and error message MESSAGE, which is a printf-style
format string with optional args.
@@ -112,7 +113,7 @@ private_strerror (errnum)
/* VARARGS */
void
-#if defined(VA_START) && __STDC__
+#if defined VA_START && __STDC__
error (int status, int errnum, const char *message, ...)
#else
error (status, errnum, message, va_alist)
@@ -151,7 +152,10 @@ error (status, errnum, message, va_alist)
{
#if defined HAVE_STRERROR_R || defined _LIBC
char errbuf[1024];
- fprintf (stderr, ": %s", __strerror_r (errnum, errbuf, sizeof errbuf));
+ /* Don't use __strerror_r's return value because on some systems
+ (at least DEC UNIX 4.0[A-D]) strerror_r returns `int'. */
+ __strerror_r (errnum, errbuf, sizeof errbuf);
+ fprintf (stderr, ": %s", errbuf);
#else
fprintf (stderr, ": %s", strerror (errnum));
#endif
@@ -167,7 +171,7 @@ error (status, errnum, message, va_alist)
int error_one_per_line;
void
-#if defined(VA_START) && __STDC__
+#if defined VA_START && __STDC__
error_at_line (int status, int errnum, const char *file_name,
unsigned int line_number, const char *message, ...)
#else
@@ -239,8 +243,8 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
#ifdef _LIBC
/* Make the weak alias. */
-#undef error
-#undef error_at_line
+# undef error
+# undef error_at_line
weak_alias (__error, error)
weak_alias (__error_at_line, error_at_line)
#endif
diff --git a/getopt.c b/getopt.c
index fc87ce6..81cef23 100644
--- a/getopt.c
+++ b/getopt.c
@@ -1,45 +1,42 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
- "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
+ "Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
- Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97
+ Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98
Free Software Foundation, Inc.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- This program 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.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library 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. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
#ifndef _NO_PROTO
-#define _NO_PROTO
+# define _NO_PROTO
#endif
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
-#if !defined (__STDC__) || !__STDC__
+#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
-#ifndef const
-#define const
-#endif
+# ifndef const
+# define const
+# endif
#endif
#include <stdio.h>
@@ -53,11 +50,11 @@
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
-#include <gnu-versions.h>
-#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
-#define ELIDE_CODE
-#endif
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+# define ELIDE_CODE
+# endif
#endif
#ifndef ELIDE_CODE
@@ -68,26 +65,26 @@
#ifdef __GNU_LIBRARY__
/* Don't include stdlib.h for non-GNU C libraries because some of them
contain conflicting prototypes for getopt. */
-#include <stdlib.h>
-#include <unistd.h>
+# include <stdlib.h>
+# include <unistd.h>
#endif /* GNU C library. */
#ifdef VMS
-#include <unixlib.h>
-#if HAVE_STRING_H - 0
-#include <string.h>
-#endif
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+# include <string.h>
+# endif
#endif
#ifndef _
/* This is for other GNU distributions with internationalized messages.
When compiling libc, the _ macro is predefined. */
-#ifdef HAVE_LIBINTL_H
-# include <libintl.h>
-# define _(msgid) gettext (msgid)
-#else
-# define _(msgid) (msgid)
-#endif
+# ifdef HAVE_LIBINTL_H
+# include <libintl.h>
+# define _(msgid) gettext (msgid)
+# else
+# define _(msgid) (msgid)
+# endif
#endif
/* This version of `getopt' appears to the caller like standard Unix `getopt'
@@ -197,14 +194,22 @@ static char *posixly_correct;
because there are many ways it can cause trouble.
On some systems, it contains special magic macros that don't work
in GCC. */
-#include <string.h>
-#define my_index strchr
+# include <string.h>
+# define my_index strchr
#else
+# if HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# endif
+
/* Avoid depending on library functions or files
whose names are inconsistent. */
-char *getenv ();
+#ifndef getenv
+extern char *getenv ();
+#endif
static char *
my_index (str, chr)
@@ -225,11 +230,11 @@ my_index (str, chr)
#ifdef __GNUC__
/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
That was relevant to code that was here before. */
-#if !defined (__STDC__) || !__STDC__
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
/* gcc with -traditional declares the built-in strlen to return int,
and has done so at least since version 2.4.5. -- rms. */
extern int strlen (const char *);
-#endif /* not __STDC__ */
+# endif /* not __STDC__ */
#endif /* __GNUC__ */
#endif /* not __GNU_LIBRARY__ */
@@ -292,7 +297,7 @@ text_set_element (__libc_subinit, store_args_and_env);
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved. */
-#if defined (__STDC__) && __STDC__
+#if defined __STDC__ && __STDC__
static void exchange (char **);
#endif
@@ -378,7 +383,7 @@ exchange (argv)
/* Initialize the internal data when the first call is made. */
-#if defined (__STDC__) && __STDC__
+#if defined __STDC__ && __STDC__
static const char *_getopt_initialize (int, char *const *, const char *);
#endif
static const char *
@@ -527,11 +532,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
from the shell indicating it is not an option. The later information
is only used when the used in the GNU libc. */
#ifdef _LIBC
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
- || (optind < nonoption_flags_len \
- && __getopt_nonoption_flags[optind] == '1'))
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \
+ || (optind < nonoption_flags_len \
+ && __getopt_nonoption_flags[optind] == '1'))
#else
-#define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
#endif
if (nextchar == NULL || *nextchar == '\0')
@@ -690,16 +695,18 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
else
{
if (opterr)
- if (argv[optind - 1][1] == '-')
- /* --option */
- fprintf (stderr,
- _("%s: option `--%s' doesn't allow an argument\n"),
- argv[0], pfound->name);
- else
- /* +option or -option */
- fprintf (stderr,
- _("%s: option `%c%s' doesn't allow an argument\n"),
- argv[0], argv[optind - 1][0], pfound->name);
+ {
+ if (argv[optind - 1][1] == '-')
+ /* --option */
+ fprintf (stderr,
+ _("%s: option `--%s' doesn't allow an argument\n"),
+ argv[0], pfound->name);
+ else
+ /* +option or -option */
+ fprintf (stderr,
+ _("%s: option `%c%s' doesn't allow an argument\n"),
+ argv[0], argv[optind - 1][0], pfound->name);
+ }
nextchar += strlen (nextchar);
diff --git a/getopt.h b/getopt.h
index c4adc30..b0147e9 100644
--- a/getopt.h
+++ b/getopt.h
@@ -1,26 +1,27 @@
/* Declarations for getopt.
- Copyright (C) 1989,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+ Copyright (C) 1989,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- This program 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.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library 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. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifndef _GETOPT_H
-#define _GETOPT_H 1
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
#ifdef __cplusplus
extern "C" {
@@ -57,6 +58,7 @@ extern int opterr;
extern int optopt;
+#ifndef __need_getopt
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
@@ -80,11 +82,11 @@ extern int optopt;
struct option
{
-#if defined (__STDC__) && __STDC__
+# if defined __STDC__ && __STDC__
const char *name;
-#else
+# else
char *name;
-#endif
+# endif
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
@@ -94,40 +96,74 @@ struct option
/* Names for the values of the `has_arg' field of `struct option'. */
-#define no_argument 0
-#define required_argument 1
-#define optional_argument 2
+# define no_argument 0
+# define required_argument 1
+# define optional_argument 2
+#endif /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+ arguments in ARGV (ARGC of them, minus the program name) for
+ options given in OPTS.
+
+ Return the option character from OPTS just read. Return -1 when
+ there are no more options. For unrecognized options, or options
+ missing arguments, `optopt' is set to the option letter, and '?' is
+ returned.
-#if defined (__STDC__) && __STDC__
-#ifdef __GNU_LIBRARY__
+ The OPTS string is a list of characters which are recognized option
+ letters, optionally followed by colons, specifying that that letter
+ takes an argument, to be placed in `optarg'.
+
+ If a letter in OPTS is followed by two colons, its argument is
+ optional. This behavior is specific to the GNU `getopt'.
+
+ The argument `--' causes premature termination of argument
+ scanning, explicitly telling `getopt' that there are no more
+ options.
+
+ If OPTS begins with `--', then non-option arguments are treated as
+ arguments to the option '\0'. This behavior is specific to the GNU
+ `getopt'. */
+
+#if defined __STDC__ && __STDC__
+# ifdef __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 (int __argc, char *const *__argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
extern int getopt ();
-#endif /* __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,
- const char *shortopts,
- const struct option *longopts, int *longind);
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+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,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind);
/* Internal only. Users should not call this directly. */
-extern int _getopt_internal (int argc, char *const *argv,
- const char *shortopts,
- const struct option *longopts, int *longind,
- int long_only);
+extern int _getopt_internal (int __argc, char *const *__argv,
+ const char *__shortopts,
+ const struct option *__longopts, int *__longind,
+ int __long_only);
+# endif
#else /* not __STDC__ */
extern int getopt ();
+# ifndef __need_getopt
extern int getopt_long ();
extern int getopt_long_only ();
extern int _getopt_internal ();
+# endif
#endif /* __STDC__ */
#ifdef __cplusplus
}
#endif
+/* Make sure we later can get all the definitions and declarations. */
+#undef __need_getopt
+
#endif /* getopt.h */
diff --git a/getopt1.c b/getopt1.c
index af8e681..3d264f2 100644
--- a/getopt1.c
+++ b/getopt1.c
@@ -1,23 +1,22 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
- Copyright (C) 1987,88,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
+ Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
- This program 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.
-
- This program is distributed in the hope that it will be useful,
+ The GNU C Library 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.
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library 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. */
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
@@ -25,7 +24,7 @@
#include "getopt.h"
-#if !defined (__STDC__) || !__STDC__
+#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
@@ -44,7 +43,7 @@
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
-#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
diff --git a/inp.c b/inp.c
index dc6f63e..3858a13 100644
--- a/inp.c
+++ b/inp.c
@@ -1,26 +1,24 @@
/* inputting files to be patched */
-/* $Id: inp.c,v 1.20 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: inp.c,v 1.21 1999/08/30 06:20:08 eggert Exp $ */
-/*
-Copyright 1986, 1988 Larry Wall
-Copyright 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright 1986, 1988 Larry Wall
+ Copyright 1991, 1992-1993, 1997-1998, 1999 Free Software Foundation, Inc.
-This program 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.
+ This program 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.
-This program 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.
+ This program 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; see the file COPYING.
-If not, write to the Free Software Foundation,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+ If not, write to the Free Software Foundation,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define XTERN extern
#include <common.h>
@@ -57,7 +55,7 @@ static void too_many_lines PARAMS ((char const *)) __attribute__((noreturn));
/* New patch--prepare to edit another file. */
void
-re_input()
+re_input (void)
{
if (using_plan_a) {
if (i_buffer)
@@ -83,8 +81,7 @@ re_input()
/* Construct the line index, somehow or other. */
void
-scan_input(filename)
-char *filename;
+scan_input (char *filename)
{
using_plan_a = ! (debug & 16) && plan_a (filename);
if (!using_plan_a)
@@ -105,8 +102,7 @@ char *filename;
/* Report whether a desired revision was found. */
static void
-report_revision (found_revision)
- int found_revision;
+report_revision (int found_revision)
{
revision = quotearg (revision);
@@ -135,17 +131,14 @@ report_revision (found_revision)
static void
-too_many_lines (filename)
- char const *filename;
+too_many_lines (char const *filename)
{
fatal ("File %s has too many lines", quotearg (filename));
}
void
-get_input_file (filename, outname)
- char const *filename;
- char const *outname;
+get_input_file (char const *filename, char const *outname)
{
int elsewhere = strcmp (filename, outname);
char const *cs;
@@ -222,8 +215,7 @@ get_input_file (filename, outname)
/* Try keeping everything in memory. */
static bool
-plan_a(filename)
- char const *filename;
+plan_a (char const *filename)
{
register char const *s;
register char const *lim;
@@ -328,8 +320,7 @@ plan_a(filename)
/* Keep (virtually) nothing in memory. */
static void
-plan_b(filename)
- char const *filename;
+plan_b (char const *filename)
{
register FILE *ifp;
register int c;
@@ -431,13 +422,11 @@ plan_b(filename)
input_lines = line - 1;
}
-/* Fetch a line from the input file. */
+/* Fetch a line from the input file.
+ WHICHBUF is ignored when the file is in memory. */
char const *
-ifetch (line, whichbuf, psize)
-register LINENUM line;
-int whichbuf; /* ignored when file in memory */
-size_t *psize;
+ifetch (LINENUM line, int whichbuf, size_t *psize)
{
register char const *q;
register char const *p;
diff --git a/install-sh b/install-sh
index 2c212cc..b41a245 100644
--- a/install-sh
+++ b/install-sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
@@ -20,8 +20,8 @@
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
-# from scratch.
-#
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
# set DOITPROG to echo to test this script
@@ -118,8 +118,9 @@ if [ x"$dir_arg" != x ]; then
if [ -d $dst ]; then
instcmd=:
+ chmodcmd=""
else
- instcmd=mkdir
+ instcmd=$mkdirprog
fi
else
@@ -162,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
+defaultIFS='
+ '
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
diff --git a/m4/ccstdc.m4 b/m4/ccstdc.m4
new file mode 100644
index 0000000..9a34791
--- /dev/null
+++ b/m4/ccstdc.m4
@@ -0,0 +1,95 @@
+# The following is taken from automake 1.4,
+# except that it prefers the compiler option -Ae to "-Aa -D_HPUX_SOURCE"
+# because only the former supports 64-bit integral types on HP-UX 10.20.
+
+## ----------------------------------------- ##
+## ANSIfy the C compiler whenever possible. ##
+## From Franc,ois Pinard ##
+## ----------------------------------------- ##
+
+# serial 2
+
+# @defmac AC_PROG_CC_STDC
+# @maindex PROG_CC_STDC
+# @ovindex CC
+# If the C compiler in not in ANSI C mode by default, try to add an option
+# to output variable @code{CC} to make it so. This macro tries various
+# options that select ANSI C on some system or another. It considers the
+# compiler to be in ANSI C mode if it handles function prototypes correctly.
+#
+# If you use this macro, you should check after calling it whether the C
+# compiler has been set to accept ANSI C; if not, the shell variable
+# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
+# code in ANSI C, you can make an un-ANSIfied copy of it by using the
+# program @code{ansi2knr}, which comes with Ghostscript.
+# @end defmac
+
+AC_DEFUN(AM_PROG_CC_STDC,
+[AC_REQUIRE([AC_PROG_CC])
+AC_BEFORE([$0], [AC_C_INLINE])
+AC_BEFORE([$0], [AC_C_CONST])
+dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
+dnl a magic option to avoid problems with ANSI preprocessor commands
+dnl like #elif.
+dnl FIXME: can't do this because then AC_AIX won't work due to a
+dnl circular dependency.
+dnl AC_BEFORE([$0], [AC_PROG_CPP])
+AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
+AC_CACHE_VAL(am_cv_prog_cc_stdc,
+[am_cv_prog_cc_stdc=no
+ac_save_CC="$CC"
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ AC_TRY_COMPILE(
+[#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+], [
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+],
+[am_cv_prog_cc_stdc="$ac_arg"; break])
+done
+CC="$ac_save_CC"
+])
+if test -z "$am_cv_prog_cc_stdc"; then
+ AC_MSG_RESULT([none needed])
+else
+ AC_MSG_RESULT($am_cv_prog_cc_stdc)
+fi
+case "x$am_cv_prog_cc_stdc" in
+ x|xno) ;;
+ *) CC="$CC $am_cv_prog_cc_stdc" ;;
+esac
+])
diff --git a/m4/d-ino.m4 b/m4/d-ino.m4
new file mode 100644
index 0000000..289452a
--- /dev/null
+++ b/m4/d-ino.m4
@@ -0,0 +1,42 @@
+#serial 2
+
+dnl From Jim Meyering.
+dnl
+dnl Check whether struct dirent has a member named d_ino.
+dnl
+
+AC_DEFUN(jm_STRUCT_DIRENT_D_INO,
+ [AC_REQUIRE([AC_HEADER_DIRENT])dnl
+ AC_CACHE_CHECK([for d_ino member in directory struct],
+ jm_cv_struct_dirent_d_ino,
+ [AC_TRY_LINK(dnl
+ [
+#include <sys/types.h>
+#ifdef HAVE_DIRENT_H
+# include <dirent.h>
+#else /* not HAVE_DIRENT_H */
+# define dirent direct
+# ifdef HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif /* HAVE_SYS_NDIR_H */
+# ifdef HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif /* HAVE_SYS_DIR_H */
+# ifdef HAVE_NDIR_H
+# include <ndir.h>
+# endif /* HAVE_NDIR_H */
+#endif /* HAVE_DIRENT_H */
+ ],
+ [struct dirent dp; dp.d_ino = 0;],
+
+ jm_cv_struct_dirent_d_ino=yes,
+ jm_cv_struct_dirent_d_ino=no)
+ ]
+ )
+ if test $jm_cv_struct_dirent_d_ino = yes; then
+ AC_DEFINE(D_INO_IN_DIRENT, 1,
+ [Define if there is a member named d_ino in the struct describing
+ directory headers.])
+ fi
+ ]
+)
diff --git a/m4/inttypes_h.m4 b/m4/inttypes_h.m4
new file mode 100644
index 0000000..750639d
--- /dev/null
+++ b/m4/inttypes_h.m4
@@ -0,0 +1,22 @@
+#serial 3
+
+dnl From Paul Eggert.
+
+# Define HAVE_INTTYPES_H if <inttypes.h> exists,
+# doesn't clash with <sys/types.h>, and declares uintmax_t.
+
+AC_DEFUN(jm_AC_HEADER_INTTYPES_H,
+[
+ AC_CACHE_CHECK([for inttypes.h], jm_ac_cv_header_inttypes_h,
+ [AC_TRY_COMPILE(
+ [#include <sys/types.h>
+#include <inttypes.h>],
+ [uintmax_t i = (uintmax_t) -1;],
+ jm_ac_cv_header_inttypes_h=yes,
+ jm_ac_cv_header_inttypes_h=no)])
+ if test $jm_ac_cv_header_inttypes_h = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_INTTYPES_H, 1,
+[Define if <inttypes.h> exists, doesn't clash with <sys/types.h>,
+ and declares uintmax_t. ])
+ fi
+])
diff --git a/m4/largefile.m4 b/m4/largefile.m4
new file mode 100644
index 0000000..9515f7e
--- /dev/null
+++ b/m4/largefile.m4
@@ -0,0 +1,115 @@
+#serial 5
+
+dnl By default, many hosts won't let programs access large files;
+dnl one must use special compiler options to get large-file access to work.
+dnl For more details about this brain damage please see:
+dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
+
+dnl Written by Paul Eggert <eggert@twinsun.com>.
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
+AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
+ [AC_CACHE_CHECK([for $1 value to request large file support],
+ ac_cv_sys_largefile_$1,
+ [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
+ ac_cv_sys_largefile_$1=no
+ ifelse($1, CFLAGS,
+ [case "$host_os" in
+ # IRIX 6.2 and later require cc -n32.
+changequote(, )dnl
+ irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
+changequote([, ])dnl
+ if test "$GCC" != yes; then
+ ac_cv_sys_largefile_CFLAGS=-n32
+ fi
+ ac_save_CC="$CC"
+ CC="$CC $ac_cv_sys_largefile_CFLAGS"
+ AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
+ CC="$ac_save_CC"
+ esac])
+ }])])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
+AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
+ [case $2 in
+ no) ;;
+ ?*)
+ case "[$]$1" in
+ '') $1=$2 ;;
+ *) $1=[$]$1' '$2 ;;
+ esac ;;
+ esac])
+
+dnl Internal subroutine of AC_SYS_LARGEFILE.
+dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
+AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
+ [AC_CACHE_CHECK([for $1], $2,
+ [$2=no
+changequote(, )dnl
+ $4
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ -D$1)
+ $2=1 ;;
+ -D$1=*)
+ $2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
+ esac
+ done
+changequote([, ])dnl
+ ])
+ if test "[$]$2" != no; then
+ AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
+ fi])
+
+AC_DEFUN(AC_SYS_LARGEFILE,
+ [AC_REQUIRE([AC_CANONICAL_HOST])
+ AC_ARG_ENABLE(largefile,
+ [ --disable-largefile omit support for large files])
+ if test "$enable_largefile" != no; then
+ AC_CHECK_TOOL(GETCONF, getconf)
+ AC_SYS_LARGEFILE_FLAGS(CFLAGS)
+ AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
+ AC_SYS_LARGEFILE_FLAGS(LIBS)
+
+ for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
+ case "$ac_flag" in
+ no) ;;
+ -D_FILE_OFFSET_BITS=*) ;;
+ -D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
+ -D_LARGE_FILES | -D_LARGE_FILES=*) ;;
+ -D?* | -I?*)
+ AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
+ *)
+ AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
+ esac
+ done
+ AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
+ AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
+ AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
+ ac_cv_sys_file_offset_bits,
+ [Number of bits in a file offset, on hosts where this is settable.],
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_file_offset_bits=64 ;;
+ esac])
+ AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
+ ac_cv_sys_largefile_source,
+ [Define to make fseeko etc. visible, on some hosts.],
+ [case "$host_os" in
+ # HP-UX 10.20 and later
+ hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
+ ac_cv_sys_largefile_source=1 ;;
+ esac])
+ AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
+ ac_cv_sys_large_files,
+ [Define for large files, on AIX-style hosts.],
+ [case "$host_os" in
+ # AIX 4.2 and later
+ aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
+ ac_cv_sys_large_files=1 ;;
+ esac])
+ fi
+ ])
diff --git a/m4/malloc.m4 b/m4/malloc.m4
new file mode 100644
index 0000000..4978eaf
--- /dev/null
+++ b/m4/malloc.m4
@@ -0,0 +1,35 @@
+#serial 3
+
+dnl From Jim Meyering.
+dnl Determine whether malloc accepts 0 as its argument.
+dnl If it doesn't, arrange to use the replacement function.
+dnl
+
+AC_DEFUN(jm_FUNC_MALLOC,
+[
+ dnl xmalloc.c requires that this symbol be defined so it doesn't
+ dnl mistakenly use a broken malloc -- as it might if this test were omitted.
+ AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_MALLOC_CHECK, 1,
+ [Define if the malloc check has been performed. ])
+
+ AC_CACHE_CHECK([for working malloc], jm_cv_func_working_malloc,
+ [AC_TRY_RUN([
+ char *malloc ();
+ int
+ main ()
+ {
+ exit (malloc (0) ? 0 : 1);
+ }
+ ],
+ jm_cv_func_working_malloc=yes,
+ jm_cv_func_working_malloc=no,
+ dnl When crosscompiling, assume malloc is broken.
+ jm_cv_func_working_malloc=no)
+ ])
+ if test $jm_cv_func_working_malloc = no; then
+ AC_SUBST(LIBOBJS)
+ LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ AC_DEFINE_UNQUOTED(malloc, rpl_malloc,
+ [Define to rpl_malloc if the replacement function should be used.])
+ fi
+])
diff --git a/m4/protos.m4 b/m4/protos.m4
new file mode 100644
index 0000000..0079f74
--- /dev/null
+++ b/m4/protos.m4
@@ -0,0 +1,25 @@
+## ------------------------------- ##
+## Check for function prototypes. ##
+## From Franc,ois Pinard ##
+## ------------------------------- ##
+
+# serial 1
+
+AC_DEFUN(AM_C_PROTOTYPES,
+[AC_REQUIRE([AM_PROG_CC_STDC])
+AC_REQUIRE([AC_PROG_CPP])
+AC_MSG_CHECKING([for function prototypes])
+if test "$am_cv_prog_cc_stdc" != no; then
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes])
+ U= ANSI2KNR=
+else
+ AC_MSG_RESULT(no)
+ U=_ ANSI2KNR=./ansi2knr
+ # Ensure some checks needed by ansi2knr itself.
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS(string.h)
+fi
+AC_SUBST(U)dnl
+AC_SUBST(ANSI2KNR)dnl
+])
diff --git a/m4/realloc.m4 b/m4/realloc.m4
new file mode 100644
index 0000000..bfbef0c
--- /dev/null
+++ b/m4/realloc.m4
@@ -0,0 +1,35 @@
+#serial 3
+
+dnl From Jim Meyering.
+dnl Determine whether realloc works when both arguments are 0.
+dnl If it doesn't, arrange to use the replacement function.
+dnl
+
+AC_DEFUN(jm_FUNC_REALLOC,
+[
+ dnl xmalloc.c requires that this symbol be defined so it doesn't
+ dnl mistakenly use a broken realloc -- as it might if this test were omitted.
+ AC_DEFINE_UNQUOTED(HAVE_DONE_WORKING_REALLOC_CHECK, 1,
+ [Define if the realloc check has been performed. ])
+
+ AC_CACHE_CHECK([for working realloc], jm_cv_func_working_realloc,
+ [AC_TRY_RUN([
+ char *realloc ();
+ int
+ main ()
+ {
+ exit (realloc (0, 0) ? 0 : 1);
+ }
+ ],
+ jm_cv_func_working_realloc=yes,
+ jm_cv_func_working_realloc=no,
+ dnl When crosscompiling, assume realloc is broken.
+ jm_cv_func_working_realloc=no)
+ ])
+ if test $jm_cv_func_working_realloc = no; then
+ AC_SUBST(LIBOBJS)
+ LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ AC_DEFINE_UNQUOTED(realloc, rpl_realloc,
+ [Define to rpl_realloc if the replacement function should be used.])
+ fi
+])
diff --git a/m4/utimbuf.m4 b/m4/utimbuf.m4
new file mode 100644
index 0000000..14d7772
--- /dev/null
+++ b/m4/utimbuf.m4
@@ -0,0 +1,40 @@
+#serial 2
+
+dnl From Jim Meyering
+
+dnl Define HAVE_STRUCT_UTIMBUF if `struct utimbuf' is declared --
+dnl usually in <utime.h>.
+dnl Some systems have utime.h but don't declare the struct anywhere.
+
+AC_DEFUN(jm_STRUCT_UTIMBUF,
+[
+ AC_CHECK_HEADERS(utime.h)
+ AC_REQUIRE([AC_HEADER_TIME])
+ AC_CACHE_CHECK([for struct utimbuf], fu_cv_sys_struct_utimbuf,
+ [AC_TRY_COMPILE(
+ [
+#ifdef TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#ifdef HAVE_UTIME_H
+# include <utime.h>
+#endif
+ ],
+ [static struct utimbuf x; x.actime = x.modtime;],
+ fu_cv_sys_struct_utimbuf=yes,
+ fu_cv_sys_struct_utimbuf=no)
+ ])
+
+ if test $fu_cv_sys_struct_utimbuf = yes; then
+ AC_DEFINE_UNQUOTED(HAVE_STRUCT_UTIMBUF, 1,
+[Define if struct utimbuf is declared -- usually in <utime.h>.
+ Some systems have utime.h but don't declare the struct anywhere. ])
+ fi
+])
diff --git a/maketime.c b/maketime.c
index e13e70a..985a6d5 100644
--- a/maketime.c
+++ b/maketime.c
@@ -64,7 +64,7 @@
#include <maketime.h>
char const maket_id[] =
- "$Id: maketime.c,v 5.16 1997/12/04 07:49:27 eggert Exp $";
+ "$Id: maketime.c,v 5.17 1999/08/29 11:12:37 eggert Exp $";
static int isleap P ((int));
static int month_days P ((struct tm const *));
@@ -79,8 +79,8 @@ static time_t maketime P ((struct partime const *, time_t));
/* Quotient and remainder when dividing A by B,
truncating towards minus infinity, where B is positive. */
-#define div(a, b) ((a) / (b) - ((a) % (b) < 0))
-#define mod(a, b) ((a) % (b) + (b) * ((a) % (b) < 0))
+#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
+#define MOD(a, b) ((a) % (b) + (b) * ((a) % (b) < 0))
/* Number of days in 400 consecutive Gregorian years. */
#define Y400_DAYS (365 * 400L + 100 - 4 + 1)
@@ -137,8 +137,8 @@ difftm (a, b)
{
int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
- int ac = div (ay, 100);
- int bc = div (by, 100);
+ int ac = DIV (ay, 100);
+ int bc = DIV (by, 100);
int difference_in_day_of_year = a->tm_yday - b->tm_yday;
int intervening_leap_days = (((ay >> 2) - (by >> 2))
- (ac - bc)
@@ -210,10 +210,10 @@ adjzone (t, seconds)
}
}
if (TM_DEFINED (t->tm_wday))
- t->tm_wday = mod (t->tm_wday + days, 7);
- t->tm_hour = mod (t->tm_hour, 24);
- t->tm_min = mod (t->tm_min, 60);
- t->tm_sec = (int) mod (sec, 60) + leap_second;
+ t->tm_wday = MOD (t->tm_wday + days, 7);
+ t->tm_hour = MOD (t->tm_hour, 24);
+ t->tm_min = MOD (t->tm_min, 60);
+ t->tm_sec = (int) MOD (sec, 60) + leap_second;
}
/* Convert TM to time_t, using localtime if LOCALZONE and gmtime otherwise.
@@ -330,7 +330,7 @@ maketime (pt, default_time)
{
/* Yield a year closest to the default that has the given modulus. */
int year0 = tm0->tm_year + TM_YEAR_ORIGIN;
- int y0 = mod (year0, pt->ymodulus);
+ int y0 = MOD (year0, pt->ymodulus);
int d = 2 * (year - y0);
year += (((year0 - y0) / pt->ymodulus
+ (pt->ymodulus < d ? -1 : d < -pt->ymodulus))
@@ -391,21 +391,21 @@ maketime (pt, default_time)
int hours = tm.tm_hour + pt->tmr.tm_hour;
int mins = tm.tm_min + pt->tmr.tm_min;
- int carried_hours = div (mins, 60);
+ int carried_hours = DIV (mins, 60);
int hours1 = hours + carried_hours;
- int carried_days = div (hours1, 24);
+ int carried_days = DIV (hours1, 24);
int mdays1 = mdays + carried_days;
- int mon0 = mod (mons, 12);
- int carried_years0 = div (mons, 12);
+ int mon0 = MOD (mons, 12);
+ int carried_years0 = DIV (mons, 12);
int year0 = years + carried_years0;
int yday0 = (month_yday[mon0]
- (mon0 < 2 || !isleap (year0 + TM_YEAR_ORIGIN)));
int yday1 = yday0 + mdays1;
- int carried_years1 = div (yday1, Y400_DAYS) * 400;
+ int carried_years1 = DIV (yday1, Y400_DAYS) * 400;
int year1 = year0 + carried_years1;
- int yday2 = mod (yday1, Y400_DAYS);
+ int yday2 = MOD (yday1, Y400_DAYS);
int leap;
if (overflow_sum_sign (tm.tm_year, pt->tmr.tm_year, years)
@@ -440,8 +440,8 @@ maketime (pt, default_time)
tm.tm_mon = mon;
}
- tm.tm_hour = mod (hours1, 24);
- tm.tm_min = mod (mins, 60);
+ tm.tm_hour = MOD (hours1, 24);
+ tm.tm_min = MOD (mins, 60);
r = tm2time (&tm, localzone);
if (r == -1)
diff --git a/malloc.c b/malloc.c
index b859e58..5e7674b 100644
--- a/malloc.c
+++ b/malloc.c
@@ -1,5 +1,5 @@
/* Work around bug on some systems where malloc (0) fails.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,8 +30,7 @@ char *malloc ();
If N is zero, allocate a 1-byte block. */
char *
-rpl_malloc (n)
- size_t n;
+rpl_malloc (size_t n)
{
if (n == 0)
n = 1;
diff --git a/memchr.c b/memchr.c
index 2012fa1..8c3b59c 100644
--- a/memchr.c
+++ b/memchr.c
@@ -1,30 +1,30 @@
-/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1993, 1997, 1999 Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
commentary by Jim Blandy (jimb@ai.mit.edu);
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
and implemented by Roland McGrath (roland@ai.mit.edu).
- NOTE: The canonical source of this file is maintained with the GNU C Library.
- Bugs can be reported to bug-glibc@prep.ai.mit.edu.
+NOTE: The canonical source of this file is maintained with the GNU C Library.
+Bugs can be reported to bug-glibc@prep.ai.mit.edu.
- This program 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.
+This program 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.
- This program 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.
+This program 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. */
+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. */
#ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
#endif
#undef __ptr_t
@@ -45,15 +45,14 @@
#define LONG_MAX_32_BITS 2147483647
#ifndef LONG_MAX
-#define LONG_MAX LONG_MAX_32_BITS
+# define LONG_MAX LONG_MAX_32_BITS
#endif
#include <sys/types.h>
-#undef memchr
-
/* Search no more than N bytes of S for C. */
+
__ptr_t
memchr (s, c, n)
const __ptr_t s;
diff --git a/mkdir.c b/mkdir.c
new file mode 100644
index 0000000..1829a9e
--- /dev/null
+++ b/mkdir.c
@@ -0,0 +1,108 @@
+/* BSD compatible make directory function for System V
+ Copyright (C) 1988, 1990, 1998 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISDIR
+#endif
+
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+#ifndef S_IRWXU
+# define S_IRWXU 0700
+#endif
+#ifndef S_IRWXG
+# define S_IRWXG 0070
+#endif
+#ifndef S_IRWXO
+# define S_IRWXO 0007
+#endif
+
+/* mkdir adapted from GNU tar. */
+
+/* Make directory DPATH, with permission mode DMODE.
+
+ Written by Robert Rother, Mariah Corporation, August 1985
+ (sdcsvax!rmr or rmr@uscd). If you want it, it's yours.
+
+ Severely hacked over by John Gilmore to make a 4.2BSD compatible
+ subroutine. 11Mar86; hoptoad!gnu
+
+ Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir,
+ subroutine didn't return EEXIST. It does now. */
+
+int
+mkdir (const char *dpath, mode_t dmode)
+{
+ pid_t cpid;
+ mode_t mode;
+ int status;
+ struct stat statbuf;
+
+ if (stat (dpath, &statbuf) == 0)
+ {
+ errno = EEXIST; /* stat worked, so it already exists. */
+ return -1;
+ }
+
+ /* If stat fails for a reason other than non-existence, return error. */
+ if (errno != ENOENT)
+ return -1;
+
+ cpid = fork ();
+ switch (cpid)
+ {
+ case -1: /* Cannot fork. */
+ return -1; /* errno is already set. */
+
+ case 0: /* Child process. */
+ /* Cheap hack to set mode of new directory. Since this child
+ process is going away anyway, we zap its umask.
+ This won't suffice to set SUID, SGID, etc. on this
+ directory, so the parent process calls chmod afterward. */
+ mode = umask (0); /* Get current umask. */
+ /* Set for mkdir. */
+ umask (mode | ((S_IRWXU | S_IRWXG | S_IRWXO) & ~dmode));
+ execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
+ _exit (1);
+
+ default: /* Parent process. */
+ /* Wait for kid to finish. */
+ while (wait (&status) != cpid)
+ /* Do nothing. */ ;
+
+ if (status)
+ {
+ /* /bin/mkdir failed. */
+ errno = EIO;
+ return -1;
+ }
+ return chmod (dpath, dmode);
+ }
+}
diff --git a/mkinstalldirs b/mkinstalldirs
index a01481b..70f983f 100644
--- a/mkinstalldirs
+++ b/mkinstalldirs
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.10 1996/05/03 07:37:52 friedman Exp $
+# $Id: mkinstalldirs,v 1.12.2.1 1998/12/26 17:32:14 bje Exp $
errstatus=0
@@ -22,7 +22,7 @@ do
esac
if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp" 1>&2
+ echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
diff --git a/patch.c b/patch.c
index 1045df1..798245a 100644
--- a/patch.c
+++ b/patch.c
@@ -1,26 +1,24 @@
/* patch - a program to apply diffs to original files */
-/* $Id: patch.c,v 1.27 1998/03/20 22:42:54 eggert Exp $ */
+/* $Id: patch.c,v 1.28 1999/08/30 06:20:08 eggert Exp $ */
-/*
-Copyright 1984, 1985, 1986, 1987, 1988 Larry Wall
-Copyright 1989, 1990-1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright 1984, 1985-1987, 1988 Larry Wall
+ Copyright 1989, 1990-1993, 1997-1998, 1999 Free Software Foundation, Inc.
-This program 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.
+ This program 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.
-This program 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.
+ This program 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; see the file COPYING.
-If not, write to the Free Software Foundation,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+ If not, write to the Free Software Foundation,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define XTERN
#include <common.h>
@@ -79,6 +77,7 @@ static void usage PARAMS ((FILE *, int)) __attribute__((noreturn));
static int make_backups;
static int backup_if_mismatch;
static char const *version_control;
+static char const *version_control_context;
static int remove_empty_files;
/* TRUE if -R was specified on command line. */
@@ -115,9 +114,7 @@ char const program_name[] = "patch";
int main PARAMS ((int, char **));
int
-main(argc,argv)
-int argc;
-char **argv;
+main (int argc, char **argv)
{
char const *val;
bool somefailed = FALSE;
@@ -136,7 +133,7 @@ char **argv;
val = getenv ("QUOTING_STYLE");
{
- int i = val ? argmatch (val, quoting_style_args) : -1;
+ int i = val ? argmatch (val, quoting_style_args, 0, 0) : -1;
set_quoting_style ((struct quoting_options *) 0,
i < 0 ? shell_quoting_style : (enum quoting_style) i);
}
@@ -151,9 +148,10 @@ char **argv;
if (val && *val)
simple_backup_suffix = val;
- version_control = getenv ("PATCH_VERSION_CONTROL");
- if (! version_control)
- version_control = getenv ("VERSION_CONTROL");
+ if ((version_control = getenv ("PATCH_VERSION_CONTROL")))
+ version_control_context = "$PATCH_VERSION_CONTROL";
+ else if ((version_control = getenv ("VERSION_CONTROL")))
+ version_control_context = "$VERSION_CONTROL";
/* Cons up the names of the global temporary files.
Do this before `cleanup' can possibly be called (e.g. by `pfatal'). */
@@ -168,7 +166,7 @@ char **argv;
get_some_switches();
if (make_backups | backup_if_mismatch)
- backup_type = get_version (version_control);
+ backup_type = get_version (version_control_context, version_control);
init_output (outfile, 0, &outstate);
@@ -290,7 +288,7 @@ char **argv;
format_linenum (numbuf, newwhere));
}
else if (!where
- || (where == 1 && pch_says_nonexistent (reverse)
+ || (where == 1 && pch_says_nonexistent (reverse) == 2
&& instat.st_size)) {
if (where)
@@ -397,7 +395,7 @@ char **argv;
utimbuf.actime = utimbuf.modtime = t;
if (! force && ! inerrno
- && ! pch_says_nonexistent (reverse)
+ && pch_says_nonexistent (reverse) != 2
&& (t = pch_timestamp (reverse)) != (time_t) -1
&& t != instat.st_mtime)
say ("Not setting time of file %s (time mismatch)\n",
@@ -461,7 +459,7 @@ char **argv;
/* Prepare to find the next patch to do in the patch file. */
static void
-reinitialize_almost_everything()
+reinitialize_almost_everything (void)
{
re_patch();
re_input();
@@ -601,9 +599,7 @@ static char const *const option_help[] =
};
static void
-usage (stream, status)
- FILE *stream;
- int status;
+usage (FILE *stream, int status)
{
char const * const *p;
@@ -626,7 +622,7 @@ usage (stream, status)
/* Process switches and filenames. */
static void
-get_some_switches()
+get_some_switches (void)
{
register int optc;
@@ -731,6 +727,7 @@ get_some_switches()
break;
case 'V':
version_control = optarg;
+ version_control_context = "--version-control or -V option";
break;
#if DEBUGGING
case 'x':
@@ -775,7 +772,7 @@ get_some_switches()
break;
case CHAR_MAX + 8:
{
- int i = argmatch (optarg, quoting_style_args);
+ int i = argmatch (optarg, quoting_style_args, 0, 0);
if (i < 0)
{
invalid_arg ("quoting style", optarg, i);
@@ -812,10 +809,9 @@ get_some_switches()
of type ARGTYPE_MSGID by converting it to an integer,
returning the result. */
static int
-numeric_string (string, negative_allowed, argtype_msgid)
- char const *string;
- int negative_allowed;
- char const *argtype_msgid;
+numeric_string (char const *string,
+ int negative_allowed,
+ char const *argtype_msgid)
{
int value = 0;
char const *p = string;
@@ -849,8 +845,7 @@ numeric_string (string, negative_allowed, argtype_msgid)
/* Attempt to find the right place to apply this hunk of patch. */
static LINENUM
-locate_hunk(fuzz)
-LINENUM fuzz;
+locate_hunk (LINENUM fuzz)
{
register LINENUM first_guess = pch_first () + last_offset;
register LINENUM offset;
@@ -938,7 +933,7 @@ LINENUM fuzz;
/* We did not find the pattern, dump out the hunk so they can handle it. */
static void
-abort_hunk()
+abort_hunk (void)
{
register LINENUM i;
register LINENUM pat_end = pch_end ();
@@ -996,9 +991,7 @@ abort_hunk()
/* We found where to apply it (we hope), so do it. */
static bool
-apply_hunk (outstate, where)
- struct outstate *outstate;
- LINENUM where;
+apply_hunk (struct outstate *outstate, LINENUM where)
{
register LINENUM old = 1;
register LINENUM lastline = pch_ptrn_lines ();
@@ -1159,9 +1152,7 @@ apply_hunk (outstate, where)
/* Create an output file. */
static FILE *
-create_output_file (name, open_flags)
- char const *name;
- int open_flags;
+create_output_file (char const *name, int open_flags)
{
int fd = create_file (name, O_WRONLY | binary_transput | open_flags,
instat.st_mode);
@@ -1174,10 +1165,7 @@ create_output_file (name, open_flags)
/* Open the new file. */
static void
-init_output (name, open_flags, outstate)
- char const *name;
- int open_flags;
- struct outstate *outstate;
+init_output (char const *name, int open_flags, struct outstate *outstate)
{
outstate->ofp = name ? create_output_file (name, open_flags) : (FILE *) 0;
outstate->after_newline = 1;
@@ -1187,7 +1175,7 @@ init_output (name, open_flags, outstate)
/* Open a file to put hunks we can't locate. */
static void
-init_reject ()
+init_reject (void)
{
int exclusive = TMPREJNAME_needs_removal ? 0 : O_EXCL;
TMPREJNAME_needs_removal = 1;
@@ -1197,9 +1185,7 @@ init_reject ()
/* Copy input file to output, up to wherever hunk is to be applied. */
static bool
-copy_till (outstate, lastline)
- register struct outstate *outstate;
- register LINENUM lastline;
+copy_till (register struct outstate *outstate, register LINENUM lastline)
{
register LINENUM R_last_frozen_line = last_frozen_line;
register FILE *fp = outstate->ofp;
@@ -1230,8 +1216,7 @@ copy_till (outstate, lastline)
/* Finish copying the input file to the output file. */
static bool
-spew_output (outstate)
- struct outstate *outstate;
+spew_output (struct outstate *outstate)
{
if (debug & 256)
{
@@ -1259,11 +1244,8 @@ spew_output (outstate)
/* Does the patch pattern match at line base+offset? */
static bool
-patch_match (base, offset, prefix_fuzz, suffix_fuzz)
-LINENUM base;
-LINENUM offset;
-LINENUM prefix_fuzz;
-LINENUM suffix_fuzz;
+patch_match (LINENUM base, LINENUM offset,
+ LINENUM prefix_fuzz, LINENUM suffix_fuzz)
{
register LINENUM pline = 1 + prefix_fuzz;
register LINENUM iline;
@@ -1289,11 +1271,8 @@ LINENUM suffix_fuzz;
/* Do two lines match with canonicalized white space? */
static bool
-similar (a, alen, b, blen)
- register char const *a;
- register size_t alen;
- register char const *b;
- register size_t blen;
+similar (register char const *a, register size_t alen,
+ register char const *b, register size_t blen)
{
/* Ignore presence or absence of trailing newlines. */
alen -= alen && a[alen - 1] == '\n';
@@ -1333,8 +1312,7 @@ char *mktemp PARAMS ((char *));
#endif
static char const *
-make_temp (letter)
- int letter;
+make_temp (int letter)
{
char *r;
#if HAVE_MKTEMP
@@ -1358,8 +1336,7 @@ make_temp (letter)
/* Fatal exit with cleanup. */
void
-fatal_exit (sig)
- int sig;
+fatal_exit (int sig)
{
cleanup ();
@@ -1370,9 +1347,7 @@ fatal_exit (sig)
}
static void
-remove_if_needed (name, needs_removal)
- char const *name;
- int volatile *needs_removal;
+remove_if_needed (char const *name, int volatile *needs_removal)
{
if (*needs_removal)
{
@@ -1382,7 +1357,7 @@ remove_if_needed (name, needs_removal)
}
static void
-cleanup ()
+cleanup (void)
{
remove_if_needed (TMPINNAME, &TMPINNAME_needs_removal);
remove_if_needed (TMPOUTNAME, &TMPOUTNAME_needs_removal);
diff --git a/patch.man b/patch.man
index d7190cb..87b8fba 100644
--- a/patch.man
+++ b/patch.man
@@ -2,7 +2,7 @@
.de Id
.ds Dt \\$4
..
-.Id $Id: patch.man,v 1.25 1998/03/17 18:35:38 eggert Exp $
+.Id $Id: patch.man,v 1.26 1998/03/21 15:48:43 eggert Exp $
.ds = \-\^\-
.de Sp
.if t .sp .3
@@ -375,7 +375,7 @@ and does not get the file; and if negative,
asks the user whether to get the file.
The default value of this option is given by the value of the
.B PATCH_GET
-environment variable if it is set; if not, the default value is zero if
+environment variable if it is set; if not, the default value is zero if
.B patch
is conforming to \s-1POSIX\s0, negative otherwise.
.TP
diff --git a/patchlevel.h b/patchlevel.h
new file mode 100644
index 0000000..5fa5321
--- /dev/null
+++ b/patchlevel.h
@@ -0,0 +1 @@
+#define PATCH_VERSION "2.5.4"
diff --git a/pc/djgpp/README b/pc/djgpp/README
index ef1cba7..063480e 100644
--- a/pc/djgpp/README
+++ b/pc/djgpp/README
@@ -7,7 +7,7 @@ To configure `patch' for DJGPP, issue these commands from the
To build `patch' in a directory other than where the sources are,
add a parameter that specifies the source directory, e.g.:
- e:\gnu\patch-2.3\pc\djgpp\configure e:/gnu/patch-2.3
+ e:\src\patch\pc\djgpp\configure e:/src/patch
You MUST use forward slashes to specify the source directory.
diff --git a/pc/djgpp/config.sed b/pc/djgpp/config.sed
index f97d210..70589c0 100644
--- a/pc/djgpp/config.sed
+++ b/pc/djgpp/config.sed
@@ -7,15 +7,18 @@
symbols that <sys/config.h> doesn't define correctly. */\
#include <sys/config.h>
+s/#undef HAVE_DONE_WORKING_MALLOC_CHECK/#define HAVE_DONE_WORKING_MALLOC_CHECK 1/
+s/#undef HAVE_DONE_WORKING_REALLOC_CHECK/#define HAVE_DONE_WORKING_REALLOC_CHECK 1/
s/#undef HAVE_LONG_FILE_NAMES/#define HAVE_LONG_FILE_NAMES 1/
s/#undef HAVE_MEMCMP/#define HAVE_MEMCMP 1/
s/#undef HAVE_MKTEMP/#define HAVE_MKTEMP 1/
s/#undef HAVE_PATHCONF/#define HAVE_PATHCONF 1/
s/#undef HAVE_RAISE/#define HAVE_RAISE 1/
s/#undef HAVE_SIGPROCMASK/#define HAVE_SIGPROCMASK 1/
-s/#undef HAVE_UTIME_H/#define HAVE_UTIME_H 1/
s/#undef HAVE_STRUCT_UTIMBUF/#define HAVE_STRUCT_UTIMBUF 1/
+s/#undef HAVE_UTIME_H/#define HAVE_UTIME_H 1/
s/#undef HAVE_VPRINTF/#define HAVE_VPRINTF 1/
+s/#undef PROTOTYPES/#define PROTOTYPES 1/
s,#undef.*,/* & */,
diff --git a/pc/djgpp/configure.sed b/pc/djgpp/configure.sed
index 6f14c38..f5025da 100644
--- a/pc/djgpp/configure.sed
+++ b/pc/djgpp/configure.sed
@@ -1,5 +1,5 @@
# Edit Makefile.in to produce Makefile for DJGPP v2
-# $Id: configure.sed,v 1.8 1997/06/18 06:26:43 eggert Exp $
+# $Id: configure.sed,v 1.9 1998/03/22 20:16:29 eggert Exp $
1i\
# Makefile generated by "configure.bat" for DJGPP v2\
@@ -20,6 +20,7 @@ s|@LDFLAGS@||g
s|@LIBOBJS@|getopt1.o getopt.o chdirsaf.o|g
s|@LIBS@||g
s|@PACKAGE@|patch|g
+s|@U@||g
/@VERSION@/d
s|@prefix@|${DJDIR}|g
diff --git a/pch.c b/pch.c
index c87644e..360fdf6 100644
--- a/pch.c
+++ b/pch.c
@@ -1,30 +1,29 @@
/* reading patches */
-/* $Id: pch.c,v 1.27 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: pch.c,v 1.29 1999/08/30 06:20:08 eggert Exp $ */
-/*
-Copyright 1986, 1987, 1988 Larry Wall
-Copyright 1990, 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright 1986, 1987, 1988 Larry Wall
+ Copyright 1990, 1991-1993, 1997-1998, 1999 Free Software Foundation, Inc.
-This program 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.
+ This program 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.
-This program 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.
+ This program 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; see the file COPYING.
-If not, write to the Free Software Foundation,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+ If not, write to the Free Software Foundation,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define XTERN extern
#include <common.h>
#include <backupfile.h>
+#include <basename.h>
#include <inp.h>
#include <quotearg.h>
#include <util.h>
@@ -37,8 +36,10 @@ If not, write to the Free Software Foundation,
/* Patch (diff listing) abstract type. */
static FILE *pfp; /* patch file pointer */
-static int p_says_nonexistent[2]; /* [0] for old file, [1] for new;
- value is 0 for nonempty, 1 for empty, 2 for nonexistent */
+static int p_says_nonexistent[2]; /* [0] for old file, [1] for new:
+ 0 for existent and nonempty,
+ 1 for existent and probably (but not necessarily) empty,
+ 2 for nonexistent */
static int p_rfc934_nesting; /* RFC 934 nesting level */
static time_t p_timestamp[2]; /* timestamps in patch headers */
static off_t p_filesize; /* size of the patch file */
@@ -82,7 +83,7 @@ static void skip_to PARAMS ((file_offset, LINENUM));
/* Prepare to look for the next patch in the patch file. */
void
-re_patch()
+re_patch (void)
{
p_first = 0;
p_newfirst = 0;
@@ -97,8 +98,7 @@ re_patch()
/* Open the patch file at the beginning of time. */
void
-open_patch_file(filename)
- char const *filename;
+open_patch_file (char const *filename)
{
file_offset file_pos = 0;
struct stat st;
@@ -161,7 +161,7 @@ open_patch_file(filename)
/* Make sure our dynamically realloced tables are malloced to begin with. */
void
-set_hunkmax()
+set_hunkmax (void)
{
if (!p_line)
p_line = (char **) malloc (hunkmax * sizeof *p_line);
@@ -174,7 +174,7 @@ set_hunkmax()
/* Enlarge the arrays containing the current hunk of patch. */
static bool
-grow_hunkmax()
+grow_hunkmax (void)
{
hunkmax *= 2;
assert (p_line && p_len && p_Char);
@@ -194,7 +194,7 @@ grow_hunkmax()
/* True if the remainder of the patch file contains a diff of some sort. */
bool
-there_is_another_patch()
+there_is_another_patch (void)
{
if (p_base != 0 && p_base >= p_filesize) {
if (verbosity == VERBOSE)
@@ -284,7 +284,7 @@ there_is_another_patch()
/* Determine what kind of diff is in the remaining part of the patch file. */
static enum diff
-intuit_diff_type()
+intuit_diff_type (void)
{
register file_offset this_line = 0;
register file_offset first_command_line = -1;
@@ -542,6 +542,8 @@ intuit_diff_type()
if (! posixly_correct)
{
+ int is_empty;
+
i = best_name (name, stat_errno);
if (i == NONE && patch_get)
@@ -583,7 +585,8 @@ intuit_diff_type()
}
}
- if (p_says_nonexistent[reverse ^ (i == NONE || st[i].st_size == 0)])
+ is_empty = i == NONE || st[i].st_size == 0;
+ if ((! is_empty) < p_says_nonexistent[reverse ^ is_empty])
{
assert (i0 != NONE);
if (ok_to_reverse
@@ -644,9 +647,7 @@ intuit_diff_type()
/* Count the path name components in FILENAME's prefix.
If CHECKDIRS is nonzero, count only existing directories. */
static int
-prefix_components (filename, checkdirs)
- char *filename;
- int checkdirs;
+prefix_components (char *filename, int checkdirs)
{
int count = 0;
struct stat stat_buf;
@@ -676,9 +677,7 @@ prefix_components (filename, checkdirs)
Ignore null names, and ignore NAME[i] if IGNORE[i] is nonzero.
Return NONE if all names are ignored. */
static enum nametype
-best_name (name, ignore)
- char *const *name;
- int const *ignore;
+best_name (char *const *name, int const *ignore)
{
enum nametype i;
int components[3];
@@ -724,9 +723,7 @@ best_name (name, ignore)
/* Remember where this patch ends so we know where to start up again. */
static void
-next_intuit_at(file_pos,file_line)
-file_offset file_pos;
-LINENUM file_line;
+next_intuit_at (file_offset file_pos, LINENUM file_line)
{
p_base = file_pos;
p_bline = file_line;
@@ -735,9 +732,7 @@ LINENUM file_line;
/* Basically a verbose fseek() to the actual diff listing. */
static void
-skip_to(file_pos,file_line)
-file_offset file_pos;
-LINENUM file_line;
+skip_to (file_offset file_pos, LINENUM file_line)
{
register FILE *i = pfp;
register FILE *o = stdout;
@@ -769,7 +764,7 @@ LINENUM file_line;
/* Make this a function for better debugging. */
static void
-malformed ()
+malformed (void)
{
char numbuf[LINENUM_LENGTH_BOUND + 1];
fatal ("malformed patch at line %s: %s",
@@ -780,9 +775,7 @@ malformed ()
/* Parse a line number from a string.
Return the address of the first char after the number. */
static char *
-scan_linenum (s0, linenum)
- char *s0;
- LINENUM *linenum;
+scan_linenum (char *s0, LINENUM *linenum)
{
char *s;
LINENUM n = 0;
@@ -812,9 +805,7 @@ scan_linenum (s0, linenum)
0 if not; -1 if ran out of memory. */
int
-another_hunk (difftype, rev)
- enum diff difftype;
- int rev;
+another_hunk (enum diff difftype, int rev)
{
register char *s;
register LINENUM context = 0;
@@ -1194,8 +1185,8 @@ another_hunk (difftype, rev)
fillsrc++;
if (p_end < fillsrc || fillsrc == repl_beginning)
{
- fatal ("replacement text or line numbers mangled in hunk at line %ld",
- p_hunk_beg);
+ fatal ("replacement text or line numbers mangled in hunk at line %s",
+ format_linenum (numbuf0, p_hunk_beg));
}
p_line[filldst] = p_line[fillsrc];
p_Char[filldst] = p_Char[fillsrc];
@@ -1506,7 +1497,7 @@ another_hunk (difftype, rev)
}
static size_t
-get_line ()
+get_line (void)
{
return pget_line (p_indent, p_rfc934_nesting, p_strip_trailing_cr);
}
@@ -1521,10 +1512,7 @@ get_line ()
Return -1 if we ran out of memory. */
static size_t
-pget_line (indent, rfc934_nesting, strip_trailing_cr)
- int indent;
- int rfc934_nesting;
- int strip_trailing_cr;
+pget_line (int indent, int rfc934_nesting, int strip_trailing_cr)
{
register FILE *fp = pfp;
register int c;
@@ -1609,7 +1597,7 @@ pget_line (indent, rfc934_nesting, strip_trailing_cr)
}
static bool
-incomplete_line ()
+incomplete_line (void)
{
register FILE *fp = pfp;
register int c;
@@ -1632,7 +1620,7 @@ incomplete_line ()
/* Reverse the old and new portions of the current hunk. */
bool
-pch_swap()
+pch_swap (void)
{
char **tp_line; /* the text of the hunk */
size_t *tp_len; /* length of each line */
@@ -1734,8 +1722,7 @@ pch_swap()
Return 1 for empty, 2 for nonexistent. */
bool
-pch_says_nonexistent (which)
- int which;
+pch_says_nonexistent (int which)
{
return p_says_nonexistent[which];
}
@@ -1744,8 +1731,7 @@ pch_says_nonexistent (which)
or -1 if there was no timestamp or an error in the timestamp. */
time_t
-pch_timestamp (which)
- int which;
+pch_timestamp (int which)
{
return p_timestamp[which];
}
@@ -1753,7 +1739,7 @@ pch_timestamp (which)
/* Return the specified line position in the old file of the old context. */
LINENUM
-pch_first()
+pch_first (void)
{
return p_first;
}
@@ -1761,7 +1747,7 @@ pch_first()
/* Return the number of lines of old context. */
LINENUM
-pch_ptrn_lines()
+pch_ptrn_lines (void)
{
return p_ptrn_lines;
}
@@ -1769,7 +1755,7 @@ pch_ptrn_lines()
/* Return the probable line position in the new file of the first line. */
LINENUM
-pch_newfirst()
+pch_newfirst (void)
{
return p_newfirst;
}
@@ -1777,7 +1763,7 @@ pch_newfirst()
/* Return the number of lines in the replacement text including context. */
LINENUM
-pch_repl_lines()
+pch_repl_lines (void)
{
return p_repl_lines;
}
@@ -1785,7 +1771,7 @@ pch_repl_lines()
/* Return the number of lines in the whole hunk. */
LINENUM
-pch_end()
+pch_end (void)
{
return p_end;
}
@@ -1793,7 +1779,7 @@ pch_end()
/* Return the number of context lines before the first changed line. */
LINENUM
-pch_prefix_context ()
+pch_prefix_context (void)
{
return p_prefix_context;
}
@@ -1801,7 +1787,7 @@ pch_prefix_context ()
/* Return the number of context lines after the last changed line. */
LINENUM
-pch_suffix_context ()
+pch_suffix_context (void)
{
return p_suffix_context;
}
@@ -1809,8 +1795,7 @@ pch_suffix_context ()
/* Return the length of a particular patch line. */
size_t
-pch_line_len(line)
-LINENUM line;
+pch_line_len (LINENUM line)
{
return p_len[line];
}
@@ -1818,8 +1803,7 @@ LINENUM line;
/* Return the control character (+, -, *, !, etc) for a patch line. */
char
-pch_char(line)
-LINENUM line;
+pch_char (LINENUM line)
{
return p_Char[line];
}
@@ -1827,8 +1811,7 @@ LINENUM line;
/* Return a pointer to a particular patch line. */
char *
-pfetch(line)
-LINENUM line;
+pfetch (LINENUM line)
{
return p_line[line];
}
@@ -1836,9 +1819,7 @@ LINENUM line;
/* Output a patch line. */
bool
-pch_write_line (line, file)
- LINENUM line;
- FILE *file;
+pch_write_line (LINENUM line, FILE *file)
{
bool after_newline = p_line[line][p_len[line] - 1] == '\n';
if (! fwrite (p_line[line], sizeof (*p_line[line]), p_len[line], file))
@@ -1849,7 +1830,7 @@ pch_write_line (line, file)
/* Return where in the patch file this hunk began, for error messages. */
LINENUM
-pch_hunk_beg()
+pch_hunk_beg (void)
{
return p_hunk_beg;
}
@@ -1857,8 +1838,7 @@ pch_hunk_beg()
/* Apply an ed script by feeding ed itself. */
void
-do_ed_script (ofp)
- FILE *ofp;
+do_ed_script (FILE *ofp)
{
static char const ed_program[] = ed_PROGRAM;
diff --git a/quotearg.c b/quotearg.c
index 7cdad92..5ac903c 100644
--- a/quotearg.c
+++ b/quotearg.c
@@ -1,5 +1,5 @@
/* quotearg.c - quote arguments for output
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -17,6 +17,8 @@
/* Written by Paul Eggert <eggert@twinsun.com> */
+/* FIXME: Multibyte characters are not supported yet. */
+
#if HAVE_CONFIG_H
# include <config.h>
#endif
@@ -37,14 +39,21 @@
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
+#if ENABLE_NLS
+# include <libintl.h>
+# define _(text) gettext (text)
+#else
+# define _(text) text
+#endif
+
#if HAVE_LIMITS_H
# include <limits.h>
#endif
#ifndef CHAR_BIT
-#define CHAR_BIT 8
+# define CHAR_BIT 8
#endif
#ifndef UCHAR_MAX
-#define UCHAR_MAX ((unsigned char) -1)
+# define UCHAR_MAX ((unsigned char) -1)
#endif
#if HAVE_STDLIB_H
@@ -61,8 +70,8 @@ struct quoting_options
{
/* Basic quoting style. */
enum quoting_style style;
-
- /* Quote the chararacters indicated by this bit vector even if the
+
+ /* Quote the characters indicated by this bit vector even if the
quoting style would not normally require them to be quoted. */
int quote_these_too[((UCHAR_MAX + 1) / INT_BITS
+ ((UCHAR_MAX + 1) % INT_BITS != 0))];
@@ -71,7 +80,24 @@ struct quoting_options
/* Names of quoting styles. */
char const *const quoting_style_args[] =
{
- "literal", "shell", "shell-always", "c", "escape", 0
+ "literal",
+ "shell",
+ "shell-always",
+ "c",
+ "escape",
+ "locale",
+ 0
+};
+
+/* Correspondences to quoting style names. */
+enum quoting_style const quoting_style_vals[] =
+{
+ literal_quoting_style,
+ shell_quoting_style,
+ shell_always_quoting_style,
+ c_quoting_style,
+ escape_quoting_style,
+ locale_quoting_style
};
/* The default quoting options. */
@@ -119,7 +145,7 @@ set_char_quoting (struct quoting_options *o, char c, int i)
*p ^= ((i & 1) ^ r) << shift;
return r;
}
-
+
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using O to control quoting.
If O is null, use the default.
@@ -130,16 +156,17 @@ set_char_quoting (struct quoting_options *o, char c, int i)
If ARGSIZE is -1, use the string length of the argument for ARGSIZE. */
size_t
quotearg_buffer (char *buffer, size_t buffersize,
- char const *arg, size_t argsize,
+ char const *arg, size_t argsize,
struct quoting_options const *o)
{
unsigned char c;
size_t i;
- size_t len;
- int quote_mark;
+ size_t len = 0;
+ char const *quote_string;
+ size_t quote_string_len;
struct quoting_options const *p = o ? o : &default_quoting_options;
enum quoting_style quoting_style = p->style;
-# define STORE(c) \
+#define STORE(c) \
do \
{ \
if (len < buffersize) \
@@ -151,18 +178,17 @@ quotearg_buffer (char *buffer, size_t buffersize,
switch (quoting_style)
{
case shell_quoting_style:
- if (! (argsize == -1 ? arg[0] == '\0' : argsize == 0))
+ if (! (argsize == (size_t) -1 ? arg[0] == '\0' : argsize == 0))
{
switch (arg[0])
{
case '#': case '~':
break;
-
+
default:
- len = 0;
for (i = 0; ; i++)
{
- if (argsize == -1 ? arg[i] == '\0' : i == argsize)
+ if (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize)
goto done;
c = arg[i];
@@ -184,32 +210,40 @@ quotearg_buffer (char *buffer, size_t buffersize,
STORE (c);
}
-
needs_quoting:;
+
+ len = 0;
break;
}
}
/* Fall through. */
case shell_always_quoting_style:
- quote_mark = '\'';
+ STORE ('\'');
+ quote_string = "'";
+ quote_string_len = 1;
break;
case c_quoting_style:
- quote_mark = '"';
+ STORE ('"');
+ quote_string = "\"";
+ quote_string_len = 1;
+ break;
+
+ case locale_quoting_style:
+ for (quote_string = _("`"); *quote_string; quote_string++)
+ STORE (*quote_string);
+ quote_string = _("'");
+ quote_string_len = strlen (quote_string);
break;
default:
- quote_mark = 0;
+ quote_string = 0;
+ quote_string_len = 0;
break;
}
- len = 0;
-
- if (quote_mark)
- STORE (quote_mark);
-
- for (i = 0; ! (argsize == -1 ? arg[i] == '\0' : i == argsize); i++)
+ for (i = 0; ! (argsize == (size_t) -1 ? arg[i] == '\0' : i == argsize); i++)
{
c = arg[i];
@@ -230,6 +264,7 @@ quotearg_buffer (char *buffer, size_t buffersize,
case c_quoting_style:
case escape_quoting_style:
+ case locale_quoting_style:
switch (c)
{
case '?': /* Do not generate trigraphs. */
@@ -242,42 +277,38 @@ quotearg_buffer (char *buffer, size_t buffersize,
case '\r': c = 'r'; goto store_escape;
case '\t': c = 't'; goto store_escape;
case '\v': c = 'v'; goto store_escape;
-
- case ' ':
- if (quoting_style == escape_quoting_style)
- goto store_escape;
- break;
-
- case '"':
- if (quoting_style == c_quoting_style)
- goto store_escape;
- break;
-
+
+ case ' ': break;
+
default:
+ if (quote_string_len
+ && strncmp (arg + i, quote_string, quote_string_len) == 0)
+ goto store_escape;
if (!ISGRAPH (c))
{
STORE ('\\');
STORE ('0' + (c >> 6));
- STORE ('0' + ((c >> 3) & 3));
- c = '0' + (c & 3);
+ STORE ('0' + ((c >> 3) & 7));
+ c = '0' + (c & 7);
goto store_c;
}
break;
}
-
+
if (! (p->quote_these_too[c / INT_BITS] & (1 << (c % INT_BITS))))
goto store_c;
-
+
store_escape:
STORE ('\\');
}
-
+
store_c:
STORE (c);
}
- if (quote_mark)
- STORE (quote_mark);
+ if (quote_string)
+ for (; *quote_string; quote_string++)
+ STORE (*quote_string);
done:
if (len < buffersize)
@@ -289,11 +320,13 @@ quotearg_buffer (char *buffer, size_t buffersize,
OPTIONS specifies the quoting options.
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
- N must be nonnegative. */
+ N must be nonnegative. N is deliberately declared with type `int'
+ to allow for future extensions (using negative values). */
static char *
-quotearg_n_options (int n, char const *arg, struct quoting_options *options)
+quotearg_n_options (int n, char const *arg,
+ struct quoting_options const *options)
{
- static unsigned nslots;
+ static unsigned int nslots;
static struct slotvec
{
size_t size;
@@ -328,7 +361,7 @@ quotearg_n_options (int n, char const *arg, struct quoting_options *options)
}
char *
-quotearg_n (int n, char const *arg)
+quotearg_n (unsigned int n, char const *arg)
{
return quotearg_n_options (n, arg, &default_quoting_options);
}
@@ -340,6 +373,21 @@ quotearg (char const *arg)
}
char *
+quotearg_n_style (unsigned int n, enum quoting_style s, char const *arg)
+{
+ struct quoting_options o;
+ o.style = s;
+ memset (o.quote_these_too, 0, sizeof o.quote_these_too);
+ return quotearg_n_options (n, arg, &o);
+}
+
+char *
+quotearg_style (enum quoting_style s, char const *arg)
+{
+ return quotearg_n_style (0, s, arg);
+}
+
+char *
quotearg_char (char const *arg, char ch)
{
struct quoting_options options;
diff --git a/quotearg.h b/quotearg.h
index 0ace3df..2a600e7 100644
--- a/quotearg.h
+++ b/quotearg.h
@@ -1,5 +1,5 @@
/* quotearg.h - quote arguments for output
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,17 +24,18 @@ enum quoting_style
shell_quoting_style, /* --quoting-style=shell */
shell_always_quoting_style, /* --quoting-style=shell-always */
c_quoting_style, /* --quoting-style=c */
- escape_quoting_style /* --quoting-style=escape */
+ escape_quoting_style, /* --quoting-style=escape */
+ locale_quoting_style /* --quoting-style=locale */
};
-/* For now, --quoting-style=literal is the default, but
- this is planned to change to --quoting-style=shell in the future. */
+/* For now, --quoting-style=literal is the default, but this may change. */
#ifndef DEFAULT_QUOTING_STYLE
-#define DEFAULT_QUOTING_STYLE literal_quoting_style
+# define DEFAULT_QUOTING_STYLE literal_quoting_style
#endif
-/* Names of quoting styles. */
+/* Names of quoting styles and their corresponding values. */
extern char const *const quoting_style_args[];
+extern enum quoting_style const quoting_style_vals[];
struct quoting_options;
@@ -69,7 +70,7 @@ void set_quoting_style PARAMS ((struct quoting_options *o,
0 (the default) and 1 (which means to quote the character even if
it would not otherwise be quoted). */
int set_char_quoting PARAMS ((struct quoting_options *o, char c, int i));
-
+
/* Place into buffer BUFFER (of size BUFFERSIZE) a quoted version of
argument ARG (of size ARGSIZE), using O to control quoting.
If O is null, use the default.
@@ -87,11 +88,20 @@ size_t quotearg_buffer PARAMS ((char *buffer, size_t buffersize,
The returned value points to static storage that can be
reused by the next call to this function with the same value of N.
N must be nonnegative. */
-char *quotearg_n PARAMS ((int n, char const *arg));
+char *quotearg_n PARAMS ((unsigned int n, char const *arg));
-/* Equivalent to quotearg_n (ARG, 0). */
+/* Equivalent to quotearg_n (0, ARG). */
char *quotearg PARAMS ((char const *arg));
+/* Use style S and storage slot N to return a quoted version of the string ARG.
+ This is like quotearg_n (N, ARG), except that it uses S with no other
+ options to specify the quoting method. */
+char *quotearg_n_style PARAMS ((unsigned int n, enum quoting_style s,
+ char const *arg));
+
+/* Equivalent to quotearg_n_style (0, S, ARG). */
+char *quotearg_style PARAMS ((enum quoting_style s, char const *arg));
+
/* Like quotearg (ARG), except also quote any instances of CH. */
char *quotearg_char PARAMS ((char const *arg, char ch));
diff --git a/rename.c b/rename.c
index d04a8bc..8dcd3e5 100644
--- a/rename.c
+++ b/rename.c
@@ -38,12 +38,9 @@ extern int errno;
Return 0 if successful, -1 if not. */
int
-rename (from, to)
- char *from;
- char *to;
+rename (char *from, char *to)
{
struct stat from_stats, to_stats;
- int pid, status;
if (stat (from, &from_stats))
return -1;
@@ -76,23 +73,27 @@ rename (from, to)
if (S_ISDIR (from_stats.st_mode))
{
/* Need a setuid root process to link and unlink directories. */
- pid = fork ();
+ int status;
+ pid_t pid = fork ();
switch (pid)
{
case -1: /* Error. */
- error (1, errno, "cannot fork");
+ return -1; /* errno already set */
case 0: /* Child. */
execl (MVDIR, "mvdir", from, to, (char *) 0);
- error (255, errno, "cannot run `%s'", MVDIR);
+ _exit (1);
default: /* Parent. */
while (wait (&status) != pid)
/* Do nothing. */ ;
- errno = 0; /* mvdir printed the system error message. */
if (status)
- return -1;
+ {
+ /* MVDIR failed. */
+ errno = EIO;
+ return -1;
+ }
}
}
else
diff --git a/rmdir.c b/rmdir.c
new file mode 100644
index 0000000..2a92803
--- /dev/null
+++ b/rmdir.c
@@ -0,0 +1,87 @@
+/* BSD compatible remove directory function for System V
+ Copyright (C) 1988, 1990 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <errno.h>
+#ifndef errno
+extern int errno;
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISDIR
+#endif
+
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
+/* rmdir adapted from GNU tar. */
+
+/* Remove directory DPATH.
+ Return 0 if successful, -1 if not. */
+
+int
+rmdir (dpath)
+ char *dpath;
+{
+ pid_t cpid;
+ int status;
+ struct stat statbuf;
+
+ if (stat (dpath, &statbuf) != 0)
+ return -1; /* errno already set */
+
+ if (!S_ISDIR (statbuf.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+
+ cpid = fork ();
+ switch (cpid)
+ {
+ case -1: /* cannot fork */
+ return -1; /* errno already set */
+
+ case 0: /* child process */
+ execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
+ _exit (1);
+
+ default: /* parent process */
+
+ /* Wait for kid to finish. */
+
+ while (wait (&status) != cpid)
+ /* Do nothing. */ ;
+
+ if (status)
+ {
+
+ /* /bin/rmdir failed. */
+
+ errno = EIO;
+ return -1;
+ }
+ return 0;
+ }
+}
diff --git a/util.c b/util.c
index aa31392..345210f 100644
--- a/util.c
+++ b/util.c
@@ -1,30 +1,29 @@
/* utility functions for `patch' */
-/* $Id: util.c,v 1.25 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: util.c,v 1.27 1999/08/30 06:20:08 eggert Exp $ */
-/*
-Copyright 1986 Larry Wall
-Copyright 1992, 1993, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright 1986 Larry Wall
+ Copyright 1992, 1993, 1997-1998, 1999 Free Software Foundation, Inc.
-This program 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.
+ This program 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.
-This program 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.
+ This program 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; see the file COPYING.
-If not, write to the Free Software Foundation,
-59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*/
+ You should have received a copy of the GNU General Public License
+ along with this program; see the file COPYING.
+ If not, write to the Free Software Foundation,
+ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define XTERN extern
#include <common.h>
#include <backupfile.h>
+#include <basename.h>
#include <quotearg.h>
#include <quotesys.h>
#include <version.h>
@@ -70,20 +69,9 @@ static void makedirs PARAMS ((char *));
FROM_NEEDS_REMOVAL must be nonnull if FROM is nonnull.
Back up TO if BACKUP is nonzero. */
-#ifdef __STDC__
-/* If mode_t doesn't promote to itself, we can't use old-style definition. */
void
move_file (char const *from, int volatile *from_needs_removal,
char *to, mode_t mode, int backup)
-#else
-void
-move_file (from, from_needs_removal, to, mode, backup)
- char const *from;
- int volatile *from_needs_removal;
- char *to;
- mode_t mode;
- int backup;
-#endif
{
struct stat to_st;
int to_errno = ! backup ? -1 : stat (to, &to_st) == 0 ? 0 : errno;
@@ -116,7 +104,7 @@ move_file (from, from_needs_removal, to, mode, backup)
}
else
{
- bakname = find_backup_file_name (to);
+ bakname = find_backup_file_name (to, backup_type);
if (!bakname)
memory_fatal ();
}
@@ -213,17 +201,8 @@ move_file (from, from_needs_removal, to, mode, backup)
/* Create FILE with OPEN_FLAGS, and with MODE adjusted so that
we can read and write the file and that the file is not executable.
Return the file descriptor. */
-#ifdef __STDC__
-/* If mode_t doesn't promote to itself, we can't use old-style definition. */
int
create_file (char const *file, int open_flags, mode_t mode)
-#else
-int
-create_file (file, open_flags, mode)
- char const *file;
- int open_flags;
- mode_t mode;
-#endif
{
int fd;
mode |= S_IRUSR | S_IWUSR;
@@ -238,18 +217,8 @@ create_file (file, open_flags, mode)
/* Copy a file. */
-#ifdef __STDC__
-/* If mode_t doesn't promote to itself, we can't use old-style definition. */
void
copy_file (char const *from, char const *to, int to_flags, mode_t mode)
-#else
-void
-copy_file (from, to, to_flags, mode)
- char const *from;
- char const *to;
- int to_flags;
- mode_t mode;
-#endif
{
int tofd;
int fromfd;
@@ -296,12 +265,8 @@ static char const CLEARTOOL_CO[] = "cleartool co -unr -nc ";
(but set *DIFFBUF to 0 if the diff operation is meaningless).
*GETBUF and *DIFFBUF must be freed by the caller. */
char const *
-version_controller (filename, readonly, filestat, getbuf, diffbuf)
- char const *filename;
- int readonly;
- struct stat const *filestat;
- char **getbuf;
- char **diffbuf;
+version_controller (char const *filename, int readonly,
+ struct stat const *filestat, char **getbuf, char **diffbuf)
{
struct stat cstat;
char const *filebase = base_name (filename);
@@ -409,13 +374,8 @@ version_controller (filename, readonly, filestat, getbuf, diffbuf)
Store the resulting file status into *FILESTAT.
Return nonzero if successful. */
int
-version_get (filename, cs, exists, readonly, getbuf, filestat)
- char const *filename;
- char const *cs;
- int exists;
- int readonly;
- char const *getbuf;
- struct stat *filestat;
+version_get (char const *filename, char const *cs, int exists, int readonly,
+ char const *getbuf, struct stat *filestat)
{
if (patch_get < 0)
{
@@ -448,9 +408,7 @@ version_get (filename, cs, exists, readonly, getbuf, filestat)
/* Allocate a unique area for a string. */
char *
-savebuf (s, size)
- register char const *s;
- register size_t size;
+savebuf (register char const *s, register size_t size)
{
register char *rv;
@@ -469,16 +427,13 @@ savebuf (s, size)
}
char *
-savestr(s)
- char const *s;
+savestr (char const *s)
{
return savebuf (s, strlen (s) + 1);
}
void
-remove_prefix (p, prefixlen)
- char *p;
- size_t prefixlen;
+remove_prefix (char *p, size_t prefixlen)
{
char const *s = p + prefixlen;
while ((*p++ = *s++))
@@ -486,9 +441,7 @@ remove_prefix (p, prefixlen)
}
char *
-format_linenum (numbuf, n)
- char numbuf[LINENUM_LENGTH_BOUND + 1];
- LINENUM n;
+format_linenum (char numbuf[LINENUM_LENGTH_BOUND + 1], LINENUM n)
{
char *p = numbuf + LINENUM_LENGTH_BOUND;
*p = '\0';
@@ -513,12 +466,8 @@ format_linenum (numbuf, n)
#if !HAVE_VPRINTF
#define vfprintf my_vfprintf
-static int vfprintf PARAMS ((FILE *, char const *, va_list));
static int
-vfprintf (stream, format, args)
- FILE *stream;
- char const *format;
- va_list args;
+vfprintf (FILE *stream, char const *format, va_list args)
{
#if !HAVE_DOPRNT && HAVE__DOPRINTF
# define _doprnt _doprintf
@@ -536,15 +485,8 @@ vfprintf (stream, format, args)
/* Terminal output, pun intended. */
-#ifdef __STDC__
void
fatal (char const *format, ...)
-#else
-/*VARARGS1*/ void
-fatal (format, va_alist)
- char const *format;
- va_dcl
-#endif
{
va_list args;
fprintf (stderr, "%s: **** ", program_name);
@@ -557,34 +499,27 @@ fatal (format, va_alist)
}
void
-memory_fatal ()
+memory_fatal (void)
{
fatal ("out of memory");
}
void
-read_fatal ()
+read_fatal (void)
{
pfatal ("read error");
}
void
-write_fatal ()
+write_fatal (void)
{
pfatal ("write error");
}
/* Say something from patch, something from the system, then silence . . . */
-#ifdef __STDC__
void
pfatal (char const *format, ...)
-#else
-/*VARARGS1*/ void
-pfatal (format, va_alist)
- char const *format;
- va_dcl
-#endif
{
int errnum = errno;
va_list args;
@@ -601,15 +536,8 @@ pfatal (format, va_alist)
/* Tell the user something. */
-#ifdef __STDC__
void
say (char const *format, ...)
-#else
-/*VARARGS1*/ void
-say (format, va_alist)
- char const *format;
- va_dcl
-#endif
{
va_list args;
vararg_start (args, format);
@@ -620,15 +548,8 @@ say (format, va_alist)
/* Get a response from the user, somehow or other. */
-#ifdef __STDC__
void
ask (char const *format, ...)
-#else
-/*VARARGS1*/ void
-ask (format, va_alist)
- char const *format;
- va_dcl
-#endif
{
static int ttyfd = -2;
int r;
@@ -686,14 +607,8 @@ ask (format, va_alist)
/* Return nonzero if it OK to reverse a patch. */
-#ifdef __STDC__
int
ok_to_reverse (char const *format, ...)
-#else
-ok_to_reverse (format, va_alist)
- char const *format;
- va_dcl
-#endif
{
int r = 0;
@@ -798,8 +713,7 @@ static sigset_t signals_to_block;
#if ! HAVE_SIGACTION
static RETSIGTYPE fatal_exit_handler PARAMS ((int)) __attribute__ ((noreturn));
static RETSIGTYPE
-fatal_exit_handler (sig)
- int sig;
+fatal_exit_handler (int sig)
{
signal (sig, SIG_IGN);
fatal_exit (sig);
@@ -807,8 +721,7 @@ fatal_exit_handler (sig)
#endif
void
-set_signals(reset)
-int reset;
+set_signals (int reset)
{
int i;
#if HAVE_SIGACTION
@@ -861,7 +774,7 @@ int reset;
/* How to handle certain events when in a critical region. */
void
-ignore_signals()
+ignore_signals (void)
{
#if HAVE_SIGPROCMASK || HAVE_SIGSETMASK
sigprocmask (SIG_BLOCK, &signals_to_block, &initial_signal_mask);
@@ -874,8 +787,7 @@ ignore_signals()
}
void
-exit_with_signal (sig)
- int sig;
+exit_with_signal (int sig)
{
sigset_t s;
signal (sig, SIG_DFL);
@@ -887,8 +799,7 @@ exit_with_signal (sig)
}
int
-systemic (command)
- char const *command;
+systemic (char const *command)
{
if (debug & 8)
say ("+ %s\n", command);
@@ -896,66 +807,11 @@ systemic (command)
return system (command);
}
-#if !HAVE_MKDIR
-/* These mkdir and rmdir substitutes are good enough for `patch';
- they are not general emulators. */
-
-static int doprogram PARAMS ((char const *, char const *));
-static int mkdir PARAMS ((char const *, mode_t));
-static int rmdir PARAMS ((char const *));
-
-static int
-doprogram (program, arg)
- char const *program;
- char const *arg;
-{
- int result;
- static char const DISCARD_OUTPUT[] = " 2>/dev/null";
- size_t program_len = strlen (program);
- char *cmd = xmalloc (program_len + 1 + quote_system_arg (0, arg)
- + sizeof DISCARD_OUTPUT);
- char *p = cmd;
- strcpy (p, program);
- p += program_len;
- *p++ = ' ';
- p += quote_system_arg (p, arg);
- strcpy (p, DISCARD_OUTPUT);
- result = systemic (cmd);
- free (cmd);
- return result;
-}
-
-#ifdef __STDC__
-/* If mode_t doesn't promote to itself, we can't use old-style definition. */
-static int
-mkdir (char const *path, mode_t mode)
-#else
-static int
-mkdir (path, mode)
- char const *path;
- mode_t mode; /* ignored */
-#endif
-{
- return doprogram ("mkdir", path);
-}
-
-static int
-rmdir (path)
- char const *path;
-{
- int result = doprogram ("rmdir", path);
- errno = EEXIST;
- return result;
-}
-#endif
-
/* Replace '/' with '\0' in FILENAME if it marks a place that
needs testing for the existence of directory. Return the address
of the last location replaced, or 0 if none were replaced. */
-static char *replace_slashes PARAMS ((char *));
static char *
-replace_slashes (filename)
- char *filename;
+replace_slashes (char *filename)
{
char *f;
char *last_location_replaced = 0;
@@ -997,8 +853,7 @@ replace_slashes (filename)
Ignore the last element of `filename'. */
static void
-makedirs (filename)
- register char *filename;
+makedirs (register char *filename)
{
register char *f;
register char *flim = replace_slashes (filename);
@@ -1026,8 +881,7 @@ makedirs (filename)
Ignore errors, since the path may contain ".."s, and when there
is an EEXIST failure the system may return some other error number. */
void
-removedirs (filename)
- char *filename;
+removedirs (char *filename)
{
size_t i;
@@ -1051,7 +905,7 @@ removedirs (filename)
static time_t initial_time;
void
-init_time ()
+init_time (void)
{
time (&initial_time);
}
@@ -1059,10 +913,7 @@ init_time ()
/* Make filenames more reasonable. */
char *
-fetchname (at, strip_leading, pstamp)
-char *at;
-int strip_leading;
-time_t *pstamp;
+fetchname (char *at, int strip_leading, time_t *pstamp)
{
char *name;
register char *t;
@@ -1117,15 +968,20 @@ time_t *pstamp;
if (!*name)
return 0;
- /* Ignore the name if it doesn't have enough slashes to strip off,
- or if it is "/dev/null". */
- if (0 < sleading || strcmp (at, "/dev/null") == 0)
+ /* If the name is "/dev/null", ignore the name and mark the file
+ as being nonexistent. The name "/dev/null" appears in patches
+ regardless of how NULL_DEVICE is spelled. */
+ if (strcmp (at, "/dev/null") == 0)
{
if (pstamp)
*pstamp = 0;
return 0;
}
+ /* Ignore the name if it doesn't have enough slashes to strip off. */
+ if (0 < sleading)
+ return 0;
+
if (pstamp)
*pstamp = stamp;
@@ -1133,10 +989,7 @@ time_t *pstamp;
}
void
-Fseek (stream, offset, ptrname)
- FILE *stream;
- file_offset offset;
- int ptrname;
+Fseek (FILE *stream, file_offset offset, int ptrname)
{
if (file_seek (stream, offset, ptrname) != 0)
pfatal ("fseek");
diff --git a/util.h b/util.h
index 93353a0..3fe0b3e 100644
--- a/util.h
+++ b/util.h
@@ -1,11 +1,13 @@
/* utility functions for `patch' */
-/* $Id: util.h,v 1.16 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: util.h,v 1.17 1999/08/30 06:20:08 eggert Exp $ */
/* An upper bound on the print length of a signed decimal line number.
Add one for the sign. */
#define LINENUM_LENGTH_BOUND (sizeof (LINENUM) * CHAR_BIT / 3 + 1)
+XTERN enum backup_type backup_type;
+
int ok_to_reverse PARAMS ((char const *, ...)) __attribute__ ((format (printf, 1, 2)));
void ask PARAMS ((char const *, ...)) __attribute__ ((format (printf, 1, 2)));
void say PARAMS ((char const *, ...)) __attribute__ ((format (printf, 1, 2)));
diff --git a/version.c b/version.c
index b32fdd1..c6b62ce 100644
--- a/version.c
+++ b/version.c
@@ -1,6 +1,6 @@
/* Print the version number. */
-/* $Id: version.c,v 1.6 1998/03/15 14:44:47 eggert Exp $ */
+/* $Id: version.c,v 1.7 1999/08/30 06:20:08 eggert Exp $ */
#define XTERN extern
#include <common.h>
@@ -11,7 +11,7 @@
static char const copyright_string[] = "\
Copyright 1984-1988 Larry Wall\n\
-Copyright 1989-1998 Free Software Foundation, Inc.";
+Copyright 1989-1999 Free Software Foundation, Inc.";
static char const free_software_msgid[] = "\
This program comes with NO WARRANTY, to the extent permitted by law.\n\
@@ -20,10 +20,10 @@ under the terms of the GNU General Public License.\n\
For more information about these matters, see the file named COPYING.";
static char const authorship_msgid[] = "\
-written by Larry Wall with lots o' patches by Paul Eggert";
+written by Larry Wall and Paul Eggert";
void
-version()
+version (void)
{
printf ("%s %s\n%s\n\n%s\n\n%s\n", program_name, PATCH_VERSION,
copyright_string, free_software_msgid, authorship_msgid);
diff --git a/xalloc.h b/xalloc.h
index 3f8d779..2709ad8 100644
--- a/xalloc.h
+++ b/xalloc.h
@@ -1,21 +1,52 @@
-#ifndef PARAMS
-# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
-# define PARAMS(Args) Args
-# else
-# define PARAMS(Args) ()
+/* xalloc.h -- malloc with out-of-memory checking
+ Copyright (C) 1990-1998, 1999 Free Software Foundation, Inc.
+
+ This program 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.
+
+ This program 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. */
+
+#ifndef XALLOC_H_
+# define XALLOC_H_
+
+# ifndef PARAMS
+# if defined PROTOTYPES || (defined __STDC__ && __STDC__)
+# define PARAMS(Args) Args
+# else
+# define PARAMS(Args) ()
+# endif
# endif
-#endif
/* Exit value when the requested amount of memory is not available.
- The caller may set it to some other value. */
+ It is initialized to EXIT_FAILURE, but the caller may set it to
+ some other value. */
extern int xalloc_exit_failure;
-/* FIXME: describe */
-extern char *const xalloc_msg_memory_exhausted;
-
-/* FIXME: describe */
+/* If this pointer is non-zero, run the specified function upon each
+ allocation failure. It is initialized to zero. */
extern void (*xalloc_fail_func) ();
+/* If XALLOC_FAIL_FUNC is undefined or a function that returns, this
+ message must be non-NULL. It is translated via gettext.
+ The default value is "Memory exhausted". */
+extern char *const xalloc_msg_memory_exhausted;
+
void *xmalloc PARAMS ((size_t n));
void *xcalloc PARAMS ((size_t n, size_t s));
void *xrealloc PARAMS ((void *p, size_t n));
+
+# define XMALLOC(Type, N_bytes) ((Type *) xmalloc (sizeof (Type) * (N_bytes)))
+# define XCALLOC(Type, N_bytes) ((Type *) xcalloc (sizeof (Type), (N_bytes)))
+# define XREALLOC(Ptr, Type, N_bytes) \
+ ((Type *) xrealloc ((void *) (Ptr), sizeof (Type) * (N_bytes)))
+
+#endif /* !XALLOC_H_ */
diff --git a/xmalloc.c b/xmalloc.c
index 204469f..696cf3c 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -1,5 +1,5 @@
/* xmalloc.c -- malloc with out of memory checking
- Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+ Copyright (C) 1990-1997, 98, 99 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,13 +46,6 @@ void free ();
# define EXIT_FAILURE 1
#endif
-/* Prototypes for functions defined here. */
-#if defined (__STDC__) && __STDC__
-void *xmalloc (size_t n);
-void *xcalloc (size_t n, size_t s);
-void *xrealloc (void *p, size_t n);
-#endif
-
#ifndef HAVE_DONE_WORKING_MALLOC_CHECK
you must run the autoconf test for a properly working malloc -- see malloc.m4
#endif
@@ -65,31 +58,25 @@ you must run the autoconf test for a properly working realloc -- see realloc.m4
The caller may set it to some other value. */
int xalloc_exit_failure = EXIT_FAILURE;
-/* FIXME: describe */
-char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
-
-/* FIXME: describe */
+/* If non NULL, call this function when memory is exhausted. */
void (*xalloc_fail_func) () = 0;
-#if __STDC__ && (HAVE_VPRINTF || HAVE_DOPRNT)
-void error (int, int, const char *, ...);
-#else
-void error ();
-#endif
+/* If XALLOC_FAIL_FUNC is NULL, or does return, display this message
+ before exiting when memory is exhausted. Goes through gettext. */
+char *const xalloc_msg_memory_exhausted = N_("Memory exhausted");
static void
-xalloc_fail ()
+xalloc_fail (void)
{
if (xalloc_fail_func)
(*xalloc_fail_func) ();
- error (xalloc_exit_failure, 0, xalloc_msg_memory_exhausted);
+ error (xalloc_exit_failure, 0, "%s", _(xalloc_msg_memory_exhausted));
}
/* Allocate N bytes of memory dynamically, with error checking. */
void *
-xmalloc (n)
- size_t n;
+xmalloc (size_t n)
{
void *p;
@@ -104,9 +91,7 @@ xmalloc (n)
If P is NULL, run xmalloc. */
void *
-xrealloc (p, n)
- void *p;
- size_t n;
+xrealloc (void *p, size_t n)
{
p = realloc (p, n);
if (p == 0)
@@ -114,13 +99,10 @@ xrealloc (p, n)
return p;
}
-#ifdef NOT_USED
-
/* Allocate memory for N elements of S bytes, with error checking. */
void *
-xcalloc (n, s)
- size_t n, s;
+xcalloc (size_t n, size_t s)
{
void *p;
@@ -129,5 +111,3 @@ xcalloc (n, s)
xalloc_fail ();
return p;
}
-
-#endif /* NOT_USED */