From 429e46051dba814e7d6c74368eb1bba550222cbe Mon Sep 17 00:00:00 2001 From: Jonathan McCrohan Date: Thu, 1 Dec 2011 22:56:23 +0000 Subject: Imported Upstream version 1.4.8 --- samples/c/Makefile.am | 15 -- samples/c/Makefile.in | 478 -------------------------------------------------- samples/c/sample1.c | 63 ------- samples/c/sample2.c | 52 ------ samples/c/sample3.c | 104 ----------- samples/c/stub.c | 84 --------- 6 files changed, 796 deletions(-) delete mode 100644 samples/c/Makefile.am delete mode 100644 samples/c/Makefile.in delete mode 100644 samples/c/sample1.c delete mode 100644 samples/c/sample2.c delete mode 100644 samples/c/sample3.c delete mode 100644 samples/c/stub.c (limited to 'samples/c') diff --git a/samples/c/Makefile.am b/samples/c/Makefile.am deleted file mode 100644 index 8664b48..0000000 --- a/samples/c/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ - -noinst_PROGRAMS = stub sample1 sample2 sample3 - -stub_SOURCES = stub.c - -sample1_SOURCES = sample1.c - -sample2_SOURCES = sample2.c - -sample3_SOURCES = sample3.c - -AM_CPPFLAGS = -I $(top_srcdir) - -LDADD = -L../../.libs -lconfig - diff --git a/samples/c/Makefile.in b/samples/c/Makefile.in deleted file mode 100644 index 1aaf2be..0000000 --- a/samples/c/Makefile.in +++ /dev/null @@ -1,478 +0,0 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 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@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@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 = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -noinst_PROGRAMS = stub$(EXEEXT) sample1$(EXEEXT) sample2$(EXEEXT) \ - sample3$(EXEEXT) -subdir = samples/c -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 = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/ac_config.h -CONFIG_CLEAN_FILES = -PROGRAMS = $(noinst_PROGRAMS) -am_sample1_OBJECTS = sample1.$(OBJEXT) -sample1_OBJECTS = $(am_sample1_OBJECTS) -sample1_LDADD = $(LDADD) -sample1_DEPENDENCIES = -am_sample2_OBJECTS = sample2.$(OBJEXT) -sample2_OBJECTS = $(am_sample2_OBJECTS) -sample2_LDADD = $(LDADD) -sample2_DEPENDENCIES = -am_sample3_OBJECTS = sample3.$(OBJEXT) -sample3_OBJECTS = $(am_sample3_OBJECTS) -sample3_LDADD = $(LDADD) -sample3_DEPENDENCIES = -am_stub_OBJECTS = stub.$(OBJEXT) -stub_OBJECTS = $(am_stub_OBJECTS) -stub_LDADD = $(LDADD) -stub_DEPENDENCIES = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -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 = $(sample1_SOURCES) $(sample2_SOURCES) $(sample3_SOURCES) \ - $(stub_SOURCES) -DIST_SOURCES = $(sample1_SOURCES) $(sample2_SOURCES) \ - $(sample3_SOURCES) $(stub_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -MKDIR_P = @MKDIR_P@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -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@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -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@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -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 = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -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 = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -stub_SOURCES = stub.c -sample1_SOURCES = sample1.c -sample2_SOURCES = sample2.c -sample3_SOURCES = sample3.c -AM_CPPFLAGS = -I $(top_srcdir) -LDADD = -L../../.libs -lconfig -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 \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu samples/c/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu samples/c/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: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -sample1$(EXEEXT): $(sample1_OBJECTS) $(sample1_DEPENDENCIES) - @rm -f sample1$(EXEEXT) - $(LINK) $(sample1_OBJECTS) $(sample1_LDADD) $(LIBS) -sample2$(EXEEXT): $(sample2_OBJECTS) $(sample2_DEPENDENCIES) - @rm -f sample2$(EXEEXT) - $(LINK) $(sample2_OBJECTS) $(sample2_LDADD) $(LIBS) -sample3$(EXEEXT): $(sample3_OBJECTS) $(sample3_DEPENDENCIES) - @rm -f sample3$(EXEEXT) - $(LINK) $(sample3_OBJECTS) $(sample3_LDADD) $(LIBS) -stub$(EXEEXT): $(stub_OBJECTS) $(stub_DEPENDENCIES) - @rm -f stub$(EXEEXT) - $(LINK) $(stub_OBJECTS) $(stub_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample3.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stub.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(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@ mv -f $(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) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -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; nonemtpy = 1; } \ - END { if (nonempty) { 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; nonempty = 1; } \ - END { if (nonempty) { 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=; \ - 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)$$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)'; \ - 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 $(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-libtool 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-dvi: install-dvi-am - -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 - -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: - -.MAKE: install-am install-strip - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstPROGRAMS 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-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 mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-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/samples/c/sample1.c b/samples/c/sample1.c deleted file mode 100644 index a119c10..0000000 --- a/samples/c/sample1.c +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************* - ** Sample1 - ** Load sample.cfg and increment the "X" setting - *************************************************************************/ - -#include -#include - -struct config_t cfg; - -/***************************************************************************/ - -int main(int argc, char **argv) -{ - char *file = "sample.cfg", *var = "x"; - - if(argc >= 2) - file = argv[1]; - - if(argc >= 3) - var = argv[2]; - -/* Initialize the configuration */ - config_init(&cfg); - - /* Load the file */ - printf("loading [%s]...", file); - if(!config_read_file(&cfg, file)) - printf("failed\n"); - else - { - config_setting_t *setting = NULL; - - printf("ok\n"); - - /* Get the variable setting from the configuration.. */ - printf("increment \"%s\"...", var); - setting = config_lookup(&cfg, var); - if(!setting) - printf("failed\n"); - else - { - long x = config_setting_get_int(setting); - x++; - config_setting_set_int(setting, x); - printf("ok (%s=%lu)\n", var, x); - - /* Save the changes */ - printf("saving [%s]...", file); - config_write_file(&cfg, file); - printf("ok\n"); - - printf("Done!\n"); - } - } - - /* Free the configuration */ - config_destroy(&cfg); - - return 0; -} - -/***************************************************************************/ diff --git a/samples/c/sample2.c b/samples/c/sample2.c deleted file mode 100644 index 09c45de..0000000 --- a/samples/c/sample2.c +++ /dev/null @@ -1,52 +0,0 @@ -/************************************************************************* - ** Sample2 - ** Load sample.cfg and access the "values" array - *************************************************************************/ - -#include -#include - -struct config_t cfg; - -/***************************************************************************/ - -int main() -{ - /* Initialize the configuration */ - config_init(&cfg); - - /* Load the file */ - printf("loading [sample.cfg].."); - if (!config_read_file(&cfg, "sample.cfg")) - printf("failed\n"); - else - { - config_setting_t *array = NULL; - - printf("ok\n"); - - /* Display the "values" array */ - printf("display \"values\".."); - array = config_lookup(&cfg, "values"); - if (!array) - printf("failed\n"); - else - { - long value1,value2; - value1 = config_setting_get_int_elem(array, 0); - value2 = config_setting_get_int_elem(array, 1); - printf("[%lu %lu]..ok\n", value1, value2); - - printf("Done!\n"); - } - - } - - /* Free the configuration */ - config_destroy(&cfg); - - return 0; -} - - -/***************************************************************************/ diff --git a/samples/c/sample3.c b/samples/c/sample3.c deleted file mode 100644 index 22f5f36..0000000 --- a/samples/c/sample3.c +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - ** Sample3 - ** Load sample.cfg and try to add a setting "foo".. - ** on success save to testfoo.cfg - *************************************************************************/ - -#include -#include - -/***************************************************************************/ - -/* - */ - -int print_path(config_setting_t *setting) -{ - if(setting) - { - const char *name = config_setting_name(setting); - - if(print_path(config_setting_parent(setting))) - putchar('.'); - - if(! config_setting_is_root(setting)) - { - if(! name) - printf("[%d]", config_setting_index(setting)); - else - printf(name); - - return(1); - } - } - - return(0); -} - -/* - */ - -int main() -{ - struct config_t cfg; - config_setting_t *setting = NULL; - int i; - - do - { - /* Initialize the configuration */ - config_init(&cfg); - - /* Load the file */ - printf("loading [sample.cfg]..."); - if (!config_read_file(&cfg, "sample.cfg")) - { - puts("failed"); - break; - } - - puts("ok"); - - /* Add setting "foo" */ - printf("add setting \"foo\"..."); - setting = config_setting_add(cfg.root, "foo", CONFIG_TYPE_INT); - if (!setting) - { - puts("failed"); - break; - } - - config_setting_set_int(setting, 1234); - puts("ok"); - - /** Look up an array element */ - printf("looking up array element..."); - setting = config_lookup(&cfg, "arrays.values.[0]"); - if(! setting) - { - puts("failed"); - break; - } - - printf("value is: %d\n", config_setting_get_int(setting)); - printf("path is: "); - print_path(setting); - putchar('\n'); - - /* Save to "samplefoo.cfg" */ - printf("saving [samplefoo.cfg]..."); - config_write_file(&cfg, "samplefoo.cfg"); - puts("ok"); - - puts("Done!"); - } - while(0); - - /* Free the configuration */ - config_destroy(&cfg); - - return 0; -} - - -/***************************************************************************/ diff --git a/samples/c/stub.c b/samples/c/stub.c deleted file mode 100644 index a4608b7..0000000 --- a/samples/c/stub.c +++ /dev/null @@ -1,84 +0,0 @@ -#ifdef _MSC_VER -#pragma warning (disable: 4996) -#endif - -#include -#include -#include "libconfig.h" - -int main(int argc, char **argv) -{ - config_t cfg; - FILE *fp; - int i, x; - const char *s; - const config_setting_t *array; - config_setting_t *old; - - fp = fopen("test.cfg", "rb"); - - if(! fp) - { - printf("Unable to open test.cfg\n"); - exit(1); - } - - config_init(&cfg); - x = config_read(&cfg, fp); - - fclose(fp); - - if(! x) - { - printf("error on line %d: %s\n", cfg.error_line, cfg.error_text); - exit(1); - } - - if(! config_lookup_string(&cfg, "application.group1.group2.zzz", &s)) - puts("NOT FOUND"); - else - printf("found: %s\n", s); - - array = config_lookup(&cfg, "application.group1.my_array"); - if(array) - { - for(i = 0; i < config_setting_length(array); i++) - { - long val = config_setting_get_int_elem(array, i); - printf("value [%i]: %ld\n", i, val); - } - } - - { - config_setting_t *root = config_root_setting(&cfg); - - config_setting_t *new = config_setting_add(root, "foobar", - CONFIG_TYPE_LIST); - - config_setting_t *newgrp, *newval; - - - if(! config_setting_set_float_elem(new, -1, 3.141592654)) - puts("FAILED"); - - if(! config_setting_set_string_elem(new, -1, "Hello, world!")) - puts("FAILED"); - - newgrp = config_setting_add(new, NULL, CONFIG_TYPE_GROUP); - - newval = config_setting_add(newgrp, "baz", CONFIG_TYPE_INT); - - old = config_lookup(&cfg, "application.group1"); - - printf("old is: %p\n", old); - config_setting_remove(old, "group2"); - } - - config_write(&cfg, stdout); - - - config_destroy(&cfg); - - - return(0); -} -- cgit v1.2.3