diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/Makefile.am | 30 | ||||
-rwxr-xr-x | bin/Makefile.in | 507 | ||||
-rwxr-xr-x | bin/checkndx.cpp | 76 | ||||
-rwxr-xr-x | bin/copydbf.cpp | 76 | ||||
-rwxr-xr-x | bin/dbfutil1.cpp | 1347 | ||||
-rwxr-xr-x | bin/dbfxtrct.cpp | 188 | ||||
-rwxr-xr-x | bin/deletall.cpp | 71 | ||||
-rwxr-xr-x | bin/dumpdbt.cpp | 113 | ||||
-rwxr-xr-x | bin/dumphdr.cpp | 69 | ||||
-rwxr-xr-x | bin/dumprecs.cpp | 97 | ||||
-rwxr-xr-x | bin/makebcc.bat | 22 | ||||
-rwxr-xr-x | bin/packdbf.cpp | 77 | ||||
-rwxr-xr-x | bin/reindex.cpp | 90 | ||||
-rwxr-xr-x | bin/undelall.cpp | 76 | ||||
-rwxr-xr-x | bin/zap.cpp | 76 |
15 files changed, 2915 insertions, 0 deletions
diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100755 index 0000000..43c8333 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,30 @@ + +INCLUDES= -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +INSTALL_PROGRAM = @INSTALL@ + +bin_PROGRAMS = checkndx copydbf dbfxtrct deletall dumphdr dumprecs packdbf \ + reindex undelall zap dbfutil1 + +noinst_PROGRAMS = dumpdbt + +checkndx_SOURCES = checkndx.cpp +copydbf_SOURCES = copydbf.cpp +dbfxtrct_SOURCES = dbfxtrct.cpp +dbfutil1_SOURCES = dbfutil1.cpp +deletall_SOURCES = deletall.cpp +dumpdbt_SOURCES = dumpdbt.cpp +dumphdr_SOURCES = dumphdr.cpp +dumprecs_SOURCES = dumprecs.cpp +packdbf_SOURCES = packdbf.cpp +reindex_SOURCES = reindex.cpp +undelall_SOURCES = undelall.cpp +zap_SOURCES = zap.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.exe *.BAK *.tds *.obj *.tr2 *.ndx *.dbf *.dbt \ + *.ntx compout diff --git a/bin/Makefile.in b/bin/Makefile.in new file mode 100755 index 0000000..e757afd --- /dev/null +++ b/bin/Makefile.in @@ -0,0 +1,507 @@ +# Makefile.in generated by automake 1.6.3 from Makefile.am. +# @configure_input@ + +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_HEADER = $(INSTALL_DATA) +transform = @program_transform_name@ +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +INSTALL_PROGRAM = @INSTALL@ +AMTAR = @AMTAR@ +AS = @AS@ +AWK = @AWK@ +CC = @CC@ +CXX = @CXX@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +GXXVER = @GXXVER@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +RELEASE = @RELEASE@ +RHREL = @RHREL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XSUBDIRS = @XSUBDIRS@ +am__include = @am__include@ +am__quote = @am__quote@ +doxygen = @doxygen@ +install_sh = @install_sh@ +topdir = @topdir@ + +INCLUDES = -I$(topdir) +LDADD = -L$(topdir)/xbase64 -lxbase64 + +bin_PROGRAMS = checkndx copydbf dbfxtrct deletall dumphdr dumprecs packdbf \ + reindex undelall zap dbfutil1 + + +noinst_PROGRAMS = dumpdbt + +checkndx_SOURCES = checkndx.cpp +copydbf_SOURCES = copydbf.cpp +dbfxtrct_SOURCES = dbfxtrct.cpp +dbfutil1_SOURCES = dbfutil1.cpp +deletall_SOURCES = deletall.cpp +dumpdbt_SOURCES = dumpdbt.cpp +dumphdr_SOURCES = dumphdr.cpp +dumprecs_SOURCES = dumprecs.cpp +packdbf_SOURCES = packdbf.cpp +reindex_SOURCES = reindex.cpp +undelall_SOURCES = undelall.cpp +zap_SOURCES = zap.cpp + +noinst_HEADERS = + +EXTRA_DIST = makebcc.bat + +CLEANFILES = Makefile.in *.exe *.BAK *.tds *.obj *.tr2 *.ndx *.dbf *.dbt \ + *.ntx compout + +subdir = bin +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/xbase64/xbconfig.h +CONFIG_CLEAN_FILES = +bin_PROGRAMS = checkndx$(EXEEXT) copydbf$(EXEEXT) dbfxtrct$(EXEEXT) \ + deletall$(EXEEXT) dumphdr$(EXEEXT) dumprecs$(EXEEXT) \ + packdbf$(EXEEXT) reindex$(EXEEXT) undelall$(EXEEXT) \ + zap$(EXEEXT) dbfutil1$(EXEEXT) +noinst_PROGRAMS = dumpdbt$(EXEEXT) +PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) + +am_checkndx_OBJECTS = checkndx.$(OBJEXT) +checkndx_OBJECTS = $(am_checkndx_OBJECTS) +checkndx_LDADD = $(LDADD) +checkndx_DEPENDENCIES = +checkndx_LDFLAGS = +am_copydbf_OBJECTS = copydbf.$(OBJEXT) +copydbf_OBJECTS = $(am_copydbf_OBJECTS) +copydbf_LDADD = $(LDADD) +copydbf_DEPENDENCIES = +copydbf_LDFLAGS = +am_dbfutil1_OBJECTS = dbfutil1.$(OBJEXT) +dbfutil1_OBJECTS = $(am_dbfutil1_OBJECTS) +dbfutil1_LDADD = $(LDADD) +dbfutil1_DEPENDENCIES = +dbfutil1_LDFLAGS = +am_dbfxtrct_OBJECTS = dbfxtrct.$(OBJEXT) +dbfxtrct_OBJECTS = $(am_dbfxtrct_OBJECTS) +dbfxtrct_LDADD = $(LDADD) +dbfxtrct_DEPENDENCIES = +dbfxtrct_LDFLAGS = +am_deletall_OBJECTS = deletall.$(OBJEXT) +deletall_OBJECTS = $(am_deletall_OBJECTS) +deletall_LDADD = $(LDADD) +deletall_DEPENDENCIES = +deletall_LDFLAGS = +am_dumpdbt_OBJECTS = dumpdbt.$(OBJEXT) +dumpdbt_OBJECTS = $(am_dumpdbt_OBJECTS) +dumpdbt_LDADD = $(LDADD) +dumpdbt_DEPENDENCIES = +dumpdbt_LDFLAGS = +am_dumphdr_OBJECTS = dumphdr.$(OBJEXT) +dumphdr_OBJECTS = $(am_dumphdr_OBJECTS) +dumphdr_LDADD = $(LDADD) +dumphdr_DEPENDENCIES = +dumphdr_LDFLAGS = +am_dumprecs_OBJECTS = dumprecs.$(OBJEXT) +dumprecs_OBJECTS = $(am_dumprecs_OBJECTS) +dumprecs_LDADD = $(LDADD) +dumprecs_DEPENDENCIES = +dumprecs_LDFLAGS = +am_packdbf_OBJECTS = packdbf.$(OBJEXT) +packdbf_OBJECTS = $(am_packdbf_OBJECTS) +packdbf_LDADD = $(LDADD) +packdbf_DEPENDENCIES = +packdbf_LDFLAGS = +am_reindex_OBJECTS = reindex.$(OBJEXT) +reindex_OBJECTS = $(am_reindex_OBJECTS) +reindex_LDADD = $(LDADD) +reindex_DEPENDENCIES = +reindex_LDFLAGS = +am_undelall_OBJECTS = undelall.$(OBJEXT) +undelall_OBJECTS = $(am_undelall_OBJECTS) +undelall_LDADD = $(LDADD) +undelall_DEPENDENCIES = +undelall_LDFLAGS = +am_zap_OBJECTS = zap.$(OBJEXT) +zap_OBJECTS = $(am_zap_OBJECTS) +zap_LDADD = $(LDADD) +zap_DEPENDENCIES = +zap_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/xbase64 +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/checkndx.Po ./$(DEPDIR)/copydbf.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dbfutil1.Po ./$(DEPDIR)/dbfxtrct.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/deletall.Po ./$(DEPDIR)/dumpdbt.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/dumphdr.Po ./$(DEPDIR)/dumprecs.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/packdbf.Po ./$(DEPDIR)/reindex.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/undelall.Po ./$(DEPDIR)/zap.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(checkndx_SOURCES) $(copydbf_SOURCES) \ + $(dbfutil1_SOURCES) $(dbfxtrct_SOURCES) $(deletall_SOURCES) \ + $(dumpdbt_SOURCES) $(dumphdr_SOURCES) $(dumprecs_SOURCES) \ + $(packdbf_SOURCES) $(reindex_SOURCES) $(undelall_SOURCES) \ + $(zap_SOURCES) +HEADERS = $(noinst_HEADERS) + +DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in +SOURCES = $(checkndx_SOURCES) $(copydbf_SOURCES) $(dbfutil1_SOURCES) $(dbfxtrct_SOURCES) $(deletall_SOURCES) $(dumpdbt_SOURCES) $(dumphdr_SOURCES) $(dumprecs_SOURCES) $(packdbf_SOURCES) $(reindex_SOURCES) $(undelall_SOURCES) $(zap_SOURCES) + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu bin/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +checkndx$(EXEEXT): $(checkndx_OBJECTS) $(checkndx_DEPENDENCIES) + @rm -f checkndx$(EXEEXT) + $(CXXLINK) $(checkndx_LDFLAGS) $(checkndx_OBJECTS) $(checkndx_LDADD) $(LIBS) +copydbf$(EXEEXT): $(copydbf_OBJECTS) $(copydbf_DEPENDENCIES) + @rm -f copydbf$(EXEEXT) + $(CXXLINK) $(copydbf_LDFLAGS) $(copydbf_OBJECTS) $(copydbf_LDADD) $(LIBS) +dbfutil1$(EXEEXT): $(dbfutil1_OBJECTS) $(dbfutil1_DEPENDENCIES) + @rm -f dbfutil1$(EXEEXT) + $(CXXLINK) $(dbfutil1_LDFLAGS) $(dbfutil1_OBJECTS) $(dbfutil1_LDADD) $(LIBS) +dbfxtrct$(EXEEXT): $(dbfxtrct_OBJECTS) $(dbfxtrct_DEPENDENCIES) + @rm -f dbfxtrct$(EXEEXT) + $(CXXLINK) $(dbfxtrct_LDFLAGS) $(dbfxtrct_OBJECTS) $(dbfxtrct_LDADD) $(LIBS) +deletall$(EXEEXT): $(deletall_OBJECTS) $(deletall_DEPENDENCIES) + @rm -f deletall$(EXEEXT) + $(CXXLINK) $(deletall_LDFLAGS) $(deletall_OBJECTS) $(deletall_LDADD) $(LIBS) +dumpdbt$(EXEEXT): $(dumpdbt_OBJECTS) $(dumpdbt_DEPENDENCIES) + @rm -f dumpdbt$(EXEEXT) + $(CXXLINK) $(dumpdbt_LDFLAGS) $(dumpdbt_OBJECTS) $(dumpdbt_LDADD) $(LIBS) +dumphdr$(EXEEXT): $(dumphdr_OBJECTS) $(dumphdr_DEPENDENCIES) + @rm -f dumphdr$(EXEEXT) + $(CXXLINK) $(dumphdr_LDFLAGS) $(dumphdr_OBJECTS) $(dumphdr_LDADD) $(LIBS) +dumprecs$(EXEEXT): $(dumprecs_OBJECTS) $(dumprecs_DEPENDENCIES) + @rm -f dumprecs$(EXEEXT) + $(CXXLINK) $(dumprecs_LDFLAGS) $(dumprecs_OBJECTS) $(dumprecs_LDADD) $(LIBS) +packdbf$(EXEEXT): $(packdbf_OBJECTS) $(packdbf_DEPENDENCIES) + @rm -f packdbf$(EXEEXT) + $(CXXLINK) $(packdbf_LDFLAGS) $(packdbf_OBJECTS) $(packdbf_LDADD) $(LIBS) +reindex$(EXEEXT): $(reindex_OBJECTS) $(reindex_DEPENDENCIES) + @rm -f reindex$(EXEEXT) + $(CXXLINK) $(reindex_LDFLAGS) $(reindex_OBJECTS) $(reindex_LDADD) $(LIBS) +undelall$(EXEEXT): $(undelall_OBJECTS) $(undelall_DEPENDENCIES) + @rm -f undelall$(EXEEXT) + $(CXXLINK) $(undelall_LDFLAGS) $(undelall_OBJECTS) $(undelall_LDADD) $(LIBS) +zap$(EXEEXT): $(zap_OBJECTS) $(zap_DEPENDENCIES) + @rm -f zap$(EXEEXT) + $(CXXLINK) $(zap_LDFLAGS) $(zap_OBJECTS) $(zap_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checkndx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/copydbf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbfutil1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dbfxtrct.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deletall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpdbt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumphdr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumprecs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/packdbf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reindex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/undelall.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zap.Po@am__quote@ + +distclean-depend: + -rm -rf ./$(DEPDIR) + +.cpp.o: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +.cpp.obj: +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` + +.cpp.lo: +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @list='$(DISTFILES)'; for file in $$list; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(HEADERS) + +installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) + +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool clean-noinstPROGRAMS distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-binPROGRAMS install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool tags uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/bin/checkndx.cpp b/bin/checkndx.cpp new file mode 100755 index 0000000..35d6add --- /dev/null +++ b/bin/checkndx.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ +#ifdef XBASE_DEBUG + xbXBase x; + xbDbf d( &x ); + xbNdx i( &d ); + xbShort rc; + + if( 3 != ac ){ + std::cout << + "\nUsage: checkndx dbf_file index_file\n"; + return 1; + } + + if(( rc = d.OpenDatabase( av[1] )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << av[1] << " rc = " << rc << "\n"; + return 2; + } + + if(( rc = i.OpenIndex( av[2] )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << av[2] << " rc = " << rc << "\n"; + return 3; + } + + std::cout << "\nRunning...\n"; + rc = i.CheckIndexIntegrity( 1 ); + std::cout << "\nNdx integrity check = " << rc << "\n"; + + i.DumpHdrNode(0); + + d.CloseDatabase(); +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/copydbf.cpp b/bin/copydbf.cpp new file mode 100755 index 0000000..3175a87 --- /dev/null +++ b/bin/copydbf.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program copies the structure of one dbf to another + dbf file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (3 != ac) { + std::cout << + "\nUsage: copydbf filename1 filename2\n" + "This program copies the structure of one dbf file to another\n"; + return 1; + } + + char* sfilename = av[1]; + char* tfilename = av[2]; + + xbXBase x; + xbDbf MyFile( &x ); + + xbShort rc = MyFile.OpenDatabase( sfilename ); + if( rc != XB_NO_ERROR ) { + std::cout << "Could not open file " << sfilename << " Error = " << rc + << "\n"; + return 2; + } + + // OverlaySwitch = 0; /* dont overlay existing file if it exists */ + xbShort OverlaySwitch = 1; /* overlay existing file if it exists */ + + if(( rc = MyFile.CopyDbfStructure( tfilename, OverlaySwitch )) != XB_NO_ERROR ) + { + std::cout << "Could not copy file " << tfilename << " Error = " << rc + << "\n"; + return 3; + } + + MyFile.CloseDatabase(); /* close database */ + return 0; +} diff --git a/bin/dbfutil1.cpp b/bin/dbfutil1.cpp new file mode 100755 index 0000000..0b74d41 --- /dev/null +++ b/bin/dbfutil1.cpp @@ -0,0 +1,1347 @@ +/* + dbf utility program + + This is a generic XBase menu program for executing XBase64 functions + on a single dbf database table. + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +// next lines are helpful for debugging purposes +/* +#include <xbase64/xbdbf.cpp> +#include <xbase64/xbexp.cpp> +#include <xbase64/xbexpprc.cpp> +#include <xbase64/xbexpfnc.cpp> +#include <xbase64/xbfields.cpp> +#include <xbase64/xbindex.cpp> +#include <xbase64/xbmemo.cpp> +#include <xbase64/xbndx.cpp> +#include <xbase64/xbntx.cpp> +#include <xbase64/xbase64.cpp> +#include <xbase64/xbdate.cpp> +#include <xbase64/xbfilter.cpp> +#include <xbase64/xblock.cpp> +#include <xbase64/xbstring.cpp> +#include <xbase64/xbfile.cpp> +#include <xbase64/xbcdx.cpp> +*/ + +xbXBase x; +xbDbf d( &x ); +xbIndex *ix; + +#ifdef XB_FILTERS +xbFilter *xbf; +#endif + + +class MyClass { + public: + MyClass() {}; + void OpenFile(); + void CloseFile(); + void ConvertDatabase(); + void ReindexDatabase(); + void PackDatabase(); + void ZapDatabase(); + void DeleteMemoField(); + void UpdateMemoField(); + void ShowFieldInfo( int ); + void ShowFieldData(); + void UpdateFieldData(); + void PutRecord(); + void GetRecord(); + void DumpDbtHeader(); + void BlankRecord(); + void FindMemoBlocks(); + void GetMemoBlocks(); + void FileStats(); + void MainMenu(); + void FileMenu(); + void RecordMenu(); + void FieldMenu(); + void IndexMenu(); + void LockingMenu(); + void DebugMenu(); + void OpenIndex(); + void CloseIndex(); + void FindKey(); + void GetFirstKey(); + void GetLastKey(); + void GetNextKey(); + void GetPrevKey(); + void DumpIndexNodes(); + void ShowLockInfo(); + void SetRetryCount(); + void SetDefaultLockMode(); + void SetTableLockMode(); + void LockDbf(); + void UnlockDbf(); + void LockRecord(); + void UnlockRecord(); + void LockMemoFile( xbShort ); + void LockIndexFile( xbShort ); + void CreateNewIndex(); + void ProcessExpression(); + void FilterMenu(); + void SetFilter(); + void FirstFilterRec(); + void NextFilterRec(); + void PrevFilterRec(); + void LastFilterRec(); +}; +/************************************************************************/ +#ifdef XB_FILTERS +void MyClass::FilterMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl + << "Filter Menu" << std::endl; + std::cout << "1 - Set Filter Expression" << std::endl; + std::cout << "2 - Get First Filter Record" << std::endl; + std::cout << "3 - Get Next Filter Record" << std::endl; + std::cout << "4 - Get Previous Filter Record" << std::endl; + std::cout << "5 - Get Last Filter Record" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: SetFilter(); break; + case 2: FirstFilterRec(); break; + case 3: NextFilterRec(); break; + case 4: PrevFilterRec(); break; + case 5: LastFilterRec(); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::SetFilter() +{ + char Expression[512]; + memset( Expression, 0x00, 512 ); + while( !strlen( Expression )){ + std::cout << "Enter filter expression (like AMOUNT<5)" << std::endl; + gets( Expression ); + } + if( xbf ) + delete xbf; + + xbf = new xbFilter( &d, 0, Expression ); + + if( xbf->GetStatus() ) + x.DisplayError( xbf->GetStatus()); + else + std::cout << "Filter initialized" << std::endl; +} +/************************************************************************/ +void MyClass::FirstFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetFirstFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); + +} +/************************************************************************/ +void MyClass::NextFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetNextFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +/************************************************************************/ +void MyClass::PrevFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetPrevFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +/************************************************************************/ +void MyClass::LastFilterRec() +{ + xbShort rc; + if( !xbf ) + SetFilter(); + rc = xbf->GetLastFilterRec(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + for( int i = 0; i < d.FieldCount() && i < 3; i++ ) + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); +} +#endif // XB_FILTERS +/************************************************************************/ +#ifdef XB_EXPRESSIONS +void MyClass::ProcessExpression() +{ + char exprsn[256]; + char type; + xbExpn *exp; // expression + xbShort rc; + int debug = 0; + memset( exprsn, 0x00, 256 ); + + std::cout << "Enter expression string or HELP" << std::endl; + + while( !strstr( exprsn, "QUIT" ) && !strstr( exprsn, "quit" )){ + + std::cout << ">"; + gets( exprsn ); + + if( strstr( exprsn, "HELP" ) || strstr( exprsn, "help" )){ + std::cout << "** Command Help ***" << std::endl << std::endl; + std::cout << "HELP - This help screen" << std::endl; + std::cout << "QUIT - Exit the function" << std::endl; + #ifdef XBASE_DEBUG + std::cout << "DEBUG - Toggle debug mode on/off" << std::endl; + #endif + std::cout << "\nExamples expressions:" << std::endl; + std::cout << " 5+5 or 5-2/7 or FUNC(op1,op2)" << std::endl; + std::cout << "\nRecognized functions:" << std::endl; + xbString s; + xbShort i = 0; + exp = new xbExpn( &x ); + s = exp->GetValidFuncName( i++ ); + while( s.len() ){ + std::cout << s << "\t"; + s = exp->GetValidFuncName( i++ ); + } + + delete exp; + std::cout << "\n\nSee documentation for more expression info" + << std::endl << std::endl; + } + + else if( strstr( exprsn, "DEBUG" ) || strstr( exprsn, "debug" )){ + if( debug ){ + std::cout << "Debug mode toggled off" << std::endl; + debug = 0; + } else { + std::cout << "Debug mode toggled on" << std::endl; + debug = 1; + } + } + + else if( !strstr( exprsn, "QUIT" ) && !strstr( exprsn, "quit" )) + { + exp = new xbExpn( &x ); + if(( rc = exp->ParseExpression( exprsn, &d )) != 0 ){ + std::cout << "Error while parsing" << std::endl; + x.DisplayError( rc ); + } + + else { + if( debug ){ + exp->DumpExpressionTree( 1 ); + std::cout << "Expression tree dumped to file xbase64.log" << std::endl; + } + + if(( rc = exp->ProcessExpression()) != 0 ){ + std::cout << "Error in processing " << std::endl; + x.DisplayError( rc ); + } else { + + type = exp->GetExpressionResultType(); + + std::cout << "Result Type = [" << type << "]" << std::endl; + std::cout << "Result Data = ["; + switch( type ){ + case 'C': + case 'D': + std::cout << exp->GetStringResult() << "]" << std::endl; + break; + case 'N': + std::cout << exp->GetDoubleResult() << "]" << std::endl; + break; + case 'L': + std::cout << exp->GetIntResult() << "]" << std::endl; + break; + default: + std::cout << "Unknown result type]" << std::endl; + break; + } + } + delete exp; + } + } + } +} +#endif // XB_EXPRESSIONS +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DumpIndexNodes() +{ + xbLong NodeCnt = ix->GetTotalNodes(); + std::cout << "For NDX indices, output placed in xbase.log" << std::endl; + std::cout << "total nodes = " << NodeCnt << std::endl; + ix->DumpHdrNode( 1 ); + if( NodeCnt > 1 ) + for( xbLong l = 1L; l <= NodeCnt-1; l++ ) + ix->DumpNodeRec( l ); +} +#endif +/************************************************************************/ +void MyClass::OpenIndex() +{ + int rc; + char Filename[51]; + + if( d.GetDbfStatus() == XB_CLOSED ){ + std::cout << "No open database" << std::endl; + return; + } + if( ix ){ + std::cout << "Index already opened" << std::endl; + return; + } + + std::cout << "Enter index name: "; + std::cin >> Filename; + if( strstr( Filename, "NDX" ) || strstr( Filename, "ndx" )){ + ix = new xbNdx( &d ); + rc = ix->OpenIndex( Filename ); + } + else if( strstr( Filename, "NTX" ) || strstr( Filename, "ntx" )){ + ix = new xbNtx( &d ); + rc = ix->OpenIndex( Filename ); + } + else + { + std::cout + << "Invalid index name. Needs file extension. index.ndx or index.ntx" + << std::endl; + return; + } + x.DisplayError( rc ); +// std::cout << "Return code " << rc << std::endl; +} +/************************************************************************/ +void MyClass::FindKey() +{ + if( !ix ){ + std::cout << "No open index" << std::endl; + return; + } + + char KeyBuf[101]; + memset( KeyBuf, 0x00, 101 ); + std::cout << "This function only works for character keys (so far).." + << std::endl; + std::cout << "Enter search key:" << std::endl; + std::cin >> KeyBuf; + x.DisplayError( ix->FindKey( KeyBuf ) ); +} +/************************************************************************/ +void MyClass::GetNextKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetNextKey() ); +} +/************************************************************************/ +void MyClass::GetPrevKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetPrevKey() ); +} +/************************************************************************/ +void MyClass::GetFirstKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetFirstKey() ); +} +/************************************************************************/ +void MyClass::GetLastKey() +{ + if( !ix ) + std::cout << "No open index" << std::endl; + else + x.DisplayError( ix->GetLastKey() ); +} +/************************************************************************/ +void MyClass::CloseIndex() +{ + if( !ix ){ + std::cout << "No open index" << std::endl; + return; + } + x.DisplayError( ix->CloseIndex()); + delete ix; + ix = 0; +} +/************************************************************************/ +/* stats */ +void MyClass::FileStats() +{ + if( d.GetDbfStatus() == XB_CLOSED ){ + std::cout << "No open database" << std::endl; + return; + } + std::cout << "Database name = " << d.GetDbfName() << std::endl; + std::cout << "Number of records = " << d.NoOfRecords() << std::endl; + std::cout << "Physical no of recs = " << d.PhysicalNoOfRecords() << std::endl; + std::cout << "Number of fields = " << d.FieldCount() << std::endl; + std::cout << "Database Status = "; + switch( d.GetDbfStatus() ){ + case 0: + std::cout << "XB_CLOSED" << std::endl; + break; + case 1: + std::cout << "XB_OPEN" << std::endl; + break; + case 2: + std::cout << "XB_UPDATED" << std::endl; + break; + default: + std::cout << std::endl; + break; + } + std::cout << "Record Length = " << d.GetRecordLen() << std::endl; +#ifdef XB_MEMO_FIELDS + std::cout << "Memo Fields Present = "; + switch( d.MemoFieldsPresent() ){ + case 0: + std::cout << "No " << std::endl; + break; + case 1: + std::cout << "Yes" << std::endl; + std::cout << "Memofile name = " << d.GetDbtName() << std::endl; + break; + default: + std::cout << std::endl; + break; + } +#endif + std::cout << "Current Record No = " << d.GetCurRecNo() << std::endl; + std::cout << "Autolock status = " << d.GetAutoLock() << std::endl; + std::cout << "Real Delete status = " << d.GetRealDelete()<< std::endl; + std::cout << "Index Count = " << d.IndexCount() << std::endl; +} +/************************************************************************/ +/* open database */ +void MyClass::OpenFile() +{ + int rc; + char filename[50]; + std::cout << "Enter database file (.dbf) name: "; + std::cin >> filename; + + rc = d.OpenDatabase( filename ); + x.DisplayError( rc ); +} +/************************************************************************/ +/* open database */ +void MyClass::PackDatabase() +{ + x.DisplayError( d.PackDatabase( 0,0,0 )); +} +/************************************************************************/ +/* open database */ +void MyClass::ZapDatabase() +{ + x.DisplayError( d.Zap(0) ); +} +/************************************************************************/ +/* close database */ +void MyClass::CloseFile() +{ + int rc; + rc = d.CloseDatabase(); + x.DisplayError( rc ); +} +/************************************************************************/ +/* convert database */ +void MyClass::ConvertDatabase() +{ + int rc; + xbShort FieldNo; + xbLong len, FieldCnt; + xbDbf d2( &x ); + char *MemoFieldBuf = NULL; + xbLong MemoFieldLen = 0L; + + std::cout << "Warning - check your results!!" << std::endl << std::endl; + + char filename[50]; + std::cout << "Enter database file name to convert to: "; + std::cin >> filename; + + if(( rc = d2.OpenDatabase( filename )) != XB_NO_ERROR ){ + std::cout << "Error " << rc << " opening database" << std::endl; + return; + } + + rc = d.GetFirstRecord(); + FieldCnt = d.FieldCount(); + std::cout << "Database has " << FieldCnt << " fields to convert" + << std::endl; + while( rc == XB_NO_ERROR ) + { + d2.BlankRecord(); + for( xbShort i = 0; i < FieldCnt; i++ ) + { + if(( FieldNo = d2.GetFieldNo( d.GetFieldName( i ))) == -1 ) + std::cout << "Error converting field " << d.GetFieldName( i ) + << std::endl; + else + { + if( d.GetFieldType( i ) != d2.GetFieldType( FieldNo )) + std::cout << "Error - different field types " << d.GetFieldName(i); + else + { + if( d.GetFieldType( i ) == 'M' ) + { +#ifdef XB_MEMO_FIELDS + len = d.GetMemoFieldLen( i ); + if( len > MemoFieldLen ) + { + if( MemoFieldLen > 0 ) + delete MemoFieldBuf; + MemoFieldBuf = new char[len]; + MemoFieldLen = len; + } + d.GetMemoField( i, len, MemoFieldBuf, XB_LOCK ); + d2.UpdateMemoData( FieldNo, len, MemoFieldBuf, XB_LOCK ); +#else + std::cout + << "Memo fields not converted XB_MEMO_FIELDS not compiled in\n"; +#endif + } + else{ + if( d.GetFieldType(i) == 'N' ){ + std::cout << "const code compile prob..." << std::endl; + +// d2.PutField( FieldNo, x.LTRIM( d.GetField( i ))); + } + else + d2.PutField( FieldNo, d.GetField(i)); + } + } + } + } + rc = d.GetNextRecord(); + d2.AppendRecord(); + } + if( MemoFieldLen > 0 ) + delete MemoFieldBuf; + d2.CloseDatabase(); +} +/************************************************************************/ +void MyClass::ShowFieldInfo( int option ) +{ + FILE * out; + xbString dbfName = d.GetDbfName(); + if( option ){ + if(( out = fopen( "xbase64.dmp" , "w" )) == NULL ){ + std::cout << "File could not be opened" << std::endl; + getchar(); + } else { + fprintf( out, "Table Name = %s\n\n", dbfName.getData()); + fprintf( out, "Number Name Type Len Decs\n" ); + for( int i = 0; i < d.FieldCount(); i++ ) + fprintf(out, "%3d %-10s %c %5d %d\n", i+1, + d.GetFieldName(i), d.GetFieldType(i), + d.GetFieldLen(i), d.GetFieldDecimal(i) ); + } + fclose( out ); + } + else + { + printf( "Table Name = %s\n", dbfName.getData()); + std::cout << "Number Name Type Len Decs" << std::endl; + for( int i = 0; i < d.FieldCount(); i++ ){ + printf( "%3d %-10s %c %5d %d\n", i+1, + d.GetFieldName(i), d.GetFieldType(i), + d.GetFieldLen(i), d.GetFieldDecimal(i) ); + if(((i+1)%15) == 0 ){ + std::cout << "Press a key to continue" << std::endl; + getchar(); + std::cout << "Number Name Type Len Decs" << std::endl; + } + } + } + std::cout << "Press a key to continue" << std::endl; + getchar(); +} +/************************************************************************/ +void MyClass::ShowFieldData() +{ + int done = 0; + + if( d.GetCurRecNo() == 0L ){ + d.GetRecord( 1L ); + } + + while( !done ){ + std::cout << "Record: " << d.GetCurRecNo() << std::endl; + std::cout << "FieldName Data" << std::endl; + std::cout << "========= ====" << std::endl; + if( d.RecordDeleted()) + std::cout << "Record is deleted" << std::endl; + for( int i = 0; i < d.FieldCount(); i++ ){ + printf( "%-10s = %s\n", d.GetFieldName(i), d.GetStringField(i)); + if(((i+1)%15) == 0 ){ + std::cout << "Press a key to continue" << std::endl; + getchar(); + std::cout << " Name Data" << std::endl; + } + } + std::cout << "Press 'N' for next record or any other key to exit" << std::endl; + if( toupper( getchar()) == 'N' ){ + d.GetRecord( d.GetCurRecNo() + 1L ); + getchar(); + } + else + done ++; + } +} +/************************************************************************/ +void MyClass::UpdateFieldData() +{ + char dbuf[100]; + int rc, fn; + std::cout << "Enter Field Number to update (first field is 0): " + << std::endl; + std::cin >> fn; + std::cout << "Enter Field Data" << std::endl; + std::cin >> dbuf; + rc = d.PutField( fn, dbuf ); + x.DisplayError( rc ); +} +/************************************************************************/ +/* open database */ +void MyClass::ReindexDatabase() +{ + xbNdx n(&d); + int rc; + char filename[50]; + std::cout << "Enter index file name: "; + std::cin >> filename; + + if(( rc = n.OpenIndex( filename )) != XB_NO_ERROR ){ + x.DisplayError( rc ); + return; + } + x.DisplayError( n.ReIndex() ); +} +/************************************************************************/ +void MyClass::GetRecord() +{ + xbLong RecNo; + std::cout << "Enter record number: "; + std::cin >> RecNo; + + x.DisplayError( d.GetRecord( RecNo )); +} +/************************************************************************/ +void MyClass::UpdateMemoField() +{ +#ifdef XB_MEMO_FIELDS + xbShort fn,rc; + xbLong len; + char bufchar[2]; + char *buf; + + std::cout << "Enter Field Number: " << std::endl; + std::cin >> fn; + if( fn < 0 || fn > d.FieldCount()){ + std::cout << "Invalid Field Number" << std::endl; + return; + } + if( d.GetFieldType( fn ) != 'M' ){ + std::cout << "Field " << fn << " is not a memo field" << std::endl; + std::cout << "Field Name = " << d.GetFieldName( fn ) << " type= "; + std::cout << d.GetFieldType( fn ) << std::endl; + return; + } + std::cout << "Enter length of memo data:" << std::endl; + std::cin >> len; + + std::cout << "Enter character to populate memo data:" << std::endl; + std::cin >> bufchar; + + buf = new char[len]; + memset( buf, bufchar[0], len ); + + rc = d.UpdateMemoData( fn, len, buf, XB_LOCK ); + std::cout << "Return Code = " << rc << std::endl; +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::DeleteMemoField() +{ +#ifdef XB_MEMO_FIELDS + xbShort fn,rc; + std::cout << "Enter Field Number: " << std::endl; + std::cin >> fn; + if( fn < 0 || fn > d.FieldCount()){ + std::cout << "Invalid Field Number" << std::endl; + return; + } + if( d.GetFieldType( fn ) != 'M' ){ + std::cout << "Field " << fn << " is not a memo field" << std::endl; + std::cout << "Field Name = " << d.GetFieldName( fn ) << " type= "; + std::cout << d.GetFieldType( fn ) << std::endl; + return; + } + rc = d.UpdateMemoData( fn, 0, 0, XB_LOCK ); + x.DisplayError( rc ); +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DumpDbtHeader() +{ + int rc; + +#ifdef XB_MEMO_FIELDS +#ifdef XBASE_DEBUG + +/* - This is used to peek in the file for debugging purposes + probably not to useful for anything else - Gary +*/ + + rc = d.DumpMemoFreeChain(); + x.DisplayError( rc ); + +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::GetMemoBlocks() +{ +#ifdef XB_MEMO_FIELDS + xbLong BlocksNeeded, Location, PrevNode; + int rc; + + std::cout << "Enter number of blocks: " << std::endl; + std::cin >> BlocksNeeded; + std::cout << "Enter starting location: " << std::endl; + std::cin >> Location; + std::cout << "Enter previous node: " << std::endl; + std::cin >> PrevNode; + rc = d.GetBlockSetFromChain( BlocksNeeded, Location, PrevNode ); + x.DisplayError( rc ); + +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +/************************************************************************/ +void MyClass::CreateNewIndex() +{ + char IndexName[128]; + char KeyExpression[500]; + char Unique[25]; + xbShort uniqueSw = 0; + xbShort rc; + + if( ix ){ + std::cout << "Program only supports one open index at a time" << std::endl; + std::cout << "Looking for volunteer to change that fact" << std::endl; + return; + } + memset( IndexName, 0x00, 128 ); + memset( KeyExpression, 0x00, 500 ); + memset( Unique, 0x00, 25 ); + std::cout << "This function creates a new index for an open table" << std::endl; + std::cout << "If the index already exists, it will be overlaid" << std::endl; + while( !strlen( IndexName ) || + ( !strstr( IndexName, ".ndx" ) && !strstr( IndexName, ".ntx" ))){ + std::cout << "Enter index name (include .ntx or .ndx extension)" << std::endl; + std::cin >> IndexName; + for( int i = 0; i < (int) strlen( IndexName ); i++ ) + IndexName[i] = tolower( IndexName[i] ); + } + while( Unique[0] != 'U' && Unique[0] != 'N' ){ + std::cout << "Enter U)nique or N)on unique" << std::endl; + std::cin >> Unique; + if( Unique[0] == 'U' ) + uniqueSw++; + } + while( !strlen( KeyExpression )){ + std::cout << "Enter key expression" << std::endl; + std::cin >> KeyExpression; + } + if( strstr( IndexName, "ndx" )){ + ix = new xbNdx( &d ); + rc = ix->CreateIndex( IndexName, KeyExpression, uniqueSw, 1 ); + } + else if( strstr( IndexName, "ntx" )){ + ix = new xbNtx( &d ); + rc = ix->CreateIndex( IndexName, KeyExpression, uniqueSw, 1 ); + } + if( rc ){ + x.DisplayError( rc ); + ix->CloseIndex(); + ix = NULL; + return; + } + std::cout << IndexName << " created. Loading data.." << std::endl; + rc = ix->ReIndex(); + if( rc ){ + x.DisplayError( rc ); + return; + } + std::cout << "Index loaded successfully" << std::endl; + return; +} +/************************************************************************/ +void MyClass::FindMemoBlocks() +{ +#ifdef XB_MEMO_FIELDS + xbLong BlocksNeeded, Location, PrevNode; + int rc; + + std::cout << "Enter number of blocks: " << std::endl; + std::cin >> BlocksNeeded; + rc = d.FindBlockSetInChain( BlocksNeeded, 0, Location, PrevNode ); + std::cout << "Return code = " << rc << std::endl; + std::cout << "Location = " << Location << std::endl; + std::cout << "Previous Node = " << PrevNode << std::endl; +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif +} +#endif // XBASE_DEBUG +/************************************************************************/ +void MyClass::IndexMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl + << "NDX and NTX Index Menu" << std::endl; + std::cout << "This program only supports one open index at a time" << std::endl; + std::cout << "1 - Open Index" << std::endl; + std::cout << "2 - Create New Index" << std::endl; + if( ix ){ + std::cout << "3 - Find Key" << std::endl; + std::cout << "4 - Get First Key" << std::endl; + std::cout << "5 - Get Last Key" << std::endl; + std::cout << "6 - Get Previous Key" << std::endl; + std::cout << "7 - Get Next Key" << std::endl; + std::cout << "8 - Close Index" << std::endl; + std::cout << "9 - Check Index Integrity" << std::endl; + } + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: OpenIndex(); break; + case 2: CreateNewIndex(); break; + case 3: FindKey(); break; + case 4: GetFirstKey(); break; + case 5: GetLastKey(); break; + case 6: GetPrevKey(); break; + case 7: GetNextKey(); break; + case 8: CloseIndex(); break; + case 9: x.DisplayError( ix->CheckIndexIntegrity( 1 )); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +#ifdef XBASE_DEBUG +void MyClass::DebugMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Debug Menu" << std::endl; + std::cout << "1 - Dislay DBT Header" << std::endl; + std::cout << "2 - Find Memo Blocks" << std::endl; + std::cout << "3 - Get Memo Blocks" << std::endl; + std::cout << "4 - Dump index node chains to file xbase.dmp" << std::endl; + std::cout << "5 - Dump index node chain" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: DumpDbtHeader(); break; + case 2: FindMemoBlocks(); break; + case 3: GetMemoBlocks(); break; + case 4: DumpIndexNodes(); break; + case 5: ix->DumpNodeChain(); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +#endif // XBASE_DEBUG + +/************************************************************************/ + +#ifdef XB_LOCKING_ON + +void MyClass::LockDbf() +{ + xbShort rc; + std::cout << "Locking table" << std::endl; +// rc = d.LockTable( XB_LOCK ); +// x.DisplayError( rc ); + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ + +void MyClass::UnlockDbf() +{ + xbShort rc; + std::cout << "Unlocking table" << std::endl; +// rc = d.LockTable( XB_UNLOCK ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} + +/************************************************************************/ + +void MyClass::LockRecord() +{ + xbShort rc; + xbULong RecNo; + xbULong RecCnt; + + std::cout << "Enter start record number to lock" << std::endl; + std::cin >> RecNo; + std::cout << "Enter number of records to lock" << std::endl; + std::cin >> RecCnt; + +// rc = d.LockRecord( XB_LOCK, RecNo, RecCnt ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ +void MyClass::UnlockRecord() +{ + xbShort rc; + xbULong RecNo; + xbULong RecCnt; + std::cout << "Enter start record number to unlock" << std::endl; + std::cin >> RecNo; + std::cout << "Enter number of records to unlock" << std::endl; + std::cin >> RecCnt; +// rc = d.LockRecord( XB_UNLOCK, RecNo, RecCnt ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; +} +/************************************************************************/ +void MyClass::ShowLockInfo() +{ + std::cout << "Retry Count (in seconds) => " << x.GetLockRetryCount() << std::endl; +// std::cout << "No of table locks => " << d.GetTableLockCnt() << std::endl; + + #ifdef XB_MEMO_FIELDS +// std::cout << "Memo locks => " << d.GetMemoLockCnt() << std::endl; + #endif + + std::cout << "Current default lock mode => "; + switch( x.GetLockMode() ){ + case XB_SINGLE_USER_MODE: + std::cout << "XB_SINGLE_USER_MODE" << std::endl; + break; + case XB_XBASE_LOCK_MODE: + std::cout << "XB_XBASE_LOCK_MODE" << std::endl; + break; + case XB_DBASE5_LOCK_MODE: + std::cout << "XB_DBASE5_LOCK_MODE" << std::endl; + break; case XB_CLIPPER5_LOCK_MODE: + std::cout << "XB_CLIPPER5_LOCK_MODE" << std::endl; + break; + case XB_FOXPRO3_LOCK_MODE: + std::cout << "XB_FOXPRO3_LOCK_MODE" << std::endl; + break; + default: + std::cout << "Unknown lock mode" << std::endl; + break; + } + + std::cout << "Current table lock mode => "; + switch( d.GetLockMode() ){ + case XB_SINGLE_USER_MODE: + std::cout << "XB_SINGLE_USER_MODE" << std::endl; + break; + case XB_XBASE_LOCK_MODE: + std::cout << "XB_XBASE_LOCK_MODE" << std::endl; + break; + case XB_DBASE5_LOCK_MODE: + std::cout << "XB_DBASE5_LOCK_MODE" << std::endl; + break; + case XB_CLIPPER5_LOCK_MODE: + std::cout << "XB_CLIPPER5_LOCK_MODE" << std::endl; + break; + case XB_FOXPRO3_LOCK_MODE: + std::cout << "XB_FOXPRO3_LOCK_MODE" << std::endl; + break; + default: + std::cout << "Unknown lock mode" << std::endl; + break; + } +} + +/************************************************************************/ + +void MyClass::SetDefaultLockMode() +{ + xbShort option; + + std::cout << std::endl << std::endl; + std::cout << "Default Lock Mode Selection" << std::endl; + std::cout << "1 - XB_SINGLE_USER_MODE" << std::endl; + std::cout << "2 - XB_XBASE_LOCK_MODE" << std::endl; + std::cout << "3 - XB_DBASE5_LOCK_MODE" << std::endl; + std::cout << "4 - XB_CLIPPER5_LOCK_MODE" << std::endl; + std::cout << "5 - XB_FOXPRO3_LOCK_MODE" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: x.SetLockMode( XB_SINGLE_USER_MODE ); break; + case 2: x.SetLockMode( XB_XBASE_LOCK_MODE ); break; + case 3: x.SetLockMode( XB_DBASE5_LOCK_MODE ); break; + case 4: x.SetLockMode( XB_CLIPPER5_LOCK_MODE ); break; + case 5: x.SetLockMode( XB_FOXPRO3_LOCK_MODE ); break; + case 99: break; + } +} + +/************************************************************************/ + +void MyClass::SetTableLockMode() +{ + + xbShort option; + + std::cout << std::endl << std::endl; + std::cout << "Table Lock Mode Selection" << std::endl; + std::cout << "1 - XB_SINGLE_USER_MODE" << std::endl; + std::cout << "2 - XB_XBASE_LOCK_MODE" << std::endl; + std::cout << "3 - XB_DBASE5_LOCK_MODE" << std::endl; + std::cout << "4 - XB_CLIPPER5_LOCK_MODE" << std::endl; + std::cout << "5 - XB_FOXPRO3_LOCK_MODE" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: d.SetLockMode( XB_SINGLE_USER_MODE ); break; + case 2: d.SetLockMode( XB_XBASE_LOCK_MODE ); break; + case 3: d.SetLockMode( XB_DBASE5_LOCK_MODE ); break; + case 4: d.SetLockMode( XB_CLIPPER5_LOCK_MODE ); break; + case 5: d.SetLockMode( XB_FOXPRO3_LOCK_MODE ); break; + case 99: break; + } +} + +/************************************************************************/ + +void MyClass::SetRetryCount() +{ + xbShort retryCnt; + std::cout << "Enter new Retry Count " << std::endl; + std::cin >> retryCnt; + x.SetLockRetryCount( retryCnt ); +} + +/************************************************************************/ +#ifdef XB_MEMO_FIELDS + +void MyClass::LockMemoFile( xbShort LockType ) +{ + xbShort rc; +// rc = d.LockMemoFile( LockType ); +// x.DisplayError( rc ); + std::cout << "no memo locking here" << std::endl; +} + +#endif + +/************************************************************************/ + +void MyClass::LockIndexFile( xbShort LockType ) +{ + xbShort rc; + + if( ix ){ +// rc = ix->LockIndex( LockType ); +// x.DisplayError( rc ); + + std::cout << "temporarily out of service" << std::endl; + } + else + std::cout << "No open index" << std::endl; +} + +#endif +/************************************************************************/ +void MyClass::PutRecord() +{ + xbLong l; + std::cout << "Enter Record number for PutRecord()" << std::endl; + std::cin >> l; + int rc = d.PutRecord( l ); + x.DisplayError( rc ); +} +/************************************************************************/ +void MyClass::FieldMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Field Menu" << std::endl; + std::cout << "1 - Delete Memo Field" << std::endl; + std::cout << "2 - Update Memo Field" << std::endl; + std::cout << "3 - Show Field Info" << std::endl; + std::cout << "4 - Dump Field Info to file xbase64.dmp" << std::endl; + std::cout << "5 - Show Field Data" << std::endl; + std::cout << "6 - Update Field Data" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: DeleteMemoField(); break; + case 2: UpdateMemoField(); break; + case 3: ShowFieldInfo(0); break; + case 4: ShowFieldInfo(1); break; + case 5: ShowFieldData(); break; + case 6: UpdateFieldData(); break; + case 99: break; + default: std::cout << "Function not available" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::RecordMenu() +{ + int option = 0; + std::cout << "Record Menu" << std::endl; + while( option != 99 ) { + std::cout << std::endl << std::endl << "Record Menu" << std::endl; + std::cout << "1 - Get Record" << std::endl; + std::cout << "2 - Blank Record" << std::endl; + std::cout << "3 - Append Record" << std::endl; + std::cout << "4 - Put Record" << std::endl; + std::cout << "5 - Delete Record" << std::endl; + std::cout << "6 - Undelete Record" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + switch( option ){ + case 1: GetRecord(); break; + case 2: x.DisplayError( d.BlankRecord()); break; + case 3: x.DisplayError( d.AppendRecord()); break; + case 4: x.DisplayError( d.PutRecord()); break; + case 5: x.DisplayError( d.DeleteRecord()); break; + case 6: x.DisplayError( d.UndeleteRecord()); break; + case 99: break; + default: std::cout << "Invalid option" << std::endl; break; + } + } +} +/************************************************************************/ +void MyClass::FileMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "File Menu" << std::endl; + std::cout << "1 - Open File" << std::endl; + std::cout << "2 - Close File" << std::endl; + std::cout << "3 - File Stats" << std::endl; + std::cout << "4 - Convert Database" << std::endl; + std::cout << "5 - Reindex Database" << std::endl; + std::cout << "6 - Pack Database" << std::endl; + std::cout << "7 - Zap Database" << std::endl; + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ){ + case 1: OpenFile(); break; + case 2: CloseFile(); break; + case 3: FileStats(); break; + case 4: ConvertDatabase(); break; + case 5: ReindexDatabase(); break; + case 6: PackDatabase(); break; + case 7: ZapDatabase(); break; + case 99: break; + default: std::cout << "Invalid Option" << std::endl; + } + } +} +/************************************************************************/ + +#ifdef XB_LOCKING_ON +void MyClass::LockingMenu() +{ + int option = 0; + + while( option != 99 ) { + std::cout << std::endl << std::endl << "Locking Menu" << std::endl; + std::cout << "1 - Display lock info" << std::endl; + std::cout << "2 - Set retry count" << std::endl; + std::cout << "3 - Set default lock mode" << std::endl; + std::cout << "4 - Set table lock mode" << std::endl; + std::cout << "5 - Lock table (dbf file)" << std::endl; + std::cout << "6 - Unlock table (dbf file)" << std::endl; + std::cout << "7 - Lock Record" << std::endl; + std::cout << "8 - Unlock Record" << std::endl; + std::cout << "9 - Lock Memo File" << std::endl; + std::cout << "10 - Unlock Memo File" << std::endl; + std::cout << "11 - Lock Index File" << std::endl; + std::cout << "12 - Unlock Index File" << std::endl; + + std::cout << "99 - Exit Menu" << std::endl; + std::cin >> option; + + switch( option ) { + case 1: ShowLockInfo(); break; + case 2: SetRetryCount(); break; + case 3: SetDefaultLockMode(); break; + case 4: SetTableLockMode(); break; + case 5: LockDbf(); break; + case 6: UnlockDbf(); break; + case 7: LockRecord(); break; + case 8: UnlockRecord(); break; + case 9: LockMemoFile( XB_LOCK ); break; + case 10: LockMemoFile( XB_UNLOCK ); break; + case 11: LockIndexFile( XB_LOCK ); break; + case 12: LockIndexFile( XB_UNLOCK ); break; + + case 99: break; + default: std::cout << "Invalid Option" << std::endl; + } + } +} +#endif + +/************************************************************************/ + +void MyClass::MainMenu() +{ + int option = 0; + std::cout << std::endl<< std::endl << "XBase Utility Program"; + while( option != 99 ) { + std::cout << std::endl << std::endl << "Main Menu" << std::endl; + std::cout << "1 - File Menu" << std::endl; + std::cout << "2 - Record Menu" << std::endl; + std::cout << "3 - Field Menu" << std::endl; + std::cout << "4 - Index Menu" << std::endl; + #ifdef XB_LOCKING_ON + std::cout << "5 - Locking Menu" << std::endl; + #endif + #ifdef XBASE_DEBUG + std::cout << "6 - Debug Menu" << std::endl; + #endif + #ifdef XB_EXPRESSIONS + std::cout << "7 - Expression Testor" << std::endl; + #endif + #ifdef XB_FILTERS + std::cout << "8 - Filter Menu" << std::endl; + #endif + std::cout << "99 - Exit" << std::endl; + std::cin >> option; + switch( option ){ + case 1: FileMenu(); break; + case 2: RecordMenu(); break; + case 3: FieldMenu(); break; + case 4: IndexMenu(); break; + #ifdef XB_LOCKING_ON + case 5: LockingMenu(); break; + #endif + #ifdef XBASE_DEBUG + case 6: DebugMenu(); break; + #endif + #ifdef XB_EXPRESSIONS + case 7: ProcessExpression(); break; + #endif + #ifdef XB_FILTERS + case 8: FilterMenu(); break; + #endif + + case 99: std::cout << "Bye!! - Thanks for using XBase64" + << std::endl; break; + default: std::cout << "Invalid function" << std::endl; break; + } + } +} + +/************************************************************************/ + +int main(int, char**) +{ + MyClass m; + m.MainMenu(); + return 0; +} diff --git a/bin/dbfxtrct.cpp b/bin/dbfxtrct.cpp new file mode 100755 index 0000000..5d36b1e --- /dev/null +++ b/bin/dbfxtrct.cpp @@ -0,0 +1,188 @@ +/* + Xbase64 project source code + + This program extracts data from a dbf data file and puts it in + a comma delimited output file, suitable for input into an awk or + perl script + + This program excludes all memo fields + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +/*************************************************************************/ +void Usage(); +void Usage() +{ + std::cout << "\nUsage: dbfxtrct -iDATABASE.DBF -sINDEX.N[TD]X -f -F -dMM/DD/YY\n"; + std::cout << "\nWhere DATABASE.DBF is the name of the database file to dump\n"; + std::cout << "INDEX.NTX or .NDX is an optional index sort paramater\n"; + std::cout << "-f optional field name list in first record\n"; + std::cout << "-F optional field name and attributes in first record\n"; + std::cout << "MM/DD/YY is an optional output date format for any date fields\n"; + std::cout << "\nThis program creates output suitable for awk and perl scripts\n"; + std::cout << "\nThis program does not support memo fields (yet).\n"; +} +/*************************************************************************/ +int main(int ac,char** av) +{ + xbXBase x; + xbDbf d( &x ); + xbShort rc, FieldOption = 0; + xbIndex *ix = 0; + xbNdx z(&d); + + char *dbfname = NULL; + char *ixname = NULL; + char *p; + char buf[200]; + xbExpn exp( &x ); + +/* Get the input paramaters + + -i input datafile name + -s optional sort index name + -f optional field names in record one + -F optional field names and attributes in record one + -d date format +*/ + for( int i = 1; i < ac; i++ ) + { + p = av[i]; + if( *p != '-' ){ + std::cout << "Invalid paramater " << *p << std::endl; + Usage(); + return 1; + } + p++; + if( *p == 'i' ) + dbfname = ++p; + else if( *p == 's' ) + ixname = ++p; + else if( *p == 'f' ) + FieldOption = 1; + else if( *p == 'F' ) + FieldOption = 2; + else if( *p == 'd' ) + x.SetDefaultDateFormat( ++p ); + else{ + std::cout << "Invalid paramater " << *p << std::endl; + Usage(); + return 1; + } + } + +/* if missing params, display a usage message and exit */ + + if( !dbfname ){ + Usage(); + return 1; + } + +/* open the database file */ + + if(( rc = d.OpenDatabase( dbfname )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open file " << dbfname << " rc = " << rc + << "\n"; + return 2; + } + +/* if an index was specified, open the index file */ + + if( ixname ){ + +#ifdef XB_INDEX_NTX + if( strstr( ixname, "NTX" )) + ix = new xbNtx( &d ); +#endif + +#ifdef XB_INDEX_NDX + if( strstr( ixname, "NDX" )) + ix = new xbNdx( &d ); +#endif + if( !ix ){ + std::cout << "Unknown index type. .NTX and .NDX index file support only\n"; + return 3; + } + if(( rc = ix->OpenIndex( ixname )) != XB_NO_ERROR ) + { + std::cout << "\nCould not open index " << ixname << " rc = " << rc + << "\n"; + return 4; + } + } + + +/* if -f or -F paramater, dump the header information */ + if( FieldOption ){ + for( xbLong l = 0; l < d.FieldCount(); l++ ){ + if( l ) std::cout << ","; + std::cout << d.GetFieldName(l); + if( FieldOption == 2 ){ + std::cout << "|" << d.GetFieldType(l) << "|" << d.GetFieldLen(l); + std::cout << "|" << d.GetFieldDecimal(l); + } + } + std::cout << std::endl; + } + +/* if an index used, then loop thru each record, based on index, else + dump in dbf sort order */ + if( ixname ) + rc = ix->GetFirstKey(); + else + rc = d.GetFirstRecord(); + + while( rc == XB_NO_ERROR ){ + for( xbLong l = 0; l < d.FieldCount(); l++ ){ + if( l ) std::cout << ","; + strcpy( buf, exp.LTRIM( d.GetStringField( l ))); + if( d.GetFieldType( l ) == 'D' ) + std::cout << exp.DTOC( buf ); + else + std::cout << exp.TRIM( buf ); + } + if( ixname ) + rc = ix->GetNextKey(); + else + rc = d.GetNextRecord(); + std::cout << std::endl; + } + +/* close everything */ + d.CloseDatabase(); + return 0; +} diff --git a/bin/deletall.cpp b/bin/deletall.cpp new file mode 100755 index 0000000..03d2e23 --- /dev/null +++ b/bin/deletall.cpp @@ -0,0 +1,71 @@ +/* + Xbase64 project source code + + This sample program deletes all records in an Xbase64 DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << "\nUsage: deletall filename...\n"; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 2; + } + + xbShort rc = MyFile.DeleteAllRecords(); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError Deleting all records - database ==> " + << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nDone...\n\n"; + } + + return 0; +} diff --git a/bin/dumpdbt.cpp b/bin/dumpdbt.cpp new file mode 100755 index 0000000..1ecae84 --- /dev/null +++ b/bin/dumpdbt.cpp @@ -0,0 +1,113 @@ +/* + Xbase64 project source code + + This program is used for debugging the memo file logic + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main( int ac, char **av ) +{ +#ifdef XB_MEMO_FIELDS + xbXBase x; + + if( ac <= 1 ){ + std::cout << "\nUsage: dumpdbt filename...\n"; + return 1; + } + + for( int i = 1; i < ac; ++i ){ + char* filename = av[i]; + xbDbf dbf( &x ); + + if( dbf.OpenDatabase( filename )){ + std::cout << "\nCant open input file " << filename; + return 2; + } + + std::cout << "\n\nFree Block Chain...."; +#ifdef XBASE_DEBUG + dbf.DumpMemoFreeChain(); + std::cout <<"\nEnd of free block chain\n***********************************"; +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + + /* lock the memo file */ +# ifdef XB_LOCKING_ON +// dbf.LockMemoFile( XB_LOCK ); +# endif /* XB_LOCKING_ON */ + + if( !dbf.MemoFieldsPresent() ) { + std::cout << "No memo fields exist in " << filename << std::endl; + } else { + xbLong BufSize = 0L; + char* Buf = NULL; + for( xbLong l = 1; l <= dbf.NoOfRecords(); l++ ){ + dbf.GetRecord( l ); + std::cout << "\nRecord # " << dbf.GetCurRecNo(); + for( int j = 0; j < dbf.FieldCount(); j++ ) { + if( dbf.GetFieldType( j ) == 'M' ) { + int len = dbf.GetMemoFieldLen( j ); + std::cout << "\nMemo field " << dbf.GetFieldName(j) + << " length = " << len; + std::cout << " Head Block = " << dbf.GetLongField( j ) << "\n"; + if( len > BufSize ){ + if( BufSize ) free( Buf ); + if(( Buf = (( char *) malloc( len ))) == NULL ) + return XB_NO_MEMORY; + BufSize = len; + } + dbf.GetMemoField( j, len, Buf, XB_LOCK ); + for( int i = 0; i < len; i++ ) + std::cout << Buf[i]; + } + } + } + + /* unlock the memo file */ +# ifdef XB_LOCKING_ON +// dbf.LockMemoFile( XB_UNLOCK ); +# endif /* XB_LOCKING_ON */ + + std::cout << "\n"; + dbf.CloseDatabase(); + } + } +#else + std::cout << "\nXB_MEMO_FIELDS is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/dumphdr.cpp b/bin/dumphdr.cpp new file mode 100755 index 0000000..50115b6 --- /dev/null +++ b/bin/dumphdr.cpp @@ -0,0 +1,69 @@ +/* + This sample program dumps an Xbase header record + + Xbase64 project source code + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main( int ac, char ** av ) +{ +#ifdef XBASE_DEBUG + xbShort rc; + xbXBase x; + + if( ac <= 1 ) { + std::cout << "\nUsage: dumphdr filename...\n"; + return 1; + } + for( int i = 1; i < ac; ++i ){ + char * filename = av[i]; + xbDbf MyFile( &x ); + + if(( rc = MyFile.OpenDatabase( filename )) != 0 ) + { + std::cout << "Could not open file rc = " << rc << " file = " + << filename << "\n"; + return 0; + } + MyFile.DumpHeader( 3 ); + MyFile.CloseDatabase(); + } +#else + std::cout << "\nXBASE_DEBUG is not compiled in\n"; +#endif + return 0; +} diff --git a/bin/dumprecs.cpp b/bin/dumprecs.cpp new file mode 100755 index 0000000..5d79ab2 --- /dev/null +++ b/bin/dumprecs.cpp @@ -0,0 +1,97 @@ +/* dumprecs.cpp + + Thos program dumps a dbf file contents + + Xbase64 project source code + + This sample program dumps Xbase records + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ +#include <xbase64/xbase64.h> + +// next lines are helpful for debugging purposes +#include <xbase64/xbdbf.cpp> +#include <xbase64/xbexp.cpp> +#include <xbase64/xbexpprc.cpp> +#include <xbase64/xbexpfnc.cpp> +#include <xbase64/xbfields.cpp> +#include <xbase64/xbindex.cpp> +#include <xbase64/xbmemo.cpp> +#include <xbase64/xbndx.cpp> +#include <xbase64/xbntx.cpp> +#include <xbase64/xbase64.cpp> +#include <xbase64/xbdate.cpp> +#include <xbase64/xbfilter.cpp> +#include <xbase64/xblock.cpp> +#include <xbase64/xbstring.cpp> +#include <xbase64/xbfile.cpp> +#include <xbase64/xbcdx.cpp> + + + +int main(int ac,char** av) +{ + xbXBase x; + xbShort rc; + + if (ac <= 1) { + std::cout << "Usage: dumprecs filename..." << std::endl; + return 1; + } + + for(int i=1; i<ac; ++i){ + char* filename = av[i]; + + xbDbf MyFile( &x ); + + MyFile.SetVersion( 4 ); + rc = MyFile.OpenDatabase(filename); + if( rc != XB_NO_ERROR) { + std::cout << "Could not open file " << filename << std::endl; + x.DisplayError( rc ); + return 1; + } + + std::cout << "Processing file sequentially from beginning..." << std::endl; + int i = 0; + while(i<MyFile.NoOfRecords()){ + rc = MyFile.DumpRecord(++i); + if( rc != XB_NO_ERROR ) + x.DisplayError( rc ); + } + MyFile.CloseDatabase(); /* close database */ + } + return 0; +} + diff --git a/bin/makebcc.bat b/bin/makebcc.bat new file mode 100755 index 0000000..d4baca0 --- /dev/null +++ b/bin/makebcc.bat @@ -0,0 +1,22 @@ +
+rem This batch file builds the xbase utility programs
+rem using the borland 5.5 compiler
+
+del *.bak
+del *.tds
+del *.exe
+del *.obj
+
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 checkndx.cpp xbase64.lib > compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 copydbf.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dbfutil1.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dbfxtrct.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 deletall.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumpdbt.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumphdr.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 dumprecs.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 packdbf.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 reindex.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 undelall.cpp xbase64.lib >> compout
+bcc32 -I.. -I/borland/bcc55/include -L/borland/bcc55/lib -L../xbase64 zap.cpp xbase64.lib >> compout
+
diff --git a/bin/packdbf.cpp b/bin/packdbf.cpp new file mode 100755 index 0000000..2c5db8b --- /dev/null +++ b/bin/packdbf.cpp @@ -0,0 +1,77 @@ +/* + Xbase64 project source code + + This sample program packs an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: packdbf filename...\n" + "\nThis program does not automatically reindex any NDX indexes." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 1; + } + + xbShort rc = MyFile.PackDatabase( XB_LOCK ); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError packing database ==> " << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nPack Database complete...\n\n"; + } + + return 0; +} diff --git a/bin/reindex.cpp b/bin/reindex.cpp new file mode 100755 index 0000000..94f56d4 --- /dev/null +++ b/bin/reindex.cpp @@ -0,0 +1,90 @@ +/* + Xbase64 project source code + + This sample program packs an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +static void +showStatus(xbLong itemNum, xbLong numItems) +{ + printf("indexing record %ld of %ld\r", itemNum, numItems); + fflush(stdout); +} + +int main(int ac,char** av) +{ + if (3 != ac) { + std::cout << + "\nUsage: reindex dbf_file ndx_file\n" + ; + return 1; + } + + char* filename = av[1]; + char* filename2 = av[2]; + + xbXBase x; + xbDbf MyFile( &x ); + xbNdx MyIndex( &MyFile ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 0; + } + if( MyIndex.OpenIndex( filename2 )) { + std::cout << "Could not open index file " << filename2 << "\n"; + return 0; + } + + xbShort rc = MyIndex.ReIndex(showStatus); + printf("\n"); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError reindexing index ==> " << filename2; + std::cout << " Return Code = " << rc; + } + + /* or + if(( rc = MyFile.RebuildAllIndicis()) != XB_NO_ERROR ) + { + std::cout << "\nError reindexing..."; + std::cout << "\nReturn Code = " << rc; + } + */ + MyFile.CloseDatabase(); /* close database */ + + return 0; +} diff --git a/bin/undelall.cpp b/bin/undelall.cpp new file mode 100755 index 0000000..e63a8c1 --- /dev/null +++ b/bin/undelall.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program zaps an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: undelall filename...\n" + "\nThis program does not automatically reindex any NDX indexes." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << "\n"; + return 0; + } + + xbShort rc = MyFile.UndeleteAllRecords(); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError undeleting records - database ==> " << filename; + std::cout << " Return Code = " << rc; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nUndelete all records complete...\n\n"; + } + return 0; +} diff --git a/bin/zap.cpp b/bin/zap.cpp new file mode 100755 index 0000000..7261a1a --- /dev/null +++ b/bin/zap.cpp @@ -0,0 +1,76 @@ +/* + Xbase64 project source code + + This sample program zaps an Xbase DBF file + + Copyright (C) 1997,2003 Gary A. Kunkel + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Contact: + + Email: + + xbase64-devel@lists.sourceforge.net + xbase64-users@lists.sourceforge.net + + + Regular Mail: + + XBase Support + 149C South Main St + Keller Texas, 76248 + USA + +*/ + +#include <xbase64/xbase64.h> + +int main(int ac,char** av) +{ + if (ac <= 1) { + std::cout << + "\nUsage: zap filename...\n" + "\nThis program does not automatically reindex any indices." + "\nUse the reindex program to reindex any indexes associated" + "\nwith the database, or build your own program which executes " + "\nthe PackDatabase() method after opening all the index files " + "\nassociated with the database.\n\n" + ; + return 1; + } + + for (int i=1; i<ac; ++i) { + char* filename = av[i]; + + xbXBase x; + xbDbf MyFile( &x ); + if( MyFile.OpenDatabase( filename )) { + std::cout << "Could not open file " << filename << std::endl; + return 0; + } + + xbShort rc = MyFile.Zap( XB_LOCK ); + if( rc != XB_NO_ERROR ) { + std::cout << "\nError zapping database ==> " << filename; + std::cout << " Return Code = " << rc << std::endl; + } + MyFile.CloseDatabase(); /* close database */ + + std::cout << "\nZap Database complete..." << std::endl; + } + + return 0; +} |