From: Andrea Zagli Date: Sat, 5 Nov 2016 11:22:49 +0000 (+0100) Subject: Moved test add_config_from_confit to tools. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=167e0a5945f7aeb2cd679977142be247c9f0c936;p=zakconfi%2Flibzakconfi Moved test add_config_from_confit to tools. --- diff --git a/.gitignore b/.gitignore index b04bb01..010c263 100644 --- a/.gitignore +++ b/.gitignore @@ -52,8 +52,8 @@ tests/test tests/test_get_configs_list tests/test_get_tree tests/test_add_config -tests/test_add_config_from_confi tests/test_set_config +tools/add_config_from_confi *.csv gtk-doc.m4 *.gir diff --git a/Makefile.am b/Makefile.am index a066227..5365a8b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-introspection -SUBDIRS = src plugins tests data docs +SUBDIRS = src plugins tools tests data docs EXTRA_DIST = libzakconfi.pc.in diff --git a/configure.ac b/configure.ac index 15b4d4d..c57c16a 100644 --- a/configure.ac +++ b/configure.ac @@ -62,6 +62,7 @@ AC_CONFIG_FILES([ plugins/db/Makefile plugins/file/Makefile tests/Makefile + tools/Makefile data/Makefile docs/Makefile docs/reference/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index bf61e14..5820ef6 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,7 +12,6 @@ LDADD = $(top_builddir)/src/libzakconfi.la noinst_PROGRAMS = test \ test_add_config \ - test_add_config_from_confi \ test_get_configs_list \ test_get_tree \ test_set_config diff --git a/tests/test_add_config_from_confi.c b/tests/test_add_config_from_confi.c deleted file mode 100644 index 4b24098..0000000 --- a/tests/test_add_config_from_confi.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2016 Andrea Zagli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -#include -#include - -#include "libzakconfi.h" - -int -main (int argc, char **argv) -{ - PeasEngine *engine; - - ZakConfi *confi; - - if (argc < 5) - { - g_error ("Usage: test_add_config "); - return 0; - } - - engine = peas_engine_get_default (); - peas_engine_add_search_path (engine, PLUGINSDIR, NULL); - - confi = zak_confi_new (argv[1]); - - if (zak_confi_add_config_from_confi (confi, argv[2], argv[3], argv[4]) == NULL) - { - g_warning ("Config %s not created.", argv[2]); - } - - return 0; -} diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..0102808 --- /dev/null +++ b/tools/Makefile.am @@ -0,0 +1,13 @@ +AM_CPPFLAGS = $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(LIBCONFI_CFLAGS) \ + -I$(top_srcdir)/src \ + -DPLUGINSDIR=\""$(libdir)/$(PACKAGE)/plugins"\" + +LIBS = $(LIBCONFI_LIBS) \ + -L../src -lzakconfi \ + -export-dynamic + +LDADD = $(top_builddir)/src/libzakconfi.la + +noinst_PROGRAMS = add_config_from_confi diff --git a/tools/add_config_from_confi.c b/tools/add_config_from_confi.c new file mode 100644 index 0000000..f069d19 --- /dev/null +++ b/tools/add_config_from_confi.c @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2016 Andrea Zagli + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include +#include + +#include "libzakconfi.h" + +int +main (int argc, char **argv) +{ + PeasEngine *engine; + + ZakConfi *confi; + + if (argc < 5) + { + g_error ("Usage: add_config_from_confi "); + return 0; + } + + engine = peas_engine_get_default (); + peas_engine_add_search_path (engine, PLUGINSDIR, NULL); + + confi = zak_confi_new (argv[1]); + + if (zak_confi_add_config_from_confi (confi, argv[2], argv[3], argv[4]) == NULL) + { + g_warning ("Config %s not created.", argv[2]); + } + + return 0; +}