summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-03-05 14:54:06 +0000
committerLars Wirzenius <liw@liw.fi>2011-03-05 14:54:06 +0000
commitac914490435f1e070c609c2a2a219a4322e5515e (patch)
tree038c86e3228c3655fe7a445acf40a376dd360fcb /lib
parent21c77f79b054b83245d0205fefcaf4b9d2394712 (diff)
downloaddynstr-ac914490435f1e070c609c2a2a219a4322e5515e.tar.gz
Add stuff.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile539
-rw-r--r--lib/Makefile.am3
-rw-r--r--lib/Makefile.in447
-rw-r--r--lib/dynstr.c547
-rw-r--r--lib/dynstr.h187
5 files changed, 1723 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..5343dc7
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,539 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# lib/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
+
+
+
+
+
+pkgdatadir = $(datadir)/dynstr
+pkgincludedir = $(includedir)/dynstr
+pkglibdir = $(libdir)/dynstr
+pkglibexecdir = $(libexecdir)/dynstr
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = :
+build_triplet = x86_64-unknown-linux-gnu
+host_triplet = x86_64-unknown-linux-gnu
+subdir = lib
+DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libdynstr_la_LIBADD =
+am_libdynstr_la_OBJECTS = dynstr.lo
+libdynstr_la_OBJECTS = $(am_libdynstr_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libdynstr_la_SOURCES)
+DIST_SOURCES = $(libdynstr_la_SOURCES)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/liw/dynstr/dynstr/missing --run aclocal-1.11
+AMTAR = ${SHELL} /home/liw/dynstr/dynstr/missing --run tar
+AR = ar
+AUTOCONF = ${SHELL} /home/liw/dynstr/dynstr/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/liw/dynstr/dynstr/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/liw/dynstr/dynstr/missing --run automake-1.11
+AWK = gawk
+CC = gcc -std=gnu99
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2
+CPP = gcc -E
+CPPFLAGS =
+CYGPATH_W = echo
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+DSYMUTIL =
+DUMPBIN =
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = /bin/grep -E
+EXEEXT =
+FGREP = /bin/grep -F
+GREP = /bin/grep
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
+LD = /usr/bin/ld -m elf_x86_64
+LDFLAGS =
+LIBOBJS =
+LIBS =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LIPO =
+LN_S = ln -s
+LTLIBOBJS =
+MAKEINFO = ${SHELL} /home/liw/dynstr/dynstr/missing --run makeinfo
+MKDIR_P = /bin/mkdir -p
+NM = /usr/bin/nm -B
+NMEDIT =
+OBJDUMP = objdump
+OBJEXT = o
+OTOOL =
+OTOOL64 =
+PACKAGE = dynstr
+PACKAGE_BUGREPORT = liw@liw.fi
+PACKAGE_NAME = dynstr
+PACKAGE_STRING = dynstr 0.0
+PACKAGE_TARNAME = dynstr
+PACKAGE_URL =
+PACKAGE_VERSION = 0.0
+PATH_SEPARATOR = :
+RANLIB = ranlib
+SED = /bin/sed
+SET_MAKE =
+SHELL = /bin/bash
+STRIP = strip
+VERSION = 0.0
+abs_builddir = /home/liw/dynstr/dynstr/lib
+abs_srcdir = /home/liw/dynstr/dynstr/lib
+abs_top_builddir = /home/liw/dynstr/dynstr
+abs_top_srcdir = /home/liw/dynstr/dynstr
+ac_ct_CC = gcc
+ac_ct_DUMPBIN =
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = ${AMTAR} chof - "$$tardir"
+am__untar = ${AMTAR} xf -
+bindir = ${exec_prefix}/bin
+build = x86_64-unknown-linux-gnu
+build_alias =
+build_cpu = x86_64
+build_os = linux-gnu
+build_vendor = unknown
+builddir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+host = x86_64-unknown-linux-gnu
+host_alias =
+host_cpu = x86_64
+host_os = linux-gnu
+host_vendor = unknown
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+install_sh = ${SHELL} /home/liw/dynstr/dynstr/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localedir = ${datarootdir}/locale
+localstatedir = ${prefix}/var
+lt_ECHO = echo
+mandir = ${datarootdir}/man
+mkdir_p = /bin/mkdir -p
+oldincludedir = /usr/include
+pdfdir = ${docdir}
+prefix = /home/liw/test
+program_transform_name = s,x,x,
+psdir = ${docdir}
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+srcdir = .
+sysconfdir = ${prefix}/etc
+target_alias =
+top_build_prefix = ../
+top_builddir = ..
+top_srcdir = ..
+lib_LTLIBRARIES = libdynstr.la
+libdynstr_la_SOURCES = dynstr.c dynstr.h
+include_HEADERS = dynstr.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign lib/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
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libdynstr.la: $(libdynstr_la_OBJECTS) $(libdynstr_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libdynstr_la_OBJECTS) $(libdynstr_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/dynstr.Plo
+
+.c.o:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+# source='$<' object='$@' libtool=no \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+# source='$<' object='$@' libtool=yes \
+# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
+# $(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(includedir)" && rm -f $$files
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__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)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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 $(LTLIBRARIES) $(HEADERS)
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-libLTLIBRARIES clean-libtool \
+ 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
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+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 \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-includeHEADERS install-info \
+ install-info-am install-libLTLIBRARIES install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES
+
+
+# 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/lib/Makefile.am b/lib/Makefile.am
new file mode 100644
index 0000000..657e3e6
--- /dev/null
+++ b/lib/Makefile.am
@@ -0,0 +1,3 @@
+bin_PROGRAMS = unittests
+unittests_SOURCES = unittests.c dynstr.c
+
diff --git a/lib/Makefile.in b/lib/Makefile.in
new file mode 100644
index 0000000..ae6fffc
--- /dev/null
+++ b/lib/Makefile.in
@@ -0,0 +1,447 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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 = :
+bin_PROGRAMS = unittests$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_unittests_OBJECTS = unittests.$(OBJEXT) dynstr.$(OBJEXT)
+unittests_OBJECTS = $(am_unittests_OBJECTS)
+unittests_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(unittests_SOURCES)
+DIST_SOURCES = $(unittests_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EXEEXT = @EXEEXT@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+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@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+unittests_SOURCES = unittests.c dynstr.c
+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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign src/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
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+unittests$(EXEEXT): $(unittests_OBJECTS) $(unittests_DEPENDENCIES)
+ @rm -f unittests$(EXEEXT)
+ $(LINK) $(unittests_OBJECTS) $(unittests_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dynstr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unittests.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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) '$<'`
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__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)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 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
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+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-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am 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-binPROGRAMS
+
+
+# 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/lib/dynstr.c b/lib/dynstr.c
new file mode 100644
index 0000000..44c4b56
--- /dev/null
+++ b/lib/dynstr.c
@@ -0,0 +1,547 @@
+/*
+ * dynstr.c - implement dynamic byte strings
+ * Copyright 2010 Lars Wirzenius
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+
+/* We shamelessly use GNU extensions to the standard C library.
+ * Primarily this is the memmem(3) function. Patches are welcome to
+ * get rid of this, but I did not feel like re-inventing the wheel.
+ */
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "dynstr.h"
+
+
+/* This is how the dynamic strings are represented. */
+struct Dynstr {
+ unsigned char *mem;
+ size_t size;
+};
+
+
+/* Return value for readline_helper's callback functions. */
+#define DYNSTR_ERROR ((size_t) -1)
+
+
+/* The current malloc and malloc error handler functions. */
+static dynstr_error_handler *error_handler = dynstr_malloc_error_indicate;
+static void *(*current_malloc)(size_t) = malloc;
+
+
+void dynstr_init(void)
+{
+ error_handler = dynstr_malloc_error_indicate;
+ current_malloc = malloc;
+}
+
+
+void *(*dynstr_get_malloc(void))(size_t)
+{
+ return current_malloc;
+}
+
+
+void dynstr_set_malloc(void *(*new_malloc)(size_t))
+{
+ current_malloc = new_malloc;
+}
+
+
+dynstr_error_handler *dynstr_get_malloc_error_handler(void)
+{
+ return error_handler;
+}
+
+
+void dynstr_set_malloc_error_handler(dynstr_error_handler *handler)
+{
+ error_handler = handler;
+}
+
+
+void dynstr_malloc_error_indicate(int error, size_t size, void *oldptr)
+{
+}
+
+void dynstr_malloc_error_abort(int error, size_t size, void *oldptr)
+{
+ abort();
+}
+
+
+/* Dynamically allocate a number of bytes. Call error handler if necessary. */
+static void *alloc(size_t size)
+{
+ void *p;
+
+ p = current_malloc(size);
+ if (p == NULL)
+ error_handler(errno, size, NULL);
+ return p;
+}
+
+
+static Dynstr *new_dynstr(const void *mem, size_t size, bool dynamic)
+{
+ Dynstr *dynstr;
+
+ if (dynamic) {
+ dynstr = alloc(sizeof(Dynstr) + size);
+ if (dynstr == NULL)
+ return NULL;
+ dynstr->mem = ((unsigned char *) dynstr) + sizeof(Dynstr);
+ } else {
+ dynstr = alloc(sizeof(Dynstr));
+ if (dynstr == NULL)
+ return NULL;
+ dynstr->mem = (unsigned char *) mem;
+ }
+
+ dynstr->size = size;
+ return dynstr;
+}
+
+
+static void init_dynstr(Dynstr *dynstr, const void *mem, bool dynamic)
+{
+ if (dynamic)
+ memcpy(dynstr->mem, mem, dynstr->size);
+}
+
+
+/* Allocate a new dynamic string. If dynamic is true, the contents of the
+ * new string is copied from mem. Otherwise the new string just uses mem
+ * directly. */
+static Dynstr *newstr(const void *mem, size_t size, bool dynamic)
+{
+ Dynstr *dynstr;
+
+ dynstr = new_dynstr(mem, size, dynamic);
+ if (dynstr != NULL)
+ init_dynstr(dynstr, mem, dynamic);
+ return dynstr;
+}
+
+
+Dynstr *dynstr_new_empty(void)
+{
+ return new_dynstr(NULL, 0, false);
+}
+
+
+Dynstr *dynstr_new_from_cstring(const char *cstring)
+{
+ return newstr(cstring, strlen(cstring), true);
+}
+
+
+Dynstr *dynstr_new_from_memory(const void *mem, size_t size)
+{
+ return newstr(mem, size, true);
+}
+
+
+Dynstr *dynstr_new_from_constant_cstring(const char *cstring)
+{
+ return newstr(cstring, strlen(cstring), false);
+}
+
+
+Dynstr *dynstr_new_from_constant_memory(const void *mem, size_t size)
+{
+ return newstr(mem, size, false);
+}
+
+
+void dynstr_free(Dynstr *dynstr)
+{
+ free(dynstr);
+}
+
+
+size_t dynstr_len(Dynstr *dynstr)
+{
+ return dynstr->size;
+}
+
+
+bool dynstr_is_empty(Dynstr *dynstr)
+{
+ return dynstr_len(dynstr) == 0;
+}
+
+
+size_t dynstr_memcpy(void *mem, Dynstr *dynstr, size_t offset, size_t size)
+{
+ size_t len;
+
+ len = dynstr_len(dynstr);
+ if (offset >= len)
+ return 0;
+ if (size > len - offset)
+ size = len - offset;
+ memcpy(mem, dynstr->mem + offset, size);
+ return size;
+}
+
+
+char *dynstr_strdup(Dynstr *dynstr)
+{
+ char *mem;
+
+ mem = alloc(dynstr->size + 1);
+ if (mem == NULL)
+ return NULL;
+ memcpy(mem, dynstr->mem, dynstr->size);
+ mem[dynstr->size] = '\0';
+ return mem;
+}
+
+
+Dynstr *dynstr_substr(Dynstr *dynstr, size_t offset, size_t size)
+{
+ if (offset >= dynstr->size) {
+ offset = 0;
+ size = 0;
+ } else if (size > dynstr->size - offset) {
+ size = dynstr->size - offset;
+ }
+ return newstr(dynstr->mem + offset, size, true);
+}
+
+
+Dynstr *dynstr_cat(Dynstr *dynstr1, Dynstr *dynstr2)
+{
+ return dynstr_cat_many(dynstr1, dynstr2, (Dynstr *) NULL);
+}
+
+
+Dynstr *dynstr_cat_many(Dynstr *dynstr, ...)
+{
+ va_list args;
+ Dynstr *result;
+ size_t size;
+ size_t offset;
+
+ va_start(args, dynstr);
+ size = 0;
+ for (Dynstr *p = dynstr; p != NULL; p = va_arg(args, Dynstr *))
+ size += p->size;
+ va_end(args);
+
+ result = new_dynstr(NULL, size, true);
+ if (result == NULL)
+ return NULL;
+
+ va_start(args, dynstr);
+ offset = 0;
+ for (Dynstr *p = dynstr; p != NULL; p = va_arg(args, Dynstr *)) {
+ memcpy(result->mem + offset, p->mem, p->size);
+ offset += p->size;
+ }
+ va_end(args);
+
+ return result;
+}
+
+
+int dynstr_byte_at(Dynstr *dynstr, size_t offset)
+{
+ if (offset >= dynstr->size)
+ return -1;
+ return dynstr->mem[offset];
+}
+
+
+size_t dynstr_first_byte(Dynstr *dynstr, size_t offset, int byte)
+{
+ unsigned char *p;
+
+ if (offset >= dynstr->size)
+ return DYNSTR_NOT_FOUND;
+ p = memchr(dynstr->mem + offset, byte, dynstr->size - offset);
+ if (p == NULL)
+ return DYNSTR_NOT_FOUND;
+ return (size_t) (p - dynstr->mem);
+}
+
+
+size_t dynstr_last_byte(Dynstr *dynstr, size_t offset, int byte)
+{
+ unsigned char *p;
+
+ if (offset >= dynstr->size)
+ return DYNSTR_NOT_FOUND;
+ p = memrchr(dynstr->mem + offset, byte, dynstr->size - offset);
+ if (p == NULL)
+ return DYNSTR_NOT_FOUND;
+ return (size_t) (p - dynstr->mem);
+}
+
+
+size_t dynstr_first_string(Dynstr *dynstr, size_t offset, Dynstr *pattern)
+{
+ const unsigned char *p;
+
+ if (offset >= dynstr->size)
+ return DYNSTR_NOT_FOUND;
+ if (pattern->size == 0)
+ return DYNSTR_NOT_FOUND;
+ p = memmem(dynstr->mem + offset, dynstr->size - offset,
+ pattern->mem, pattern->size);
+ if (p == NULL)
+ return DYNSTR_NOT_FOUND;
+ return (size_t) (p - dynstr->mem);
+}
+
+
+size_t dynstr_last_string(Dynstr *dynstr, size_t offset, Dynstr *pattern)
+{
+ size_t result;
+ size_t new_result;
+
+ /* GNU libc lacks a memrmem function, so we loop to the last
+ * dynstr_first_string match. */
+ result = DYNSTR_NOT_FOUND;
+ for (;;) {
+ new_result = dynstr_first_string(dynstr, offset, pattern);
+ if (new_result == DYNSTR_NOT_FOUND)
+ break;
+ result = new_result;
+ offset = result + 1;
+ }
+ return result;
+}
+
+
+int dynstr_cmp(Dynstr *dynstr1, Dynstr *dynstr2)
+{
+ int result;
+ size_t min_size;
+
+ if (dynstr1->size < dynstr2->size)
+ min_size = dynstr1->size;
+ else
+ min_size = dynstr2->size;
+ result = memcmp(dynstr1->mem, dynstr2->mem, min_size);
+ if (result == 0) {
+ if (dynstr1->size < dynstr2->size)
+ return -1;
+ else if (dynstr1->size == dynstr2->size)
+ return 0;
+ else
+ return 1;
+ }
+ return result;
+}
+
+
+size_t dynstr_fwrite(FILE *file, Dynstr *dynstr)
+{
+ return fwrite(dynstr->mem, 1, dynstr->size, file);
+}
+
+
+ssize_t dynstr_write(int fd, Dynstr *dynstr)
+{
+ return write(fd, dynstr->mem, dynstr->size);
+}
+
+
+/* A helper function for dynstr_read and dynstr_fread. The callback does
+ * the actual reading. */
+static Dynstr *read_helper(size_t (*callback)(FILE *f, int fd, unsigned char *buf,
+ size_t size),
+ FILE *f, int fd, size_t size)
+{
+ Dynstr *dynstr;
+ Dynstr *dynstr2;
+ size_t n;
+
+ dynstr = new_dynstr(NULL, size, true);
+ if (dynstr == NULL)
+ return NULL;
+
+ n = callback(f, fd, dynstr->mem, size);
+ if (n == DYNSTR_ERROR) {
+ dynstr_free(dynstr);
+ return NULL;
+ }
+
+ if (n < size) {
+ dynstr2 = dynstr_substr(dynstr, 0, n);
+ if (dynstr2 == NULL) {
+ dynstr->size = n;
+ } else {
+ dynstr_free(dynstr);
+ dynstr = dynstr2;
+ }
+ }
+
+ return dynstr;
+}
+
+
+static size_t fread_callback(FILE *f, int fd, unsigned char *buf, size_t size)
+{
+ size_t n;
+
+ n = fread(buf, 1, size, f);
+ if (n == 0 && ferror(f))
+ return DYNSTR_ERROR;
+ return n;
+}
+
+
+static size_t read_callback(FILE *f, int fd, unsigned char *buf, size_t size)
+{
+ ssize_t n;
+
+ do {
+ n = read(fd, buf, size);
+ } while (n == -1 && errno == EINTR);
+ if (n == -1)
+ return DYNSTR_ERROR;
+ return n;
+}
+
+
+Dynstr *dynstr_fread(FILE *file, size_t size)
+{
+ return read_helper(fread_callback, file, -1, size);
+}
+
+
+Dynstr *dynstr_read(int file, size_t size)
+{
+ return read_helper(read_callback, NULL, file, size);
+}
+
+
+/* Helper function for dynstr_readline and dynstr_freadline. The callback
+ * does the actual reading. Reading happens one byte at a time, since we
+ * must not read past the newline that terminates a line. */
+static Dynstr *readline_helper(int (*callback)(FILE *, int), FILE *f, int fd)
+{
+ Dynstr *line;
+ Dynstr *temp1;
+ Dynstr *temp2;
+ int c;
+ unsigned char buf[1024];
+ size_t buflen;
+
+ line = dynstr_new_empty();
+ buflen = 0;
+
+ for (;;) {
+ temp1 = NULL;
+ temp2 = NULL;
+
+ c = callback(f, fd);
+ if (c == -1)
+ goto error;
+ else if (c == -2)
+ break;
+
+ buf[buflen++] = c;
+ if (buflen == sizeof(buf)) {
+ temp1 = dynstr_new_from_constant_memory(buf, buflen);
+ if (temp1 == NULL)
+ goto error;
+ temp2 = dynstr_cat(line, temp1);
+ if (temp2 == NULL)
+ goto error;
+ dynstr_free(temp1);
+ dynstr_free(line);
+ line = temp2;
+ buflen = 0;
+ }
+
+ if (c == '\n')
+ break;
+ }
+
+ if (buflen > 0) {
+ temp1 = dynstr_new_from_constant_memory(buf, buflen);
+ if (temp1 == NULL)
+ goto error;
+ temp2 = dynstr_cat(line, temp1);
+ if (temp2 == NULL)
+ goto error;
+ dynstr_free(temp1);
+ dynstr_free(line);
+ line = temp2;
+ }
+
+ return line;
+
+error:
+ dynstr_free(line);
+ dynstr_free(temp1);
+ dynstr_free(temp2);
+ return NULL;
+}
+
+
+static int freadline_callback(FILE *f, int fd)
+{
+ int c;
+
+ c = getc(f);
+ if (c == EOF && ferror(f))
+ return -1;
+ else if (c == EOF)
+ return -2;
+ else
+ return c;
+}
+
+
+Dynstr *dynstr_freadline(FILE *file)
+{
+ return readline_helper(freadline_callback, file, -1);
+}
+
+
+static int readline_callback(FILE *f, int fd)
+{
+ unsigned char c;
+ int n;
+
+ do {
+ n = read(fd, &c, 1);
+ } while (n == -1 && errno == EINTR);
+ if (n == 0)
+ return -2;
+ else if (n == -1)
+ return -1;
+ else
+ return c;
+}
+
+
+Dynstr *dynstr_readline(int file)
+{
+ return readline_helper(readline_callback, NULL, file);
+}
+
diff --git a/lib/dynstr.h b/lib/dynstr.h
new file mode 100644
index 0000000..302902d
--- /dev/null
+++ b/lib/dynstr.h
@@ -0,0 +1,187 @@
+/*
+ * dynstr.h - dynamic C string library
+ *
+ * This is a library for managing dynamic C strings of bytes (not
+ * multibyte characters).
+ *
+ * Each dynamic string is immutable: once created, it cannot be modified.
+ * To achieve changes, create new strings. This allows an implementation
+ * of the API to make use of copy-on-write techniques to save memory,
+ * and avoid unnecessary copying.
+ *
+ * Dynamic allocation can fail. By default, the routines in this library
+ * return NULL for failures. The caller may use the
+ * dynstr_set_malloc_error_handler function to set a function that gets
+ * called before NULL is returned. This function can, for example, abort
+ * the program (see dynstr_malloc_error_abort), or use longjmp to jump
+ * some error handling routine.
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef DYNSTR_H
+#define DYNSTR_H
+
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stddef.h>
+
+
+/* Version number of the shared library. */
+#define DYNSTR_VERSION_MAJOR 0
+#define DYNSTR_VERSION_MINOR 0
+#define DYNSTR_VERSION_PATCH 0
+
+
+/* Magic value returned by functions that search for things within
+ * dynamic strings, to indicate 'not found'. */
+#define DYNSTR_NOT_FOUND (~(size_t)0)
+
+
+/* The abstract type for dynamic strings. The type is opaque: the caller
+ * may only operate on it using the functions declared in this header. */
+typedef struct Dynstr Dynstr;
+
+
+/* Initialize or re-initialize the library. This sets all global variables
+ * used internally to their defaults. This is mainly useful for unit
+ * tests. */
+void dynstr_init(void);
+
+/* Set the memory allocator to use, instead of malloc. This is mainly
+ * useful for unit tests. */
+void dynstr_set_malloc(void *(*allocator)(size_t));
+
+/* Get the memory allocator being used. This is mainly useful for unit
+ * tests. */
+void *(*dynstr_get_malloc(void))(size_t);
+
+/* Type of callback functions for handling malloc failures. */
+typedef void dynstr_error_handler(int error, size_t size, void *oldptr);
+
+/* Get and set malloc error handler. */
+dynstr_error_handler *dynstr_get_malloc_error_handler(void);
+void dynstr_set_malloc_error_handler(dynstr_error_handler *handler);
+
+/* Malloc error handler that aborts the program (using abort, not exit). */
+void dynstr_malloc_error_abort(int error, size_t size, void *oldptr);
+
+/* Malloc error handler that does nothing. This is the default handler.
+ * It causes NULL to be returned. */
+void dynstr_malloc_error_indicate(int error, size_t size, void *oldptr);
+
+
+/* Create a new, empty string. */
+Dynstr *dynstr_new_empty(void);
+
+/* Create a new string, copy contents from a NUL-terminated C string. */
+Dynstr *dynstr_new_from_cstring(const char *cstring);
+
+/* Create a new string, copy contents from an arbitrary memory area. */
+Dynstr *dynstr_new_from_memory(const void *mem, size_t size);
+
+/* Create a new string, use contents from a constant C string. The caller
+ * MUST make sure the contents of the C string do not change while the
+ * dynamic string exists, since the dynamic string will not copy the
+ * contents, but use it directly. */
+Dynstr *dynstr_new_from_constant_cstring(const char *cstring);
+
+/* Create a new string, use contents from an arbitrary memory area. The caller
+ * MUST make sure the contents of the memory area do not change while the
+ * dynamic string exists, since the dynamic string will not copy the
+ * contents, but use it directly. */
+Dynstr *dynstr_new_from_constant_memory(const void *mem, size_t size);
+
+/* Free a dynamic string. */
+void dynstr_free(Dynstr *dynstr);
+
+/* Return length of dynamic string, in bytes. */
+size_t dynstr_len(Dynstr *dynstr);
+
+/* Is the dynamic string empty? In other words, is its length 0? */
+bool dynstr_is_empty(Dynstr *dynstr);
+
+/* Create a new string, copying its contents from an existing one. */
+Dynstr *dynstr_substr(Dynstr *dynstr, size_t offset, size_t size);
+
+/* Create a new string by catenating two existing ones. Return NULL on
+ * failure. */
+Dynstr *dynstr_cat(Dynstr *dynstr1, Dynstr *dynstr2);
+
+/* Create a new string by catenating zero or more existing ones. The
+ * argument list has zero or more pointers to dynamic strings, and
+ * then a NULL pointer. */
+Dynstr *dynstr_cat_many(Dynstr *dynstr, ...);
+
+/* Return value of byte at a given offset. The value is non-negative. If
+ * the offset is past the end of the string, -1 is returned. */
+int dynstr_byte_at(Dynstr *dynstr, size_t offset);
+
+/* Copy contents of a dynamic string into a memory area. If the offset or
+ * size extends past the end of the string, only as much as actually exists
+ * in the string is actually copied. The rest of the output memory area will
+ * be filled with garbage. Return number of bytes actually copied, which may
+ * be less than requested, and may be zero. */
+size_t dynstr_memcpy(void *mem, Dynstr *dynstr, size_t offset, size_t size);
+
+/* Create a dynamically allocated C string copy of the dynamic string.
+ * This is like strdup. If the dynamic string contains NUL bytes, then
+ * that is the caller's problem. Return pointer to the C string. The
+ * caller is responsible for freeing it. Return NULL on error. */
+char *dynstr_strdup(Dynstr *dynstr);
+
+/* Search for first or last byte with a given value in a string,
+ * starting at a given offset and until the end of the string. Return offset
+ * of matching byte, or DYNSTR_NOT_FOUND if not found. Offset is from
+ * beginning of string. */
+size_t dynstr_first_byte(Dynstr *dynstr, size_t offset, int byte);
+size_t dynstr_last_byte(Dynstr *dynstr, size_t offset, int byte);
+
+/* Search for first or last occurrence of a substring in a string,
+ * starting at a given offset and until the end of the string. Return
+ * offset of match, or DYNSTR_NOT_FOUND if not found. Offset is from
+ * beginning of string. */
+size_t dynstr_first_string(Dynstr *dynstr, size_t offset, Dynstr *pattern);
+size_t dynstr_last_string(Dynstr *dynstr, size_t offset, Dynstr *pattern);
+
+/* Compare two strings, return 0 if they are equal, negative if the
+ * first comes before the second, and positive if second comes first.
+ * Comparisons are done byte-by-byte using unsigned values. */
+int dynstr_cmp(Dynstr *dynstr1, Dynstr *dynstr2);
+
+/* Write a dynamic string into an open file (using stdio). Return value is
+ * number of bytes written, just like for fwrite(3).
+ * If an error occurs, the size is less than the length of the string,
+ * and errno has been set by fwrite(3). */
+size_t dynstr_fwrite(FILE *file, Dynstr *dynstr);
+
+/* Write a dynamic string into an open Unix file handle. Return value is
+ * number of bytes written, or -1. */
+ssize_t dynstr_write(int file, Dynstr *dynstr);
+
+/* Read a number of bytes from an open file, either FILE or a Unix file
+ * handle. Return value is the string that was read. The string is empty
+ * to indicate EOF, or NULL for error. */
+Dynstr *dynstr_fread(FILE *file, size_t size);
+Dynstr *dynstr_read(int file, size_t size);
+
+/* Read a line from an open file, either a FILE or a Unix file handle.
+ * The line ends with the first newline byte, or at the end of the file.
+ * If there was an error, NULL is returned, and errno is set, and the
+ * partially read line is discarded. */
+Dynstr *dynstr_freadline(FILE *file);
+Dynstr *dynstr_readline(int file);
+
+#endif