home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-27 | 136.8 KB | 4,789 lines |
- diff -rc2N /free/libg++-2.5.3/Makefile /sources/libg++-2.5.3-amiga/Makefile
- *** /free/libg++-2.5.3/Makefile Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/Makefile Sun Dec 5 16:47:57 1993
- ***************
- *** 0 ****
- --- 1,1133 ----
- + # This file was generated automatically by configure. Do not edit.
- + VPATH = .
- + links =
- + host_alias = amigados
- + host_cpu = m68k
- + host_vendor = cbm
- + host_os = amigados
- + host_canonical = m68k-cbm-amigados
- + target_alias = amigados
- + target_cpu = m68k
- + target_vendor = cbm
- + target_os = amigados
- + target_canonical = m68k-cbm-amigados
- + #
- + # Makefile for directory with subdirs to build.
- + # Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation
- + #
- + # 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
- + #
- +
- + srcdir = .
- +
- + prefix = /usr/local
- +
- + exec_prefix = $(prefix)
- + bindir = $(exec_prefix)/bin
- + libdir = $(exec_prefix)/lib
- + tooldir = $(exec_prefix)/amigados
- +
- + program_transform_name =
- +
- + datadir = $(prefix)/lib
- + mandir = $(prefix)/man
- + man1dir = $(mandir)/man1
- + man2dir = $(mandir)/man2
- + man3dir = $(mandir)/man3
- + man4dir = $(mandir)/man4
- + man5dir = $(mandir)/man5
- + man6dir = $(mandir)/man6
- + man7dir = $(mandir)/man7
- + man8dir = $(mandir)/man8
- + man9dir = $(mandir)/man9
- + infodir = $(prefix)/info
- + includedir = $(prefix)/include
- + docdir = $(datadir)/doc
- +
- + SHELL = /bin/sh
- +
- + INSTALL = $${srcroot}/install.sh -c
- + INSTALL_PROGRAM = $(INSTALL)
- + INSTALL_DATA = $(INSTALL)
- + INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
- +
- + AS = as
- + AR = ar
- + AR_FLAGS = rc
- + CC = gcc
- +
- + # We don't specify -g -O because many compilers don't support -g -O,
- + # and/or -O is broken in and of itself.
- + CFLAGS = -O2
- +
- + CXX = gcc
- +
- + # Use -O to stress test the compiler.
- + CXXFLAGS = -O2
- +
- + RANLIB = ranlib
- + NM = nm
- + MUNCH_NM = $(NM)
- + GZIP = gzip
- +
- + BISON = bison -y
- + LEX = `if [ -f $${rootme}/flex/flex ] ; \
- + then echo $${rootme}/flex/flex ; \
- + else echo flex ; fi`
- +
- + M4 = `if [ -f $${rootme}/m4/m4 ] ; \
- + then echo $${rootme}/m4/m4 ; \
- + else echo m4 ; fi`
- +
- + MAKEINFO = `if [ -f $${rootme}/texinfo/makeinfo/makeinfo ] ; \
- + then echo $${rootme}/texinfo/makeinfo/makeinfo ; \
- + else echo makeinfo ; fi`
- +
- + # This just becomes part of the MAKEINFO definition passed down to
- + # sub-makes. It lets flags be given on the command line while still
- + # using the makeinfo from the object tree.
- + MAKEINFOFLAGS =
- +
- + EXPECT = `if [ -f $${rootme}/expect/expect ] ; \
- + then echo $${rootme}/expect/expect ; \
- + else echo expect ; fi`
- +
- + RUNTEST = `if [ -f $${srcroot}/dejagnu/runtest ] ; \
- + then echo $${srcroot}/dejagnu/runtest ; \
- + else echo runtest ; fi`
- +
- +
- + # libraries that may need to be augmented on a system-by-system basis
- + X11_LIB = -lX11
- +
- + # compilers to use to create programs which must be run in the build
- + # environment.
- + CC_FOR_BUILD = $(CC)
- + CXX_FOR_BUILD = $(CXX)
- +
- + SUBDIRS = mmalloc libiberty opcodes bfd readline gash tcl tk tclX byacc flex bison binutils ld gas gcc gdb make patch prms send-pr gprof gdbtest tgas etc expect dejagnu sim m4 autoconf ispell grep diff rcs cvs fileutils shellutils textutils wdiff find emacs uudecode hello tar gzip indent recode release sed utils libm libio libg++ groff
- + OTHERS =
- +
- + ALL = all.normal
- + INSTALL_TARGET = install-dirs \
- + $(INSTALL_MODULES) \
- + $(INSTALL_TARGET_MODULES) \
- + $(INSTALL_X11_MODULES) \
- + install-gcc
- +
- + CC_FOR_TARGET = ` \
- + if [ -f $${rootme}/gcc/Makefile ] ; then \
- + echo $${rootme}/gcc/xgcc -B$${rootme}/gcc/; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(CC); \
- + else \
- + t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
- + fi; \
- + fi`
- +
- +
- + CXX_FOR_TARGET = ` \
- + if [ -f $${rootme}/gcc/Makefile ] ; then \
- + echo $${rootme}/gcc/xgcc -B$${rootme}/gcc/; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(CXX); \
- + else \
- + t='$(program_transform_name)'; echo gcc | sed -e '' $$t; \
- + fi; \
- + fi`
- +
- + AS_FOR_TARGET = ` \
- + if [ -f $${rootme}/gas/Makefile ] ; then \
- + echo $${rootme}/gas/as.new ; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(AS); \
- + else \
- + t='$(program_transform_name)'; echo as | sed -e '' $$t ; \
- + fi; \
- + fi`
- +
- + AR_FOR_TARGET = ` \
- + if [ -f $${rootme}/binutils/ar ] ; then \
- + echo $${rootme}/binutils/ar ; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(AR); \
- + else \
- + t='$(program_transform_name)'; echo ar | sed -e '' $$t ; \
- + fi; \
- + fi`
- +
- + RANLIB_FOR_TARGET = ` \
- + if [ -f $${rootme}/binutils/ranlib ] ; then \
- + echo $${rootme}/binutils/ranlib ; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(RANLIB); \
- + else \
- + t='$(program_transform_name)'; echo ranlib | sed -e '' $$t ; \
- + fi; \
- + fi`
- +
- + NM_FOR_TARGET = ` \
- + if [ -f $${rootme}/binutils/Makefile ] ; then \
- + echo $${rootme}/binutils/nm ; \
- + else \
- + if [ "$(host_canonical)" = "$(target_canonical)" ] ; then \
- + echo $(NM); \
- + else \
- + t='$(program_transform_name)'; echo nm | sed -e '' $$t ; \
- + fi; \
- + fi`
- +
- + # FIXME: This is badly named.
- + XTRAFLAGS = ` \
- + if [ -f $${rootme}/gcc/Makefile ] ; then \
- + if [ -f $${rootme}/newlib/Makefile ] ; then \
- + echo -I$${rootme}/newlib/targ-include -I$${srcroot}/newlib/libc/include -I$${rootme}/gcc/include -nostdinc ; \
- + else \
- + echo -I$${rootme}/gcc/include ; \
- + fi ; \
- + else \
- + echo ; \
- + fi`
- +
- + #### host and target specific makefile fragments come in here.
- + ###
- +
- + # Flags to pass down to all sub-makes.
- + # Please keep these in alphabetical order.
- + BASE_FLAGS_TO_PASS = \
- + "AR_FLAGS=$(AR_FLAGS)" \
- + "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
- + "AS_FOR_TARGET=$(AS_FOR_TARGET)" \
- + "BISON=$(BISON)" \
- + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
- + "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
- + "CFLAGS=$(CFLAGS)" \
- + "CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
- + "CXXFLAGS=$(CXXFLAGS)" \
- + "CXX_FOR_TARGET=$(CXX_FOR_TARGET)" \
- + "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
- + "INSTALL=$(INSTALL)" \
- + "INSTALL_DATA=$(INSTALL_DATA)" \
- + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
- + "INSTALL_XFORM=$(INSTALL_XFORM)" \
- + "LDFLAGS=$(LDFLAGS)" \
- + "LEX=$(LEX)" \
- + "M4=$(M4)" \
- + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
- + "MUNCH_NM=$(MUNCH_NM)" \
- + "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
- + "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
- + "EXPECT=$(EXPECT)" \
- + "RUNTEST=$(RUNTEST)" \
- + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
- + "XTRAFLAGS_FOR_TARGET=$(XTRAFLAGS)" \
- + "exec_prefix=$(exec_prefix)" \
- + "prefix=$(prefix)" \
- + "tooldir=$(tooldir)"
- +
- + # Flags to pass down to most sub-makes, in which we're building with
- + # the host environment.
- + # If any variables are added here, they must be added to do-*, below.
- + EXTRA_HOST_FLAGS = \
- + 'AR=$(AR)' \
- + 'AS=$(AS)' \
- + 'CC=$(CC)' \
- + 'CXX=$(CXX)' \
- + 'NM=$(NM)' \
- + 'RANLIB=$(RANLIB)' \
- + 'XTRAFLAGS='
- +
- + FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_HOST_FLAGS)
- +
- + # Flags that are concerned with the location of the X11 include files
- + # and library files
- + X11_FLAGS_TO_PASS = \
- + "X11_INCLUDE_FLAGS=$(X11_INCLUDE_FLAGS)" \
- + "X11_LIB_FLAGS=$(X11_LIB_FLAGS)" \
- + "X11_LIB=$(X11_LIB)"
- +
- + # Flags to pass down to makes which are built with the target environment.
- + # The double $ decreases the length of the command line; the variables
- + # are set in BASE_FLAGS_TO_PASS, and the sub-make will expand them.
- + # If any variables are added here, they must be added to do-*, below.
- + EXTRA_TARGET_FLAGS = \
- + 'AR=$$(AR_FOR_TARGET)' \
- + 'AS=$$(AS_FOR_TARGET)' \
- + 'CC=$$(CC_FOR_TARGET)' \
- + 'CXX=$$(CXX_FOR_TARGET)' \
- + 'NM=$$(NM_FOR_TARGET)' \
- + 'RANLIB=$$(RANLIB_FOR_TARGET)' \
- + 'XTRAFLAGS=$$(XTRAFLAGS_FOR_TARGET)'
- +
- + TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
- +
- + # Flags to pass down to gcc. gcc builds a library, libgcc.a, so it
- + # unfortunately needs the native compiler and the target ar and
- + # ranlib.
- + # If any variables are added here, they must be added to do-*, below.
- + # The HOST_* variables are a special case, which are used for the gcc
- + # cross-building scheme.
- + HOST_CC = $(CC_FOR_BUILD)
- + HOST_PREFIX =
- + HOST_PREFIX_1 = loser-
- + EXTRA_GCC_FLAGS = \
- + 'AR=$$(AR_FOR_TARGET)' \
- + 'AS=$(AS)' \
- + 'CC=$(CC)' \
- + 'CXX=$(CXX)' \
- + 'HOST_CC=$(CC_FOR_BUILD)' \
- + 'HOST_PREFIX=$(HOST_PREFIX)' \
- + 'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
- + 'NM=$(NM)' \
- + 'RANLIB=$$(RANLIB_FOR_TARGET)' \
- + 'XTRAFLAGS='
- +
- + GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
- +
- + # This is a list of the targets for all of the modules which are compiled
- + # using $(FLAGS_TO_PASS).
- + ALL_MODULES = \
- + all-autoconf \
- + all-bfd \
- + all-binutils \
- + all-byacc \
- + all-cvs \
- + all-dejagnu \
- + all-diff \
- + all-dosutils \
- + all-etc \
- + all-fileutils \
- + all-find \
- + all-flex \
- + all-gas \
- + all-gawk \
- + all-gdb \
- + all-gprof \
- + all-grep \
- + all-gzip \
- + all-hello \
- + all-indent \
- + all-ispell \
- + all-ld \
- + all-libiberty \
- + all-m4 \
- + all-make \
- + all-mmalloc \
- + all-opcodes \
- + all-pagas \
- + all-patch \
- + all-prms \
- + all-rcs \
- + all-readline \
- + all-release \
- + all-recode \
- + all-sed \
- + all-send-pr \
- + all-shellutils \
- + all-sim \
- + all-tar \
- + all-tcl \
- + all-texinfo \
- + all-textutils \
- + all-tgas \
- + all-time \
- + all-uudecode \
- + all-wdiff
- +
- + # This is a list of the check targets for all of the modules which are
- + # compiled using $(FLAGS_TO_PASS).
- + CHECK_MODULES = \
- + check-autoconf \
- + check-bfd \
- + check-binutils \
- + check-byacc \
- + check-cvs \
- + check-dejagnu \
- + check-diff \
- + check-etc \
- + check-fileutils \
- + check-find \
- + check-flex \
- + check-gas \
- + check-gawk \
- + check-gdb \
- + check-gprof \
- + check-grep \
- + check-gzip \
- + check-hello \
- + check-indent \
- + check-ispell \
- + check-ld \
- + check-libiberty \
- + check-m4 \
- + check-make \
- + check-mmcheckoc \
- + check-opcodes \
- + check-pagas \
- + check-patch \
- + check-prms \
- + check-rcs \
- + check-readline \
- + check-recode \
- + check-sed \
- + check-send-pr \
- + check-shellutils \
- + check-sim \
- + check-tar \
- + check-tcl \
- + check-texinfo \
- + check-textutils \
- + check-tgas \
- + check-time \
- + check-uudecode \
- + check-wdiff
- +
- + # This is a list of the install targets for all of the modules which are
- + # compiled using $(FLAGS_TO_PASS).
- + INSTALL_MODULES = \
- + install-autoconf \
- + install-bfd \
- + install-binutils \
- + install-byacc \
- + install-cvs \
- + install-dejagnu \
- + install-diff \
- + install-etc \
- + install-fileutils \
- + install-find \
- + install-flex \
- + install-gas \
- + install-gawk \
- + install-gdb \
- + install-glob \
- + install-gprof \
- + install-grep \
- + install-gzip \
- + install-hello \
- + install-indent \
- + install-ispell \
- + install-ld \
- + install-libiberty \
- + install-m4 \
- + install-make \
- + install-mmalloc \
- + install-opcodes \
- + install-pagas \
- + install-patch \
- + install-prms \
- + install-rcs \
- + install-readline \
- + install-recode \
- + install-sed \
- + install-send-pr \
- + install-shellutils \
- + install-sim \
- + install-tar \
- + install-tcl \
- + install-textutils \
- + install-tgas \
- + install-time \
- + install-uudecode \
- + install-wdiff
- +
- + # This is a list of the targets for all of the modules which are compiled
- + # using $(X11_FLAGS_TO_PASS).
- + ALL_X11_MODULES = \
- + all-emacs \
- + all-expect \
- + all-gash \
- + all-tclX \
- + all-tk
- +
- + # This is a list of the check targets for all of the modules which are
- + # compiled using $(X11_FLAGS_TO_PASS).
- + CHECK_X11_MODULES = \
- + check-emacs \
- + check-expect \
- + check-gash \
- + check-tclX \
- + check-tk
- +
- + # This is a list of the install targets for all the modules which are
- + # compiled using $(X11_FLAGS_TO_PASS).
- + INSTALL_X11_MODULES = \
- + install-emacs \
- + install-expect \
- + install-gash \
- + install-tclX \
- + install-tk
- +
- + # This is a list of the targets for all of the modules which are compiled
- + # using $(TARGET_FLAGS_TO_PASS).
- + ALL_TARGET_MODULES = \
- + all-libio \
- + all-libg++ \
- + all-newlib \
- + all-xiberty
- +
- + # This is a list of the check targets for all of the modules which are
- + # compiled using $(TARGET_FLAGS_TO_PASS).
- + CHECK_TARGET_MODULES = \
- + check-libio \
- + check-libg++ \
- + check-newlib \
- + check-xiberty
- +
- + # This is a list of the install targets for all of the modules which are
- + # compiled using $(TARGET_FLAGS_TO_PASS).
- + INSTALL_TARGET_MODULES = \
- + install-libio \
- + install-libg++ \
- + install-newlib \
- + install-xiberty
- +
- + # This is a shell case of all modules which are compiled using
- + # $(TARGET_FLAGS_TO_PASS), used in the do-X rule.
- + TARGET_LIBS = libio | libg++ | newlib | xiberty
- +
- + # The first rule in the file had better be this one. Don't put any above it.
- + all: all.normal
- + .PHONY: all
- +
- + # The target built for a native build.
- + .PHONY: all.normal
- + all.normal: \
- + $(ALL_MODULES) \
- + $(ALL_TARGET_MODULES) \
- + $(ALL_X11_MODULES) \
- + all-gcc
- +
- + # Do a target for all the subdirectories. A ``make do-X'' will do a
- + # ``make X'' in all subdirectories (because, in general, there is a
- + # dependency (below) of X upon do-X, a ``make X'' will also do this,
- + # but it may do additional work as well).
- + # This target ensures that $(BASE_FLAGS_TO_PASS) appears only once,
- + # because it is so large that it can easily overflow the command line
- + # length limit on some systems.
- + DO_X = \
- + do-clean \
- + do-distclean \
- + do-dvi \
- + do-info \
- + do-install-info \
- + do-installcheck \
- + do-mostlyclean \
- + do-realclean
- + .PHONY: $(DO_X)
- + $(DO_X):
- + @target=`echo $@ | sed -e 's/^do-//'`; \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + for i in $(SUBDIRS); do \
- + if [ -f ./$$i/Makefile ]; then \
- + case $$i in \
- + $(TARGET_LIBS) ) \
- + for flag in $(EXTRA_TARGET_FLAGS); do \
- + eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
- + done; \
- + ;; \
- + gcc) \
- + for flag in $(EXTRA_GCC_FLAGS); do \
- + eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
- + done; \
- + ;; \
- + *) \
- + for flag in $(EXTRA_HOST_FLAGS); do \
- + eval `echo "$$flag" | sed -e "s|^\(.*\)=\(.*\)|\1='\2'|"`; \
- + done; \
- + ;; \
- + esac ; \
- + export AR AS CC CXX NM RANLIB XTRAFLAGS; \
- + if (cd ./$$i; \
- + $(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
- + "CC=$${CC}" "CXX=$${CXX}" "NM=$${NM}" \
- + "RANLIB=$${RANLIB}" "XTRAFLAGS=$${XTRAFLAGS}" \
- + $${target}); \
- + then true; else exit 1; fi; \
- + else true; fi; \
- + done
- +
- + # Here are the targets which correspond to the do-X targets.
- +
- + .PHONY: info installcheck dvi install-info
- + .PHONY: clean distclean mostlyclean realclean local-clean local-distclean
- + info: do-info
- + installcheck: do-installcheck
- + dvi: do-dvi
- +
- + install-info: do-install-info dir.info
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + if [ -f dir.info ] ; then \
- + $(INSTALL_DATA) dir.info $(infodir)/dir.info ; \
- + else true ; fi
- +
- + local-clean:
- + -rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
- +
- + local-distclean:
- + -rm -f Makefile config.status
- +
- + clean: do-clean local-clean
- + mostlyclean: do-mostlyclean local-clean
- + distclean: do-distclean local-clean local-distclean
- + realclean: do-realclean local-clean local-distclean
- +
- + # Check target.
- +
- + .PHONY: check
- + check: $(CHECK_MODULES) \
- + $(CHECK_TARGET_MODULES) \
- + $(CHECK_X11_MODULES) \
- + check-gcc
- +
- + # Installation targets.
- +
- + .PHONY: install uninstall vault-install
- + install: $(INSTALL_TARGET)
- +
- + uninstall:
- + @echo "the uninstall target is not supported in this tree"
- +
- + vault-install:
- + @if [ -f ./release/vault-install ] ; then \
- + ./release/vault-install $(host_alias) $(target_alias) ; \
- + else \
- + true ; \
- + fi
- +
- + .PHONY: install.all
- + install.all: install-no-fixedincludes
- + @if [ -f ./gcc/Makefile ] ; then \
- + rootme=`pwd` ; export rootme ; \
- + (cd ./gcc; \
- + $(MAKE) $(FLAGS_TO_PASS) install-headers) ; \
- + else \
- + true ; \
- + fi
- +
- + # install-no-fixedincludes is used because Cygnus can not distribute
- + # the fixed header files.
- + .PHONY: install-no-fixedincludes
- + install-no-fixedincludes: \
- + install-dirs \
- + $(INSTALL_MODULES) \
- + $(INSTALL_TARGET_MODULES) \
- + $(INSTALL_X11_MODULES) \
- + gcc-no-fixedincludes
- +
- + # Install the gcc headers files, but not the fixed include files,
- + # which Cygnus is not allowed to distribute. This rule is very
- + # dependent on the workings of the gcc Makefile.in.
- + .PHONY: gcc-no-fixedincludes
- + gcc-no-fixedincludes:
- + @if [ -f ./gcc/Makefile ]; then \
- + rm -rf gcc/tmp-include; \
- + mv gcc/include gcc/tmp-include 2>/dev/null; \
- + mkdir gcc/include; \
- + cp $(srcdir)/gcc/gsyslimits.h gcc/include/syslimits.h; \
- + touch gcc/stmp-fixinc gcc/stmp-fixproto; \
- + rm -f gcc/stmp-headers gcc/stmp-int-hdrs; \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd` ; export srcroot; \
- + (cd ./gcc; \
- + $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
- + rm -rf gcc/include; \
- + mv gcc/tmp-include gcc/include 2>/dev/null; \
- + else true; fi
- +
- + # This rule is used to build the modules which use FLAGS_TO_PASS. To
- + # build a target all-X means to cd to X and make all.
- + # all-glob is handled specially because it doesn't actually build.
- + .PHONY: $(ALL_MODULES) all-glob
- + $(ALL_MODULES) all-glob:
- + @dir=`echo $@ | sed -e 's/all-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) all); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to check the modules which use FLAGS_TO_PASS. To
- + # build a target check-X means to cd to X and make all.
- + .PHONY: $(CHECK_MODULES)
- + $(CHECK_MODULES):
- + @dir=`echo $@ | sed -e 's/check-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) check); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to install the modules which use FLAGS_TO_PASS.
- + # To build a target install-X means to cd to X and make install.
- + .PHONY: $(INSTALL_MODULES)
- + $(INSTALL_MODULES): install-dirs
- + @dir=`echo $@ | sed -e 's/install-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(FLAGS_TO_PASS) install); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to build the modules which use TARGET_FLAGS_TO_PASS.
- + # To build a target all-X means to cd to X and make all.
- + .PHONY: $(ALL_TARGET_MODULES)
- + $(ALL_TARGET_MODULES):
- + @dir=`echo $@ | sed -e 's/all-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) all); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to check the modules which use TARGET_FLAGS_TO_PASS.
- + # To build a target install-X means to cd to X and make install.
- + .PHONY: $(CHECK_TARGET_MODULES)
- + $(CHECK_TARGET_MODULES):
- + @dir=`echo $@ | sed -e 's/check-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) check); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to install the modules which use
- + # TARGET_FLAGS_TO_PASS. To build a target install-X means to cd to X
- + # and make install.
- + .PHONY: $(INSTALL_TARGET_MODULES)
- + $(INSTALL_TARGET_MODULES): install-dirs
- + @dir=`echo $@ | sed -e 's/install-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; $(MAKE) $(TARGET_FLAGS_TO_PASS) install); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to build the modules which use X11_FLAGS_TO_PASS.
- + # To build a target all-X means to cd to X and make all.
- + .PHONY: $(ALL_X11_MODULES)
- + $(ALL_X11_MODULES):
- + @dir=`echo $@ | sed -e 's/all-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; \
- + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) all); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to check the modules which use X11_FLAGS_TO_PASS.
- + # To build a target check-X means to cd to X and make all.
- + .PHONY: $(CHECK_X11_MODULES)
- + $(CHECK_X11_MODULES):
- + @dir=`echo $@ | sed -e 's/check-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; \
- + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) check); \
- + else \
- + true; \
- + fi
- +
- + # This rule is used to install the modules which use X11_FLAGS_TO_PASS.
- + # To build a target install-X means to cd to X and make install.
- + .PHONY: $(INSTALL_X11_MODULES)
- + $(INSTALL_X11_MODULES):
- + @dir=`echo $@ | sed -e 's/install-//'`; \
- + if [ -f ./$${dir}/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd $${dir}; \
- + $(MAKE) $(FLAGS_TO_PASS) $(X11_FLAGS_TO_PASS) install); \
- + else \
- + true; \
- + fi
- +
- + # gcc is the only module which uses GCC_FLAGS_TO_PASS.
- + .PHONY: all-gcc
- + all-gcc:
- + @if [ -f ./gcc/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) all); \
- + else \
- + true; \
- + fi
- +
- + .PHONY: check-gcc
- + check-gcc:
- + @if [ -f ./gcc/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) check); \
- + else \
- + true; \
- + fi
- +
- + .PHONY: install-gcc
- + install-gcc:
- + @if [ -f ./gcc/Makefile ] ; then \
- + rootme=`pwd`; export rootme; \
- + srcroot=`cd $(srcdir); pwd`; export srcroot; \
- + (cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) install); \
- + else \
- + true; \
- + fi
- +
- + # This is a list of inter-dependencies among modules.
- + all-autoconf: all-m4
- + all-bfd:
- + all-binutils: all-libiberty all-opcodes all-bfd all-flex
- + all-byacc:
- + all-cvs:
- + all-dejagnu:
- + all-diff: all-libiberty
- + all-emacs:
- + all-etc:
- + all-expect: all-tcl all-tk
- + all-fileutils: all-libiberty
- + all-find:
- + all-flex: all-libiberty all-byacc
- + all-gas: all-libiberty all-opcodes all-bfd
- + all-gash: all-tcl
- + all-gawk:
- + all-gcc: all-libiberty all-byacc all-binutils all-gas all-pagas
- + all-gdb: all-libiberty all-opcodes all-bfd all-mmalloc all-readline all-glob all-byacc all-sim
- + all-glob:
- + all-gprof: all-libiberty all-bfd
- + all-grep: all-libiberty
- + all-gzip: all-libiberty
- + all-hello: all-libiberty
- + all-indent:
- + all-ispell: all-emacs
- + all-ld: all-libiberty all-bfd all-byacc all-flex
- + all-libg++: all-gas all-pagas all-ld all-gcc all-xiberty all-newlib all-libio
- + all-libio: all-gas all-pagas all-ld all-gcc all-xiberty all-newlib
- + all-libiberty:
- + all-m4: all-libiberty
- + all-make: all-libiberty
- + all-mmalloc:
- + all-newlib: all-binutils all-gas all-pagas all-gcc
- + all-opcodes: all-bfd
- + all-patch:
- + all-prms: all-libiberty
- + all-rcs:
- + all-readline:
- + all-recode: all-libiberty
- + all-sed: all-libiberty
- + all-send-pr: all-prms
- + all-shellutils:
- + all-sim: all-libiberty all-bfd
- + all-tar: all-libiberty
- + all-tcl:
- + all-tclX: all-tcl all-tk
- + all-tk: all-tcl
- + all-texinfo: all-libiberty
- + all-textutils:
- + all-tgas: all-libiberty all-bfd
- + all-time:
- + all-wdiff:
- + all-uudecode: all-libiberty
- + all-xiberty: all-gcc all-newlib
- +
- + ### other supporting targets
- +
- + MAKEDIRS= \
- + $(prefix) \
- + $(exec_prefix) \
- + $(tooldir)
- +
- + .PHONY: install-dirs
- + install-dirs:
- + @for i in $(MAKEDIRS) ; do \
- + echo Making $$i... ; \
- + parent=`echo $$i | sed -e 's@/[^/]*$$@@' | sed -e 's@^$$@/@'`; \
- + if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi ; \
- + if [ ! -d $$i ] ; then \
- + if mkdir $$i ; then \
- + true ; \
- + else \
- + exit 1 ; \
- + fi ; \
- + else \
- + true ; \
- + fi ; \
- + done
- +
- +
- + dir.info: do-install-info
- + if [ -f $(srcdir)/texinfo/gen-info-dir ] ; then \
- + $(srcdir)/texinfo/gen-info-dir $(infodir) $(srcdir)/texinfo/dir.info-template > dir.info.new ; \
- + mv -f dir.info.new dir.info ; \
- + else true ; \
- + fi
- +
- + dist:
- + @echo "Building a full distribution of this tree isn't done"
- + @echo "via 'make dist'. Check out the etc/ subdirectory"
- +
- + etags tags: TAGS
- +
- + TAGS:
- + etags `$(MAKE) ls`
- +
- + ls:
- + @echo Makefile
- + @for i in $(SUBDIRS); \
- + do \
- + (cd $$i; \
- + pwd=`pwd`; \
- + wd=`basename $$pwd`; \
- + for j in `$(MAKE) ls`; \
- + do \
- + echo $$wd/$$j; \
- + done) \
- + done
- +
- + # with the gnu make, this is done automatically.
- +
- + Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
- + $(SHELL) ./config.status
- +
- + #
- + # Support for building net releases
- +
- + # Files in devo used in any net release.
- + # ChangeLog omitted because it may refer to files which are not in this
- + # distribution (perhaps it would be better to include it anyway).
- + DEVO_SUPPORT= README Makefile.in configure configure.in \
- + config.guess config.sub config move-if-change \
- + COPYING COPYING.LIB install.sh
- +
- + # Files in devo/etc used in any net release.
- + # ChangeLog omitted because it may refer to files which are not in this
- + # distribution (perhaps it would be better to include it anyway).
- + ETC_SUPPORT= Makefile.in cfg-paper.texi configure.in configure.man \
- + configure.texi standards.texi make-stds.texi
- +
- + GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline glob sim
- + GDB_SUPPORT_FILES= $(GDB_SUPPORT_DIRS)
- +
- + .PHONY: setup-dirs-gdb gdb.tar.gz make-gdb.tar.gz
- + setup-dirs-gdb:
- + ./configure sun4
- + $(MAKE) clean
- + ./configure -rm sun4
- + chmod og=u `find etc $(DEVO_SUPPORT) $(GDB_SUPPORT_FILES) -print`
- +
- + gdb.tar.gz: setup-dirs-gdb
- + (cd gdb; $(MAKE) -f Makefile.in make-proto-gdb.dir BISON="byacc")
- + (cd gdb; $(MAKE) -f Makefile.in make-proto-testsuite.dir)
- + $(MAKE) $(MFLAGS) -f Makefile.in make-gdb.tar.gz
- +
- + make-gdb.tar.gz: $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS) gdb texinfo/texinfo.tex
- + rm -rf proto-toplev; mkdir proto-toplev
- + ln -s ../gdb/proto-gdb.dir proto-toplev/gdb
- + (cd proto-toplev; for i in $(DEVO_SUPPORT) $(GDB_SUPPORT_DIRS); do \
- + ln -s ../$$i . ; \
- + done)
- + mkdir proto-toplev/etc
- + (cd proto-toplev/etc; for i in $(ETC_SUPPORT); do \
- + ln -s ../../etc/$$i . ; \
- + done)
- + # Put only one copy (four hard links) of COPYING in the tar file.
- + rm proto-toplev/bfd/COPYING
- + ln proto-toplev/gdb/COPYING proto-toplev/bfd/COPYING
- + rm proto-toplev/include/COPYING
- + ln proto-toplev/gdb/COPYING proto-toplev/include/COPYING
- + rm proto-toplev/readline/COPYING
- + ln proto-toplev/gdb/COPYING proto-toplev/readline/COPYING
- +
- + # Change the bug reporting address in configure to bug-gdb
- + rm proto-toplev/configure
- + sed -e 's/configure@cygnus.com/bug-gdb@prep.ai.mit.edu/' \
- + <configure >proto-toplev/configure
- + chmod a+x proto-toplev/configure
- +
- + # Take out texinfo and glob from configurable dirs
- + rm proto-toplev/configure.in
- + sed -e '/^host_tools=/s/texinfo //' \
- + -e '/^host_libs=/s/glob //' \
- + <configure.in >proto-toplev/configure.in
- +
- + # Take out texinfo from a few places; make simple BISON=bison line.
- + rm proto-toplev/Makefile.in
- + sed -e '/^all\.normal: /s/\all-texinfo //' \
- + -e '/^ install-texinfo /d' \
- + -e '/^BISON = /,/^$$/d' \
- + -e '/^# BISON:/s/.*/BISON = bison -y/' \
- + <Makefile.in >proto-toplev/Makefile.in
- +
- + mkdir proto-toplev/texinfo
- + ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
- + ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
- + ln -s ../../texinfo/tex3patch proto-toplev/texinfo/
- + chmod og=u `find proto-toplev -print`
- + (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
- + echo "==> Making gdb-$$VER.tar.gz"; \
- + rm -f gdb-$$VER; ln -s proto-toplev gdb-$$VER; \
- + tar cfh - gdb-$$VER \
- + | $(GZIP) -v -9 >gdb-$$VER.tar.gz)
- +
- + # Make the testsuite archive separately.
- + ln -s ../../gdb/proto-testsuite.dir/testsuite proto-toplev/gdb/testsuite
- + # Blow away the Chill test that requires a Chill compiled executable,
- + # since GNU Chill is not yet publically available.
- + rm -rf proto-toplev/gdb/testsuite/gdb.t31
- +
- + # Put a copy of COPYING in the tar file.
- + ln proto-toplev/gdb/COPYING proto-toplev/gdb/testsuite/COPYING
- + chmod og=u `find proto-toplev/gdb/testsuite -print`
- + (VER=`sed <gdb/Makefile.in -n 's/VERSION = //p'`; \
- + echo "==> Making gdb-$$VER-testsuite.tar.gz"; \
- + tar cfh - gdb-$$VER/configure gdb-$$VER/config.guess \
- + gdb-$$VER/config.sub gdb-$$VER/move-if-change \
- + gdb-$$VER/gdb/testsuite \
- + | $(GZIP) -v -9 >gdb-$$VER-testsuite.tar.gz)
- +
- + # When you use `make setup-dirs' or `make taz' you should always redefine
- + # this macro.
- + SUPPORT_FILES = list-of-support-files-for-tool-in-question
- + # Directories that might want `make diststuff' run.
- + DISTSTUFFDIRS= ld gprof gdb libg++ binutils
- + # Files where "byacc" (Cygnus version) should be changed to "bison -y" (FSF).
- + DISTBISONFILES= binutils/Makefile.in gas/Makefile.in gdb/Makefile.in
- + # Directories where "info" should be built.
- + DISTDOCDIRS= ld gprof binutils gas bfd libg++ libio
- +
- + .PHONY: taz
- +
- + taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
- + texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
- + # Make sure "diststuff" files get built properly.
- + for f in $(DISTBISONFILES) ; do \
- + if [ -r $$f ]; then \
- + sed '/^BISON *=.*$$/s/.*/BISON = bison -y/' <$$f >tmp ; \
- + mv -f tmp $$f ; \
- + else true; fi ; \
- + done
- + # Take out texinfo from a few places; make simple BISON=bison line.
- + sed -e '/^all\.normal: /s/\all-texinfo //' \
- + -e '/^ install-texinfo /d' \
- + -e '/^BISON = /,/^$$/d' \
- + -e '/^# BISON:/s/.*/BISON = bison -y/' \
- + <Makefile.in >tmp
- + mv -f tmp Makefile.in
- + #
- + ./configure sun4
- + # Doc files don't change; include them in distribution.
- + for f in $(DISTDOCDIRS) ; do \
- + if [ -r $$f/Makefile ]; then \
- + (cd $$f ; $(MAKE) info) || exit 1 ; \
- + else true ; fi ; \
- + done
- + # Make links, and run "make diststuff" when needed.
- + # The `echo' for setting `p' is to convert all whitespace to spaces.
- + # Then the `case' further below should tell whether $$d is in
- + # DISTSTUFFDIRS.
- + rm -rf proto-toplev ; mkdir proto-toplev
- + set -e ; dirs="$(TOOL) $(DEVO_SUPPORT) $(SUPPORT_FILES)" ; \
- + p=" `echo $(DISTSTUFFDIRS)` " ; \
- + for d in $$dirs ; do \
- + if [ -d $$d ]; then \
- + case " $$p " in \
- + *" $$d "*) \
- + echo making diststuff in $$d ; \
- + (cd $$d ; pwd ; $(MAKE) diststuff ) || exit 1 ;; \
- + esac ; \
- + if [ -d $$d/proto-$$d.dir ]; then \
- + ln -s ../$$d/proto-$$d.dir proto-toplev/$$d ; \
- + else \
- + ln -s ../$$d proto-toplev/$$d ; \
- + fi ; \
- + else ln -s ../$$d proto-toplev/$$d ; fi ; \
- + done
- + $(MAKE) distclean
- + #
- + mkdir proto-toplev/etc
- + (cd proto-toplev/etc; for i in $(ETC_SUPPORT); do \
- + ln -s ../../etc/$$i . ; \
- + done)
- + #
- + # Take out texinfo and glob from configurable dirs
- + rm proto-toplev/configure.in
- + sed -e '/^host_tools=/s/texinfo //' \
- + -e '/^host_libs=/s/glob //' \
- + <configure.in >proto-toplev/configure.in
- + #
- + mkdir proto-toplev/texinfo
- + ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
- + ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
- + ln -s ../../texinfo/lgpl.texinfo proto-toplev/texinfo/
- + ln -s ../../texinfo/tex3patch proto-toplev/texinfo/
- + chmod og=u `find . -print`
- + (VER=`sed <$(TOOL)/Makefile.in -n 's/^VERSION *= *//p'`; \
- + echo "==> Making $(TOOL)-$$VER.tar.gz"; \
- + rm -f $(TOOL)-$$VER; ln -s proto-toplev $(TOOL)-$$VER; \
- + tar cfh - $(TOOL)-$$VER \
- + | $(GZIP) -v -9 >$(TOOL)-$$VER.tar.gz)
- +
- + TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
- + DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
- +
- + .PHONY: gas.tar.gz
- + GAS_SUPPORT_DIRS= bfd include libiberty opcodes
- + gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
- + $(MAKE) -f Makefile.in taz TOOL=gas \
- + SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
- +
- + # The FSF "binutils" release includes gprof and ld.
- + .PHONY: binutils.tar.gz
- + BINUTILS_SUPPORT_DIRS= bfd include libiberty opcodes ld gprof
- + binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
- + $(MAKE) -f Makefile.in taz TOOL=binutils \
- + SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
- +
- + .PHONY: gas+binutils.tar.gz
- + GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
- + gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
- + $(MAKE) -f Makefile.in taz TOOL=gas \
- + SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
- +
- + .PHONY: libg++.tar.gz
- + LIBGXX_SUPPORT_DIRS=include libio libiberty xiberty
- + libg++.tar.gz: $(DIST_SUPPORT) libg++
- + $(MAKE) -f Makefile.in taz TOOL=libg++ \
- + SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
- +
- + .NOEXPORT:
- + MAKEOVERRIDES=
- +
- +
- + # end of Makefile.in
- diff -rc2N /free/libg++-2.5.3/config/mh-amigados /sources/libg++-2.5.3-amiga/config/mh-amigados
- *** /free/libg++-2.5.3/config/mh-amigados Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/config/mh-amigados Sun Dec 5 16:43:54 1993
- ***************
- *** 0 ****
- --- 1,5 ----
- + # do the best you can ;-)
- + CC = gcc -O2
- + # as long as we don't have a working debugger under AmigaDOS, using
- + # -g just wastes disk space, so don't use it
- + CFLAGS =
- diff -rc2N /free/libg++-2.5.3/configure.in /sources/libg++-2.5.3-amiga/configure.in
- *** /free/libg++-2.5.3/configure.in Mon Dec 27 21:43:31 1993
- --- /sources/libg++-2.5.3-amiga/configure.in Mon Dec 27 16:53:12 1993
- ***************
- *** 104,107 ****
- --- 104,108 ----
- *-sun-*) host_makefile_frag=config/mh-sun ;;
- *-hp-hpux*) host_makefile_frag=config/mh-hpux ;;
- + amigados) host_makefile_frag=config/mh-amigados ;;
- *-*-hiux*) host_makefile_frag=config/mh-hpux ;;
- *-*-lynxos*) host_makefile_frag=config/mh-lynxos
- diff -rc2N /free/libg++-2.5.3/libg++/config/amigados.mt /sources/libg++-2.5.3-amiga/libg++/config/amigados.mt
- *** /free/libg++-2.5.3/libg++/config/amigados.mt Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libg++/config/amigados.mt Sun Dec 5 16:42:38 1993
- ***************
- *** 0 ****
- --- 1,13 ----
- + # do the best you can ;-)
- + CC = gcc -O2
- + # as long as we don't have a working debugger under AmigaDOS, using
- + # -g just wastes disk space, so don't use it
- + CFLAGS =
- + # Use -nostdinc++ flag if your version of gcc understands it.
- + NOSTDINC = -nostdinc++
- + # If the C include files are C++-ready (with extern "C"),
- + # define: HAVE_CPLUS_EXTERN = 1 and: WRAP_C_INCLUDES =
- + # If not, define HAVE_CPLUS_EXTERN = 0, and do not define WRAP_C_INCLUDES here
- + HAVE_CPLUS_EXTERN = 1
- + WRAP_C_INCLUDES =
- + XTRAFLAGS = -DNO_LIBGXX_MALLOC
- diff -rc2N /free/libg++-2.5.3/libg++/etc/ADT-examples/Patmain.cc /sources/libg++-2.5.3-amiga/libg++/etc/ADT-examples/Patmain.cc
- *** /free/libg++-2.5.3/libg++/etc/ADT-examples/Patmain.cc Mon Dec 27 21:37:12 1993
- --- /sources/libg++-2.5.3-amiga/libg++/etc/ADT-examples/Patmain.cc Sun Dec 5 16:42:42 1993
- ***************
- *** 3,7 ****
- --- 3,12 ----
- #include <stream.h>
- #include <stdio.h>
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
- #include "Patricia.h"
- #include <builtin.h>
- diff -rc2N /free/libg++-2.5.3/libg++/etc/benchmarks/dhrystone.cc /sources/libg++-2.5.3-amiga/libg++/etc/benchmarks/dhrystone.cc
- *** /free/libg++-2.5.3/libg++/etc/benchmarks/dhrystone.cc Mon Dec 27 21:40:24 1993
- --- /sources/libg++-2.5.3-amiga/libg++/etc/benchmarks/dhrystone.cc Mon Dec 13 22:54:59 1993
- ***************
- *** 332,336 ****
- --- 332,341 ----
-
- #ifdef NOSTRUCTASSIGN
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
- #define structassign(d, s) memcpy(&(d), &(s), sizeof(d))
- #else
- diff -rc2N /free/libg++-2.5.3/libg++/etc/lf/Dirent.cc /sources/libg++-2.5.3-amiga/libg++/etc/lf/Dirent.cc
- *** /free/libg++-2.5.3/libg++/etc/lf/Dirent.cc Mon Dec 27 21:37:18 1993
- --- /sources/libg++-2.5.3-amiga/libg++/etc/lf/Dirent.cc Sun Dec 5 16:42:48 1993
- ***************
- *** 6,10 ****
-
- #include <std.h>
- ! #include "Dirent.h"
-
- // error handlers
- --- 6,10 ----
-
- #include <std.h>
- ! #include "_Dirent.h"
-
- // error handlers
- diff -rc2N /free/libg++-2.5.3/libg++/etc/lf/directory.cc /sources/libg++-2.5.3-amiga/libg++/etc/lf/directory.cc
- *** /free/libg++-2.5.3/libg++/etc/lf/directory.cc Mon Dec 27 21:37:19 1993
- --- /sources/libg++-2.5.3-amiga/libg++/etc/lf/directory.cc Sun Dec 5 16:42:48 1993
- ***************
- *** 1,5 ****
- #include <stdio.h>
- #include <std.h>
- ! #include "Dirent.h"
- #include "option.h"
- #include "entry.h"
- --- 1,5 ----
- #include <stdio.h>
- #include <std.h>
- ! #include "_Dirent.h"
- #include "option.h"
- #include "entry.h"
- diff -rc2N /free/libg++-2.5.3/libg++/etc/trie-gen/test.cc /sources/libg++-2.5.3-amiga/libg++/etc/trie-gen/test.cc
- *** /free/libg++-2.5.3/libg++/etc/trie-gen/test.cc Mon Dec 27 21:37:21 1993
- --- /sources/libg++-2.5.3-amiga/libg++/etc/trie-gen/test.cc Sun Dec 5 16:42:50 1993
- ***************
- *** 6,10 ****
- --- 6,15 ----
-
- #include <stdio.h>
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
-
- #define MAX_LEN 200
- diff -rc2N /free/libg++-2.5.3/libg++/old-stream/Makefile.in /sources/libg++-2.5.3-amiga/libg++/old-stream/Makefile.in
- *** /free/libg++-2.5.3/libg++/old-stream/Makefile.in Mon Dec 27 21:37:34 1993
- --- /sources/libg++-2.5.3-amiga/libg++/old-stream/Makefile.in Sun Dec 5 16:43:02 1993
- ***************
- *** 11,15 ****
-
- USER_INCLUDES = File.h Filebuf.h Fmodes.h PlotFile.h SFile.h \
- ! filebuf.h istream.h ostream.h stream.h streambuf.h
-
- # The following include files are private to the implementation.
- --- 11,15 ----
-
- USER_INCLUDES = File.h Filebuf.h Fmodes.h PlotFile.h SFile.h \
- ! _filebuf.h istream.h ostream.h stream.h streambuf.h
-
- # The following include files are private to the implementation.
- diff -rc2N /free/libg++-2.5.3/libg++/old-stream/istream.h /sources/libg++-2.5.3-amiga/libg++/old-stream/istream.h
- *** /free/libg++-2.5.3/libg++/old-stream/istream.h Mon Dec 27 21:37:36 1993
- --- /sources/libg++-2.5.3-amiga/libg++/old-stream/istream.h Sun Dec 5 16:43:03 1993
- ***************
- *** 30,34 ****
- #include <File.h>
- #include <streambuf.h>
- ! #include <filebuf.h>
- #include <Filebuf.h>
-
- --- 30,34 ----
- #include <File.h>
- #include <streambuf.h>
- ! #include <_filebuf.h>
- #include <Filebuf.h>
-
- diff -rc2N /free/libg++-2.5.3/libg++/old-stream/ostream.h /sources/libg++-2.5.3-amiga/libg++/old-stream/ostream.h
- *** /free/libg++-2.5.3/libg++/old-stream/ostream.h Mon Dec 27 21:37:36 1993
- --- /sources/libg++-2.5.3-amiga/libg++/old-stream/ostream.h Sun Dec 5 16:43:03 1993
- ***************
- *** 33,37 ****
- #include <File.h>
- #include <streambuf.h>
- ! #include <filebuf.h>
- #include <Filebuf.h>
-
- --- 33,37 ----
- #include <File.h>
- #include <streambuf.h>
- ! #include <_filebuf.h>
- #include <Filebuf.h>
-
- diff -rc2N /free/libg++-2.5.3/libg++/src/BitSet.cc /sources/libg++-2.5.3-amiga/libg++/src/BitSet.cc
- *** /free/libg++-2.5.3/libg++/src/BitSet.cc Mon Dec 27 21:37:58 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/BitSet.cc Sun Dec 5 16:43:21 1993
- ***************
- *** 30,34 ****
- #include <new.h>
- #include <builtin.h>
- ! #include <string.h>
- #include <strstream.h>
-
- --- 30,34 ----
- #include <new.h>
- #include <builtin.h>
- ! // #include <string.h> included by std.h
- #include <strstream.h>
-
- diff -rc2N /free/libg++-2.5.3/libg++/src/Complex.h /sources/libg++-2.5.3-amiga/libg++/src/Complex.h
- *** /free/libg++-2.5.3/libg++/src/Complex.h Mon Dec 27 21:38:12 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/Complex.h Sun Dec 5 19:52:33 1993
- ***************
- *** 1,6 ****
- ! #ifndef _complex_h
- ! #define _complex_h
- ! #define __ATT_complex__
- ! #include <Complex.h>
- ! typedef class Complex complex;
- #endif
- --- 1,276 ----
- ! // This may look like C code, but it is really -*- C++ -*-
- ! /*
- ! Copyright (C) 1988 Free Software Foundation
- ! written by Doug Lea (dl@rocky.oswego.edu)
- !
- ! This file is part of the GNU C++ Library. This 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 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 Library General Public License for more details.
- ! You should have received a copy of the GNU Library General Public
- ! License along with this library; if not, write to the Free Software
- ! Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- ! */
- !
- ! #ifndef _Complex_h
- ! #ifdef __GNUG__
- ! #pragma interface
- ! #endif
- ! #define _Complex_h 1
- !
- !
- ! #include <stream.h>
- ! #include <math.h>
- !
- ! class Complex
- ! {
- ! #ifdef __ATT_complex__
- ! public:
- ! #else
- ! protected:
- ! #endif
- !
- ! double re;
- ! double im;
- !
- ! public:
- !
- ! double real() const;
- ! double imag() const;
- !
- ! Complex();
- ! Complex(const Complex& y);
- ! Complex(double r, double i=0);
- !
- ! ~Complex();
- !
- ! Complex& operator = (const Complex& y);
- !
- ! Complex& operator += (const Complex& y);
- ! Complex& operator += (double y);
- ! Complex& operator -= (const Complex& y);
- ! Complex& operator -= (double y);
- ! Complex& operator *= (const Complex& y);
- ! Complex& operator *= (double y);
- !
- ! Complex& operator /= (const Complex& y);
- ! Complex& operator /= (double y);
- !
- ! void error(const char* msg) const;
- ! };
- !
- !
- ! // non-inline functions
- !
- ! Complex operator / (const Complex& x, const Complex& y);
- ! Complex operator / (const Complex& x, double y);
- ! Complex operator / (double x, const Complex& y);
- !
- ! Complex cos(const Complex& x);
- ! Complex sin(const Complex& x);
- !
- ! Complex cosh(const Complex& x);
- ! Complex sinh(const Complex& x);
- !
- ! Complex exp(const Complex& x);
- ! Complex log(const Complex& x);
- !
- ! Complex pow(const Complex& x, int p);
- ! Complex pow(const Complex& x, const Complex& p);
- ! Complex pow(const Complex& x, double y);
- ! Complex sqrt(const Complex& x);
- !
- ! istream& operator >> (istream& s, Complex& x);
- ! ostream& operator << (ostream& s, const Complex& x);
- !
- ! // other functions defined as inlines
- !
- ! int operator == (const Complex& x, const Complex& y);
- ! int operator == (const Complex& x, double y);
- ! int operator != (const Complex& x, const Complex& y);
- ! int operator != (const Complex& x, double y);
- !
- ! Complex operator - (const Complex& x);
- ! Complex conj(const Complex& x);
- ! Complex operator + (const Complex& x, const Complex& y);
- ! Complex operator + (const Complex& x, double y);
- ! Complex operator + (double x, const Complex& y);
- ! Complex operator - (const Complex& x, const Complex& y);
- ! Complex operator - (const Complex& x, double y);
- ! Complex operator - (double x, const Complex& y);
- ! Complex operator * (const Complex& x, const Complex& y);
- ! Complex operator * (const Complex& x, double y);
- ! Complex operator * (double x, const Complex& y);
- !
- ! double real(const Complex& x);
- ! double imag(const Complex& x);
- ! double abs(const Complex& x);
- ! double norm(const Complex& x);
- ! double arg(const Complex& x);
- !
- ! Complex polar(double r, double t = 0.0);
- !
- !
- ! // inline members
- !
- ! inline double Complex::real() const { return re; }
- ! inline double Complex::imag() const { return im; }
- !
- ! inline Complex::Complex() {}
- ! inline Complex::Complex(const Complex& y) :re(y.real()), im(y.imag()) {}
- ! inline Complex::Complex(double r, double i) :re(r), im(i) {}
- !
- ! inline Complex::~Complex() {}
- !
- ! inline Complex& Complex::operator = (const Complex& y)
- ! {
- ! re = y.real(); im = y.imag(); return *this;
- ! }
- !
- ! inline Complex& Complex::operator += (const Complex& y)
- ! {
- ! re += y.real(); im += y.imag(); return *this;
- ! }
- !
- ! inline Complex& Complex::operator += (double y)
- ! {
- ! re += y; return *this;
- ! }
- !
- ! inline Complex& Complex::operator -= (const Complex& y)
- ! {
- ! re -= y.real(); im -= y.imag(); return *this;
- ! }
- !
- ! inline Complex& Complex::operator -= (double y)
- ! {
- ! re -= y; return *this;
- ! }
- !
- ! inline Complex& Complex::operator *= (const Complex& y)
- ! {
- ! double r = re * y.real() - im * y.imag();
- ! im = re * y.imag() + im * y.real();
- ! re = r;
- ! return *this;
- ! }
- !
- ! inline Complex& Complex::operator *= (double y)
- ! {
- ! re *= y; im *= y; return *this;
- ! }
- !
- !
- ! // functions
- !
- ! inline int operator == (const Complex& x, const Complex& y)
- ! {
- ! return x.real() == y.real() && x.imag() == y.imag();
- ! }
- !
- ! inline int operator == (const Complex& x, double y)
- ! {
- ! return x.imag() == 0.0 && x.real() == y;
- ! }
- !
- ! inline int operator != (const Complex& x, const Complex& y)
- ! {
- ! return x.real() != y.real() || x.imag() != y.imag();
- ! }
- !
- ! inline int operator != (const Complex& x, double y)
- ! {
- ! return x.imag() != 0.0 || x.real() != y;
- ! }
- !
- ! inline Complex operator - (const Complex& x)
- ! {
- ! return Complex(-x.real(), -x.imag());
- ! }
- !
- ! inline Complex conj(const Complex& x)
- ! {
- ! return Complex(x.real(), -x.imag());
- ! }
- !
- ! inline Complex operator + (const Complex& x, const Complex& y)
- ! {
- ! return Complex(x.real() + y.real(), x.imag() + y.imag());
- ! }
- !
- ! inline Complex operator + (const Complex& x, double y)
- ! {
- ! return Complex(x.real() + y, x.imag());
- ! }
- !
- ! inline Complex operator + (double x, const Complex& y)
- ! {
- ! return Complex(x + y.real(), y.imag());
- ! }
- !
- ! inline Complex operator - (const Complex& x, const Complex& y)
- ! {
- ! return Complex(x.real() - y.real(), x.imag() - y.imag());
- ! }
- !
- ! inline Complex operator - (const Complex& x, double y)
- ! {
- ! return Complex(x.real() - y, x.imag());
- ! }
- !
- ! inline Complex operator - (double x, const Complex& y)
- ! {
- ! return Complex(x - y.real(), -y.imag());
- ! }
- !
- ! inline Complex operator * (const Complex& x, const Complex& y)
- ! {
- ! return Complex(x.real() * y.real() - x.imag() * y.imag(),
- ! x.real() * y.imag() + x.imag() * y.real());
- ! }
- !
- ! inline Complex operator * (const Complex& x, double y)
- ! {
- ! return Complex(x.real() * y, x.imag() * y);
- ! }
- !
- ! inline Complex operator * (double x, const Complex& y)
- ! {
- ! return Complex(x * y.real(), x * y.imag());
- ! }
- !
- ! inline double real(const Complex& x)
- ! {
- ! return x.real();
- ! }
- !
- ! inline double imag(const Complex& x)
- ! {
- ! return x.imag();
- ! }
- !
- ! inline double abs(const Complex& x)
- ! {
- ! return hypot(x.real(), x.imag());
- ! }
- !
- ! inline double norm(const Complex& x)
- ! {
- ! return (x.real() * x.real() + x.imag() * x.imag());
- ! }
- !
- ! inline double arg(const Complex& x)
- ! {
- ! return atan2(x.imag(), x.real());
- ! }
- !
- ! inline Complex polar(double r, double t)
- ! {
- ! return Complex(r * cos(t), r * sin(t));
- ! }
- !
- #endif
- diff -rc2N /free/libg++-2.5.3/libg++/src/Regex.cc /sources/libg++-2.5.3-amiga/libg++/src/Regex.cc
- *** /free/libg++-2.5.3/libg++/src/Regex.cc Mon Dec 27 21:38:17 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/Regex.cc Sun Dec 5 19:26:03 1993
- ***************
- *** 55,59 ****
- --- 55,64 ----
-
- #include <_G_config.h>
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
- #include <stdlib.h>
-
- ***************
- *** 115,120 ****
-
- /* Get the interface, including the syntax bits. */
- #include "regex.h"
- !
-
- /* These are the command codes that appear in compiled regular
- --- 120,129 ----
-
- /* Get the interface, including the syntax bits. */
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "_regex.h"
- + #else
- #include "regex.h"
- ! #endif
-
- /* These are the command codes that appear in compiled regular
- diff -rc2N /free/libg++-2.5.3/libg++/src/Regex.h /sources/libg++-2.5.3-amiga/libg++/src/Regex.h
- *** /free/libg++-2.5.3/libg++/src/Regex.h Mon Dec 27 21:38:17 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/Regex.h Sun Dec 5 19:13:54 1993
- ***************
- *** 1,6 ****
- ! /* Definitions for data structures callers pass the regex library.
-
- - Copyright (C) 1985, 1989-92 Free Software Foundation, Inc.
- -
- This file is part of the GNU C++ Library. This library is free
- software; you can redistribute it and/or modify it under the terms of
- --- 1,7 ----
- ! // This may look like C code, but it is really -*- C++ -*-
- ! /*
- ! Copyright (C) 1988 Free Software Foundation
- ! written by Doug Lea (dl@rocky.oswego.edu)
-
- This file is part of the GNU C++ Library. This library is free
- software; you can redistribute it and/or modify it under the terms of
- ***************
- *** 16,21 ****
- */
-
- ! #ifndef __REGEXP_LIBRARY
- ! #define __REGEXP_LIBRARY
-
- #if defined(SHORT_NAMES) || defined(VMS)
- --- 17,26 ----
- */
-
- !
- ! #ifndef _Regex_h
- ! #ifdef __GNUG__
- ! #pragma interface
- ! #endif
- ! #define _Regex_h 1
-
- #if defined(SHORT_NAMES) || defined(VMS)
- ***************
- *** 25,272 ****
- #endif
-
- ! #ifdef __cplusplus
- ! extern "C" {
- ! #endif
- !
- ! /* Define number of parens for which we record the beginnings and ends.
- ! This affects how much space the `struct re_registers' type takes up. */
- ! #ifndef RE_NREGS
- ! #define RE_NREGS 10
- ! #endif
- !
- ! #define BYTEWIDTH 8
- !
- !
- ! /* Maximum number of duplicates an interval can allow. */
- ! #ifndef RE_DUP_MAX /* kludge for AIX, which defines it */
- ! #define RE_DUP_MAX ((1 << 15) - 1)
- ! #endif
- !
- ! /* This defines the various regexp syntaxes. */
- ! extern int obscure_syntax;
-
-
- - /* The following bits are used in the obscure_syntax variable to choose among
- - alternative regexp syntaxes. */
-
- - /* If this bit is set, plain parentheses serve as grouping, and backslash
- - parentheses are needed for literal searching.
- - If not set, backslash-parentheses are grouping, and plain parentheses
- - are for literal searching. */
- - #define RE_NO_BK_PARENS 1
- -
- - /* If this bit is set, plain | serves as the `or'-operator, and \| is a
- - literal.
- - If not set, \| serves as the `or'-operator, and | is a literal. */
- - #define RE_NO_BK_VBAR (1 << 1)
- -
- - /* If this bit is not set, plain + or ? serves as an operator, and \+, \? are
- - literals.
- - If set, \+, \? are operators and plain +, ? are literals. */
- - #define RE_BK_PLUS_QM (1 << 2)
- -
- - /* If this bit is set, | binds tighter than ^ or $.
- - If not set, the contrary. */
- - #define RE_TIGHT_VBAR (1 << 3)
- -
- - /* If this bit is set, then treat newline as an OR operator.
- - If not set, treat it as a normal character. */
- - #define RE_NEWLINE_OR (1 << 4)
- -
- - /* If this bit is set, then special characters may act as normal
- - characters in some contexts. Specifically, this applies to:
- - ^ -- only special at the beginning, or after ( or |;
- - $ -- only special at the end, or before ) or |;
- - *, +, ? -- only special when not after the beginning, (, or |.
- - If this bit is not set, special characters (such as *, ^, and $)
- - always have their special meaning regardless of the surrounding
- - context. */
- - #define RE_CONTEXT_INDEP_OPS (1 << 5)
- -
- - /* If this bit is not set, then \ before anything inside [ and ] is taken as
- - a real \.
- - If set, then such a \ escapes the following character. This is a
- - special case for awk. */
- - #define RE_AWK_CLASS_HACK (1 << 6)
- -
- - /* If this bit is set, then \{ and \} or { and } serve as interval operators.
- - If not set, then \{ and \} and { and } are treated as literals. */
- - #define RE_INTERVALS (1 << 7)
- -
- - /* If this bit is not set, then \{ and \} serve as interval operators and
- - { and } are literals.
- - If set, then { and } serve as interval operators and \{ and \} are
- - literals. */
- - #define RE_NO_BK_CURLY_BRACES (1 << 8)
- -
- - /* If this bit is set, then character classes are supported; they are:
- - [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- - [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- - If not set, then character classes are not supported. */
- - #define RE_CHAR_CLASSES (1 << 9)
- -
- - /* If this bit is set, then the dot re doesn't match a null byte.
- - If not set, it does. */
- - #define RE_DOT_NOT_NULL (1 << 10)
- -
- - /* If this bit is set, then [^...] doesn't match a newline.
- - If not set, it does. */
- - #define RE_HAT_NOT_NEWLINE (1 << 11)
- -
- - /* If this bit is set, back references are recognized.
- - If not set, they aren't. */
- - #define RE_NO_BK_REFS (1 << 12)
- -
- - /* If this bit is set, back references must refer to a preceding
- - subexpression. If not set, a back reference to a nonexistent
- - subexpression is treated as literal characters. */
- - #define RE_NO_EMPTY_BK_REF (1 << 13)
- -
- - /* If this bit is set, bracket expressions can't be empty.
- - If it is set, they can be empty. */
- - #define RE_NO_EMPTY_BRACKETS (1 << 14)
- -
- - /* If this bit is set, then *, +, ? and { cannot be first in an re or
- - immediately after a |, or a (. Furthermore, a | cannot be first or
- - last in an re, or immediately follow another | or a (. Also, a ^
- - cannot appear in a nonleading position and a $ cannot appear in a
- - nontrailing position (outside of bracket expressions, that is). */
- - #define RE_CONTEXTUAL_INVALID_OPS (1 << 15)
- -
- - /* If this bit is set, then +, ? and | aren't recognized as operators.
- - If it's not, they are. */
- - #define RE_LIMITED_OPS (1 << 16)
- -
- - /* If this bit is set, then an ending range point has to collate higher
- - or equal to the starting range point.
- - If it's not set, then when the ending range point collates higher
- - than the starting range point, the range is just considered empty. */
- - #define RE_NO_EMPTY_RANGES (1 << 17)
- -
- - /* If this bit is set, then a hyphen (-) can't be an ending range point.
- - If it isn't, then it can. */
- - #define RE_NO_HYPHEN_RANGE_END (1 << 18)
- -
- -
- - /* Define combinations of bits for the standard possibilities. */
- - #define RE_SYNTAX_POSIX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- - | RE_CONTEXT_INDEP_OPS)
- - #define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- - | RE_CONTEXT_INDEP_OPS | RE_AWK_CLASS_HACK)
- - #define RE_SYNTAX_EGREP (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- - | RE_CONTEXT_INDEP_OPS | RE_NEWLINE_OR)
- - #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
- - #define RE_SYNTAX_EMACS 0
- - #define RE_SYNTAX_POSIX_BASIC (RE_INTERVALS | RE_BK_PLUS_QM \
- - | RE_CHAR_CLASSES | RE_DOT_NOT_NULL \
- - | RE_HAT_NOT_NEWLINE | RE_NO_EMPTY_BK_REF \
- - | RE_NO_EMPTY_BRACKETS | RE_LIMITED_OPS \
- - | RE_NO_EMPTY_RANGES | RE_NO_HYPHEN_RANGE_END)
- -
- - #define RE_SYNTAX_POSIX_EXTENDED (RE_INTERVALS | RE_NO_BK_CURLY_BRACES \
- - | RE_NO_BK_VBAR | RE_NO_BK_PARENS \
- - | RE_HAT_NOT_NEWLINE | RE_CHAR_CLASSES \
- - | RE_NO_EMPTY_BRACKETS | RE_CONTEXTUAL_INVALID_OPS \
- - | RE_NO_BK_REFS | RE_NO_EMPTY_RANGES \
- - | RE_NO_HYPHEN_RANGE_END)
- -
- -
- - /* This data structure is used to represent a compiled pattern. */
- -
- - struct re_pattern_buffer
- - {
- - char *buffer; /* Space holding the compiled pattern commands. */
- - long allocated; /* Size of space that `buffer' points to. */
- - long used; /* Length of portion of buffer actually occupied */
- - char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- - /* re_search uses the fastmap, if there is one,
- - to skip over totally implausible characters. */
- - char *translate; /* Translate table to apply to all characters before
- - comparing, or zero for no translation.
- - The translation is applied to a pattern when it is
- - compiled and to data when it is matched. */
- - char fastmap_accurate;
- - /* Set to zero when a new pattern is stored,
- - set to one when the fastmap is updated from it. */
- - char can_be_null; /* Set to one by compiling fastmap
- - if this pattern might match the null string.
- - It does not necessarily match the null string
- - in that case, but if this is zero, it cannot.
- - 2 as value means can match null string
- - but at end of range or before a character
- - listed in the fastmap. */
- - };
- -
- -
- - /* search.c (search_buffer) needs this one value. It is defined both in
- - regex.c and here. */
- - #define RE_EXACTN_VALUE 1
- -
- -
- - /* Structure to store register contents data in.
- -
- - Pass the address of such a structure as an argument to re_match, etc.,
- - if you want this information back.
- -
- - For i from 1 to RE_NREGS - 1, start[i] records the starting index in
- - the string of where the ith subexpression matched, and end[i] records
- - one after the ending index. start[0] and end[0] are analogous, for
- - the entire pattern. */
- -
- - struct re_registers
- - {
- - int start[RE_NREGS];
- - int end[RE_NREGS];
- - };
- -
- -
- -
- - #if defined(__STDC__) || defined(__cplusplus)
- -
- - extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);
- - /* Is this really advertised? */
- - extern void re_compile_fastmap (struct re_pattern_buffer *);
- - extern int re_search (struct re_pattern_buffer *, char*, int, int, int,
- - struct re_registers *);
- - extern int re_search_2 (struct re_pattern_buffer *, char *, int,
- - char *, int, int, int,
- - struct re_registers *, int);
- - extern int re_match (struct re_pattern_buffer *, char *, int, int,
- - struct re_registers *);
- - extern int re_match_2 (struct re_pattern_buffer *, char *, int,
- - char *, int, int, struct re_registers *, int);
- -
- - #if 0
- - /* 4.2 bsd compatibility. */
- - extern char *re_comp (char *);
- - extern int re_exec (char *);
- #endif
- -
- - #else /* !__STDC__ */
- -
- - #define const /* nothing */
- - extern char *re_compile_pattern ();
- - /* Is this really advertised? */
- - extern void re_compile_fastmap ();
- - extern int re_search (), re_search_2 ();
- - extern int re_match (), re_match_2 ();
- -
- - #if 0
- - /* 4.2 bsd compatibility. */
- - extern char *re_comp ();
- - extern int re_exec ();
- - #endif
- -
- - #endif /* __STDC__ */
- -
- -
- - #ifdef SYNTAX_TABLE
- - extern char *re_syntax_table;
- - #endif
- -
- - #ifdef __cplusplus
- - extern int re_max_failures;
- - }
- - #endif
- -
- - #endif /* !__REGEXP_LIBRARY */
- --- 30,76 ----
- #endif
-
- ! struct re_pattern_buffer; // defined elsewhere
- ! struct re_registers;
-
- + class Regex
- + {
- + private:
- +
- + Regex(const Regex&) {} // no X(X&)
- + void operator = (const Regex&) {} // no assignment
- +
- + protected:
- + re_pattern_buffer* buf;
- + re_registers* reg;
- +
- + public:
- + Regex(const char* t,
- + int fast = 0,
- + int bufsize = 40,
- + const char* transtable = 0);
- +
- + ~Regex();
- +
- + int match(const char* s, int len, int pos = 0) const;
- + int search(const char* s, int len,
- + int& matchlen, int startpos = 0) const;
- + int match_info(int& start, int& length, int nth = 0) const;
- +
- + int OK() const; // representation invariant
- + };
- +
- + // some built in regular expressions
- +
- + extern const Regex RXwhite; // = "[ \n\t\r\v\f]+"
- + extern const Regex RXint; // = "-?[0-9]+"
- + extern const Regex RXdouble; // = "-?\\(\\([0-9]+\\.[0-9]*\\)\\|
- + // \\([0-9]+\\)\\|\\(\\.[0-9]+\\)\\)
- + // \\([eE][---+]?[0-9]+\\)?"
- + extern const Regex RXalpha; // = "[A-Za-z]+"
- + extern const Regex RXlowercase; // = "[a-z]+"
- + extern const Regex RXuppercase; // = "[A-Z]+"
- + extern const Regex RXalphanum; // = "[0-9A-Za-z]+"
- + extern const Regex RXidentifier; // = "[A-Za-z_][A-Za-z0-9_]*"
-
-
- #endif
- diff -rc2N /free/libg++-2.5.3/libg++/src/String.cc /sources/libg++-2.5.3-amiga/libg++/src/String.cc
- *** /free/libg++-2.5.3/libg++/src/String.cc Mon Dec 27 21:38:10 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/String.cc Sun Dec 5 19:14:24 1993
- ***************
- *** 31,35 ****
- --- 31,40 ----
-
- // extern "C" {
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include <_regex.h>
- + #else
- #include <regex.h>
- + #endif
- // }
-
- diff -rc2N /free/libg++-2.5.3/libg++/src/_complex.h /sources/libg++-2.5.3-amiga/libg++/src/_complex.h
- *** /free/libg++-2.5.3/libg++/src/_complex.h Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libg++/src/_complex.h Sun Dec 5 16:43:30 1993
- ***************
- *** 0 ****
- --- 1,6 ----
- + #ifndef _complex_h
- + #define _complex_h
- + #define __ATT_complex__
- + #include <Complex.h>
- + typedef class Complex complex;
- + #endif
- diff -rc2N /free/libg++-2.5.3/libg++/src/_regex.h /sources/libg++-2.5.3-amiga/libg++/src/_regex.h
- *** /free/libg++-2.5.3/libg++/src/_regex.h Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libg++/src/_regex.h Sun Dec 5 19:26:57 1993
- ***************
- *** 0 ****
- --- 1,272 ----
- + /* Definitions for data structures callers pass the regex library.
- +
- + Copyright (C) 1985, 1989-92 Free Software Foundation, Inc.
- +
- + This file is part of the GNU C++ Library. This 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 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 Library General Public License for more details.
- + You should have received a copy of the GNU Library General Public
- + License along with this library; if not, write to the Free Software
- + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- + */
- +
- + #ifndef __REGEXP_LIBRARY
- + #define __REGEXP_LIBRARY
- +
- + #if defined(SHORT_NAMES) || defined(VMS)
- + #define re_compile_pattern recmppat
- + #define re_pattern_buffer repatbuf
- + #define re_registers reregs
- + #endif
- +
- + #ifdef __cplusplus
- + extern "C" {
- + #endif
- +
- + /* Define number of parens for which we record the beginnings and ends.
- + This affects how much space the `struct re_registers' type takes up. */
- + #ifndef RE_NREGS
- + #define RE_NREGS 10
- + #endif
- +
- + #define BYTEWIDTH 8
- +
- +
- + /* Maximum number of duplicates an interval can allow. */
- + #ifndef RE_DUP_MAX /* kludge for AIX, which defines it */
- + #define RE_DUP_MAX ((1 << 15) - 1)
- + #endif
- +
- + /* This defines the various regexp syntaxes. */
- + extern int obscure_syntax;
- +
- +
- + /* The following bits are used in the obscure_syntax variable to choose among
- + alternative regexp syntaxes. */
- +
- + /* If this bit is set, plain parentheses serve as grouping, and backslash
- + parentheses are needed for literal searching.
- + If not set, backslash-parentheses are grouping, and plain parentheses
- + are for literal searching. */
- + #define RE_NO_BK_PARENS 1
- +
- + /* If this bit is set, plain | serves as the `or'-operator, and \| is a
- + literal.
- + If not set, \| serves as the `or'-operator, and | is a literal. */
- + #define RE_NO_BK_VBAR (1 << 1)
- +
- + /* If this bit is not set, plain + or ? serves as an operator, and \+, \? are
- + literals.
- + If set, \+, \? are operators and plain +, ? are literals. */
- + #define RE_BK_PLUS_QM (1 << 2)
- +
- + /* If this bit is set, | binds tighter than ^ or $.
- + If not set, the contrary. */
- + #define RE_TIGHT_VBAR (1 << 3)
- +
- + /* If this bit is set, then treat newline as an OR operator.
- + If not set, treat it as a normal character. */
- + #define RE_NEWLINE_OR (1 << 4)
- +
- + /* If this bit is set, then special characters may act as normal
- + characters in some contexts. Specifically, this applies to:
- + ^ -- only special at the beginning, or after ( or |;
- + $ -- only special at the end, or before ) or |;
- + *, +, ? -- only special when not after the beginning, (, or |.
- + If this bit is not set, special characters (such as *, ^, and $)
- + always have their special meaning regardless of the surrounding
- + context. */
- + #define RE_CONTEXT_INDEP_OPS (1 << 5)
- +
- + /* If this bit is not set, then \ before anything inside [ and ] is taken as
- + a real \.
- + If set, then such a \ escapes the following character. This is a
- + special case for awk. */
- + #define RE_AWK_CLASS_HACK (1 << 6)
- +
- + /* If this bit is set, then \{ and \} or { and } serve as interval operators.
- + If not set, then \{ and \} and { and } are treated as literals. */
- + #define RE_INTERVALS (1 << 7)
- +
- + /* If this bit is not set, then \{ and \} serve as interval operators and
- + { and } are literals.
- + If set, then { and } serve as interval operators and \{ and \} are
- + literals. */
- + #define RE_NO_BK_CURLY_BRACES (1 << 8)
- +
- + /* If this bit is set, then character classes are supported; they are:
- + [:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
- + [:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
- + If not set, then character classes are not supported. */
- + #define RE_CHAR_CLASSES (1 << 9)
- +
- + /* If this bit is set, then the dot re doesn't match a null byte.
- + If not set, it does. */
- + #define RE_DOT_NOT_NULL (1 << 10)
- +
- + /* If this bit is set, then [^...] doesn't match a newline.
- + If not set, it does. */
- + #define RE_HAT_NOT_NEWLINE (1 << 11)
- +
- + /* If this bit is set, back references are recognized.
- + If not set, they aren't. */
- + #define RE_NO_BK_REFS (1 << 12)
- +
- + /* If this bit is set, back references must refer to a preceding
- + subexpression. If not set, a back reference to a nonexistent
- + subexpression is treated as literal characters. */
- + #define RE_NO_EMPTY_BK_REF (1 << 13)
- +
- + /* If this bit is set, bracket expressions can't be empty.
- + If it is set, they can be empty. */
- + #define RE_NO_EMPTY_BRACKETS (1 << 14)
- +
- + /* If this bit is set, then *, +, ? and { cannot be first in an re or
- + immediately after a |, or a (. Furthermore, a | cannot be first or
- + last in an re, or immediately follow another | or a (. Also, a ^
- + cannot appear in a nonleading position and a $ cannot appear in a
- + nontrailing position (outside of bracket expressions, that is). */
- + #define RE_CONTEXTUAL_INVALID_OPS (1 << 15)
- +
- + /* If this bit is set, then +, ? and | aren't recognized as operators.
- + If it's not, they are. */
- + #define RE_LIMITED_OPS (1 << 16)
- +
- + /* If this bit is set, then an ending range point has to collate higher
- + or equal to the starting range point.
- + If it's not set, then when the ending range point collates higher
- + than the starting range point, the range is just considered empty. */
- + #define RE_NO_EMPTY_RANGES (1 << 17)
- +
- + /* If this bit is set, then a hyphen (-) can't be an ending range point.
- + If it isn't, then it can. */
- + #define RE_NO_HYPHEN_RANGE_END (1 << 18)
- +
- +
- + /* Define combinations of bits for the standard possibilities. */
- + #define RE_SYNTAX_POSIX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- + | RE_CONTEXT_INDEP_OPS)
- + #define RE_SYNTAX_AWK (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- + | RE_CONTEXT_INDEP_OPS | RE_AWK_CLASS_HACK)
- + #define RE_SYNTAX_EGREP (RE_NO_BK_PARENS | RE_NO_BK_VBAR \
- + | RE_CONTEXT_INDEP_OPS | RE_NEWLINE_OR)
- + #define RE_SYNTAX_GREP (RE_BK_PLUS_QM | RE_NEWLINE_OR)
- + #define RE_SYNTAX_EMACS 0
- + #define RE_SYNTAX_POSIX_BASIC (RE_INTERVALS | RE_BK_PLUS_QM \
- + | RE_CHAR_CLASSES | RE_DOT_NOT_NULL \
- + | RE_HAT_NOT_NEWLINE | RE_NO_EMPTY_BK_REF \
- + | RE_NO_EMPTY_BRACKETS | RE_LIMITED_OPS \
- + | RE_NO_EMPTY_RANGES | RE_NO_HYPHEN_RANGE_END)
- +
- + #define RE_SYNTAX_POSIX_EXTENDED (RE_INTERVALS | RE_NO_BK_CURLY_BRACES \
- + | RE_NO_BK_VBAR | RE_NO_BK_PARENS \
- + | RE_HAT_NOT_NEWLINE | RE_CHAR_CLASSES \
- + | RE_NO_EMPTY_BRACKETS | RE_CONTEXTUAL_INVALID_OPS \
- + | RE_NO_BK_REFS | RE_NO_EMPTY_RANGES \
- + | RE_NO_HYPHEN_RANGE_END)
- +
- +
- + /* This data structure is used to represent a compiled pattern. */
- +
- + struct re_pattern_buffer
- + {
- + char *buffer; /* Space holding the compiled pattern commands. */
- + long allocated; /* Size of space that `buffer' points to. */
- + long used; /* Length of portion of buffer actually occupied */
- + char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- + /* re_search uses the fastmap, if there is one,
- + to skip over totally implausible characters. */
- + char *translate; /* Translate table to apply to all characters before
- + comparing, or zero for no translation.
- + The translation is applied to a pattern when it is
- + compiled and to data when it is matched. */
- + char fastmap_accurate;
- + /* Set to zero when a new pattern is stored,
- + set to one when the fastmap is updated from it. */
- + char can_be_null; /* Set to one by compiling fastmap
- + if this pattern might match the null string.
- + It does not necessarily match the null string
- + in that case, but if this is zero, it cannot.
- + 2 as value means can match null string
- + but at end of range or before a character
- + listed in the fastmap. */
- + };
- +
- +
- + /* search.c (search_buffer) needs this one value. It is defined both in
- + regex.c and here. */
- + #define RE_EXACTN_VALUE 1
- +
- +
- + /* Structure to store register contents data in.
- +
- + Pass the address of such a structure as an argument to re_match, etc.,
- + if you want this information back.
- +
- + For i from 1 to RE_NREGS - 1, start[i] records the starting index in
- + the string of where the ith subexpression matched, and end[i] records
- + one after the ending index. start[0] and end[0] are analogous, for
- + the entire pattern. */
- +
- + struct re_registers
- + {
- + int start[RE_NREGS];
- + int end[RE_NREGS];
- + };
- +
- +
- +
- + #if defined(__STDC__) || defined(__cplusplus)
- +
- + extern char *re_compile_pattern (const char *, int, struct re_pattern_buffer *);
- + /* Is this really advertised? */
- + extern void re_compile_fastmap (struct re_pattern_buffer *);
- + extern int re_search (struct re_pattern_buffer *, char*, int, int, int,
- + struct re_registers *);
- + extern int re_search_2 (struct re_pattern_buffer *, char *, int,
- + char *, int, int, int,
- + struct re_registers *, int);
- + extern int re_match (struct re_pattern_buffer *, char *, int, int,
- + struct re_registers *);
- + extern int re_match_2 (struct re_pattern_buffer *, char *, int,
- + char *, int, int, struct re_registers *, int);
- +
- + #if 0
- + /* 4.2 bsd compatibility. */
- + extern char *re_comp (char *);
- + extern int re_exec (char *);
- + #endif
- +
- + #else /* !__STDC__ */
- +
- + #define const /* nothing */
- + extern char *re_compile_pattern ();
- + /* Is this really advertised? */
- + extern void re_compile_fastmap ();
- + extern int re_search (), re_search_2 ();
- + extern int re_match (), re_match_2 ();
- +
- + #if 0
- + /* 4.2 bsd compatibility. */
- + extern char *re_comp ();
- + extern int re_exec ();
- + #endif
- +
- + #endif /* __STDC__ */
- +
- +
- + #ifdef SYNTAX_TABLE
- + extern char *re_syntax_table;
- + #endif
- +
- + #ifdef __cplusplus
- + extern int re_max_failures;
- + }
- + #endif
- +
- + #endif /* !__REGEXP_LIBRARY */
- diff -rc2N /free/libg++-2.5.3/libg++/src/std.h /sources/libg++-2.5.3-amiga/libg++/src/std.h
- *** /free/libg++-2.5.3/libg++/src/std.h Mon Dec 27 21:38:17 1993
- --- /sources/libg++-2.5.3-amiga/libg++/src/std.h Sun Dec 5 18:26:13 1993
- ***************
- *** 24,29 ****
- --- 24,39 ----
- #include <stddef.h>
- #include <stdlib.h>
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
- + #include <memory.h>
- + #ifdef amigados
- + /* conflicts w/ ../g++-include */
- + #else
- #include <unistd.h>
- + #endif
- #include <stdio.h>
- #include <errno.h>
- diff -rc2N /free/libg++-2.5.3/libg++/target-mkfrag /sources/libg++-2.5.3-amiga/libg++/target-mkfrag
- *** /free/libg++-2.5.3/libg++/target-mkfrag Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libg++/target-mkfrag Sun Dec 5 16:43:51 1993
- ***************
- *** 0 ****
- --- 1,11 ----
- + # Warning this fragment is automatically generated
- + # RANLIB = ranlib
- + # Use -nostdinc++ flag if your version of gcc understands it.
- + NOSTDINC = -nostdinc++
- +
- + # If the C include files are C++-ready (with extern "C"), uncomment next line:
- + # WRAP_C_INCLUDES =
- +
- + # Flags to pass to gen-params when building _G_config.h.
- + # For example: G_CONFIG_ARGS = size_t="unsigned long"
- + G_CONFIG_ARGS =
- diff -rc2N /free/libg++-2.5.3/libg++/tests/test_h.cc /sources/libg++-2.5.3-amiga/libg++/tests/test_h.cc
- *** /free/libg++-2.5.3/libg++/tests/test_h.cc Mon Dec 27 21:43:55 1993
- --- /sources/libg++-2.5.3-amiga/libg++/tests/test_h.cc Mon Dec 27 16:53:43 1993
- ***************
- *** 89,93 ****
- --- 89,98 ----
- #include <stdlib.h>
- #include <strclass.h>
- + #ifdef amigados
- + /* amigados is not case sensitive ! */
- + #include "gcc:include/string.h"
- + #else
- #include <string.h>
- + #endif
- #include <swap.h>
- #include <unistd.h>
- diff -rc2N /free/libg++-2.5.3/libiberty/alloca-conf.h /sources/libg++-2.5.3-amiga/libiberty/alloca-conf.h
- *** /free/libg++-2.5.3/libiberty/alloca-conf.h Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libiberty/alloca-conf.h Mon Dec 13 23:09:38 1993
- ***************
- *** 0 ****
- --- 1,11 ----
- + /* "Normal" configuration for alloca. */
- +
- + #ifdef __GNUC__
- + #define alloca __builtin_alloca
- + #else /* not __GNUC__ */
- + #ifdef sparc
- + #include <alloca.h>
- + #else
- + char *alloca ();
- + #endif /* sparc */
- + #endif /* not __GNUC__ */
- diff -rc2N /free/libg++-2.5.3/libiberty/config/mh-amigados /sources/libg++-2.5.3-amiga/libiberty/config/mh-amigados
- *** /free/libg++-2.5.3/libiberty/config/mh-amigados Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libiberty/config/mh-amigados Sun Dec 5 16:44:18 1993
- ***************
- *** 0 ****
- --- 1,5 ----
- + # do the best you can ;-)
- + CC = gcc -O2
- + # as long as we don't have a working debugger under AmigaDOS, using
- + # -g just wastes disk space, so don't use it
- + CFLAGS =
- diff -rc2N /free/libg++-2.5.3/libio/Make.pack /sources/libg++-2.5.3-amiga/libio/Make.pack
- *** /free/libg++-2.5.3/libio/Make.pack Thu Jan 1 00:00:00 1970
- --- /sources/libg++-2.5.3-amiga/libio/Make.pack Sun Dec 5 16:44:17 1993
- ***************
- *** 0 ****
- --- 1,114 ----
- + # Start of package fragment generated by ./config.shared.
- + # TOPDIR=$${rootme}../../ invsubdir= subdir=
- + srcdir = .
- + SUBDIRS =
- + prefix = /usr/local
- + exec_prefix = $(prefix)
- + bindir = $(exec_prefix)/bin
- + libdir = $(exec_prefix)/lib
- + datadir = $(prefix)/lib
- + mandir = $(prefix)/man
- + man1dir = $(mandir)/man1
- + man2dir = $(mandir)/man2
- + man3dir = $(mandir)/man3
- + man4dir = $(mandir)/man4
- + man5dir = $(mandir)/man5
- + man6dir = $(mandir)/man6
- + man7dir = $(mandir)/man7
- + man8dir = $(mandir)/man8
- + man9dir = $(mandir)/man9
- + infodir = $(prefix)/info
- + includedir = $(prefix)/include
- + gxx_includedir = $(libdir)/g++-include
- + docdir = $(datadir)/doc
- +
- + SHELL = /bin/sh
- +
- + INSTALL = ${rootme}$(srcdir)/../../install.sh -c
- + INSTALL_PROGRAM = $(INSTALL)
- + INSTALL_DATA = $(INSTALL)
- +
- + AR = `if [ -f $${rootme}../../binutils/ar ] ; \
- + then echo $${rootme}../../binutils/ar ; \
- + else echo ar ; fi`
- + AR_FLAGS = rc
- + RANLIB = `if [ -f $${rootme}../../binutils/ranlib ] ; \
- + then echo $${rootme}../../binutils/ranlib ; \
- + else echo ranlib ; fi`
- + NM = `if [ -f $${rootme}../../binutils/nm ] ; \
- + then echo $${rootme}../../binutils/nm ; \
- + else echo nm ; fi`
- +
- + MAKEINFO = `if [ -f $${rootme}../../texinfo/C/makeinfo ] ; \
- + then echo $${rootme}../../texinfo/C/makeinfo ; \
- + else echo makeinfo ; fi`
- + TEXIDIR=${srcdir}/../..//texinfo
- + TEXI2DVI = TEXINPUTS=${TEXIDIR}:$$TEXINPUTS texi2dvi
- +
- + CC = `if [ -f $${rootme}../../gcc/xgcc ] ; \
- + then echo $${rootme}../../gcc/xgcc -B$${rootme}../../gcc/ ; \
- + else echo cc ; fi`
- + CXX = `if [ -f $${rootme}../../gcc/xgcc ] ; \
- + then echo $${rootme}../../gcc/xgcc -B$${rootme}../../gcc/ ; \
- + else echo gcc ; fi`
- +
- + XTRAFLAGS = `if [ -f $${rootme}../../gcc/xgcc ] ;\
- + then echo -I$${rootme}../../gcc/include;\
- + else echo ; fi`
- + WRAP_C_INCLUDES =
- + CFLAGS = -g
- + CXXFLAGS = -g -O
- + .PHONY: all
- + all: nothing
- +
- +
- + .SUFFIXES: .o .C .cc
- + .c.o:
- + $(CC) -c $(CFLAGS) $(CINCLUDES) $<
- + .C.o:
- + $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $<
- + .cc.o:
- + $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $<
- +
- +
- + .PHONY: install
- + install:
- + .PHONY: check
- + check: nothing
- + .PHONY: info dvi install-info clean-info
- + info:
- + dvi:
- + install-info:
- + .PHONY: do-clean-info clean-info do-clean-dvi clean-dvi
- + do-clean-info:
- + do-clean-dvi:
- + clean-info: do-clean-info
- + clean-dvi: do-clean-dvi
- +
- + .PHONY: boltcc
- + boltcc:
- + rootme=`pwd`/ ; export rootme ; $(MAKE) $(FLAGS_TO_PASS)
- +
- +
- + # clean rules
- + .PHONY: mostlyclean clean distclean realclean
- + mostlyclean: clean-dvi
- + rm -rf *.o core stdio.list
- + clean: clean-dvi
- + rm -rf *.o core stdio.list
- + distclean: clean
- + rm -rf config.status Makefile *~ Make.pack
- + realclean: clean clean-info
- + rm -rf config.status Makefile *~ Make.pack depend *.info*
- +
- + .PHONY: force
- + force:
- +
- + # with the gnu make, this is done automatically.
- +
- + Makefile: $(srcdir)/Makefile.in $(host_makefile_frag) $(target_makefile_frag)
- + $(SHELL) ./config.status
- +
- + .NOEXPORT:
- + MAKEOVERRIDES=
- + # End of package fragment generated by ./config.shared.
- diff -rc2N /free/libg++-2.5.3/libio/dbz/rdbz.c /sources/libg++-2.5.3-amiga/libio/dbz/rdbz.c
- *** /free/libg++-2.5.3/libio/dbz/rdbz.c Mon Dec 27 21:41:03 1993
- --- /sources/libg++-2.5.3-amiga/libio/dbz/rdbz.c Mon Dec 13 22:57:12 1993
- ***************
- *** 0 ****
- --- 1,1766 ----
- + /*
- +
- + dbz.c V3.2
- +
- + Copyright 1988 Jon Zeeff (zeeff@b-tech.ann-arbor.mi.us)
- + You can use this code in any manner, as long as you leave my name on it
- + and don't hold me responsible for any problems with it.
- +
- + Hacked on by gdb@ninja.UUCP (David Butler); Sun Jun 5 00:27:08 CDT 1988
- +
- + Various improvments + INCORE by moraes@ai.toronto.edu (Mark Moraes)
- +
- + Major reworking by Henry Spencer as part of the C News project.
- +
- + These routines replace dbm as used by the usenet news software
- + (it's not a full dbm replacement by any means). It's fast and
- + simple. It contains no AT&T code.
- +
- + In general, dbz's files are 1/20 the size of dbm's. Lookup performance
- + is somewhat better, while file creation is spectacularly faster, especially
- + if the incore facility is used.
- +
- + */
- +
- + #include <stdio.h>
- + #include <sys/types.h>
- + #include <string.h>
- + #include <ctype.h>
- + #include <errno.h>
- + #ifndef __STDC__
- + extern int errno;
- + #endif
- + #include <dbz.h>
- +
- + /*
- + * #ifdef index. "LIA" = "leave it alone unless you know what you're doing".
- + *
- + * FUNNYSEEKS SEEK_SET is not 0, get it from <unistd.h>
- + * INDEX_SIZE backward compatibility with old dbz; avoid using this
- + * NMEMORY number of days of memory for use in sizing new table (LIA)
- + * INCORE backward compatibility with old dbz; use dbzincore() instead
- + * DBZDEBUG enable debugging
- + * DEFSIZE default table size (not as critical as in old dbz)
- + * OLDBNEWS default case mapping as in old B News; set NOBUFFER
- + * BNEWS default case mapping as in current B News; set NOBUFFER
- + * DEFCASE default case-map algorithm selector
- + * NOTAGS fseek offsets are strange, do not do tagging (see below)
- + * NPAGBUF size of .pag buffer, in longs (LIA)
- + * SHISTBUF size of ASCII-file buffer, in bytes (LIA)
- + * MAXRUN length of run which shifts to next table (see below) (LIA)
- + * OVERFLOW long-int arithmetic overflow must be avoided, will trap
- + * NOBUFFER do not buffer hash-table i/o, B News locking is defective
- + */
- +
- + #ifdef FUNNYSEEKS
- + #include <unistd.h>
- + #else
- + #define SEEK_SET 0
- + #endif
- + #ifdef OVERFLOW
- + #include <limits.h>
- + #endif
- +
- + static int dbzversion = 3; /* for validating .dir file format */
- +
- + /*
- + * The dbz database exploits the fact that when news stores a <key,value>
- + * tuple, the `value' part is a seek offset into a text file, pointing to
- + * a copy of the `key' part. This avoids the need to store a copy of
- + * the key in the dbz files. However, the text file *must* exist and be
- + * consistent with the dbz files, or things will fail.
- + *
- + * The basic format of the database is a simple hash table containing the
- + * values. A value is stored by indexing into the table using a hash value
- + * computed from the key; collisions are resolved by linear probing (just
- + * search forward for an empty slot, wrapping around to the beginning of
- + * the table if necessary). Linear probing is a performance disaster when
- + * the table starts to get full, so a complication is introduced. The
- + * database is actually one *or more* tables, stored sequentially in the
- + * .pag file, and the length of linear-probe sequences is limited. The
- + * search (for an existing item or an empty slot) always starts in the
- + * first table, and whenever MAXRUN probes have been done in table N,
- + * probing continues in table N+1. This behaves reasonably well even in
- + * cases of massive overflow. There are some other small complications
- + * added, see comments below.
- + *
- + * The table size is fixed for any particular database, but is determined
- + * dynamically when a database is rebuilt. The strategy is to try to pick
- + * the size so the first table will be no more than 2/3 full, that being
- + * slightly before the point where performance starts to degrade. (It is
- + * desirable to be a bit conservative because the overflow strategy tends
- + * to produce files with holes in them, which is a nuisance.)
- + */
- +
- + /*
- + * The following is for backward compatibility.
- + */
- + #ifdef INDEX_SIZE
- + #define DEFSIZE INDEX_SIZE
- + #endif
- +
- + /*
- + * ANSI C says an offset into a file is a long, not an off_t, for some
- + * reason. This actually does simplify life a bit, but it's still nice
- + * to have a distinctive name for it. Beware, this is just for readability,
- + * don't try to change this.
- + */
- + #define of_t long
- + #define SOF (sizeof(of_t))
- +
- + /*
- + * We assume that unused areas of a binary file are zeros, and that the
- + * bit pattern of `(of_t)0' is all zeros. The alternative is rather
- + * painful file initialization. Note that okayvalue(), if OVERFLOW is
- + * defined, knows what value of an offset would cause overflow.
- + */
- + #define VACANT ((of_t)0)
- + #define BIAS(o) ((o)+1) /* make any valid of_t non-VACANT */
- + #define UNBIAS(o) ((o)-1) /* reverse BIAS() effect */
- +
- + /*
- + * In a Unix implementation, or indeed any in which an of_t is a byte
- + * count, there are a bunch of high bits free in an of_t. There is a
- + * use for them. Checking a possible hit by looking it up in the base
- + * file is relatively expensive, and the cost can be dramatically reduced
- + * by using some of those high bits to tag the value with a few more bits
- + * of the key's hash. This detects most false hits without the overhead of
- + * seek+read+strcmp. We use the top bit to indicate whether the value is
- + * tagged or not, and don't tag a value which is using the tag bits itself.
- + * We're in trouble if the of_t representation wants to use the top bit.
- + * The actual bitmasks and offset come from the configuration stuff,
- + * which permits fiddling with them as necessary, and also suppressing
- + * them completely (by defining the masks to 0). We build pre-shifted
- + * versions of the masks for efficiency.
- + */
- + static of_t tagbits; /* pre-shifted tag mask */
- + static of_t taghere; /* pre-shifted tag-enable bit */
- + static of_t tagboth; /* tagbits|taghere */
- + #define HASTAG(o) ((o)&taghere)
- + #define TAG(o) ((o)&tagbits)
- + #define NOTAG(o) ((o)&~tagboth)
- + #define CANTAG(o) (((o)&tagboth) == 0)
- + #define MKTAG(v) (((v)<<conf.tagshift)&tagbits)
- +
- + /*
- + * A new, from-scratch database, not built as a rebuild of an old one,
- + * needs to know table size, casemap algorithm, and tagging. Normally
- + * the user supplies this info, but there have to be defaults.
- + */
- + #ifndef DEFSIZE
- + #define DEFSIZE 120011 /* 300007 might be better */
- + #endif
- + #ifdef OLDBNEWS
- + #define DEFCASE '0' /* B2.10 -- no mapping */
- + #define NOBUFFER /* B News locking is defective */
- + #endif
- + #ifdef BNEWS
- + #define DEFCASE '=' /* B2.11 -- all mapped */
- + #define NOBUFFER /* B News locking is defective */
- + #endif
- + #ifndef DEFCASE /* C News compatibility is the default */
- + #define DEFCASE 'C' /* C News -- RFC822 mapping */
- + #endif
- + #ifndef NOTAGS
- + #define TAGENB 0x80 /* tag enable is top bit, tag is next 7 */
- + #define TAGMASK 0x7f
- + #define TAGSHIFT 24
- + #else
- + #define TAGENB 0 /* no tags */
- + #define TAGMASK 0
- + #define TAGSHIFT 0
- + #endif
- +
- + /*
- + * We read configuration info from the .dir file into this structure,
- + * so we can avoid wired-in assumptions for an existing database.
- + *
- + * Among the info is a record of recent peak usages, so that a new table
- + * size can be chosen intelligently when rebuilding. 10 is a good
- + * number of usages to keep, since news displays marked fluctuations
- + * in volume on a 7-day cycle.
- + */
- + struct dbzconfig {
- + int olddbz; /* .dir file empty but .pag not? */
- + of_t tsize; /* table size */
- + # ifndef NMEMORY
- + # define NMEMORY 10 /* # days of use info to remember */
- + # endif
- + # define NUSEDS (1+NMEMORY)
- + of_t used[NUSEDS]; /* entries used today, yesterday, ... */
- + int valuesize; /* size of table values, == SOF */
- + int bytemap[SOF]; /* byte-order map */
- + char casemap; /* case-mapping algorithm (see cipoint()) */
- + char fieldsep; /* field separator in base file, if any */
- + of_t tagenb; /* unshifted tag-enable bit */
- + of_t tagmask; /* unshifted tag mask */
- + int tagshift; /* shift count for tagmask and tagenb */
- + };
- + static struct dbzconfig conf;
- + static int getconf();
- + static long getno();
- + static int putconf();
- + static void mybytemap();
- + static of_t bytemap();
- +
- + /*
- + * For a program that makes many, many references to the database, it
- + * is a large performance win to keep the table in core, if it will fit.
- + * Note that this does hurt robustness in the event of crashes, and
- + * dbmclose() *must* be called to flush the in-core database to disk.
- + * The code is prepared to deal with the possibility that there isn't
- + * enough memory. There *is* an assumption that a size_t is big enough
- + * to hold the size (in bytes) of one table, so dbminit() tries to figure
- + * out whether this is possible first.
- + *
- + * The preferred way to ask for an in-core table is to do dbzincore(1)
- + * before dbminit(). The default is not to do it, although -DINCORE
- + * overrides this for backward compatibility with old dbz.
- + *
- + * We keep only the first table in core. This greatly simplifies the
- + * code, and bounds memory demand. Furthermore, doing this is a large
- + * performance win even in the event of massive overflow.
- + */
- + #ifdef INCORE
- + static int incore = 1;
- + #else
- + static int incore = 0;
- + #endif
- +
- + /*
- + * Stdio buffer for .pag reads. Buffering more than about 16 does not help
- + * significantly at the densities we try to maintain, and the much larger
- + * buffers that most stdios default to are much more expensive to fill.
- + * With small buffers, stdio is performance-competitive with raw read(),
- + * and it's much more portable.
- + */
- + #ifndef NPAGBUF
- + #define NPAGBUF 16
- + #endif
- + #ifndef NOBUFFER
- + #ifdef _IOFBF
- + static of_t pagbuf[NPAGBUF]; /* only needed if !NOBUFFER && _IOFBF */
- + #endif
- + #endif
- +
- + /*
- + * Stdio buffer for base-file reads. Message-IDs (all news ever needs to
- + * read) are essentially never longer than 64 bytes, and the typical stdio
- + * buffer is so much larger that it is much more expensive to fill.
- + */
- + #ifndef SHISTBUF
- + #define SHISTBUF 64
- + #endif
- + #ifdef _IOFBF
- + static char basebuf[SHISTBUF]; /* only needed if _IOFBF exists */
- + #endif
- +
- + /*
- + * Data structure for recording info about searches.
- + */
- + struct searcher {
- + of_t place; /* current location in file */
- + int tabno; /* which table we're in */
- + int run; /* how long we'll stay in this table */
- + # ifndef MAXRUN
- + # define MAXRUN 100
- + # endif
- + long hash; /* the key's hash code (for optimization) */
- + of_t tag; /* tag we are looking for */
- + int seen; /* have we examined current location? */
- + int aborted; /* has i/o error aborted search? */
- + };
- + static void start();
- + #define FRESH ((struct searcher *)NULL)
- + static of_t search();
- + #define NOTFOUND ((of_t)-1)
- + static int okayvalue();
- + static int set();
- +
- + /*
- + * Arguably the searcher struct for a given routine ought to be local to
- + * it, but a fetch() is very often immediately followed by a store(), and
- + * in some circumstances it is a useful performance win to remember where
- + * the fetch() completed. So we use a global struct and remember whether
- + * it is current.
- + */
- + static struct searcher srch;
- + static struct searcher *prevp; /* &srch or FRESH */
- +
- + /* byte-ordering stuff */
- + static int mybmap[SOF]; /* my byte order (see mybytemap()) */
- + static int bytesame; /* is database order same as mine? */
- + #define MAPIN(o) ((bytesame) ? (o) : bytemap((o), conf.bytemap, mybmap))
- + #define MAPOUT(o) ((bytesame) ? (o) : bytemap((o), mybmap, conf.bytemap))
- +
- + /*
- + * The double parentheses needed to make this work are ugly, but the
- + * alternative (under most compilers) is to pack around 2K of unused
- + * strings -- there's just no way to get rid of them.
- + */
- + static int debug; /* controlled by dbzdebug() */
- + #ifdef DBZDEBUG
- + #define DEBUG(args) if (debug) { (void) printf args ; }
- + #else
- + #define DEBUG(args) ;
- + #endif
- +
- + /* externals used */
- + extern char *malloc();
- + extern char *calloc();
- + extern void free(); /* ANSI C; some old implementations say int */
- + extern int atoi();
- + extern long atol();
- +
- + /* misc. forwards */
- + static long hash();
- + static void crcinit();
- + static char *cipoint();
- + static char *mapcase();
- + static int isprime();
- + static FILE *latebase();
- +
- + /* file-naming stuff */
- + static char dir[] = ".dir";
- + static char pag[] = ".pag";
- + static char *enstring();
- +
- + /* central data structures */
- + static FILE *basef; /* descriptor for base file */
- + static char *basefname; /* name for not-yet-opened base file */
- + static FILE *dirf; /* descriptor for .dir file */
- + static int dirronly; /* dirf open read-only? */
- + static FILE *pagf = NULL; /* descriptor for .pag file */
- + static of_t pagpos; /* posn in pagf; only search may set != -1 */
- + static int pagronly; /* pagf open read-only? */
- + static of_t *corepag; /* incore version of .pag file, if any */
- + static FILE *bufpagf; /* well-buffered pagf, for incore rewrite */
- + static of_t *getcore();
- + static int putcore();
- + static int written; /* has a store() been done? */
- +
- + /*
- + - dbzfresh - set up a new database, no historical info
- + */
- + int /* 0 success, -1 failure */
- + dbzfresh(name, size, fs, cmap, tagmask)
- + char *name; /* base name; .dir and .pag must exist */
- + long size; /* table size (0 means default) */
- + int fs; /* field-separator character in base file */
- + int cmap; /* case-map algorithm (0 means default) */
- + of_t tagmask; /* 0 default, 1 no tags */
- + {
- + register char *fn;
- + struct dbzconfig c;
- + register of_t m;
- + register FILE *f;
- +
- + if (pagf != NULL) {
- + DEBUG(("dbzfresh: database already open\n"));
- + return(-1);
- + }
- + if (size != 0 && size < 2) {
- + DEBUG(("dbzfresh: preposterous size (%ld)\n", size));
- + return(-1);
- + }
- +
- + /* get default configuration */
- + if (getconf((FILE *)NULL, (FILE *)NULL, &c) < 0)
- + return(-1); /* "can't happen" */
- +
- + /* and mess with it as specified */
- + if (size != 0)
- + c.tsize = size;
- + c.fieldsep = fs;
- + switch (cmap) {
- + case 0:
- + case '0':
- + case 'B': /* 2.10 compat */
- + c.casemap = '0'; /* '\0' nicer, but '0' printable! */
- + break;
- + case '=':
- + case 'b': /* 2.11 compat */
- + c.casemap = '=';
- + break;
- + case 'C':
- + c.casemap = 'C';
- + break;
- + case '?':
- + c.casemap = DEFCASE;
- + break;
- + default:
- + DEBUG(("dbzfresh case map `%c' unknown\n", cmap));
- + return(-1);
- + break;
- + }
- + switch (tagmask) {
- + case 0: /* default */
- + break;
- + case 1: /* no tags */
- + c.tagshift = 0;
- + c.tagmask = 0;
- + c.tagenb = 0;
- + break;
- + default:
- + m = tagmask;
- + c.tagshift = 0;
- + while (!(m&01)) {
- + m >>= 1;
- + c.tagshift++;
- + }
- + c.tagmask = m;
- + c.tagenb = (m << 1) & ~m;
- + break;
- + }
- +
- + /* write it out */
- + fn = enstring(name, dir);
- + if (fn == NULL)
- + return(-1);
- + f = fopen(fn, "w");
- + free(fn);
- + if (f == NULL) {
- + DEBUG(("dbzfresh: unable to write config\n"));
- + return(-1);
- + }
- + if (putconf(f, &c) < 0) {
- + (void) fclose(f);
- + return(-1);
- + }
- + if (fclose(f) == EOF) {
- + DEBUG(("dbzfresh: fclose failure\n"));
- + return(-1);
- + }
- +
- + /* create/truncate .pag */
- + fn = enstring(name, pag);
- + if (fn == NULL)
- + return(-1);
- + f = fopen(fn, "w");
- + free(fn);
- + if (f == NULL) {
- + DEBUG(("dbzfresh: unable to create/truncate .pag file\n"));
- + return(-1);
- + } else
- + (void) fclose(f);
- +
- + /* and punt to dbminit for the hard work */
- + return(dbminit(name));
- + }
- +
- + /*
- + - dbzsize - what's a good table size to hold this many entries?
- + */
- + long
- + dbzsize(contents)
- + long contents; /* 0 means what's the default */
- + {
- + register long n;
- +
- + if (contents <= 0) { /* foulup or default inquiry */
- + DEBUG(("dbzsize: preposterous input (%ld)\n", contents));
- + return(DEFSIZE);
- + }
- + n = (contents/2)*3; /* try to keep table at most 2/3 full */
- + if (!(n&01)) /* make it odd */
- + n++;
- + DEBUG(("dbzsize: tentative size %ld\n", n));
- + while (!isprime(n)) /* and look for a prime */
- + n += 2;
- + DEBUG(("dbzsize: final size %ld\n", n));
- +
- + return(n);
- + }
- +
- + /*
- + - isprime - is a number prime?
- + *
- + * This is not a terribly efficient approach.
- + */
- + static int /* predicate */
- + isprime(x)
- + register long x;
- + {
- + static int quick[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 0 };
- + register int *ip;
- + register long div;
- + register long stop;
- +
- + /* hit the first few primes quickly to eliminate easy ones */
- + /* this incidentally prevents ridiculously small tables */
- + for (ip = quick; (div = *ip) != 0; ip++)
- + if (x%div == 0) {
- + DEBUG(("isprime: quick result on %ld\n", (long)x));
- + return(0);
- + }
- +
- + /* approximate square root of x */
- + for (stop = x; x/stop < stop; stop >>= 1)
- + continue;
- + stop <<= 1;
- +
- + /* try odd numbers up to stop */
- + for (div = *--ip; div < stop; div += 2)
- + if (x%div == 0)
- + return(0);
- +
- + return(1);
- + }
- +
- + /*
- + - dbzagain - set up a new database to be a rebuild of an old one
- + */
- + int /* 0 success, -1 failure */
- + dbzagain(name, oldname)
- + char *name; /* base name; .dir and .pag must exist */
- + char *oldname; /* base name; all must exist */
- + {
- + register char *fn;
- + struct dbzconfig c;
- + register int i;
- + register long top;
- + register FILE *f;
- + register int newtable;
- + register of_t newsize;
- +
- + if (pagf != NULL) {
- + DEBUG(("dbzagain: database already open\n"));
- + return(-1);
- + }
- +
- + /* pick up the old configuration */
- + fn = enstring(oldname, dir);
- + if (fn == NULL)
- + return(-1);
- + f = fopen(fn, "r");
- + free(fn);
- + if (f == NULL) {
- + DEBUG(("dbzagain: cannot open old .dir file\n"));
- + return(-1);
- + }
- + i = getconf(f, (FILE *)NULL, &c);
- + (void) fclose(f);
- + if (i < 0) {
- + DEBUG(("dbzagain: getconf failed\n"));
- + return(-1);
- + }
- +
- + /* tinker with it */
- + top = 0;
- + newtable = 0;
- + for (i = 0; i < NUSEDS; i++) {
- + if (top < c.used[i])
- + top = c.used[i];
- + if (c.used[i] == 0)
- + newtable = 1; /* hasn't got full usage history yet */
- + }
- + if (top == 0) {
- + DEBUG(("dbzagain: old table has no contents!\n"));
- + newtable = 1;
- + }
- + for (i = NUSEDS-1; i > 0; i--)
- + c.used[i] = c.used[i-1];
- + c.used[0] = 0;
- + newsize = dbzsize(top);
- + if (!newtable || newsize > c.tsize) /* don't shrink new table */
- + c.tsize = newsize;
- +
- + /* write it out */
- + fn = enstring(name, dir);
- + if (fn == NULL)
- + return(-1);
- + f = fopen(fn, "w");
- + free(fn);
- + if (f == NULL) {
- + DEBUG(("dbzagain: unable to write new .dir\n"));
- + return(-1);
- + }
- + i = putconf(f, &c);
- + (void) fclose(f);
- + if (i < 0) {
- + DEBUG(("dbzagain: putconf failed\n"));
- + return(-1);
- + }
- +
- + /* create/truncate .pag */
- + fn = enstring(name, pag);
- + if (fn == NULL)
- + return(-1);
- + f = fopen(fn, "w");
- + free(fn);
- + if (f == NULL) {
- + DEBUG(("dbzagain: unable to create/truncate .pag file\n"));
- + return(-1);
- + } else
- + (void) fclose(f);
- +
- + /* and let dbminit do the work */
- + return(dbminit(name));
- + }
- +
- + /*
- + - dbminit - open a database, creating it (using defaults) if necessary
- + *
- + * We try to leave errno set plausibly, to the extent that underlying
- + * functions permit this, since many people consult it if dbminit() fails.
- + */
- + int /* 0 success, -1 failure */
- + dbminit(name)
- + char *name;
- + {
- + register int i;
- + register size_t s;
- + register char *dirfname;
- + register char *pagfname;
- +
- + if (pagf != NULL) {
- + DEBUG(("dbminit: dbminit already called once\n"));
- + errno = 0;
- + return(-1);
- + }
- +
- + /* open the .dir file */
- + dirfname = enstring(name, dir);
- + if (dirfname == NULL)
- + return(-1);
- + dirf = fopen(dirfname, "r+");
- + if (dirf == NULL) {
- + dirf = fopen(dirfname, "r");
- + dirronly = 1;
- + } else
- + dirronly = 0;
- + free(dirfname);
- + if (dirf == NULL) {
- + DEBUG(("dbminit: can't open .dir file\n"));
- + return(-1);
- + }
- +
- + /* open the .pag file */
- + pagfname = enstring(name, pag);
- + if (pagfname == NULL) {
- + (void) fclose(dirf);
- + return(-1);
- + }
- + pagf = fopen(pagfname, "r+b");
- + if (pagf == NULL) {
- + pagf = fopen(pagfname, "rb");
- + if (pagf == NULL) {
- + DEBUG(("dbminit: .pag open failed\n"));
- + (void) fclose(dirf);
- + free(pagfname);
- + return(-1);
- + }
- + pagronly = 1;
- + } else if (dirronly)
- + pagronly = 1;
- + else
- + pagronly = 0;
- + #ifdef NOBUFFER
- + /*
- + * B News does not do adequate locking on its database accesses.
- + * Why it doesn't get into trouble using dbm is a mystery. In any
- + * case, doing unbuffered i/o does not cure the problem, but does
- + * enormously reduce its incidence.
- + */
- + (void) setbuf(pagf, (char *)NULL);
- + #else
- + #ifdef _IOFBF
- + (void) setvbuf(pagf, (char *)pagbuf, _IOFBF, sizeof(pagbuf));
- + #endif
- + #endif
- + pagpos = -1;
- + /* don't free pagfname, need it below */
- +
- + /* open the base file */
- + basef = fopen(name, "r");
- + if (basef == NULL) {
- + DEBUG(("dbminit: basefile open failed\n"));
- + basefname = enstring(name, "");
- + if (basefname == NULL) {
- + (void) fclose(pagf);
- + (void) fclose(dirf);
- + free(pagfname);
- + pagf = NULL;
- + return(-1);
- + }
- + } else
- + basefname = NULL;
- + #ifdef _IOFBF
- + if (basef != NULL)
- + (void) setvbuf(basef, basebuf, _IOFBF, sizeof(basebuf));
- + #endif
- +
- + /* pick up configuration */
- + if (getconf(dirf, pagf, &conf) < 0) {
- + DEBUG(("dbminit: getconf failure\n"));
- + (void) fclose(basef);
- + (void) fclose(pagf);
- + (void) fclose(dirf);
- + free(pagfname);
- + pagf = NULL;
- + errno = EDOM; /* kind of a kludge, but very portable */
- + return(-1);
- + }
- + tagbits = conf.tagmask << conf.tagshift;
- + taghere = conf.tagenb << conf.tagshift;
- + tagboth = tagbits | taghere;
- + mybytemap(mybmap);
- + bytesame = 1;
- + for (i = 0; i < SOF; i++)
- + if (mybmap[i] != conf.bytemap[i])
- + bytesame = 0;
- +
- + /* get first table into core, if it looks desirable and feasible */
- + s = (size_t)conf.tsize * SOF;
- + if (incore && (of_t)(s/SOF) == conf.tsize) {
- + bufpagf = fopen(pagfname, (pagronly) ? "rb" : "r+b");
- + if (bufpagf != NULL)
- + corepag = getcore(bufpagf);
- + } else {
- + bufpagf = NULL;
- + corepag = NULL;
- + }
- + free(pagfname);
- +
- + /* misc. setup */
- + crcinit();
- + written = 0;
- + prevp = FRESH;
- + DEBUG(("dbminit: succeeded\n"));
- + return(0);
- + }
- +
- + /*
- + - enstring - concatenate two strings into a malloced area
- + */
- + static char * /* NULL if malloc fails */
- + enstring(s1, s2)
- + char *s1;
- + char *s2;
- + {
- + register char *p;
- +
- + p = malloc((size_t)strlen(s1) + (size_t)strlen(s2) + 1);
- + if (p != NULL) {
- + (void) strcpy(p, s1);
- + (void) strcat(p, s2);
- + } else {
- + DEBUG(("enstring(%s, %s) out of memory\n", s1, s2));
- + }
- + return(p);
- + }
- +
- + /*
- + - dbmclose - close a database
- + */
- + int
- + dbmclose()
- + {
- + register int ret = 0;
- +
- + if (pagf == NULL) {
- + DEBUG(("dbmclose: not opened!\n"));
- + return(-1);
- + }
- +
- + if (fclose(pagf) == EOF) {
- + DEBUG(("dbmclose: fclose(pagf) failed\n"));
- + ret = -1;
- + }
- + pagf = basef; /* ensure valid pointer; dbzsync checks it */
- + if (dbzsync() < 0)
- + ret = -1;
- + if (bufpagf != NULL && fclose(bufpagf) == EOF) {
- + DEBUG(("dbmclose: fclose(bufpagf) failed\n"));
- + ret = -1;
- + }
- + if (corepag != NULL)
- + free((char *)corepag);
- + corepag = NULL;
- + if (fclose(basef) == EOF) {
- + DEBUG(("dbmclose: fclose(basef) failed\n"));
- + ret = -1;
- + }
- + if (basefname != NULL)
- + free(basefname);
- + basef = NULL;
- + pagf = NULL;
- + if (fclose(dirf) == EOF) {
- + DEBUG(("dbmclose: fclose(dirf) failed\n"));
- + ret = -1;
- + }
- +
- + DEBUG(("dbmclose: %s\n", (ret == 0) ? "succeeded" : "failed"));
- + return(ret);
- + }
- +
- + /*
- + - dbzsync - push all in-core data out to disk
- + */
- + int
- + dbzsync()
- + {
- + register int ret = 0;
- +
- + if (pagf == NULL) {
- + DEBUG(("dbzsync: not opened!\n"));
- + return(-1);
- + }
- + if (!written)
- + return(0);
- +
- + if (corepag != NULL) {
- + if (putcore(corepag, bufpagf) < 0) {
- + DEBUG(("dbzsync: putcore failed\n"));
- + ret = -1;
- + }
- + }
- + if (!conf.olddbz)
- + if (putconf(dirf, &conf) < 0)
- + ret = -1;
- +
- + DEBUG(("dbzsync: %s\n", (ret == 0) ? "succeeded" : "failed"));
- + return(ret);
- + }
- +
- + /*
- + - dbzcancel - cancel writing of in-core data
- + * Mostly for use from child processes.
- + * Note that we don't need to futz around with stdio buffers, because we
- + * always fflush them immediately anyway and so they never have stale data.
- + */
- + int
- + dbzcancel()
- + {
- + if (pagf == NULL) {
- + DEBUG(("dbzcancel: not opened!\n"));
- + return(-1);
- + }
- +
- + written = 0;
- + return(0);
- + }
- +
- + /*
- + - dbzfetch - fetch() with case mapping built in
- + */
- + datum
- + dbzfetch(key)
- + datum key;
- + {
- + char buffer[DBZMAXKEY + 1];
- + datum mappedkey;
- + register size_t keysize;
- +
- + DEBUG(("dbzfetch: (%s)\n", key.dptr));
- +
- + /* Key is supposed to be less than DBZMAXKEY */
- + keysize = key.dsize;
- + if (keysize >= DBZMAXKEY) {
- + keysize = DBZMAXKEY;
- + DEBUG(("keysize is %d - truncated to %d\n", key.dsize, DBZMAXKEY));
- + }
- +
- + mappedkey.dptr = mapcase(buffer, key.dptr, keysize);
- + buffer[keysize] = '\0'; /* just a debug aid */
- + mappedkey.dsize = keysize;
- +
- + return(fetch(mappedkey));
- + }
- +
- + /*
- + - fetch - get an entry from the database
- + *
- + * Disgusting fine point, in the name of backward compatibility: if the
- + * last character of "key" is a NUL, that character is (effectively) not
- + * part of the comparison against the stored keys.
- + */
- + datum /* dptr NULL, dsize 0 means failure */
- + fetch(key)
- + datum key;
- + {
- + char buffer[DBZMAXKEY + 1];
- + static of_t key_ptr; /* return value points here */
- + datum output;
- + register size_t keysize;
- + register size_t cmplen;
- + register char *sepp;
- +
- + DEBUG(("fetch: (%s)\n", key.dptr));
- + output.dptr = NULL;
- + output.dsize = 0;
- + prevp = FRESH;
- +
- + /* Key is supposed to be less than DBZMAXKEY */
- + keysize = key.dsize;
- + if (keysize >= DBZMAXKEY) {
- + keysize = DBZMAXKEY;
- + DEBUG(("keysize is %d - truncated to %d\n", key.dsize, DBZMAXKEY));
- + }
- +
- + if (pagf == NULL) {
- + DEBUG(("fetch: database not open!\n"));
- + return(output);
- + } else if (basef == NULL) { /* basef didn't exist yet */
- + basef = latebase();
- + if (basef == NULL)
- + return(output);
- + }
- +
- + cmplen = keysize;
- + sepp = &conf.fieldsep;
- + if (key.dptr[keysize-1] == '\0') {
- + cmplen--;
- + sepp = &buffer[keysize-1];
- + }
- + start(&srch, &key, FRESH);
- + while ((key_ptr = search(&srch)) != NOTFOUND) {
- + DEBUG(("got 0x%lx\n", key_ptr));
- +
- + /* fetch the key */
- + if (fseek(basef, key_ptr, SEEK_SET) != 0) {
- + DEBUG(("fetch: seek failed\n"));
- + return(output);
- + }
- + if (fread(buffer, 1, keysize, basef) != keysize) {
- + DEBUG(("fetch: read failed\n"));
- + return(output);
- + }
- +
- + /* try it */
- + buffer[keysize] = '\0'; /* terminated for DEBUG */
- + (void) mapcase(buffer, buffer, keysize);
- + DEBUG(("fetch: buffer (%s) looking for (%s) size = %d\n",
- + buffer, key.dptr, keysize));
- + if (memcmp(key.dptr, buffer, cmplen) == 0 &&
- + (*sepp == conf.fieldsep || *sepp == '\0')) {
- + /* we found it */
- + output.dptr = (char *)&key_ptr;
- + output.dsize = SOF;
- + DEBUG(("fetch: successful\n"));
- + return(output);
- + }
- + }
- +
- + /* we didn't find it */
- + DEBUG(("fetch: failed\n"));
- + prevp = &srch; /* remember where we stopped */
- + return(output);
- + }
- +
- + /*
- + - latebase - try to open a base file that wasn't there at the start
- + */
- + static FILE *
- + latebase()
- + {
- + register FILE *it;
- +
- + if (basefname == NULL) {
- + DEBUG(("latebase: name foulup\n"));
- + return(NULL);
- + }
- + it = fopen(basefname, "r");
- + if (it == NULL) {
- + DEBUG(("latebase: still can't open base\n"));
- + } else {
- + DEBUG(("latebase: late open succeeded\n"));
- + free(basefname);
- + basefname = NULL;
- + #ifdef _IOFBF
- + (void) setvbuf(it, basebuf, _IOFBF, sizeof(basebuf));
- + #endif
- + }
- + return(it);
- + }
- +
- + /*
- + - dbzstore - store() with case mapping built in
- + */
- + int
- + dbzstore(key, data)
- + datum key;
- + datum data;
- + {
- + char buffer[DBZMAXKEY + 1];
- + datum mappedkey;
- + register size_t keysize;
- +
- + DEBUG(("dbzstore: (%s)\n", key.dptr));
- +
- + /* Key is supposed to be less than DBZMAXKEY */
- + keysize = key.dsize;
- + if (keysize >= DBZMAXKEY) {
- + DEBUG(("dbzstore: key size too big (%d)\n", key.dsize));
- + return(-1);
- + }
- +
- + mappedkey.dptr = mapcase(buffer, key.dptr, keysize);
- + buffer[keysize] = '\0'; /* just a debug aid */
- + mappedkey.dsize = keysize;
- +
- + return(store(mappedkey, data));
- + }
- +
- + /*
- + - store - add an entry to the database
- + */
- + int /* 0 success, -1 failure */
- + store(key, data)
- + datum key;
- + datum data;
- + {
- + of_t value;
- +
- + if (pagf == NULL) {
- + DEBUG(("store: database not open!\n"));
- + return(-1);
- + } else if (basef == NULL) { /* basef didn't exist yet */
- + basef = latebase();
- + if (basef == NULL)
- + return(-1);
- + }
- + if (pagronly) {
- + DEBUG(("store: database open read-only\n"));
- + return(-1);
- + }
- + if (data.dsize != SOF) {
- + DEBUG(("store: value size wrong (%d)\n", data.dsize));
- + return(-1);
- + }
- + if (key.dsize >= DBZMAXKEY) {
- + DEBUG(("store: key size too big (%d)\n", key.dsize));
- + return(-1);
- + }
- +
- + /* copy the value in to ensure alignment */
- + (void) memcpy((char *)&value, data.dptr, SOF);
- + DEBUG(("store: (%s, %ld)\n", key.dptr, (long)value));
- + if (!okayvalue(value)) {
- + DEBUG(("store: reserved bit or overflow in 0x%lx\n", value));
- + return(-1);
- + }
- +
- + /* find the place, exploiting previous search if possible */
- + start(&srch, &key, prevp);
- + while (search(&srch) != NOTFOUND)
- + continue;
- +
- + prevp = FRESH;
- + conf.used[0]++;
- + DEBUG(("store: used count %ld\n", conf.used[0]));
- + written = 1;
- + return(set(&srch, value));
- + }
- +
- + /*
- + - dbzincore - control attempts to keep .pag file in core
- + */
- + int /* old setting */
- + dbzincore(value)
- + int value;
- + {
- + register int old = incore;
- +
- + incore = value;
- + return(old);
- + }
- +
- + /*
- + - getconf - get configuration from .dir file
- + */
- + static int /* 0 success, -1 failure */
- + getconf(df, pf, cp)
- + register FILE *df; /* NULL means just give me the default */
- + register FILE *pf; /* NULL means don't care about .pag */
- + register struct dbzconfig *cp;
- + {
- + register int c;
- + register int i;
- + int err = 0;
- +
- + c = (df != NULL) ? getc(df) : EOF;
- + if (c == EOF) { /* empty file, no configuration known */
- + cp->olddbz = 0;
- + if (df != NULL && pf != NULL && getc(pf) != EOF)
- + cp->olddbz = 1;
- + cp->tsize = DEFSIZE;
- + cp->fieldsep = '\t';
- + for (i = 0; i < NUSEDS; i++)
- + cp->used[i] = 0;
- + cp->valuesize = SOF;
- + mybytemap(cp->bytemap);
- + cp->casemap = DEFCASE;
- + cp->tagenb = TAGENB;
- + cp->tagmask = TAGMASK;
- + cp->tagshift = TAGSHIFT;
- + DEBUG(("getconf: defaults (%ld, %c, (0x%lx/0x%lx<<%d))\n",
- + cp->tsize, cp->casemap, cp->tagenb,
- + cp->tagmask, cp->tagshift));
- + return(0);
- + }
- + (void) ungetc(c, df);
- +
- + /* first line, the vital stuff */
- + if (getc(df) != 'd' || getc(df) != 'b' || getc(df) != 'z')
- + err = -1;
- + if (getno(df, &err) != dbzversion)
- + err = -1;
- + cp->tsize = getno(df, &err);
- + cp->fieldsep = getno(df, &err);
- + while ((c = getc(df)) == ' ')
- + continue;
- + cp->casemap = c;
- + cp->tagenb = getno(df, &err);
- + cp->tagmask = getno(df, &err);
- + cp->tagshift = getno(df, &err);
- + cp->valuesize = getno(df, &err);
- + if (cp->valuesize != SOF) {
- + DEBUG(("getconf: wrong of_t size (%d)\n", cp->valuesize));
- + err = -1;
- + cp->valuesize = SOF; /* to protect the loops below */
- + }
- + for (i = 0; i < cp->valuesize; i++)
- + cp->bytemap[i] = getno(df, &err);
- + if (getc(df) != '\n')
- + err = -1;
- + DEBUG(("size %ld, sep %d, cmap %c, tags 0x%lx/0x%lx<<%d, ", cp->tsize,
- + cp->fieldsep, cp->casemap, cp->tagenb, cp->tagmask,
- + cp->tagshift));
- + DEBUG(("bytemap (%d)", cp->valuesize));
- + for (i = 0; i < cp->valuesize; i++) {
- + DEBUG((" %d", cp->bytemap[i]));
- + }
- + DEBUG(("\n"));
- +
- + /* second line, the usages */
- + for (i = 0; i < NUSEDS; i++)
- + cp->used[i] = getno(df, &err);
- + if (getc(df) != '\n')
- + err = -1;
- + DEBUG(("used %ld %ld %ld...\n", cp->used[0], cp->used[1], cp->used[2]));
- +
- + if (err < 0) {
- + DEBUG(("getconf error\n"));
- + return(-1);
- + }
- + return(0);
- + }
- +
- + /*
- + - getno - get a long
- + */
- + static long
- + getno(f, ep)
- + FILE *f;
- + int *ep;
- + {
- + register char *p;
- + # define MAXN 50
- + char getbuf[MAXN];
- + register int c;
- +
- + while ((c = getc(f)) == ' ')
- + continue;
- + if (c == EOF || c == '\n') {
- + DEBUG(("getno: missing number\n"));
- + *ep = -1;
- + return(0);
- + }
- + p = getbuf;
- + *p++ = c;
- + while ((c = getc(f)) != EOF && c != '\n' && c != ' ')
- + if (p < &getbuf[MAXN-1])
- + *p++ = c;
- + if (c == EOF) {
- + DEBUG(("getno: EOF\n"));
- + *ep = -1;
- + } else
- + (void) ungetc(c, f);
- + *p = '\0';
- +
- + if (strspn(getbuf, "-1234567890") != strlen(getbuf)) {
- + DEBUG(("getno: `%s' non-numeric\n", getbuf));
- + *ep = -1;
- + }
- + return(atol(getbuf));
- + }
- +
- + /*
- + - putconf - write configuration to .dir file
- + */
- + static int /* 0 success, -1 failure */
- + putconf(f, cp)
- + register FILE *f;
- + register struct dbzconfig *cp;
- + {
- + register int i;
- + register int ret = 0;
- +
- + if (fseek(f, (of_t)0, SEEK_SET) != 0) {
- + DEBUG(("fseek failure in putconf\n"));
- + ret = -1;
- + }
- + fprintf(f, "dbz %d %ld %d %c %ld %ld %d %d", dbzversion, cp->tsize,
- + cp->fieldsep, cp->casemap, cp->tagenb,
- + cp->tagmask, cp->tagshift, cp->valuesize);
- + for (i = 0; i < cp->valuesize; i++)
- + fprintf(f, " %d", cp->bytemap[i]);
- + fprintf(f, "\n");
- + for (i = 0; i < NUSEDS; i++)
- + fprintf(f, "%ld%c", cp->used[i], (i < NUSEDS-1) ? ' ' : '\n');
- +
- + (void) fflush(f);
- + if (ferror(f))
- + ret = -1;
- +
- + DEBUG(("putconf status %d\n", ret));
- + return(ret);
- + }
- +
- + /*
- + - getcore - try to set up an in-core copy of .pag file
- + */
- + static of_t * /* pointer to copy, or NULL */
- + getcore(f)
- + FILE *f;
- + {
- + register of_t *p;
- + register size_t i;
- + register size_t nread;
- + register char *it;
- +
- + it = malloc((size_t)conf.tsize * SOF);
- + if (it == NULL) {
- + DEBUG(("getcore: malloc failed\n"));
- + return(NULL);
- + }
- +
- + nread = fread(it, SOF, (size_t)conf.tsize, f);
- + if (ferror(f)) {
- + DEBUG(("getcore: read failed\n"));
- + free(it);
- + return(NULL);
- + }
- +
- + p = (of_t *)it + nread;
- + i = (size_t)conf.tsize - nread;
- + while (i-- > 0)
- + *p++ = VACANT;
- + return((of_t *)it);
- + }
- +
- + /*
- + - putcore - try to rewrite an in-core table
- + */
- + static int /* 0 okay, -1 fail */
- + putcore(tab, f)
- + of_t *tab;
- + FILE *f;
- + {
- + if (fseek(f, (of_t)0, SEEK_SET) != 0) {
- + DEBUG(("fseek failure in putcore\n"));
- + return(-1);
- + }
- + (void) fwrite((char *)tab, SOF, (size_t)conf.tsize, f);
- + (void) fflush(f);
- + return((ferror(f)) ? -1 : 0);
- + }
- +
- + /*
- + - start - set up to start or restart a search
- + */
- + static void
- + start(sp, kp, osp)
- + register struct searcher *sp;
- + register datum *kp;
- + register struct searcher *osp; /* may be FRESH, i.e. NULL */
- + {
- + register long h;
- +
- + h = hash(kp->dptr, kp->dsize);
- + if (osp != FRESH && osp->hash == h) {
- + if (sp != osp)
- + *sp = *osp;
- + DEBUG(("search restarted\n"));
- + } else {
- + sp->hash = h;
- + sp->tag = MKTAG(h / conf.tsize);
- + DEBUG(("tag 0x%lx\n", sp->tag));
- + sp->place = h % conf.tsize;
- + sp->tabno = 0;
- + sp->run = (conf.olddbz) ? conf.tsize : MAXRUN;
- + sp->aborted = 0;
- + }
- + sp->seen = 0;
- + }
- +
- + /*
- + - search - conduct part of a search
- + */
- + static of_t /* NOTFOUND if we hit VACANT or error */
- + search(sp)
- + register struct searcher *sp;
- + {
- + register of_t dest;
- + register of_t value;
- + of_t val; /* buffer for value (can't fread register) */
- + register of_t place;
- +
- + if (sp->aborted)
- + return(NOTFOUND);
- +
- + for (;;) {
- + /* determine location to be examined */
- + place = sp->place;
- + if (sp->seen) {
- + /* go to next location */
- + if (--sp->run <= 0) {
- + sp->tabno++;
- + sp->run = MAXRUN;
- + }
- + place = (place+1)%conf.tsize + sp->tabno*conf.tsize;
- + sp->place = place;
- + } else
- + sp->seen = 1; /* now looking at current location */
- + DEBUG(("search @ %ld\n", place));
- +
- + /* get the tagged value */
- + if (corepag != NULL && place < conf.tsize) {
- + DEBUG(("search: in core\n"));
- + value = MAPIN(corepag[place]);
- + } else {
- + /* seek, if necessary */
- + dest = place * SOF;
- + if (pagpos != dest) {
- + if (fseek(pagf, dest, SEEK_SET) != 0) {
- + DEBUG(("search: seek failed\n"));
- + pagpos = -1;
- + sp->aborted = 1;
- + return(NOTFOUND);
- + }
- + pagpos = dest;
- + }
- +
- + /* read it */
- + if (fread((char *)&val, sizeof(val), 1, pagf) == 1)
- + value = MAPIN(val);
- + else if (ferror(pagf)) {
- + DEBUG(("search: read failed\n"));
- + pagpos = -1;
- + sp->aborted = 1;
- + return(NOTFOUND);
- + } else
- + value = VACANT;
- +
- + /* and finish up */
- + pagpos += sizeof(val);
- + }
- +
- + /* vacant slot is always cause to return */
- + if (value == VACANT) {
- + DEBUG(("search: empty slot\n"));
- + return(NOTFOUND);
- + };
- +
- + /* check the tag */
- + value = UNBIAS(value);
- + DEBUG(("got 0x%lx\n", value));
- + if (!HASTAG(value)) {
- + DEBUG(("tagless\n"));
- + return(value);
- + } else if (TAG(value) == sp->tag) {
- + DEBUG(("match\n"));
- + return(NOTAG(value));
- + } else {
- + DEBUG(("mismatch 0x%lx\n", TAG(value)));
- + }
- + }
- + /* NOTREACHED */
- + }
- +
- + /*
- + - okayvalue - check that a value can be stored
- + */
- + static int /* predicate */
- + okayvalue(value)
- + of_t value;
- + {
- + if (HASTAG(value))
- + return(0);
- + #ifdef OVERFLOW
- + if (value == LONG_MAX) /* BIAS() and UNBIAS() will overflow */
- + return(0);
- + #endif
- + return(1);
- + }
- +
- + /*
- + - set - store a value into a location previously found by search
- + */
- + static int /* 0 success, -1 failure */
- + set(sp, value)
- + register struct searcher *sp;
- + of_t value;
- + {
- + register of_t place = sp->place;
- + register of_t v = value;
- +
- + if (sp->aborted)
- + return(-1);
- +
- + if (CANTAG(v) && !conf.olddbz) {
- + v |= sp->tag | taghere;
- + if (v != UNBIAS(VACANT)) /* BIAS(v) won't look VACANT */
- + #ifdef OVERFLOW
- + if (v != LONG_MAX) /* and it won't overflow */
- + #endif
- + value = v;
- + }
- + DEBUG(("tagged value is 0x%lx\n", value));
- + value = BIAS(value);
- + value = MAPOUT(value);
- +
- + /* If we have the index file in memory, use it */
- + if (corepag != NULL && place < conf.tsize) {
- + corepag[place] = value;
- + DEBUG(("set: incore\n"));
- + return(0);
- + }
- +
- + /* seek to spot */
- + pagpos = -1; /* invalidate position memory */
- + if (fseek(pagf, place * SOF, SEEK_SET) != 0) {
- + DEBUG(("set: seek failed\n"));
- + sp->aborted = 1;
- + return(-1);
- + }
- +
- + /* write in data */
- + if (fwrite((char *)&value, SOF, 1, pagf) != 1) {
- + DEBUG(("set: write failed\n"));
- + sp->aborted = 1;
- + return(-1);
- + }
- + /* fflush improves robustness, and buffer re-use is rare anyway */
- + if (fflush(pagf) == EOF) {
- + DEBUG(("set: fflush failed\n"));
- + sp->aborted = 1;
- + return(-1);
- + }
- +
- + DEBUG(("set: succeeded\n"));
- + return(0);
- + }
- +
- + /*
- + - mybytemap - determine this machine's byte map
- + *
- + * A byte map is an array of ints, sizeof(of_t) of them. The 0th int
- + * is the byte number of the high-order byte in my of_t, and so forth.
- + */
- + static void
- + mybytemap(map)
- + int map[]; /* -> int[SOF] */
- + {
- + union {
- + of_t o;
- + char c[SOF];
- + } u;
- + register int *mp = &map[SOF];
- + register int ntodo;
- + register int i;
- +
- + u.o = 1;
- + for (ntodo = (int)SOF; ntodo > 0; ntodo--) {
- + for (i = 0; i < SOF; i++)
- + if (u.c[i] != 0)
- + break;
- + if (i == SOF) {
- + /* trouble -- set it to *something* consistent */
- + DEBUG(("mybytemap: nonexistent byte %d!!!\n", ntodo));
- + for (i = 0; i < SOF; i++)
- + map[i] = i;
- + return;
- + }
- + DEBUG(("mybytemap: byte %d\n", i));
- + *--mp = i;
- + while (u.c[i] != 0)
- + u.o <<= 1;
- + }
- + }
- +
- + /*
- + - bytemap - transform an of_t from byte ordering map1 to map2
- + */
- + static of_t /* transformed result */
- + bytemap(ino, map1, map2)
- + of_t ino;
- + int *map1;
- + int *map2;
- + {
- + union oc {
- + of_t o;
- + char c[SOF];
- + };
- + union oc in;
- + union oc out;
- + register int i;
- +
- + in.o = ino;
- + for (i = 0; i < SOF; i++)
- + out.c[map2[i]] = in.c[map1[i]];
- + return(out.o);
- + }
- +
- + /*
- + * This is a simplified version of the pathalias hashing function.
- + * Thanks to Steve Belovin and Peter Honeyman
- + *
- + * hash a string into a long int. 31 bit crc (from andrew appel).
- + * the crc table is computed at run time by crcinit() -- we could
- + * precompute, but it takes 1 clock tick on a 750.
- + *
- + * This fast table calculation works only if POLY is a prime polynomial
- + * in the field of integers modulo 2. Since the coefficients of a
- + * 32-bit polynomial won't fit in a 32-bit word, the high-order bit is
- + * implicit. IT MUST ALSO BE THE CASE that the coefficients of orders
- + * 31 down to 25 are zero. Happily, we have candidates, from
- + * E. J. Watson, "Primitive Polynomials (Mod 2)", Math. Comp. 16 (1962):
- + * x^32 + x^7 + x^5 + x^3 + x^2 + x^1 + x^0
- + * x^31 + x^3 + x^0
- + *
- + * We reverse the bits to get:
- + * 111101010000000000000000000000001 but drop the last 1
- + * f 5 0 0 0 0 0 0
- + * 010010000000000000000000000000001 ditto, for 31-bit crc
- + * 4 8 0 0 0 0 0 0
- + */
- +
- + #define POLY 0x48000000L /* 31-bit polynomial (avoids sign problems) */
- +
- + static long CrcTable[128];
- +
- + /*
- + - crcinit - initialize tables for hash function
- + */
- + static void
- + crcinit()
- + {
- + register int i, j;
- + register long sum;
- +
- + for (i = 0; i < 128; ++i) {
- + sum = 0L;
- + for (j = 7 - 1; j >= 0; --j)
- + if (i & (1 << j))
- + sum ^= POLY >> j;
- + CrcTable[i] = sum;
- + }
- + DEBUG(("crcinit: done\n"));
- + }
- +
- + /*
- + - hash - Honeyman's nice hashing function
- + */
- + static long
- + hash(name, size)
- + register char *name;
- + register int size;
- + {
- + register long sum = 0L;
- +
- + while (size--) {
- + sum = (sum >> 7) ^ CrcTable[(sum ^ (*name++)) & 0x7f];
- + }
- + DEBUG(("hash: returns (%ld)\n", sum));
- + return(sum);
- + }
- +
- + /*
- + * case-mapping stuff
- + *
- + * Borrowed from C News, by permission of the authors. Somewhat modified.
- + *
- + * We exploit the fact that we are dealing only with headers here, and
- + * headers are limited to the ASCII characters by RFC822. It is barely
- + * possible that we might be dealing with a translation into another
- + * character set, but in particular it's very unlikely for a header
- + * character to be outside -128..255.
- + *
- + * Life would be a whole lot simpler if tolower() could safely and portably
- + * be applied to any char.
- + */
- +
- + #define OFFSET 128 /* avoid trouble with negative chars */
- +
- + /* must call casencmp before invoking TOLOW... */
- + #define TOLOW(c) (cmap[(c)+OFFSET])
- +
- + /* ...but the use of it in CISTREQN is safe without the preliminary call (!) */
- + /* CISTREQN is an optimised case-insensitive strncmp(a,b,n)==0; n > 0 */
- + #define CISTREQN(a, b, n) \
- + (TOLOW((a)[0]) == TOLOW((b)[0]) && casencmp(a, b, n) == 0)
- +
- + #define MAPSIZE (256+OFFSET)
- + static char cmap[MAPSIZE]; /* relies on init to '\0' */
- + static int mprimed = 0; /* has cmap been set up? */
- +
- + /*
- + - mapprime - set up case-mapping stuff
- + */
- + static void
- + mapprime()
- + {
- + register char *lp;
- + register char *up;
- + register int c;
- + register int i;
- + static char lower[] = "abcdefghijklmnopqrstuvwxyz";
- + static char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- +
- + for (lp = lower, up = upper; *lp != '\0'; lp++, up++) {
- + c = *lp;
- + cmap[c+OFFSET] = c;
- + cmap[*up+OFFSET] = c;
- + }
- + for (i = 0; i < MAPSIZE; i++)
- + if (cmap[i] == '\0')
- + cmap[i] = (char)(i-OFFSET);
- + mprimed = 1;
- + }
- +
- + /*
- + - casencmp - case-independent strncmp
- + */
- + static int /* < == > 0 */
- + casencmp(s1, s2, len)
- + char *s1;
- + char *s2;
- + int len;
- + {
- + register char *p1;
- + register char *p2;
- + register int n;
- +
- + if (!mprimed)
- + mapprime();
- +
- + p1 = s1;
- + p2 = s2;
- + n = len;
- + while (--n >= 0 && *p1 != '\0' && TOLOW(*p1) == TOLOW(*p2)) {
- + p1++;
- + p2++;
- + }
- + if (n < 0)
- + return(0);
- +
- + /*
- + * The following case analysis is necessary so that characters
- + * which look negative collate low against normal characters but
- + * high against the end-of-string NUL.
- + */
- + if (*p1 == '\0' && *p2 == '\0')
- + return(0);
- + else if (*p1 == '\0')
- + return(-1);
- + else if (*p2 == '\0')
- + return(1);
- + else
- + return(TOLOW(*p1) - TOLOW(*p2));
- + }
- +
- + /*
- + - mapcase - do case-mapped copy
- + */
- + static char * /* returns src or dst */
- + mapcase(dst, src, siz)
- + char *dst; /* destination, used only if mapping needed */
- + char *src; /* source; src == dst is legal */
- + size_t siz;
- + {
- + register char *s;
- + register char *d;
- + register char *c; /* case break */
- + register char *e; /* end of source */
- +
- +
- + c = cipoint(src, siz);
- + if (c == NULL)
- + return(src);
- +
- + if (!mprimed)
- + mapprime();
- + s = src;
- + e = s + siz;
- + d = dst;
- +
- + while (s < c)
- + *d++ = *s++;
- + while (s < e)
- + *d++ = TOLOW(*s++);
- +
- + return(dst);
- + }
- +
- + /*
- + - cipoint - where in this message-ID does it become case-insensitive?
- + *
- + * The RFC822 code is not quite complete. Absolute, total, full RFC822
- + * compliance requires a horrible parsing job, because of the arcane
- + * quoting conventions -- abc"def"ghi is not equivalent to abc"DEF"ghi,
- + * for example. There are three or four things that might occur in the
- + * domain part of a message-id that are case-sensitive. They don't seem
- + * to ever occur in real news, thank Cthulhu. (What? You were expecting
- + * a merciful and forgiving deity to be invoked in connection with RFC822?
- + * Forget it; none of them would come near it.)
- + */
- + static char * /* pointer into s, or NULL for "nowhere" */
- + cipoint(s, siz)
- + char *s;
- + size_t siz;
- + {
- + register char *p;
- + static char post[] = "postmaster";
- + static int plen = sizeof(post)-1;
- +
- + switch (conf.casemap) {
- + case '0': /* unmapped, sensible */
- + return(NULL);
- + break;
- + case 'C': /* C News, RFC 822 conformant (approx.) */
- + p = memchr(s, '@', siz);
- + if (p == NULL) /* no local/domain split */
- + return(NULL); /* assume all local */
- + else if (p - (s+1) == plen && CISTREQN(s+1, post, plen)) {
- + /* crazy -- "postmaster" is case-insensitive */
- + return(s);
- + } else
- + return(p);
- + break;
- + case '=': /* 2.11, neither sensible nor conformant */
- + return(s); /* all case-insensitive */
- + break;
- + }
- +
- + DEBUG(("cipoint: unknown case mapping `%c'\n", conf.casemap));
- + return(NULL); /* just leave it alone */
- + }
- +
- + /*
- + - dbzdebug - control dbz debugging at run time
- + */
- + int /* old value */
- + dbzdebug(value)
- + int value;
- + {
- + #ifdef DBZDEBUG
- + register int old = debug;
- +
- + debug = value;
- + return(old);
- + #else
- + return(-1);
- + #endif
- + }
- diff -rc2N /free/libg++-2.5.3/libio/dbz/rdbzmain.c /sources/libg++-2.5.3-amiga/libio/dbz/rdbzmain.c
- *** /free/libg++-2.5.3/libio/dbz/rdbzmain.c Mon Dec 27 21:41:04 1993
- --- /sources/libg++-2.5.3-amiga/libio/dbz/rdbzmain.c Mon Dec 13 22:57:36 1993
- ***************
- *** 0 ****
- --- 1,518 ----
- + /*
- + * dbz - use and test dbz in various ways
- + *
- + * -Log-
- + */
- +
- + #include <stdio.h>
- + #include <sys/types.h>
- + #include <sys/stat.h>
- + #include <string.h>
- + #include <dbz.h>
- +
- + #ifdef FUNNYSEEKS
- + #include <unistd.h>
- + #else
- + #define SEEK_SET 0
- + #endif
- +
- + #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0)
- +
- + #ifndef lint
- + static char RCSid[] = "$Header: /rel/cvsfiles/devo/libio/dbz/dbzmain.c,v 1.2 1993/10/25 20:02:41 bothner Exp $";
- + #endif
- +
- + char *progname;
- +
- + char *inname = "(no file)"; /* filename for messages etc. */
- + long lineno; /* line number for messages etc. */
- +
- + char *basename;
- + char *pagname;
- + char *dirname;
- + char *str2dup();
- + FILE *base;
- +
- + int op = 'b'; /* what to do, default build a new table */
- + int baseinput = 1; /* is the base file also the input? */
- +
- + char *from = NULL; /* old table to use for dbzagain() */
- + int omitzero = 0; /* omit lines tagged with 0 */
- + long every = 0; /* report every n lines */
- + int syncs = 0; /* dbzsync() on each report */
- + int quick = 0; /* quick checking, not too thorough */
- + int sweep = 0; /* sweep file checking all offsets */
- + int useincore = 1; /* should we use incore facility? */
- + long xxx = 0; /* debugging variable */
- + int printx = 0; /* print xxx after all is done */
- + int unique = 1; /* before store(), check with fetch() */
- + int usefresh = 0; /* use dbzfresh? */
- + long siz = 0; /* -p size */
- + char map = 'C'; /* -p map */
- + long tag = 0; /* -p tag mask */
- + int exact = 0; /* do not run dbzsize(siz) */
- + int dbzint = 1; /* use new interface? */
- + char fs = '\t'; /* field separator, default tab */
- + int unopen = 0; /* make base unopenable during dbminit? */
- + char *change = NULL; /* chdir here before dbmclose */
- +
- + #define DEFBUF 1024 /* default line-buffer size */
- + int buflen = DEFBUF; /* line length limit */
- + char lbuf[DEFBUF];
- + char *line = lbuf;
- + char cbuf[DEFBUF];
- + char *cmp = cbuf;
- +
- + void fail();
- + void dofile();
- + void runs();
- + void dosweep();
- + void mkfiles();
- + void crfile();
- + void doline();
- + void process();
- +
- + #ifdef HAVERFCIZE
- + extern char *rfc822ize();
- + #else
- + #define rfc822ize(n) (n)
- + #endif
- +
- + extern char *malloc();
- +
- + /*
- + - main - parse arguments and handle options
- + */
- + main(argc, argv)
- + int argc;
- + char *argv[];
- + {
- + int c;
- + int errflg = 0;
- + extern int optind;
- + extern char *optarg;
- + int doruns = 0;
- + extern long atol();
- +
- + progname = argv[0];
- +
- + while ((c = getopt(argc, argv, "axcmt:l:R0E:SqOiX:Yuf:p:eMUC:d")) != EOF)
- + switch (c) {
- + case 'a': /* append to existing table */
- + if (op != 'b')
- + fail("only one of -a -x -c -m can be given", "");
- + op = 'a';
- + baseinput = 0;
- + break;
- + case 'x': /* extract from existing table */
- + if (op != 'b')
- + fail("only one of -a -x -c -m can be given", "");
- + op = 'x';
- + baseinput = 0;
- + break;
- + case 'c': /* check existing table */
- + if (op != 'b')
- + fail("only one of -a -x -c -m can be given", "");
- + op = 'c';
- + break;
- + case 'm': /* extract missing (complement of -x) */
- + if (op != 'b')
- + fail("only one of -a -x -c -m can be given", "");
- + op = 'm';
- + baseinput = 0;
- + break;
- + case 't': /* set field separator */
- + if (strlen(optarg) > 1)
- + fail("only one field separator allowed", "");
- + fs = *optarg;
- + break;
- + case 'l': /* override line-length limit */
- + buflen = atoi(optarg) + 1;
- + if (buflen <= 2)
- + fail("bad -l value `%s'", optarg);
- + line = malloc(buflen);
- + cmp = malloc(buflen);
- + if (line == NULL || cmp == NULL)
- + fail("cannot allocate %s-byte buffers", optarg);
- + break;
- + case 'R': /* print run statistics */
- + doruns = 1;
- + break;
- + case '0': /* omit lines tagged (by fake -t) with 0 */
- + omitzero = 1;
- + break;
- + case 'E': /* report every n items */
- + every = atol(optarg);
- + break;
- + case 'S': /* dbzsync() on each -E report */
- + syncs = 1;
- + break;
- + case 'q': /* quick check or extract */
- + quick = 1;
- + break;
- + case 'O': /* sweep file checking all offsets */
- + sweep = 1;
- + break;
- + case 'i': /* don't use incore */
- + useincore = 0;
- + break;
- + case 'X': /* set xxx */
- + xxx = atoi(optarg);
- + break;
- + case 'Y': /* print xxx afterward */
- + printx = 1;
- + break;
- + case 'u': /* don't check uniqueness */
- + unique = 0;
- + break;
- + case 'f': /* init from existing table's parameters */
- + from = optarg;
- + break;
- + case 'p': /* parameters for dbzfresh */
- + if (sscanf(optarg, "%ld %1s %lx", &siz, &map, &tag) != 3) {
- + map = '?';
- + tag = 0;
- + if (sscanf(optarg, "%ld", &siz) != 1)
- + fail("bad -n value `%s'", optarg);
- + }
- + usefresh = 1;
- + break;
- + case 'e': /* -p size is exact, don't dbzsize() it */
- + exact = 1;
- + break;
- + case 'M': /* use old dbm interface + rfc822ize */
- + dbzint = 0;
- + break;
- + case 'U': /* make base unopenable during init */
- + unopen = 1;
- + break;
- + case 'C': /* change directories before dbmclose */
- + change = optarg;
- + break;
- + case 'd': /* Debugging. */
- + if (dbzdebug(1) < 0)
- + fail("dbz debugging not available", "");
- + break;
- + case '?':
- + default:
- + errflg++;
- + break;
- + }
- + if (errflg || optind >= argc || (optind+1 < argc && baseinput)) {
- + fprintf(stderr, "usage: %s ", progname);
- + fprintf(stderr, "[-a] [-x] [-c] database [file] ...\n");
- + exit(2);
- + }
- +
- + (void) dbzincore(useincore);
- + basename = argv[optind];
- + pagname = str2dup(basename, ".pag");
- + dirname = str2dup(basename, ".dir");
- + mkfiles();
- + optind++;
- +
- + if (baseinput) /* implies no further arguments */
- + process(base, basename);
- + else if (optind >= argc)
- + process(stdin, "stdin");
- + else
- + for (; optind < argc; optind++)
- + dofile(argv[optind]);
- +
- + if (change != NULL)
- + (void) chdir(change);
- + if (dbmclose() < 0)
- + fail("dbmclose failed", "");
- + if (doruns)
- + runs(pagname);
- + if (sweep)
- + dosweep(basename, pagname);
- + if (printx)
- + printf("%ld\n", xxx);
- + #ifdef DBZ_FINISH
- + DBZ_FINISH;
- + #endif
- + exit(0);
- + }
- +
- + /*
- + - dofile - open a file and invoke process()
- + */
- + void
- + dofile(name)
- + char *name;
- + {
- + register FILE *in;
- +
- + if (STREQ(name, "-"))
- + process(stdin, "-");
- + else {
- + in = fopen(name, "r");
- + if (in == NULL)
- + fail("cannot open `%s'", name);
- + process(in, name);
- + (void) fclose(in);
- + }
- + }
- +
- + /*
- + - mkfiles - create empty files and open them up
- + */
- + void
- + mkfiles()
- + {
- + if (op == 'b' && !dbzint) {
- + crfile(dirname);
- + crfile(pagname);
- + }
- +
- + base = fopen(basename, (op == 'a') ? "a" : "r");
- + if (base == NULL)
- + fail("cannot open `%s'", basename);
- + if (unopen)
- + (void) chmod(basename, 0);
- + if (from != NULL) {
- + if (dbzagain(basename, from) < 0)
- + fail("dbzagain(`%s'...) failed", basename);
- + } else if (op == 'b' && dbzint) {
- + if (!exact)
- + siz = dbzsize(siz);
- + if (dbzfresh(basename, siz, (int)fs, map, tag) < 0)
- + fail("dbzfresh(`%s'...) failed", basename);
- + } else if (dbminit(basename) < 0)
- + fail("dbminit(`%s') failed", basename);
- + if (unopen)
- + (void) chmod(basename, 0600); /* hard to restore original */
- + }
- +
- + /*
- + - crfile - create a file
- + */
- + void
- + crfile(name)
- + char *name;
- + {
- + register int f;
- +
- + f = creat(name, 0666);
- + if (f < 0)
- + fail("cannot create `%s'", name);
- + (void) close(f);
- + }
- +
- + /*
- + - process - process input file
- + */
- + void
- + process(in, name)
- + FILE *in;
- + char *name;
- + {
- + register off_t place;
- +
- + inname = name;
- + lineno = 0;
- +
- + for (;;) {
- + place = ftell(in);
- + if (fgets(line, buflen, in) == NULL)
- + return;
- + lineno++;
- + if (every > 0 && lineno%every == 0) {
- + fprintf(stderr, "%ld\n", lineno);
- + if (dbzsync() < 0)
- + fail("dbzsync failed", "");
- + }
- + doline(line, place);
- + }
- + /* NOTREACHED */
- + }
- +
- + /*
- + - doline - process input line
- + */
- + void
- + doline(lp, inoffset)
- + char *lp;
- + off_t inoffset;
- + {
- + register char *p;
- + register char pc;
- + datum key, value;
- + off_t place = inoffset;
- + register int shouldfind;
- + register int llen;
- + char keytext[DBZMAXKEY+1];
- +
- + p = NULL;
- + if (fs != '\0')
- + p = strchr(lp, fs);
- + if (p == NULL)
- + p = lp + strlen(lp);
- + if (p > lp && *(p-1) == '\n')
- + p--;
- + if (p - lp > DBZMAXKEY)
- + fail("key of `%.40s...' too long", lp);
- + pc = *p;
- + *p = '\0';
- + (void) strcpy(keytext, lp);
- + *p = pc;
- + key.dptr = (dbzint) ? keytext : rfc822ize(keytext);
- + key.dsize = strlen(keytext)+1;
- +
- + switch (op) {
- + case 'a':
- + place = ftell(base);
- + llen = strlen(lp);
- + if (fwrite(lp, 1, llen, base) != llen)
- + fail("write error in `%s'", basename);
- + /* FALLTHROUGH */
- + case 'b':
- + if (omitzero && p != NULL && *(p+1) == '0')
- + return;
- + if (unique) {
- + value = (dbzint) ? dbzfetch(key) : fetch(key);
- + if (value.dptr != NULL)
- + fail("`%.40s...' already present", lp);
- + }
- + value.dptr = (char *)&place;
- + value.dsize = (int)sizeof(off_t);
- + if (((dbzint) ? dbzstore(key, value) : store(key, value)) < 0)
- + fail("store failed on `%.40s...'", lp);
- + break;
- + case 'c':
- + value = (dbzint) ? dbzfetch(key) : fetch(key);
- + shouldfind = (omitzero && p != NULL && *(p+1) == '0') ? 0 : 1;
- + if (!shouldfind && (value.dptr != NULL || value.dsize != 0))
- + fail("`%.40s...' found, shouldn't be", lp);
- + if (shouldfind && (value.dptr == NULL ||
- + value.dsize != sizeof(off_t)))
- + fail("can't find `%.40s...'", lp);
- + if (shouldfind && !quick) {
- + (void) memcpy((char *)&place, value.dptr, sizeof(off_t));
- + if (place != inoffset)
- + fail("offset mismatch on `%.40s...'", lp);
- + if (fseek(base, place, SEEK_SET) == -1)
- + fail("fseek failed on `%.40s...'", lp);
- + if (fgets(cmp, buflen, base) == NULL)
- + fail("can't read line for `%.40s...'", lp);
- + if (!STREQ(lp, cmp))
- + fail("compare failed on `%.40s...'", lp);
- + }
- + break;
- + case 'x':
- + value = (dbzint) ? dbzfetch(key) : fetch(key);
- + if (value.dptr != NULL && !quick) {
- + (void) memcpy((char *)&place, value.dptr, sizeof(off_t));
- + if (fseek(base, place, SEEK_SET) == -1)
- + fail("fseek failed on `%.40s...'", lp);
- + if (fgets(cmp, buflen, base) == NULL)
- + fail("can't read line for `%.40s...'", lp);
- + fputs(cmp, stdout);
- + } else if (value.dptr != NULL)
- + fputs(lp, stdout);
- + break;
- + case 'm':
- + value = (dbzint) ? dbzfetch(key) : fetch(key);
- + if (value.dptr == NULL) {
- + fputs(keytext, stdout);
- + putchar('\n');
- + }
- + break;
- + default:
- + fail("unknown operator -- can't happen", "");
- + break;
- + }
- + }
- +
- + /*
- + - runs - print run statistics
- + */
- + void
- + runs(file)
- + char *file;
- + {
- + register FILE *fd;
- + off_t it;
- + register long run;
- +
- + fd = fopen(file, "r");
- + if (fd == NULL)
- + fail("cannot reopen `%s'", file);
- + run = 0;
- + while (fread((char *)&it, sizeof(off_t), 1, fd) == 1) {
- + if (it != 0)
- + run++;
- + else if (run > 0) {
- + printf("%ld\n", run);
- + run = 0;
- + }
- + }
- + (void) fclose(fd);
- + }
- +
- + /*
- + - dosweep - sweep pag file checking for valid offsets
- + */
- + void
- + dosweep(fn, pn)
- + char *fn;
- + char *pn;
- + {
- + register FILE *pf;
- + off_t it;
- + char nl;
- + register FILE *hf;
- +
- + hf = fopen(fn, "r");
- + if (hf == NULL)
- + fail("cannot reopen `%s'", fn);
- + pf = fopen(pn, "r");
- + if (pf == NULL)
- + fail("cannot reopen `%s'", pn);
- + while (fread((char *)&it, sizeof(off_t), 1, pf) == 1) {
- + it = (it & ((off_t)0x80000000)) ? (it&~((off_t)0xff000000)) : it;
- + if (it != 0 && it != 1) { /* 0 empty, 1 known okay */
- + it--; /* get rid of bias */
- + (void) fseek(hf, it-1, SEEK_SET);
- + nl = getc(hf);
- + if (nl != '\n')
- + fprintf(stderr, "offset 0%lo does not point to line\n",
- + (long)it);
- + }
- + }
- + (void) fclose(hf);
- + (void) fclose(pf);
- + }
- +
- + /*
- + - fail - complain and die
- + */
- + void
- + fail(s1, s2)
- + char *s1;
- + char *s2;
- + {
- + fprintf(stderr, "%s: (file `%s', line %ld) ", progname, inname, lineno);
- + fprintf(stderr, s1, s2);
- + fprintf(stderr, "\n");
- + exit(1);
- + }
- +
- + /*
- + - str2dup - concatenate strings and malloc result
- + */
- + char *
- + str2dup(s1, s2)
- + char *s1;
- + char *s2;
- + {
- + register char *p;
- +
- + p = malloc((size_t)strlen(s1) + strlen(s2) + 1);
- + if (p == NULL)
- + fail("can't allocate space for strings", "");
- + (void) strcpy(p, s1);
- + (void) strcat(p, s2);
- + return(p);
- + }
-