Initial commit
All of the files from the tarball downloaded from SourceForge are being checked in so there's a record of the changes made compared to it (since I can't find the libcfu source repository). The generated files will be removed in the following commit.
This commit is contained in:
11
examples/Makefile.am
Normal file
11
examples/Makefile.am
Normal file
@@ -0,0 +1,11 @@
|
||||
noinst_PROGRAMS = hash_usage large_hash strings conf_example conf_example2 opt_example
|
||||
LDADD = -L$(top_srcdir)/src -lcfu
|
||||
|
||||
if DEBUG
|
||||
AM_CFLAGS = -Wall -W -Werror -I$(top_srcdir)/include -DCFU_DEBUG=1
|
||||
else
|
||||
AM_CFLAGS = -Wall -W -Werror -I$(top_srcdir)/include
|
||||
endif
|
||||
|
||||
AM_LDFLAGS = -Xlinker -rpath -Xlinker $(top_src_dir)/src
|
||||
|
418
examples/Makefile.in
Normal file
418
examples/Makefile.in
Normal file
@@ -0,0 +1,418 @@
|
||||
# Makefile.in generated by automake 1.9.2 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004 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@
|
||||
|
||||
SOURCES = conf_example.c conf_example2.c hash_usage.c large_hash.c opt_example.c strings.c
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
top_builddir = ..
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
INSTALL = @INSTALL@
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
noinst_PROGRAMS = hash_usage$(EXEEXT) large_hash$(EXEEXT) \
|
||||
strings$(EXEEXT) conf_example$(EXEEXT) conf_example2$(EXEEXT) \
|
||||
opt_example$(EXEEXT)
|
||||
subdir = examples
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
CONFIG_CLEAN_FILES =
|
||||
PROGRAMS = $(noinst_PROGRAMS)
|
||||
conf_example_SOURCES = conf_example.c
|
||||
conf_example_OBJECTS = conf_example.$(OBJEXT)
|
||||
conf_example_LDADD = $(LDADD)
|
||||
conf_example_DEPENDENCIES =
|
||||
conf_example2_SOURCES = conf_example2.c
|
||||
conf_example2_OBJECTS = conf_example2.$(OBJEXT)
|
||||
conf_example2_LDADD = $(LDADD)
|
||||
conf_example2_DEPENDENCIES =
|
||||
hash_usage_SOURCES = hash_usage.c
|
||||
hash_usage_OBJECTS = hash_usage.$(OBJEXT)
|
||||
hash_usage_LDADD = $(LDADD)
|
||||
hash_usage_DEPENDENCIES =
|
||||
large_hash_SOURCES = large_hash.c
|
||||
large_hash_OBJECTS = large_hash.$(OBJEXT)
|
||||
large_hash_LDADD = $(LDADD)
|
||||
large_hash_DEPENDENCIES =
|
||||
opt_example_SOURCES = opt_example.c
|
||||
opt_example_OBJECTS = opt_example.$(OBJEXT)
|
||||
opt_example_LDADD = $(LDADD)
|
||||
opt_example_DEPENDENCIES =
|
||||
strings_SOURCES = strings.c
|
||||
strings_OBJECTS = strings.$(OBJEXT)
|
||||
strings_LDADD = $(LDADD)
|
||||
strings_DEPENDENCIES =
|
||||
DEFAULT_INCLUDES = -I. -I$(srcdir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = conf_example.c conf_example2.c hash_usage.c large_hash.c \
|
||||
opt_example.c strings.c
|
||||
DIST_SOURCES = conf_example.c conf_example2.c hash_usage.c \
|
||||
large_hash.c opt_example.c strings.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMDEP_FALSE = @AMDEP_FALSE@
|
||||
AMDEP_TRUE = @AMDEP_TRUE@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEBUG_FALSE = @DEBUG_FALSE@
|
||||
DEBUG_TRUE = @DEBUG_TRUE@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBCFU_TYPE_u_int = @LIBCFU_TYPE_u_int@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_RANLIB = @ac_ct_RANLIB@
|
||||
ac_ct_STRIP = @ac_ct_STRIP@
|
||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
datadir = @datadir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
LDADD = -L$(top_srcdir)/src -lcfu
|
||||
@DEBUG_FALSE@AM_CFLAGS = -Wall -W -Werror -I$(top_srcdir)/include
|
||||
@DEBUG_TRUE@AM_CFLAGS = -Wall -W -Werror -I$(top_srcdir)/include -DCFU_DEBUG=1
|
||||
AM_LDFLAGS = -Xlinker -rpath -Xlinker $(top_src_dir)/src
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu examples/Makefile'; \
|
||||
cd $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu examples/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
clean-noinstPROGRAMS:
|
||||
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
|
||||
conf_example$(EXEEXT): $(conf_example_OBJECTS) $(conf_example_DEPENDENCIES)
|
||||
@rm -f conf_example$(EXEEXT)
|
||||
$(LINK) $(conf_example_LDFLAGS) $(conf_example_OBJECTS) $(conf_example_LDADD) $(LIBS)
|
||||
conf_example2$(EXEEXT): $(conf_example2_OBJECTS) $(conf_example2_DEPENDENCIES)
|
||||
@rm -f conf_example2$(EXEEXT)
|
||||
$(LINK) $(conf_example2_LDFLAGS) $(conf_example2_OBJECTS) $(conf_example2_LDADD) $(LIBS)
|
||||
hash_usage$(EXEEXT): $(hash_usage_OBJECTS) $(hash_usage_DEPENDENCIES)
|
||||
@rm -f hash_usage$(EXEEXT)
|
||||
$(LINK) $(hash_usage_LDFLAGS) $(hash_usage_OBJECTS) $(hash_usage_LDADD) $(LIBS)
|
||||
large_hash$(EXEEXT): $(large_hash_OBJECTS) $(large_hash_DEPENDENCIES)
|
||||
@rm -f large_hash$(EXEEXT)
|
||||
$(LINK) $(large_hash_LDFLAGS) $(large_hash_OBJECTS) $(large_hash_LDADD) $(LIBS)
|
||||
opt_example$(EXEEXT): $(opt_example_OBJECTS) $(opt_example_DEPENDENCIES)
|
||||
@rm -f opt_example$(EXEEXT)
|
||||
$(LINK) $(opt_example_LDFLAGS) $(opt_example_OBJECTS) $(opt_example_LDADD) $(LIBS)
|
||||
strings$(EXEEXT): $(strings_OBJECTS) $(strings_DEPENDENCIES)
|
||||
@rm -f strings$(EXEEXT)
|
||||
$(LINK) $(strings_LDFLAGS) $(strings_OBJECTS) $(strings_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_example.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf_example2.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash_usage.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/large_hash.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/opt_example.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strings.Po@am__quote@
|
||||
|
||||
.c.o:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
||||
|
||||
.c.obj:
|
||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
||||
uninstall-info-am:
|
||||
|
||||
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: TAGS
|
||||
|
||||
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; }'`; \
|
||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$tags $$unique; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(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 "$(CTAGS_ARGS)$$tags$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
||||
list='$(DISTFILES)'; for file in $$list; do \
|
||||
case $$file in \
|
||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
||||
esac; \
|
||||
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"; \
|
||||
$(mkdir_p) "$(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)
|
||||
installdirs:
|
||||
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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-generic clean-noinstPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-man:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-info-am
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
||||
clean-noinstPROGRAMS ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am 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 pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am 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:
|
42
examples/conf_example.c
Normal file
42
examples/conf_example.c
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Creation date: 2005-07-08 23:43:37
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
#include "cfuconf.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CFU_DEBUG
|
||||
#ifdef NDEBUG
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
#else
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
char *file_path = "/tmp/test.conf";
|
||||
cfuconf_t *conf = NULL;
|
||||
char *error = NULL;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
||||
if (cfuconf_parse_file(file_path, &conf, &error) < 0) {
|
||||
fprintf(stderr, "Error loading conf file: %s\n", error);
|
||||
free(error);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n\nvals:\n\n");
|
||||
|
||||
cfuconf_pretty_print_conf(conf, stderr, 0);
|
||||
|
||||
cfuconf_destroy(conf);
|
||||
|
||||
return 0;
|
||||
}
|
48
examples/conf_example2.c
Normal file
48
examples/conf_example2.c
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Creation date: 2005-07-25 22:00:49
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
|
||||
#include "cfuconf.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CFU_DEBUG
|
||||
#ifdef NDEBUG
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
#else
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cfuconf_t *conf = NULL;
|
||||
char *error = NULL;
|
||||
char *buffer = "SetVar Test1 Val1\n"
|
||||
"SetVar Test2 Val2\n"
|
||||
"<test_container c1>\n"
|
||||
" SetVar Test3 Val3\n"
|
||||
" SetVar Test4 Val4\n"
|
||||
"</test_container>\n";
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
||||
if (cfuconf_parse_buffer(buffer, &conf, &error) < 0) {
|
||||
fprintf(stderr, "Error loading conf buffer: %s\n", error);
|
||||
free(error);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
fprintf(stderr, "\n\nvals:\n\n");
|
||||
|
||||
cfuconf_pretty_print_conf(conf, stderr, 0);
|
||||
|
||||
cfuconf_destroy(conf);
|
||||
|
||||
return 0;
|
||||
}
|
133
examples/hash_usage.c
Normal file
133
examples/hash_usage.c
Normal file
@@ -0,0 +1,133 @@
|
||||
/* Creation date: 2005-06-25 10:33:53
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
#include "cfuhash.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
remove_func(void *key, size_t key_size, void *data, size_t data_size, void *arg) {
|
||||
data_size = data_size;
|
||||
data = data;
|
||||
arg = arg;
|
||||
|
||||
if (key_size > 7) {
|
||||
if (!strncasecmp(key, "content", 7)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cfuhash_table_t *hash = cfuhash_new_with_initial_size(30);
|
||||
cfuhash_table_t *hash2 = cfuhash_new_with_initial_size(4);
|
||||
char *val = NULL;
|
||||
char list[32][2][32];
|
||||
size_t i;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
||||
cfuhash_set_flag(hash, CFUHASH_FROZEN_UNTIL_GROWS);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
sprintf(list[i][0], "test_var%d", i);
|
||||
sprintf(list[i][1], "value%d", i);
|
||||
}
|
||||
|
||||
cfuhash_put(hash, "var1", "value1");
|
||||
cfuhash_put(hash, "var2", "value2");
|
||||
cfuhash_put(hash, "var3", "value3");
|
||||
cfuhash_put(hash, "var4", "value4");
|
||||
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
|
||||
printf("\n\n");
|
||||
val = (char *)cfuhash_delete(hash, "var3");
|
||||
printf("delete: got back '%s'\n\n", val);
|
||||
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
|
||||
printf("\n\n");
|
||||
val = cfuhash_get(hash, "var2");
|
||||
printf("got var2='%s'\n", val);
|
||||
printf("var4 %s\n", cfuhash_exists(hash, "var4") ? "exists" : "does NOT exist!!!");
|
||||
|
||||
printf("%d entries, %d buckets used out of %d\n", cfuhash_num_entries(hash), cfuhash_num_buckets_used(hash), cfuhash_num_buckets(hash));
|
||||
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
|
||||
cfuhash_clear(hash);
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
size_t used = cfuhash_num_buckets_used(hash);
|
||||
size_t num_buckets = cfuhash_num_buckets(hash);
|
||||
size_t num_entries = cfuhash_num_entries(hash);
|
||||
cfuhash_put(hash, list[i][0], list[i][1]);
|
||||
printf("%d entries, %d buckets used out of %d (%.2f)\n", num_entries, used, num_buckets, (float)num_entries/(float)num_buckets);
|
||||
|
||||
}
|
||||
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
|
||||
{
|
||||
char **keys = NULL;
|
||||
size_t *key_sizes = NULL;
|
||||
size_t key_count = 0;
|
||||
|
||||
keys = (char **)cfuhash_keys_data(hash, &key_count, &key_sizes, 0);
|
||||
|
||||
printf("\n\nkeys (%u):\n", key_count);
|
||||
for (i = 0; i < key_count; i++) {
|
||||
printf("\t%s\n", keys[i]);
|
||||
free(keys[i]);
|
||||
}
|
||||
free(keys);
|
||||
free(key_sizes);
|
||||
}
|
||||
|
||||
cfuhash_clear(hash);
|
||||
printf("%d entries, %d buckets used out of %d\n", cfuhash_num_entries(hash), cfuhash_num_buckets_used(hash), cfuhash_num_buckets(hash));
|
||||
|
||||
cfuhash_destroy(hash);
|
||||
|
||||
printf("\n\n====> case-insensitive hash:\n\n");
|
||||
hash = cfuhash_new_with_initial_size(30);
|
||||
cfuhash_set_flag(hash, CFUHASH_IGNORE_CASE);
|
||||
cfuhash_put(hash, "Content-Type", "value1");
|
||||
cfuhash_put(hash, "Content-Length", "value2");
|
||||
|
||||
cfuhash_put(hash2, "var3", "value3");
|
||||
cfuhash_put(hash2, "var4", "value4");
|
||||
|
||||
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
cfuhash_copy(hash2, hash);
|
||||
cfuhash_pretty_print(hash, stdout);
|
||||
|
||||
{
|
||||
char keys[4][32] = { "content-type", "content-length", "Var3", "VaR4" };
|
||||
size_t i = 0;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
printf("%s => %s\n", keys[i], (char *)cfuhash_get(hash, keys[i]));
|
||||
}
|
||||
|
||||
cfuhash_foreach_remove(hash, remove_func, NULL, NULL);
|
||||
printf("\n\nafter removing content*:\n");
|
||||
for (i = 0; i < 4; i++) {
|
||||
printf("%s => %s\n", keys[i], (char *)cfuhash_get(hash, keys[i]));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cfuhash_destroy(hash);
|
||||
cfuhash_destroy(hash2);
|
||||
|
||||
return 0;
|
||||
}
|
162
examples/large_hash.c
Normal file
162
examples/large_hash.c
Normal file
@@ -0,0 +1,162 @@
|
||||
/* Creation date: 2005-06-26 00:41:47
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
#include "cfuhash.h"
|
||||
#include "cfutime.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
|
||||
static
|
||||
void free_data(void *data) {
|
||||
free(data);
|
||||
}
|
||||
|
||||
static char *
|
||||
dup_str(const char *str) {
|
||||
size_t len = strlen(str);
|
||||
char *ns = (char *)calloc(len + 1, 1);
|
||||
memcpy(ns, str, len);
|
||||
return ns;
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
hash_func1(const void *key, size_t length) {
|
||||
size_t i = length;
|
||||
u_int hash = 0;
|
||||
char *s = (char *)key;
|
||||
while (i--) hash = hash * 33 + *s++;
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
/* From libtc */
|
||||
#define mix(a,b,c) \
|
||||
{ \
|
||||
a -= b; a -= c; a ^= (c>>13); \
|
||||
b -= c; b -= a; b ^= (a<<8); \
|
||||
c -= a; c -= b; c ^= (b>>13); \
|
||||
a -= b; a -= c; a ^= (c>>12); \
|
||||
b -= c; b -= a; b ^= (a<<16); \
|
||||
c -= a; c -= b; c ^= (b>>5); \
|
||||
a -= b; a -= c; a ^= (c>>3); \
|
||||
b -= c; b -= a; b ^= (a<<10); \
|
||||
c -= a; c -= b; c ^= (b>>15); \
|
||||
}
|
||||
|
||||
typedef u_int32_t ub4;
|
||||
|
||||
static u_int
|
||||
hash_func_tc(const void *key, size_t length)
|
||||
{
|
||||
register ub4 a,b,c,len;
|
||||
const char *k = key;
|
||||
|
||||
/* Set up the internal state */
|
||||
len = length;
|
||||
a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
|
||||
c = 0; /* the previous hash value */
|
||||
|
||||
/*---------------------------------------- handle most of the key */
|
||||
while(len >= 12){
|
||||
a += (k[0] +((ub4)k[1]<<8) +((ub4)k[2]<<16) +((ub4)k[3]<<24));
|
||||
b += (k[4] +((ub4)k[5]<<8) +((ub4)k[6]<<16) +((ub4)k[7]<<24));
|
||||
c += (k[8] +((ub4)k[9]<<8) +((ub4)k[10]<<16)+((ub4)k[11]<<24));
|
||||
mix(a,b,c);
|
||||
k += 12; len -= 12;
|
||||
}
|
||||
|
||||
/*------------------------------------- handle the last 11 bytes */
|
||||
c += length;
|
||||
switch(len){ /* all the case statements fall through */
|
||||
case 11: c+=((ub4)k[10]<<24);
|
||||
case 10: c+=((ub4)k[9]<<16);
|
||||
case 9 : c+=((ub4)k[8]<<8);
|
||||
/* the first byte of c is reserved for the length */
|
||||
case 8 : b+=((ub4)k[7]<<24);
|
||||
case 7 : b+=((ub4)k[6]<<16);
|
||||
case 6 : b+=((ub4)k[5]<<8);
|
||||
case 5 : b+=k[4];
|
||||
case 4 : a+=((ub4)k[3]<<24);
|
||||
case 3 : a+=((ub4)k[2]<<16);
|
||||
case 2 : a+=((ub4)k[1]<<8);
|
||||
case 1 : a+=k[0];
|
||||
/* case 0: nothing left to add */
|
||||
}
|
||||
mix(a,b,c);
|
||||
/*-------------------------------------------- report the result */
|
||||
return c;
|
||||
}
|
||||
|
||||
/* End of code from Jenkins */
|
||||
|
||||
|
||||
static int
|
||||
time_it(cfuhash_function_t hf, double *elapsed_time, u_int32_t num_tests) {
|
||||
cfuhash_table_t *hash = cfuhash_new_with_initial_size(30);
|
||||
u_int32_t flags = 0;
|
||||
char key[32];
|
||||
char value[32];
|
||||
size_t i;
|
||||
size_t used;
|
||||
size_t num_buckets;
|
||||
size_t num_entries;
|
||||
cfutime_t *time = cfutime_new();
|
||||
|
||||
/* freeze the hash so that it won't shrink while we put in all the data */
|
||||
flags = cfuhash_set_flag(hash, CFUHASH_FROZEN_UNTIL_GROWS);
|
||||
cfuhash_set_hash_function(hash, hf);
|
||||
|
||||
cfutime_begin(time);
|
||||
for (i = 0; i < num_tests; i++) {
|
||||
sprintf(key, "%u", 15000000 - i);
|
||||
sprintf(value, "value%d", i);
|
||||
cfuhash_put(hash, key, dup_str(value));
|
||||
}
|
||||
cfutime_end(time);
|
||||
*elapsed_time = cfutime_elapsed(time);
|
||||
|
||||
used = cfuhash_num_buckets_used(hash);
|
||||
num_buckets = cfuhash_num_buckets(hash);
|
||||
num_entries = cfuhash_num_entries(hash);
|
||||
printf("%d entries, %d/%d buckets (%.2f%%), %.2f%% threshold check\n", num_entries, used, num_buckets, 100.0 * (float)used/(float)num_buckets, 100.0 * (float)num_entries/(float)num_buckets);
|
||||
|
||||
cfuhash_destroy_with_free_fn(hash, free_data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
double elapsed_time = 0;
|
||||
u_int32_t num_tests = 3000000;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
||||
printf("mutex is %d bytes\n", sizeof(pthread_mutex_t));
|
||||
|
||||
printf("default:\n");
|
||||
time_it(NULL, &elapsed_time, num_tests);
|
||||
printf("%.3f seconds\n", elapsed_time);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
printf("hash_func1:\n");
|
||||
time_it(hash_func1, &elapsed_time, num_tests);
|
||||
printf("%.3f seconds\n", elapsed_time);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
printf("hash_func_tc:\n");
|
||||
time_it(hash_func_tc, &elapsed_time, num_tests);
|
||||
printf("%.3f seconds\n", elapsed_time);
|
||||
printf("\n");
|
||||
fflush(stdout);
|
||||
|
||||
return 1;
|
||||
}
|
56
examples/opt_example.c
Normal file
56
examples/opt_example.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/* Creation date: 2005-09-04 14:46:45
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
#include "cfuopt.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cfuopt_t *opt = cfuopt_new();
|
||||
int verbose = 0;
|
||||
char *file = NULL;
|
||||
long count = 0;
|
||||
char *error = NULL;
|
||||
double scale = 0.0;
|
||||
char *help = NULL;
|
||||
int i = 0;
|
||||
|
||||
argc = argc;
|
||||
argv = argv;
|
||||
|
||||
cfuopt_add_entry(opt, "verbose|v!", &verbose, "Verbosity", "");
|
||||
cfuopt_add_entry(opt, "file|f:s", &file, "File to load", "FILE");
|
||||
cfuopt_add_entry(opt, "count|c|n=i", &count, "Count to run", "COUNT");
|
||||
cfuopt_add_entry(opt, "scale|s:f", &scale, "Scaling factor", "SCALE");
|
||||
|
||||
printf("\nStarting args:\n");
|
||||
for (i = 0; i < argc; i++) {
|
||||
printf("\t%s\n", argv[i]);
|
||||
}
|
||||
|
||||
cfuopt_parse(opt, &argc, &argv, &error);
|
||||
|
||||
printf("\n\n");
|
||||
printf("verbose=%d\n", verbose);
|
||||
printf("file=%s\n", file);
|
||||
printf("count=%ld\n", count);
|
||||
printf("scale=%f\n", scale);
|
||||
|
||||
help = cfuopt_get_help_str(opt);
|
||||
|
||||
printf("\n\nhelp:\n%s\n", help);
|
||||
free(help);
|
||||
|
||||
printf("\nLeft over args:\n");
|
||||
for (i = 0; i < argc; i++) {
|
||||
printf("\t%s\n", argv[i]);
|
||||
}
|
||||
|
||||
cfuopt_destroy(opt);
|
||||
|
||||
free(file);
|
||||
|
||||
return 0;
|
||||
}
|
99
examples/strings.c
Normal file
99
examples/strings.c
Normal file
@@ -0,0 +1,99 @@
|
||||
/* Creation date: 2005-06-27 22:19:17
|
||||
* Authors: Don
|
||||
* Change log:
|
||||
*/
|
||||
|
||||
#include "cfustring.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CFU_DEBUG
|
||||
#ifdef NDEBUG
|
||||
#undef NDEBUG
|
||||
#endif
|
||||
#else
|
||||
#ifndef NDEBUG
|
||||
#define NDEBUG 1
|
||||
#endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
cfustring_t *buf = cfustring_new_with_initial_size(32);
|
||||
char **strings = NULL;
|
||||
size_t num_strings = 0;
|
||||
size_t num_headers = 0;
|
||||
size_t i = 0;
|
||||
char *ref_addr = NULL;
|
||||
char *s = NULL;
|
||||
cfustring_t *header_block = cfustring_new_from_string(
|
||||
"User-Agent: curl/7.10.6 (i386-redhat-linux-gnu) libcurl/7.10.6 OpenSSL/0.9.7a ipv6 zlib/1.2.0.7\r\n"
|
||||
"Host: localhost:9095\r\n"
|
||||
"Pragma: no-cache\r\n"
|
||||
"Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n");
|
||||
cfustring_t **header_lines = NULL;
|
||||
|
||||
argc = argc; argv = argv; /* avoid compiler warnings */
|
||||
|
||||
cfustring_append(buf, "test^*string%2^*3");
|
||||
strings = cfustring_split_to_c_str(buf, &num_strings, 0, "%", "^*", NULL);
|
||||
|
||||
printf("got back %u strings\n", num_strings);
|
||||
|
||||
printf("\n");
|
||||
for (i = 0; i < num_strings; i++) {
|
||||
printf("'%s'\n", strings[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_strings; i++) {
|
||||
free(strings[i]);
|
||||
}
|
||||
free(strings);
|
||||
|
||||
header_lines = cfustring_split(header_block, &num_headers, 0, "\r\n", "\n", NULL);
|
||||
printf("got back %u headers\n", num_strings);
|
||||
|
||||
for (i = 0; i < num_headers; i++) {
|
||||
strings = cfustring_split_to_c_str(header_lines[i], &num_strings, 2, ":", NULL);
|
||||
if (num_strings != 2) {
|
||||
/* bad header */
|
||||
size_t j = 0;
|
||||
for (j = 0; j < num_strings; j++) free(strings[j]);
|
||||
free(strings);
|
||||
fprintf(stderr, "bad header: %u strings from split -- '%s'\n", num_strings, cfustring_get_buffer(header_lines[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("Got header '%s' => '%s'\n", strings[0], strings[1]);
|
||||
free(strings[0]); free(strings[1]);
|
||||
free(strings);
|
||||
}
|
||||
|
||||
for (i = 0; i < num_headers; i++) {
|
||||
assert(cfu_is_string(header_lines[i]));
|
||||
cfustring_destroy(header_lines[i]);
|
||||
}
|
||||
free(header_lines);
|
||||
|
||||
cfustring_sprintf(buf, "this %% is a string - '%.2f'", 509.0);
|
||||
printf("cfustring_sprintf(): '%s'\n", cfustring_get_buffer(buf));
|
||||
|
||||
cfustring_destroy(buf);
|
||||
|
||||
s = cfustring_sprintf_c_str("this is a test with a num: '%u'\n", 5);
|
||||
|
||||
printf("got: %s\n", s);
|
||||
free(s);
|
||||
|
||||
ref_addr = cfustring_sprintf_c_str("%p", (void *)header_block);
|
||||
|
||||
cfustring_destroy(header_block);
|
||||
|
||||
printf("\n\nheader_block as ref_addr='%s'\n\n", ref_addr);
|
||||
free(ref_addr);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user