Browse Source

Rename all configure subsystem API. The confd daemon is konfd now.

git-svn-id: https://klish.googlecode.com/svn/trunk@118 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 14 years ago
parent
commit
9de478a99d

+ 2 - 2
Makefile.am

@@ -24,7 +24,7 @@ EXTRA_DIST              =  \
     tinyxml/module.am      \
     test/module.am         \
     xml-examples/module.am \
-    cliconf/module.am      \
+    konf/module.am         \
     doxygen.config         \
     clish.xsd              \
     LICENCE                \
@@ -42,4 +42,4 @@ include $(top_srcdir)/tinyrl/module.am
 include $(top_srcdir)/tinyxml/module.am
 include $(top_srcdir)/test/module.am
 include $(top_srcdir)/xml-examples/module.am
-include $(top_srcdir)/cliconf/module.am
+include $(top_srcdir)/konf/module.am

File diff suppressed because it is too large
+ 36 - 39
Makefile.in


+ 16 - 17
aclocal.m4

@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
@@ -13,8 +13,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
-[m4_warning([this file was generated for autoconf 2.65.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
+[m4_warning([this file was generated for autoconf 2.64.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -2460,7 +2460,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -3099,7 +3099,7 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -3720,7 +3720,7 @@ m4_if([$1], [CXX], [
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -4004,7 +4004,7 @@ m4_if([$1], [CXX], [
       _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -4300,7 +4300,6 @@ dnl Note also adjust exclude_expsyms for C++ above.
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -4392,7 +4391,7 @@ _LT_EOF
       _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -5872,7 +5871,7 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -7879,15 +7878,15 @@ m4_define([lt_dict_filter],
 
 # Generated from ltversion.in.
 
-# serial 3017 ltversion.m4
+# serial 3012 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.2.6b])
-m4_define([LT_PACKAGE_REVISION], [1.3017])
+m4_define([LT_PACKAGE_VERSION], [2.2.6])
+m4_define([LT_PACKAGE_REVISION], [1.3012])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6b'
-macro_revision='1.3017'
+[macro_version='2.2.6'
+macro_revision='1.3012'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
@@ -8000,7 +7999,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.1], [],
+m4_if([$1], [1.11], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -8016,7 +8015,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
+[AM_AUTOMAKE_VERSION([1.11])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])

+ 4 - 4
aux_scripts/ltmain.sh

@@ -1,6 +1,6 @@
 # Generated from ltmain.m4sh.
 
-# ltmain.sh (GNU libtool) 2.2.6b
+# ltmain.sh (GNU libtool) 2.2.6
 # Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
 #       compiler:		$LTCC
 #       compiler flags:		$LTCFLAGS
 #       linker:		$LD (gnu? $with_gnu_ld)
-#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
+#       $progname:		(GNU libtool) 2.2.6 Debian-2.2.6a-4
 #       automake:		$automake_version
 #       autoconf:		$autoconf_version
 #
@@ -73,9 +73,9 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
+VERSION="2.2.6 Debian-2.2.6a-4"
 TIMESTAMP=""
-package_revision=1.3017
+package_revision=1.3012
 
 # Be Bourne compatible
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then

+ 58 - 58
bin/confd.c → bin/konfd.c

@@ -19,14 +19,14 @@
 #include <signal.h>
 
 #include "clish/private.h"
-#include "cliconf/conf.h"
-#include "cliconf/query.h"
-#include "cliconf/buf.h"
+#include "konf/tree.h"
+#include "konf/query.h"
+#include "konf/buf.h"
 #include "lub/argv.h"
 #include "lub/string.h"
 
-#define CONFD_SOCKET_PATH "/tmp/confd.socket"
-#define CONFD_CONFIG_PATH "/tmp/running-config"
+#define KONFD_SOCKET_PATH "/tmp/konfd.socket"
+#define KONFD_CONFIG_PATH "/tmp/running-config"
 
 #ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX 108
@@ -37,9 +37,9 @@
 static volatile int sigterm = 0;
 static void sighandler(int signo);
 
-static char * process_query(int sock, cliconf_t * conf, char *str);
+static char * process_query(int sock, konf_tree_t * conf, char *str);
 int answer_send(int sock, char *command);
-static int dump_running_config(int sock, cliconf_t *conf, query_t *query);
+static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query);
 
 /*--------------------------------------------------------- */
 int main(int argc, char **argv)
@@ -47,9 +47,9 @@ int main(int argc, char **argv)
 	int retval = 0;
 	unsigned i;
 	char *str;
-	cliconf_t *conf;
+	konf_tree_t *conf;
 	lub_bintree_t bufs;
-	conf_buf_t *tbuf;
+	konf_buf_t *tbuf;
 
 	/* Network vars */
 	int sock;
@@ -75,12 +75,12 @@ int main(int argc, char **argv)
 	sigaction(SIGQUIT, &sig_act, NULL);
 
 	/* Configuration tree */
-	conf = cliconf_new("", 0);
+	conf = konf_tree_new("", 0);
 
 	/* Initialize the tree of buffers */
 	lub_bintree_init(&bufs,
-		conf_buf_bt_offset(),
-		conf_buf_bt_compare, conf_buf_bt_getkey);
+		konf_buf_bt_offset(),
+		konf_buf_bt_compare, konf_buf_bt_getkey);
 
 	/* Create listen socket */
 	if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
@@ -89,9 +89,9 @@ int main(int argc, char **argv)
 */		return -1;
 	}
 
-	unlink(CONFD_SOCKET_PATH);
+	unlink(KONFD_SOCKET_PATH);
 	laddr.sun_family = AF_UNIX;
-	strncpy(laddr.sun_path, CONFD_SOCKET_PATH, UNIX_PATH_MAX);
+	strncpy(laddr.sun_path, KONFD_SOCKET_PATH, UNIX_PATH_MAX);
 	laddr.sun_path[UNIX_PATH_MAX - 1] = '\0';
 	if (bind(sock, (struct sockaddr *)&laddr, sizeof(laddr))) {
 		fprintf(stderr, "Can't bind()\n");
@@ -142,21 +142,21 @@ int main(int argc, char **argv)
 						continue;
 					}
 					fprintf(stderr, "Server: connect %u\n", new);
-					conf_buftree_remove(&bufs, new);
-					tbuf = conf_buf_new(new);
+					konf_buftree_remove(&bufs, new);
+					tbuf = konf_buf_new(new);
 					/* insert it into the binary tree for this conf */
 					lub_bintree_insert(&bufs, tbuf);
 					FD_SET(new, &active_fd_set);
 				} else {
 					int nbytes;
 					/* Data arriving on an already-connected socket. */
-					if ((nbytes = conf_buftree_read(&bufs, i)) <= 0) {
+					if ((nbytes = konf_buftree_read(&bufs, i)) <= 0) {
 						close(i);
 						FD_CLR(i, &active_fd_set);
-						conf_buftree_remove(&bufs, i);
+						konf_buftree_remove(&bufs, i);
 						continue;
 					}
-					while ((str = conf_buftree_parse(&bufs, i))) {
+					while ((str = konf_buftree_parse(&bufs, i))) {
 						char *answer;
 						if (!(answer = process_query(i, conf, str)))
 							answer = lub_string_dup("-e");
@@ -170,47 +170,47 @@ int main(int argc, char **argv)
 	}
 
 	/* Free resources */
-	cliconf_delete(conf);
+	konf_tree_delete(conf);
 
 	/* delete each buf */
 	while ((tbuf = lub_bintree_findfirst(&bufs))) {
 		/* remove the buf from the tree */
 		lub_bintree_remove(&bufs, tbuf);
 		/* release the instance */
-		conf_buf_delete(tbuf);
+		konf_buf_delete(tbuf);
 	}
 
 	return retval;
 }
 
-static char * process_query(int sock, cliconf_t * conf, char *str)
+static char * process_query(int sock, konf_tree_t * conf, char *str)
 {
 	unsigned i;
 	int res;
-	cliconf_t *iconf;
-	cliconf_t *tmpconf;
-	query_t *query;
+	konf_tree_t *iconf;
+	konf_tree_t *tmpconf;
+	konf_query_t *query;
 	char *retval = NULL;
-	query_op_t ret;
+	konf_query_op_t ret;
 
 	/* Parse query */
-	query = query_new();
-	res = query_parse_str(query, str);
+	query = konf_query_new();
+	res = konf_query_parse_str(query, str);
 	if (res < 0) {
-		query_free(query);
+		konf_query_free(query);
 		return NULL;
 	}
 	printf("----------------------\n");
 	printf("REQUEST: %s\n", str);
-/*	query_dump(query);
+/*	konf_query_dump(query);
 */
 
 	/* Go through the pwd */
 	iconf = conf;
-	for (i = 0; i < query__get_pwdc(query); i++) {
+	for (i = 0; i < konf_query__get_pwdc(query); i++) {
 		if (!
 		    (iconf =
-		     cliconf_find_conf(iconf, query__get_pwd(query, i), 0))) {
+		     konf_tree_find_conf(iconf, konf_query__get_pwd(query, i), 0))) {
 			iconf = NULL;
 			break;
 		}
@@ -218,58 +218,58 @@ static char * process_query(int sock, cliconf_t * conf, char *str)
 
 	if (!iconf) {
 		printf("Unknown path\n");
-		query_free(query);
+		konf_query_free(query);
 		return NULL;
 	}
 
-	switch (query__get_op(query)) {
+	switch (konf_query__get_op(query)) {
 
-	case QUERY_OP_SET:
-		if (cliconf_find_conf(iconf, query__get_line(query), 0)) {
-			ret = QUERY_OP_OK;
+	case konf_query_OP_SET:
+		if (konf_tree_find_conf(iconf, konf_query__get_line(query), 0)) {
+			ret = konf_query_OP_OK;
 			break;
 		}
-		cliconf_del_pattern(iconf, query__get_pattern(query));
-		tmpconf = cliconf_new_conf(iconf, 
-			query__get_line(query), query__get_priority(query));
+		konf_tree_del_pattern(iconf, konf_query__get_pattern(query));
+		tmpconf = konf_tree_new_conf(iconf, 
+			konf_query__get_line(query), konf_query__get_priority(query));
 		if (!tmpconf) {
-			ret = QUERY_OP_ERROR;
+			ret = konf_query_OP_ERROR;
 			break;
 		}
-		cliconf__set_splitter(tmpconf, query__get_splitter(query));
-		ret = QUERY_OP_OK;
+		konf_tree__set_splitter(tmpconf, konf_query__get_splitter(query));
+		ret = konf_query_OP_OK;
 		break;
 
-	case QUERY_OP_UNSET:
-		cliconf_del_pattern(iconf, query__get_pattern(query));
-		ret = QUERY_OP_OK;
+	case konf_query_OP_UNSET:
+		konf_tree_del_pattern(iconf, konf_query__get_pattern(query));
+		ret = konf_query_OP_OK;
 		break;
 
-	case QUERY_OP_DUMP:
+	case konf_query_OP_DUMP:
 		if (dump_running_config(sock, iconf, query))
-			ret = QUERY_OP_ERROR;
+			ret = konf_query_OP_ERROR;
 		else
-			ret = QUERY_OP_OK;
+			ret = konf_query_OP_OK;
 		break;
 
 	default:
-		ret = QUERY_OP_ERROR;
+		ret = konf_query_OP_ERROR;
 		break;
 	}
 
 #ifdef DEBUG
 	/* Print whole tree */
-	cliconf_fprintf(conf, stdout, NULL, -1, 0);
+	konf_tree_fprintf(conf, stdout, NULL, -1, 0);
 #endif
 
 	/* Free resources */
-	query_free(query);
+	konf_query_free(query);
 
 	switch (ret) {
-	case QUERY_OP_OK:
+	case konf_query_OP_OK:
 		lub_string_cat(&retval, "-o");
 		break;
-	case QUERY_OP_ERROR:
+	case konf_query_OP_ERROR:
 		lub_string_cat(&retval, "-e");
 		break;
 	default:
@@ -293,13 +293,13 @@ int answer_send(int sock, char *command)
 	return send(sock, command, strlen(command) + 1, MSG_NOSIGNAL);
 }
 
-static int dump_running_config(int sock, cliconf_t *conf, query_t *query)
+static int dump_running_config(int sock, konf_tree_t *conf, konf_query_t *query)
 {
 	FILE *fd;
 	char *filename;
 	int dupsock = -1;
 
-	if ((filename = query__get_path(query))) {
+	if ((filename = konf_query__get_path(query))) {
 		if (!(fd = fopen(filename, "w")))
 			return -1;
 	} else {
@@ -313,8 +313,8 @@ static int dump_running_config(int sock, cliconf_t *conf, query_t *query)
 		printf("ANSWER: -t\n");
 #endif
 	}
-	cliconf_fprintf(conf, fd, query__get_pattern(query),
-		query__get_pwdc(query) - 1, 0);
+	konf_tree_fprintf(conf, fd, konf_query__get_pattern(query),
+		konf_query__get_pwdc(query) - 1, 0);
 	if (!filename) {
 		fprintf(fd, "\n");
 #ifdef DEBUG

+ 6 - 6
bin/module.am

@@ -1,10 +1,10 @@
 ## Process this file with automake to produce Makefile.in
-bin_PROGRAMS += bin/clish bin/confd
+bin_PROGRAMS += bin/clish bin/konfd
 
 bin_clish_SOURCES = bin/clish.cpp	
 bin_clish_LDADD  = \
     libclish.la    \
-    @CLICONF_LIBS@ \
+    @KONF_LIBS@ \
     @TINYRL_LIBS@  \
     @TINYXML_LIBS@ \
     @LUBHEAP_LIBS@ \
@@ -12,9 +12,9 @@ bin_clish_LDADD  = \
     @PTHREAD_LIBS@ \
     @BFD_LIBS@
 
-bin_confd_SOURCES = bin/confd.c
-bin_confd_LDADD  = \
-    @CLICONF_LIBS@ \
+bin_konfd_SOURCES = bin/konfd.c
+bin_konfd_LDADD  = \
+    @KONF_LIBS@ \
     @LUB_LIBS@
 
 bin_PROGRAMS += bin/tclish@TCL_VERSION@
@@ -22,7 +22,7 @@ bin_PROGRAMS += bin/tclish@TCL_VERSION@
 bin_tclish@TCL_VERSION@_SOURCES = bin/tclish.cpp
 bin_tclish@TCL_VERSION@_LDADD   = \
     libclish.la                   \
-    @CLICONF_LIBS@ \
+    @KONF_LIBS@ \
     @TINYRL_LIBS@                 \
     @TINYXML_LIBS@                \
     @TCL_LIBS@                    \

+ 0 - 52
cliconf/buf.h

@@ -1,52 +0,0 @@
-/*
- * buf.h
- */
- /**
-\ingroup clish
-\defgroup clish_conf config
-@{
-
-\brief This class is a config in memory container.
-
-Use it to implement config in memory.
-
-*/
-#ifndef _cliconf_buf_h
-#define _cliconf_buf_h
-
-#include <stdio.h>
-
-#include "lub/bintree.h"
-
-typedef struct conf_buf_s conf_buf_t;
-
-/*=====================================
- * CONF INTERFACE
- *===================================== */
-/*-----------------
- * meta functions
- *----------------- */
-conf_buf_t *conf_buf_new(int sock);
-int conf_buf_bt_compare(const void *clientnode, const void *clientkey);
-void conf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
-size_t conf_buf_bt_offset(void);
-/*-----------------
- * methods
- *----------------- */
-void conf_buf_delete(conf_buf_t *instance);
-int conf_buf_read(conf_buf_t *instance);
-int conf_buf_add(conf_buf_t *instance, void *str, size_t len);
-char * conf_buf_string(char *instance, int len);
-char * conf_buf_parse(conf_buf_t *instance);
-char * conf_buf_preparse(conf_buf_t *instance);
-int conf_buf_lseek(conf_buf_t *instance, int newpos);
-int conf_buf__get_sock(const conf_buf_t *instance);
-int conf_buf__get_len(const conf_buf_t *instance);
-
-int conf_buftree_read(lub_bintree_t *instance, int sock);
-char * conf_buftree_parse(lub_bintree_t *instance, int sock);
-void conf_buftree_remove(lub_bintree_t *instance, int sock);
-
-
-#endif				/* _cliconf_h */
-/** @} clish_conf */

+ 0 - 2
cliconf/buf/module.am

@@ -1,2 +0,0 @@
-libcliconf_la_SOURCES +=	cliconf/buf/buf.c	\
-				cliconf/buf/private.h

+ 0 - 60
cliconf/conf.h

@@ -1,60 +0,0 @@
-/*
- * conf.h
- */
- /**
-\ingroup clish
-\defgroup clish_conf config
-@{
-
-\brief This class is a config in memory container.
-
-Use it to implement config in memory.
-
-*/
-#ifndef _cliconf_h
-#define _cliconf_h
-
-#include <stdio.h>
-
-#include "lub/types.h"
-#include "lub/bintree.h"
-
-typedef struct cliconf_s cliconf_t;
-
-/*=====================================
- * CONF INTERFACE
- *===================================== */
-/*-----------------
- * meta functions
- *----------------- */
-cliconf_t *cliconf_new(const char * line, unsigned short priority);
-int cliconf_bt_compare(const void *clientnode, const void *clientkey);
-void cliconf_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
-size_t cliconf_bt_offset(void);
-
-/*-----------------
- * methods
- *----------------- */
-void cliconf_delete(cliconf_t * instance);
-void cliconf_fprintf(cliconf_t * instance, FILE * stream,
-		const char *pattern,
-		int depth, unsigned char prev_pri_hi);
-cliconf_t *cliconf_new_conf(cliconf_t * instance,
-				const char *line, unsigned short priority);
-cliconf_t *cliconf_find_conf(cliconf_t * instance,
-				const char *line, unsigned short priority);
-void cliconf_del_pattern(cliconf_t *this,
-				const char *pattern);
-
-/*-----------------
- * attributes 
- *----------------- */
-unsigned cliconf__get_depth(const cliconf_t * instance);
-unsigned short cliconf__get_priority(const cliconf_t * instance);
-unsigned char cliconf__get_priority_hi(const cliconf_t * instance);
-unsigned char cliconf__get_priority_lo(const cliconf_t * instance);
-bool_t cliconf__get_splitter(const cliconf_t * instance);
-void cliconf__set_splitter(cliconf_t *instance, bool_t splitter);
-
-#endif				/* _cliconf_h */
-/** @} clish_conf */

+ 0 - 3
cliconf/conf/module.am

@@ -1,3 +0,0 @@
-libcliconf_la_SOURCES +=	cliconf/conf/conf.c	\
-				cliconf/conf/conf_dump.c	\
-				cliconf/conf/private.h

+ 0 - 21
cliconf/module.am

@@ -1,21 +0,0 @@
-## Process this file with automake to generate Makefile.in
-lib_LTLIBRARIES         += libcliconf.la
-libcliconf_la_SOURCES        =
-libcliconf_la_LIBADD         =
-
-nobase_include_HEADERS  +=  \
-    cliconf/conf.h          \
-    cliconf/query.h         \
-    cliconf/buf.h           \
-    cliconf/net.h
-
-EXTRA_DIST             +=   \
-    cliconf/conf/module.am  \
-    cliconf/query/module.am \
-    cliconf/buf/module.am   \
-    cliconf/net/module.am
-
-include $(top_srcdir)/cliconf/conf/module.am
-include $(top_srcdir)/cliconf/query/module.am
-include $(top_srcdir)/cliconf/buf/module.am
-include $(top_srcdir)/cliconf/net/module.am

+ 0 - 16
cliconf/net.h

@@ -1,16 +0,0 @@
-#ifndef _net_h
-#define _net_h
-
-typedef struct conf_client_s conf_client_t;
-
-#define CONFD_SOCKET_PATH "/tmp/confd.socket"
-
-conf_client_t *conf_client_new(char *path);
-void conf_client_free(conf_client_t *client);
-int conf_client_connect(conf_client_t *client);
-void conf_client_disconnect(conf_client_t *client);
-int conf_client_reconnect(conf_client_t *client);
-int conf_client_send(conf_client_t *client, char *command);
-int conf_client__get_sock(conf_client_t *client);
-
-#endif

+ 0 - 2
cliconf/net/module.am

@@ -1,2 +0,0 @@
-libcliconf_la_SOURCES +=	cliconf/net/net.c	\
-				cliconf/net/private.h

+ 0 - 11
cliconf/net/private.h

@@ -1,11 +0,0 @@
-#ifndef net_private_h
-#define net_private_h
-
-#include "cliconf/net.h"
-
-struct conf_client_s {
-	int sock;
-	char *path;
-};
-
-#endif

+ 0 - 32
cliconf/query.h

@@ -1,32 +0,0 @@
-#ifndef _query_h
-#define _query_h
-
-
-typedef enum
-{
-  QUERY_OP_NONE,
-  QUERY_OP_OK,
-  QUERY_OP_ERROR,
-  QUERY_OP_SET,
-  QUERY_OP_UNSET,
-  QUERY_OP_STREAM,
-  QUERY_OP_DUMP
-} query_op_t;
-
-typedef struct query_s query_t;
-
-int query_parse(query_t *query, int argc, char **argv);
-int query_parse_str(query_t *query, char *str);
-query_t *query_new(void);
-void query_free(query_t *query);
-char *query__get_pwd(query_t *query, unsigned index);
-int query__get_pwdc(query_t *query);
-void query_dump(query_t *query);
-query_op_t query__get_op(query_t *query);
-char * query__get_path(query_t *query);
-const char * query__get_pattern(query_t *instance);
-const char * query__get_line(query_t *instance);
-unsigned short query__get_priority(query_t *instance);
-bool_t query__get_splitter(query_t *instance);
-
-#endif

+ 0 - 2
cliconf/query/module.am

@@ -1,2 +0,0 @@
-libcliconf_la_SOURCES +=	cliconf/query/query.c	\
-				cliconf/query/private.h

+ 45 - 45
clish/clish_config_callback.c

@@ -13,15 +13,15 @@
 #include <sys/un.h>
 
 #include "private.h"
-#include "cliconf/net.h"
-#include "cliconf/buf.h"
-#include "cliconf/query.h"
+#include "konf/net.h"
+#include "konf/buf.h"
+#include "konf/query.h"
 #include "clish/variable.h"
 
-static int send_request(conf_client_t * client, char *command);
-static int receive_answer(conf_client_t * client, conf_buf_t **data);
-static int process_answer(conf_client_t * client, char *str, conf_buf_t *buf, conf_buf_t **data);
-static int receive_data(conf_client_t * client, conf_buf_t *buf, conf_buf_t **data);
+static int send_request(konf_client_t * client, char *command);
+static int receive_answer(konf_client_t * client, konf_buf_t **data);
+static int process_answer(konf_client_t * client, char *str, konf_buf_t *buf, konf_buf_t **data);
+static int receive_data(konf_client_t * client, konf_buf_t *buf, konf_buf_t **data);
 
 /*--------------------------------------------------------- */
 bool_t
@@ -31,8 +31,8 @@ clish_config_callback(const clish_shell_t * shell,
 	unsigned i;
 	char *line;
 	char *command = NULL;
-	conf_client_t *client;
-	conf_buf_t *buf = NULL;
+	konf_client_t *client;
+	konf_buf_t *buf = NULL;
 
 	switch (clish_command__get_cfg_op(cmd)) {
 
@@ -177,8 +177,8 @@ clish_config_callback(const clish_shell_t * shell,
 			}
 			if (buf) {
 				char *str;
-				conf_buf_lseek(buf, 0);
-				while ((str = conf_buf_preparse(buf))) {
+				konf_buf_lseek(buf, 0);
+				while ((str = konf_buf_preparse(buf))) {
 					if (strlen(str) == 0) {
 						lub_string_free(str);
 						break;
@@ -186,7 +186,7 @@ clish_config_callback(const clish_shell_t * shell,
 					printf("%s\n", str);
 					lub_string_free(str);
 				}
-				conf_buf_delete(buf);
+				konf_buf_delete(buf);
 			}
 			break;
 		}
@@ -200,36 +200,36 @@ clish_config_callback(const clish_shell_t * shell,
 
 /*--------------------------------------------------------- */
 
-static int send_request(conf_client_t * client, char *command)
+static int send_request(konf_client_t * client, char *command)
 {
-	if ((conf_client_connect(client) < 0))
+	if ((konf_client_connect(client) < 0))
 		return -1;
 
-	if (conf_client_send(client, command) < 0) {
-		if (conf_client_reconnect(client) < 0)
+	if (konf_client_send(client, command) < 0) {
+		if (konf_client_reconnect(client) < 0)
 			return -1;
-		if (conf_client_send(client, command) < 0)
+		if (konf_client_send(client, command) < 0)
 			return -1;
 	}
 
 	return 0;
 }
 
-static int receive_answer(conf_client_t * client, conf_buf_t **data)
+static int receive_answer(konf_client_t * client, konf_buf_t **data)
 {
-	conf_buf_t *buf;
+	konf_buf_t *buf;
 	int nbytes;
 	char *str;
 	int retval = 0;
 	int processed = 0;
 
-	if ((conf_client_connect(client) < 0))
+	if ((konf_client_connect(client) < 0))
 		return -1;
 
-	buf = conf_buf_new(conf_client__get_sock(client));
-	while ((!processed) && (nbytes = conf_buf_read(buf)) > 0) {
-		while ((str = conf_buf_parse(buf))) {
-			conf_buf_t *tmpdata = NULL;
+	buf = konf_buf_new(konf_client__get_sock(client));
+	while ((!processed) && (nbytes = konf_buf_read(buf)) > 0) {
+		while ((str = konf_buf_parse(buf))) {
+			konf_buf_t *tmpdata = NULL;
 			retval = process_answer(client, str, buf, &tmpdata);
 			lub_string_free(str);
 			if (retval < 0)
@@ -238,33 +238,33 @@ static int receive_answer(conf_client_t * client, conf_buf_t **data)
 				processed = 1;
 			if (tmpdata) {
 				if (*data)
-					conf_buf_delete(*data);
+					konf_buf_delete(*data);
 				*data = tmpdata;
 			}
 		}
 	}
-	conf_buf_delete(buf);
+	konf_buf_delete(buf);
 
 	return retval;
 }
 
-static int receive_data(conf_client_t * client, conf_buf_t *buf, conf_buf_t **data)
+static int receive_data(konf_client_t * client, konf_buf_t *buf, konf_buf_t **data)
 {
-	conf_buf_t *tmpdata;
+	konf_buf_t *tmpdata;
 	char *str;
 	int retval = 0;
 	int processed = 0;
 
-	if ((conf_client_connect(client) < 0))
+	if ((konf_client_connect(client) < 0))
 		return -1;
 
-	tmpdata = conf_buf_new(conf_client__get_sock(client));
+	tmpdata = konf_buf_new(konf_client__get_sock(client));
 	do {
-		while ((str = conf_buf_parse(buf))) {
+		while ((str = konf_buf_parse(buf))) {
 #ifdef DEBUG
 			printf("RECV DATA: [%s]\n", str);
 #endif
-			conf_buf_add(tmpdata, str, strlen(str) + 1);
+			konf_buf_add(tmpdata, str, strlen(str) + 1);
 			if (strlen(str) == 0) {
 				processed = 1;
 				lub_string_free(str);
@@ -272,9 +272,9 @@ static int receive_data(conf_client_t * client, conf_buf_t *buf, conf_buf_t **da
 			}
 			lub_string_free(str);
 		}
-	} while ((!processed) && (conf_buf_read(buf)) > 0);
+	} while ((!processed) && (konf_buf_read(buf)) > 0);
 	if (!processed) {
-		conf_buf_delete(tmpdata);
+		konf_buf_delete(tmpdata);
 		*data = NULL;
 		return -1;
 	}
@@ -284,16 +284,16 @@ static int receive_data(conf_client_t * client, conf_buf_t *buf, conf_buf_t **da
 	return 0;
 }
 
-static int process_answer(conf_client_t * client, char *str, conf_buf_t *buf, conf_buf_t **data)
+static int process_answer(konf_client_t * client, char *str, konf_buf_t *buf, konf_buf_t **data)
 {
 	int res;
-	query_t *query;
+	konf_query_t *query;
 
 	/* Parse query */
-	query = query_new();
-	res = query_parse_str(query, str);
+	query = konf_query_new();
+	res = konf_query_parse_str(query, str);
 	if (res < 0) {
-		query_free(query);
+		konf_query_free(query);
 #ifdef DEBUG
 		printf("CONFIG error: Cannot parse answer string.\n");
 #endif
@@ -302,20 +302,20 @@ static int process_answer(conf_client_t * client, char *str, conf_buf_t *buf, co
 
 #ifdef DEBUG
 	printf("CONFIG answer: %s\n", str);
-	// query_dump(query);
+	// konf_query_dump(query);
 #endif
 
-	switch (query__get_op(query)) {
+	switch (konf_query__get_op(query)) {
 
-	case QUERY_OP_OK:
+	case konf_query_OP_OK:
 		res = 0;
 		break;
 
-	case QUERY_OP_ERROR:
+	case konf_query_OP_ERROR:
 		res = -1;
 		break;
 
-	case QUERY_OP_STREAM:
+	case konf_query_OP_STREAM:
 		if (receive_data(client, buf, data) < 0)
 			res = -1;
 		else
@@ -328,7 +328,7 @@ static int process_answer(conf_client_t * client, char *str, conf_buf_t *buf, co
 	}
 
 	/* Free resources */
-	query_free(query);
+	konf_query_free(query);
 
 	return res;
 }

+ 2 - 2
clish/shell.h

@@ -22,7 +22,7 @@
 #include "tinyrl/tinyrl.h"
 
 #include "view.h"
-#include "cliconf/net.h"
+#include "konf/net.h"
 
 _BEGIN_C_DECL typedef struct clish_shell_s clish_shell_t;
 
@@ -321,7 +321,7 @@ clish_shell__set_pwd(clish_shell_t * instance, unsigned index,
 const char *clish_shell__get_pwd(const clish_shell_t * instance,
 				 unsigned index);
 char *clish_shell__get_line(const clish_command_t * cmd, clish_pargv_t * pargv);
-conf_client_t *clish_shell__get_client(const clish_shell_t * instance);
+konf_client_t *clish_shell__get_client(const clish_shell_t * instance);
 
 /* Context */
 typedef struct clish_context_s clish_context_t;

+ 1 - 1
clish/shell/private.h

@@ -66,7 +66,7 @@ struct clish_shell_s {
 	clish_shell_file_t *current_file;	/* file currently in use for input */
 	char **cfg_pwdv;	/* Levels for the config file structure */
 	unsigned cfg_pwdc;
-	conf_client_t *client;
+	konf_client_t *client;
 	clish_pargv_t *completion_pargv;
 	unsigned completion_index;
 	unsigned completion_pindex;

+ 1 - 1
clish/shell/shell_delete.c

@@ -52,7 +52,7 @@ static void clish_shell_fini(clish_shell_t * this)
 	free(this->cfg_pwdv);
 	this->cfg_pwdc = 0;
 	this->cfg_pwdv = NULL;
-	conf_client_free(this->client);
+	konf_client_free(this->client);
 	if (this->completion_pargv) {
 		clish_pargv_delete(this->completion_pargv);
 		this->completion_pargv = NULL;

+ 1 - 1
clish/shell/shell_new.c

@@ -37,7 +37,7 @@ clish_shell_init(clish_shell_t * this,
 	this->current_file = NULL;
 	this->cfg_pwdv = NULL;
 	this->cfg_pwdc = 0;
-	this->client = conf_client_new(CONFD_SOCKET_PATH);
+	this->client = konf_client_new(KONFD_SOCKET_PATH);
 	this->completion_pargv = NULL;
 }
 

+ 1 - 1
clish/shell/shell_pwd.c

@@ -39,7 +39,7 @@ const char *clish_shell__get_pwd(const clish_shell_t * this, unsigned index)
 	return this->cfg_pwdv[index];
 }
 
-conf_client_t *clish_shell__get_client(const clish_shell_t * this)
+konf_client_t *clish_shell__get_client(const clish_shell_t * this)
 {
 	return this->client;
 }

+ 114 - 146
configure

@@ -1,14 +1,12 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for clish 0.7.4alpha.
+# Generated by GNU Autoconf 2.64 for clish 0.7.4alpha.
 #
 # Report bugs to <gmckerrell at users dot sourceforge dot net>.
 #
-#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-#
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
+# Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
@@ -678,8 +676,7 @@ fi
 
 
 
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
+exec 7<&0 </dev/null 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -762,8 +759,8 @@ TINYXML_CXXFLAGS
 TINYXML_LIBS
 TINYRL_CFLAGS
 TINYRL_LIBS
-CLICONF_CFLAGS
-CLICONF_LIBS
+KONF_CFLAGS
+KONF_LIBS
 LUB_CFLAGS
 LUB_LIBS
 DEBUG_FALSE
@@ -1560,7 +1557,7 @@ Some influential environment variables:
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
@@ -1634,7 +1631,7 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 clish configure 0.7.4alpha
-generated by GNU Autoconf 2.65
+generated by GNU Autoconf 2.64
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -1681,7 +1678,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 	ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_c_try_compile
 
@@ -1719,7 +1716,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 	ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_cxx_try_compile
 
@@ -1765,7 +1762,7 @@ fi
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_c_try_link
 
@@ -1833,7 +1830,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
     ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_c_try_cpp
 
@@ -1875,7 +1872,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 fi
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_c_try_run
 
@@ -1979,7 +1976,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
     ac_retval=1
 fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_cxx_try_cpp
 
@@ -2025,7 +2022,7 @@ fi
   # left behind by Apple's compiler.  We do this before executing the actions.
   rm -rf conftest.dSYM conftest_ipa8_conftest.oo
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_cxx_try_link
 
@@ -2203,7 +2200,7 @@ rm -f conftest.val
 
   fi
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-  as_fn_set_status $ac_retval
+  return $ac_retval
 
 } # ac_fn_c_compute_int
 
@@ -2304,7 +2301,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by clish $as_me 0.7.4alpha, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+generated by GNU Autoconf 2.64.  Invocation command line was
 
   $ $0 $@
 
@@ -2557,7 +2554,7 @@ fi
 for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
   test "x$ac_site_file" = xNONE && continue
-  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+  if test -r "$ac_site_file"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
     sed 's/^/| /' "$ac_site_file" >&5
@@ -2566,9 +2563,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
 done
 
 if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special files
-  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
-  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
 $as_echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
@@ -2998,30 +2995,32 @@ $as_echo "$ac_try_echo"; } >&5
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
   fi
-  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
 
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+#include <stdio.h>
 int
 main ()
 {
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
 
   ;
   return 0;
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
 ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
 
 # The possible output files:
@@ -3083,10 +3082,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 if test -z "$ac_file"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -3094,18 +3093,51 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 { as_fn_set_status 77
 as_fn_error "C compiler cannot create executables
 See \`config.log' for more details." "$LINENO" 5; }; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
 ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
 $as_echo_n "checking for suffix of executables... " >&6; }
 if { { ac_try="$ac_link"
@@ -3138,72 +3170,13 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
 as_fn_error "cannot compute suffix of executables: cannot compile and link
 See \`config.log' for more details." "$LINENO" 5; }
 fi
-rm -f conftest conftest$ac_cv_exeext
+rm -f conftest$ac_cv_exeext
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
 $as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
-  { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }
-  if { ac_try='./conftest$ac_cv_exeext'
-  { { case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
-    fi
-  fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
 $as_echo_n "checking for suffix of object files... " >&6; }
 if test "${ac_cv_objext+set}" = set; then :
@@ -3597,8 +3570,8 @@ $as_echo "$ac_try_echo"; } >&5
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
   fi
-  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
@@ -4106,8 +4079,8 @@ esac
 
 
 
-macro_version='2.2.6b'
-macro_revision='1.3017'
+macro_version='2.2.6'
+macro_revision='1.3012'
 
 
 
@@ -4707,13 +4680,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
 else
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4710: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4683: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4713: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4686: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4716: output\"" >&5)
+  (eval echo "\"\$as_me:4689: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
     lt_cv_nm_interface="MS dumpbin"
@@ -5176,7 +5149,7 @@ irix5* | irix6* | nonstopux*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
@@ -5916,7 +5889,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5919 "configure"' > conftest.$ac_ext
+  echo '#line 5892 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -7076,8 +7049,8 @@ $as_echo "$ac_try_echo"; } >&5
 ... rest of stderr output deleted ...
          10q' conftest.err >conftest.er1
     cat conftest.er1 >&5
+    rm -f conftest.er1 conftest.err
   fi
-  rm -f conftest.er1 conftest.err
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
 done
@@ -7840,11 +7813,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7843: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7816: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7847: \$? = $ac_status" >&5
+   echo "$as_me:7820: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8009,7 +7982,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
       lt_prog_compiler_static='-non_shared'
       ;;
 
-    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    linux* | k*bsd*-gnu)
       case $cc_basename in
       # old Intel for x86_64 which still supported -KPIC.
       ecc*)
@@ -8179,11 +8152,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8182: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8155: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:8186: \$? = $ac_status" >&5
+   echo "$as_me:8159: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -8284,11 +8257,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8287: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8260: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8291: \$? = $ac_status" >&5
+   echo "$as_me:8264: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8339,11 +8312,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:8342: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:8315: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:8346: \$? = $ac_status" >&5
+   echo "$as_me:8319: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -8482,7 +8455,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     fi
     supports_anon_versioning=no
     case `$LD -v 2>&1` in
-      *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
       *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
@@ -8574,7 +8546,7 @@ _LT_EOF
       archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
-    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+    gnu* | linux* | tpf* | k*bsd*-gnu)
       tmp_diet=no
       if test "$host_os" = linux-dietlibc; then
 	case $cc_basename in
@@ -10036,7 +10008,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -10723,7 +10695,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10726 "configure"
+#line 10698 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -10819,7 +10791,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10822 "configure"
+#line 10794 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11759,7 +11731,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
         inherit_rpath_CXX=yes
         ;;
 
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
         case $cc_basename in
           KCC*)
 	    # Kuck and Associates, Inc. (KAI) C++ Compiler
@@ -12587,7 +12559,7 @@ $as_echo_n "checking for $compiler option to produce PIC... " >&6; }
 	    ;;
 	esac
 	;;
-      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      linux* | k*bsd*-gnu)
 	case $cc_basename in
 	  KCC*)
 	    # KAI C++ Compiler
@@ -12775,11 +12747,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12778: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12750: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12782: \$? = $ac_status" >&5
+   echo "$as_me:12754: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -12874,11 +12846,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12877: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12849: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12881: \$? = $ac_status" >&5
+   echo "$as_me:12853: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12926,11 +12898,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12929: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12901: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12933: \$? = $ac_status" >&5
+   echo "$as_me:12905: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -13504,7 +13476,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+linux* | k*bsd*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -14210,7 +14182,6 @@ IFS=$as_save_IFS
 
 fi
 
-  test -d ./--version && rmdir ./--version
   if test "${ac_cv_path_mkdir+set}" = set; then
     MKDIR_P="$ac_cv_path_mkdir -p"
   else
@@ -14218,6 +14189,7 @@ fi
     # value for MKDIR_P within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
     MKDIR_P="$ac_install_sh -d"
   fi
 fi
@@ -14966,12 +14938,12 @@ fi
 
 
 ################################
-# Check for the CLICONF library
+# Check for the KONF library
 ################################
-CLICONF_LIBS="-lcliconf"
-CLICONF_CFLAGS=""
+KONF_LIBS="-lkonf"
+KONF_CFLAGS=""
 
-if test x$CLICONF_LIBS = x; then
+if test x$KONF_LIBS = x; then
     as_fn_error "Cannot find the \"CLI config\" library" "$LINENO" 5
 fi
 
@@ -15917,7 +15889,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by clish $as_me 0.7.4alpha, which was
-generated by GNU Autoconf 2.65.  Invocation command line was
+generated by GNU Autoconf 2.64.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -15957,7 +15929,6 @@ Usage: $0 [OPTION]... [TAG]...
 
   -h, --help       print this help, then exit
   -V, --version    print version number and configuration settings, then exit
-      --config     print configuration, then exit
   -q, --quiet, --silent
                    do not print progress messages
   -d, --debug      don't remove temporary files
@@ -15980,11 +15951,10 @@ Report bugs to <gmckerrell at users dot sourceforge dot net>."
 
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 clish config.status 0.7.4alpha
-configured by $0, generated by GNU Autoconf 2.65,
-  with options \\"\$ac_cs_config\\"
+configured by $0, generated by GNU Autoconf 2.64,
+  with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
@@ -16022,8 +15992,6 @@ do
     ac_cs_recheck=: ;;
   --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
     $as_echo "$ac_cs_version"; exit ;;
-  --config | --confi | --conf | --con | --co | --c )
-    $as_echo "$ac_cs_config"; exit ;;
   --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
@@ -16564,7 +16532,7 @@ s/'"$ac_delim"'$//
 t delim
 :nl
 h
-s/\(.\{148\}\)..*/\1/
+s/\(.\{148\}\).*/\1/
 t more1
 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
 p
@@ -16578,7 +16546,7 @@ s/.\{148\}//
 t nl
 :delim
 h
-s/\(.\{148\}\)..*/\1/
+s/\(.\{148\}\).*/\1/
 t more2
 s/["\\]/\\&/g; s/^/"/; s/$/"/
 p

+ 6 - 6
configure.ac

@@ -62,16 +62,16 @@ AC_SUBST(LUB_LIBS)
 AC_SUBST(LUB_CFLAGS)
 
 ################################
-# Check for the CLICONF library
+# Check for the KONF library
 ################################
-CLICONF_LIBS="-lcliconf"
-CLICONF_CFLAGS=""
+KONF_LIBS="-lkonf"
+KONF_CFLAGS=""
 
-if test x$CLICONF_LIBS = x; then
+if test x$KONF_LIBS = x; then
     AC_MSG_ERROR([Cannot find the "CLI config" library])
 fi
-AC_SUBST(CLICONF_LIBS)
-AC_SUBST(CLICONF_CFLAGS)
+AC_SUBST(KONF_LIBS)
+AC_SUBST(KONF_CFLAGS)
 
 ################################
 # Check for the TINYRL library

+ 51 - 0
konf/buf.h

@@ -0,0 +1,51 @@
+/*
+ * buf.h
+ */
+ /**
+\ingroup clish
+\defgroup clish_conf config
+@{
+
+\brief This class is a config in memory container.
+
+Use it to implement config in memory.
+
+*/
+#ifndef _konf_buf_h
+#define _konf_buf_h
+
+#include <stdio.h>
+
+#include <lub/bintree.h>
+
+typedef struct konf_buf_s konf_buf_t;
+
+/*=====================================
+ * CONF INTERFACE
+ *===================================== */
+/*-----------------
+ * meta functions
+ *----------------- */
+konf_buf_t *konf_buf_new(int sock);
+int konf_buf_bt_compare(const void *clientnode, const void *clientkey);
+void konf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
+size_t konf_buf_bt_offset(void);
+/*-----------------
+ * methods
+ *----------------- */
+void konf_buf_delete(konf_buf_t *instance);
+int konf_buf_read(konf_buf_t *instance);
+int konf_buf_add(konf_buf_t *instance, void *str, size_t len);
+char * konf_buf_string(char *instance, int len);
+char * konf_buf_parse(konf_buf_t *instance);
+char * konf_buf_preparse(konf_buf_t *instance);
+int konf_buf_lseek(konf_buf_t *instance, int newpos);
+int konf_buf__get_sock(const konf_buf_t *instance);
+int konf_buf__get_len(const konf_buf_t *instance);
+
+int konf_buftree_read(lub_bintree_t *instance, int sock);
+char * konf_buftree_parse(lub_bintree_t *instance, int sock);
+void konf_buftree_remove(lub_bintree_t *instance, int sock);
+
+#endif				/* _konf_buf_h */
+/** @} clish_conf */

+ 49 - 49
cliconf/buf/buf.c → konf/buf/buf.c

@@ -14,14 +14,14 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#define CONF_BUF_CHUNK 1024
+#define KONF_BUF_CHUNK 1024
 
 /*---------------------------------------------------------
  * PRIVATE META FUNCTIONS
  *--------------------------------------------------------- */
-int conf_buf_bt_compare(const void *clientnode, const void *clientkey)
+int konf_buf_bt_compare(const void *clientnode, const void *clientkey)
 {
-	const conf_buf_t *this = clientnode;
+	const konf_buf_t *this = clientnode;
 	int keysock;
 
 	memcpy(&keysock, clientkey, sizeof(keysock));
@@ -30,29 +30,29 @@ int conf_buf_bt_compare(const void *clientnode, const void *clientkey)
 }
 
 /*-------------------------------------------------------- */
-static void conf_buf_key(lub_bintree_key_t * key,
+static void konf_buf_key(lub_bintree_key_t * key,
 	int sock)
 {
 	memcpy(key, &sock, sizeof(sock));
 }
 
 /*-------------------------------------------------------- */
-void conf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key)
+void konf_buf_bt_getkey(const void *clientnode, lub_bintree_key_t * key)
 {
-	const conf_buf_t *this = clientnode;
+	const konf_buf_t *this = clientnode;
 
-	conf_buf_key(key, this->sock);
+	konf_buf_key(key, this->sock);
 }
 
 /*---------------------------------------------------------
  * PRIVATE METHODS
  *--------------------------------------------------------- */
 static void
-conf_buf_init(conf_buf_t * this, int sock)
+konf_buf_init(konf_buf_t * this, int sock)
 {
 	this->sock = sock;
-	this->buf = malloc(CONF_BUF_CHUNK);
-	this->size = CONF_BUF_CHUNK;
+	this->buf = malloc(KONF_BUF_CHUNK);
+	this->size = KONF_BUF_CHUNK;
 	this->pos = 0;
 	this->rpos = 0;
 
@@ -61,7 +61,7 @@ conf_buf_init(conf_buf_t * this, int sock)
 }
 
 /*--------------------------------------------------------- */
-static void conf_buf_fini(conf_buf_t * this)
+static void konf_buf_fini(konf_buf_t * this)
 {
 	free(this->buf);
 }
@@ -69,18 +69,18 @@ static void conf_buf_fini(conf_buf_t * this)
 /*---------------------------------------------------------
  * PUBLIC META FUNCTIONS
  *--------------------------------------------------------- */
-size_t conf_buf_bt_offset(void)
+size_t konf_buf_bt_offset(void)
 {
-	return offsetof(conf_buf_t, bt_node);
+	return offsetof(konf_buf_t, bt_node);
 }
 
 /*--------------------------------------------------------- */
-conf_buf_t *conf_buf_new(int sock)
+konf_buf_t *konf_buf_new(int sock)
 {
-	conf_buf_t *this = malloc(sizeof(conf_buf_t));
+	konf_buf_t *this = malloc(sizeof(konf_buf_t));
 
 	if (this) {
-		conf_buf_init(this, sock);
+		konf_buf_init(this, sock);
 	}
 
 	return this;
@@ -89,41 +89,41 @@ conf_buf_t *conf_buf_new(int sock)
 /*---------------------------------------------------------
  * PUBLIC METHODS
  *--------------------------------------------------------- */
-void conf_buf_delete(conf_buf_t * this)
+void konf_buf_delete(konf_buf_t * this)
 {
-	conf_buf_fini(this);
+	konf_buf_fini(this);
 	free(this);
 }
 
 /*--------------------------------------------------------- */
-conf_buf_t *conf_buftree_find(lub_bintree_t * this,
+konf_buf_t *konf_buftree_find(lub_bintree_t * this,
 	int sock)
 {
 	lub_bintree_key_t key;
 
-	conf_buf_key(&key, sock);
+	konf_buf_key(&key, sock);
 
 	return lub_bintree_find(this, &key);
 }
 
 /*--------------------------------------------------------- */
-void conf_buftree_remove(lub_bintree_t * this,
+void konf_buftree_remove(lub_bintree_t * this,
 	int sock)
 {
-	conf_buf_t *tbuf;
+	konf_buf_t *tbuf;
 
-	if ((tbuf = conf_buftree_find(this, sock)) == NULL)
+	if ((tbuf = konf_buftree_find(this, sock)) == NULL)
 		return;
 
 	lub_bintree_remove(this, tbuf);
-	conf_buf_delete(tbuf);
+	konf_buf_delete(tbuf);
 }
 
 
 /*--------------------------------------------------------- */
-static int conf_buf_realloc(conf_buf_t *buf, int addsize)
+static int konf_buf_realloc(konf_buf_t *buf, int addsize)
 {
-	int chunk = CONF_BUF_CHUNK;
+	int chunk = KONF_BUF_CHUNK;
 	char *tmpbuf;
 
 	if (addsize > chunk)
@@ -138,11 +138,11 @@ static int conf_buf_realloc(conf_buf_t *buf, int addsize)
 }
 
 /*--------------------------------------------------------- */
-int conf_buf_add(conf_buf_t *buf, void *str, size_t len)
+int konf_buf_add(konf_buf_t *buf, void *str, size_t len)
 {
 	char *buffer;
 
-	conf_buf_realloc(buf, len);
+	konf_buf_realloc(buf, len);
 	buffer = buf->buf + buf->pos;
 	memcpy(buffer, str, len);
 	buf->pos += len;
@@ -151,13 +151,13 @@ int conf_buf_add(conf_buf_t *buf, void *str, size_t len)
 }
 
 /*--------------------------------------------------------- */
-int conf_buf_read(conf_buf_t *buf)
+int konf_buf_read(konf_buf_t *buf)
 {
 	char *buffer;
 	int buffer_size;
 	int nbytes;
 
-	conf_buf_realloc(buf, 0);
+	konf_buf_realloc(buf, 0);
 	buffer_size = buf->size - buf->pos;
 	buffer = buf->buf + buf->pos;
 
@@ -169,20 +169,20 @@ int conf_buf_read(conf_buf_t *buf)
 }
 
 /*--------------------------------------------------------- */
-int conf_buftree_read(lub_bintree_t * this,
+int konf_buftree_read(lub_bintree_t * this,
 	int sock)
 {
-	conf_buf_t *buf;
+	konf_buf_t *buf;
 
-	buf = conf_buftree_find(this, sock);
+	buf = konf_buftree_find(this, sock);
 	if (!buf)
 		return -1;
 
-	return conf_buf_read(buf);
+	return konf_buf_read(buf);
 }
 
 /*--------------------------------------------------------- */
-char * conf_buf_string(char *buf, int len)
+char * konf_buf_string(char *buf, int len)
 {
 	unsigned i;
 	char *str;
@@ -203,12 +203,12 @@ char * conf_buf_string(char *buf, int len)
 }
 
 /*--------------------------------------------------------- */
-char * conf_buf_parse(conf_buf_t *buf)
+char * konf_buf_parse(konf_buf_t *buf)
 {
 	char * str = NULL;
 
 	/* Search the buffer for the string */
-	str = conf_buf_string(buf->buf, buf->pos);
+	str = konf_buf_string(buf->buf, buf->pos);
 
 	/* Remove parsed string from the buffer */
 	if (str) {
@@ -222,28 +222,28 @@ char * conf_buf_parse(conf_buf_t *buf)
 	}
 
 	/* Make buffer shorter */
-	if ((buf->size - buf->pos) > (2 * CONF_BUF_CHUNK)) {
+	if ((buf->size - buf->pos) > (2 * KONF_BUF_CHUNK)) {
 		char *tmpbuf;
-		tmpbuf = realloc(buf->buf, buf->size - CONF_BUF_CHUNK);
+		tmpbuf = realloc(buf->buf, buf->size - KONF_BUF_CHUNK);
 		buf->buf = tmpbuf;
-		buf->size -= CONF_BUF_CHUNK;
+		buf->size -= KONF_BUF_CHUNK;
 	}
 
 	return str;
 }
 
-char * conf_buf_preparse(conf_buf_t *buf)
+char * konf_buf_preparse(konf_buf_t *buf)
 {
 	char * str = NULL;
 
-	str = conf_buf_string(buf->buf + buf->rpos, buf->pos - buf->rpos);
+	str = konf_buf_string(buf->buf + buf->rpos, buf->pos - buf->rpos);
 	if (str)
 		buf->rpos += (strlen(str) + 1);
 
 	return str;
 }
 
-int conf_buf_lseek(conf_buf_t *buf, int newpos)
+int konf_buf_lseek(konf_buf_t *buf, int newpos)
 {
 	if (newpos > buf->pos)
 		return -1;
@@ -253,25 +253,25 @@ int conf_buf_lseek(conf_buf_t *buf, int newpos)
 }
 
 /*--------------------------------------------------------- */
-char * conf_buftree_parse(lub_bintree_t * this,
+char * konf_buftree_parse(lub_bintree_t * this,
 	int sock)
 {
-	conf_buf_t *buf;
+	konf_buf_t *buf;
 
-	buf = conf_buftree_find(this, sock);
+	buf = konf_buftree_find(this, sock);
 	if (!buf)
 		return NULL;
 
-	return conf_buf_parse(buf);
+	return konf_buf_parse(buf);
 }
 
 /*--------------------------------------------------------- */
-int conf_buf__get_sock(const conf_buf_t * this)
+int konf_buf__get_sock(const konf_buf_t * this)
 {
 	return this->sock;
 }
 
-int conf_buf__get_len(const conf_buf_t *this)
+int konf_buf__get_len(const konf_buf_t *this)
 {
 	return this->pos;
 }

+ 2 - 0
konf/buf/module.am

@@ -0,0 +1,2 @@
+libkonf_la_SOURCES +=	konf/buf/buf.c	\
+			konf/buf/private.h

+ 4 - 4
cliconf/buf/private.h → konf/buf/private.h

@@ -1,16 +1,16 @@
 /*
  * conf.h
  */
-#ifndef buf_private_h
-#define buf_private_h
+#ifndef _konf_buf_private_h
+#define _konf_buf_private_h
 
-#include "cliconf/buf.h"
+#include "konf/buf.h"
 #include "lub/bintree.h"
 
 /*---------------------------------------------------------
  * PRIVATE TYPES
  *--------------------------------------------------------- */
-struct conf_buf_s {
+struct konf_buf_s {
 	lub_bintree_node_t bt_node;
 	int sock;
 	int size;

+ 21 - 0
konf/module.am

@@ -0,0 +1,21 @@
+## Process this file with automake to generate Makefile.in
+lib_LTLIBRARIES         += libkonf.la
+libkonf_la_SOURCES        =
+libkonf_la_LIBADD         =
+
+nobase_include_HEADERS  += \
+    konf/tree.h            \
+    konf/query.h           \
+    konf/buf.h             \
+    konf/net.h
+
+EXTRA_DIST             += \
+    konf/tree/module.am   \
+    konf/query/module.am  \
+    konf/buf/module.am    \
+    konf/net/module.am
+
+include $(top_srcdir)/konf/tree/module.am
+include $(top_srcdir)/konf/query/module.am
+include $(top_srcdir)/konf/buf/module.am
+include $(top_srcdir)/konf/net/module.am

+ 16 - 0
konf/net.h

@@ -0,0 +1,16 @@
+#ifndef _konf_net_h
+#define _konf_net_h
+
+typedef struct konf_client_s konf_client_t;
+
+#define KONFD_SOCKET_PATH "/tmp/konfd.socket"
+
+konf_client_t *konf_client_new(char *path);
+void konf_client_free(konf_client_t *client);
+int konf_client_connect(konf_client_t *client);
+void konf_client_disconnect(konf_client_t *client);
+int konf_client_reconnect(konf_client_t *client);
+int konf_client_send(konf_client_t *client, char *command);
+int konf_client__get_sock(konf_client_t *client);
+
+#endif

+ 2 - 0
konf/net/module.am

@@ -0,0 +1,2 @@
+libkonf_la_SOURCES +=	konf/net/net.c	\
+			konf/net/private.h

+ 12 - 29
cliconf/net/net.c → konf/net/net.c

@@ -1,10 +1,3 @@
-/*
- * clish_config_callback.c
- *
- *
- * Callback hook to execute config operations.
- */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -17,16 +10,16 @@
 #include <sys/un.h>
 
 #include "clish/private.h"
-#include "private.h"
 #include "lub/string.h"
+#include "private.h"
 
 #ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX 108
 #endif
 
-conf_client_t *conf_client_new(char *path)
+konf_client_t *konf_client_new(char *path)
 {
-	conf_client_t *client;
+	konf_client_t *client;
 
 	if (!path)
 		return NULL;
@@ -40,16 +33,16 @@ conf_client_t *conf_client_new(char *path)
 	return client;
 }
 
-void conf_client_free(conf_client_t *client)
+void konf_client_free(konf_client_t *client)
 {
 	if (client->sock != -1)
-		conf_client_disconnect(client);
+		konf_client_disconnect(client);
 	lub_string_free(client->path);
 
 	free(client);
 }
 
-int conf_client_connect(conf_client_t *client)
+int konf_client_connect(konf_client_t *client)
 {
 	struct sockaddr_un raddr;
 
@@ -70,7 +63,7 @@ int conf_client_connect(conf_client_t *client)
 	return client->sock;
 }
 
-void conf_client_disconnect(conf_client_t *client)
+void konf_client_disconnect(konf_client_t *client)
 {
 	if (client->sock >= 0) {
 		close(client->sock);
@@ -78,13 +71,13 @@ void conf_client_disconnect(conf_client_t *client)
 	}
 }
 
-int conf_client_reconnect(conf_client_t *client)
+int konf_client_reconnect(konf_client_t *client)
 {
-	conf_client_disconnect(client);
-	return conf_client_connect(client);
+	konf_client_disconnect(client);
+	return konf_client_connect(client);
 }
 
-int conf_client_send(conf_client_t *client, char *command)
+int konf_client_send(konf_client_t *client, char *command)
 {
 	if (client->sock < 0)
 		return client->sock;
@@ -92,17 +85,7 @@ int conf_client_send(conf_client_t *client, char *command)
 	return send(client->sock, command, strlen(command) + 1, MSG_NOSIGNAL);
 }
 
-/*int conf_client_recv(conf_client_t *client, char *command)
-{
-	if (client->sock < 0)
-		return client->sock;
-
-	return send(client->sock, command, strlen(command) + 1, 0);
-}
-*/
-
-int conf_client__get_sock(conf_client_t *client)
+int konf_client__get_sock(konf_client_t *client)
 {
 	return client->sock;
 }
-

+ 11 - 0
konf/net/private.h

@@ -0,0 +1,11 @@
+#ifndef _konf_net_private_h
+#define _konf_net_private_h
+
+#include "konf/net.h"
+
+struct konf_client_s {
+	int sock;
+	char *path;
+};
+
+#endif

+ 31 - 0
konf/query.h

@@ -0,0 +1,31 @@
+#ifndef _konf_query_h
+#define _konf_query_h
+
+typedef enum
+{
+  konf_query_OP_NONE,
+  konf_query_OP_OK,
+  konf_query_OP_ERROR,
+  konf_query_OP_SET,
+  konf_query_OP_UNSET,
+  konf_query_OP_STREAM,
+  konf_query_OP_DUMP
+} konf_query_op_t;
+
+typedef struct konf_query_s konf_query_t;
+
+int konf_query_parse(konf_query_t *query, int argc, char **argv);
+int konf_query_parse_str(konf_query_t *query, char *str);
+konf_query_t *konf_query_new(void);
+void konf_query_free(konf_query_t *query);
+char *konf_query__get_pwd(konf_query_t *query, unsigned index);
+int konf_query__get_pwdc(konf_query_t *query);
+void konf_query_dump(konf_query_t *query);
+konf_query_op_t konf_query__get_op(konf_query_t *query);
+char * konf_query__get_path(konf_query_t *query);
+const char * konf_query__get_pattern(konf_query_t *instance);
+const char * konf_query__get_line(konf_query_t *instance);
+unsigned short konf_query__get_priority(konf_query_t *instance);
+bool_t konf_query__get_splitter(konf_query_t *instance);
+
+#endif

+ 2 - 0
konf/query/module.am

@@ -0,0 +1,2 @@
+libkonf_la_SOURCES +=	konf/query/query.c   \
+			konf/query/private.h

+ 5 - 5
cliconf/query/private.h → konf/query/private.h

@@ -1,11 +1,11 @@
-#ifndef query_private_h
-#define query_private_h
+#ifndef _konf_query_private_h
+#define _konf_query_private_h
 
-#include "cliconf/query.h"
+#include "konf/query.h"
 #include "lub/types.h"
 
-struct query_s {
-	query_op_t op;
+struct konf_query_s {
+	konf_query_op_t op;
 	char *pattern;
 	unsigned short priority;
 	unsigned pwdc;

+ 32 - 40
cliconf/query/query.c → konf/query/query.c

@@ -1,10 +1,3 @@
-/*
- * clish_config_callback.c
- *
- *
- * Callback hook to execute config operations.
- */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -19,14 +12,14 @@
 #include "lub/argv.h"
 #include "lub/string.h"
 
-query_t *query_new(void)
+konf_query_t *konf_query_new(void)
 {
-	query_t *query;
+	konf_query_t *query;
 
 	if (!(query = malloc(sizeof(*query))))
 		return NULL;
 
-	query->op = QUERY_OP_NONE;
+	query->op = konf_query_OP_NONE;
 	query->pattern = NULL;
 	query->priority = 0x7f00;
 	query->pwdc = 0;
@@ -38,25 +31,25 @@ query_t *query_new(void)
 	return query;
 }
 
-void query_dump(query_t *query)
+void konf_query_dump(konf_query_t *query)
 {
 	switch (query->op) {
-	case QUERY_OP_SET:
+	case konf_query_OP_SET:
 		printf("op=SET\n");
 		break;
-	case QUERY_OP_UNSET:
+	case konf_query_OP_UNSET:
 		printf("op=UNSET\n");
 		break;
-	case QUERY_OP_DUMP:
+	case konf_query_OP_DUMP:
 		printf("op=DUMP\n");
 		break;
-	case QUERY_OP_OK:
+	case konf_query_OP_OK:
 		printf("op=OK\n");
 		break;
-	case QUERY_OP_ERROR:
+	case konf_query_OP_ERROR:
 		printf("op=ERROR\n");
 		break;
-	case QUERY_OP_STREAM:
+	case konf_query_OP_STREAM:
 		printf("op=STREAM\n");
 		break;
 	default:
@@ -70,7 +63,7 @@ void query_dump(query_t *query)
 	printf("pwdc=%u\n", query->pwdc);
 }
 
-void query_add_pwd(query_t *query, char *str)
+void konf_query_add_pwd(konf_query_t *query, char *str)
 {
 	size_t new_size;
 	char **tmp;
@@ -89,7 +82,7 @@ void query_add_pwd(query_t *query, char *str)
 }
 
 
-void query_free(query_t *query)
+void konf_query_free(konf_query_t *query)
 {
 	unsigned i;
 
@@ -106,7 +99,7 @@ void query_free(query_t *query)
 }
 
 /* Parse query */
-int query_parse(query_t *query, int argc, char **argv)
+int konf_query_parse(konf_query_t *query, int argc, char **argv)
 {
 	unsigned i = 0;
 	int pwdc = 0;
@@ -137,22 +130,22 @@ int query_parse(query_t *query, int argc, char **argv)
 			break;
 		switch (opt) {
 		case 'o':
-			query->op = QUERY_OP_OK;
+			query->op = konf_query_OP_OK;
 			break;
 		case 'e':
-			query->op = QUERY_OP_ERROR;
+			query->op = konf_query_OP_ERROR;
 			break;
 		case 's':
-			query->op = QUERY_OP_SET;
+			query->op = konf_query_OP_SET;
 			break;
 		case 'u':
-			query->op = QUERY_OP_UNSET;
+			query->op = konf_query_OP_UNSET;
 			break;
 		case 'd':
-			query->op = QUERY_OP_DUMP;
+			query->op = konf_query_OP_DUMP;
 			break;
 		case 't':
-			query->op = QUERY_OP_STREAM;
+			query->op = konf_query_OP_STREAM;
 			break;
 		case 'p':
 			{
@@ -187,9 +180,9 @@ int query_parse(query_t *query, int argc, char **argv)
 	}
 
 	/* Check options */
-	if (QUERY_OP_NONE == query->op)
+	if (konf_query_OP_NONE == query->op)
 		return -1;
-	if (QUERY_OP_SET == query->op) {
+	if (konf_query_OP_SET == query->op) {
 		if (NULL == query->pattern)
 			return -1;
 		if (NULL == query->line)
@@ -200,13 +193,13 @@ int query_parse(query_t *query, int argc, char **argv)
 		return -1;
 
 	for (i = 0; i < pwdc; i ++)
-		query_add_pwd(query, argv[optind + i]);
+		konf_query_add_pwd(query, argv[optind + i]);
 
 	return 0;
 }
 
 /* Parse query string */
-int query_parse_str(query_t *query, char *str)
+int konf_query_parse_str(konf_query_t *query, char *str)
 {
 	int res;
 	lub_argv_t *lub_argv;
@@ -219,14 +212,14 @@ int query_parse_str(query_t *query, char *str)
 	str_argc = lub_argv__get_count(lub_argv) + 1;
 
 	/* Parse query */
-	res = query_parse(query, str_argc, str_argv);
+	res = konf_query_parse(query, str_argc, str_argv);
 	free(str_argv);
 	lub_argv_delete(lub_argv);
 
 	return res;
 }
 
-char * query__get_pwd(query_t *query, unsigned index)
+char * konf_query__get_pwd(konf_query_t *query, unsigned index)
 {
 	if (!query)
 		return NULL;
@@ -236,39 +229,38 @@ char * query__get_pwd(query_t *query, unsigned index)
 	return query->pwd[index];
 }
 
-int query__get_pwdc(query_t *query)
+int konf_query__get_pwdc(konf_query_t *query)
 {
 	return query->pwdc;
 }
 
-query_op_t query__get_op(query_t *query)
+konf_query_op_t konf_query__get_op(konf_query_t *query)
 {
 	return query->op;
 }
 
-char * query__get_path(query_t *query)
+char * konf_query__get_path(konf_query_t *query)
 {
 	return query->path;
 }
 
 
-const char * query__get_pattern(query_t *this)
+const char * konf_query__get_pattern(konf_query_t *this)
 {
 	return this->pattern;
 }
 
-const char * query__get_line(query_t *this)
+const char * konf_query__get_line(konf_query_t *this)
 {
 	return this->line;
 }
 
-unsigned short query__get_priority(query_t *this)
+unsigned short konf_query__get_priority(konf_query_t *this)
 {
 	return this->priority;
 }
 
-bool_t query__get_splitter(query_t *this)
+bool_t konf_query__get_splitter(konf_query_t *this)
 {
 	return this->splitter;
 }
-

+ 60 - 0
konf/tree.h

@@ -0,0 +1,60 @@
+/*
+ * conf.h
+ */
+ /**
+\ingroup clish
+\defgroup clish_conf config
+@{
+
+\brief This class is a config in memory container.
+
+Use it to implement config in memory.
+
+*/
+#ifndef _konf_tree_h
+#define _konf_tree_h
+
+#include <stdio.h>
+
+#include "lub/types.h"
+#include "lub/bintree.h"
+
+typedef struct konf_tree_s konf_tree_t;
+
+/*=====================================
+ * CONF INTERFACE
+ *===================================== */
+/*-----------------
+ * meta functions
+ *----------------- */
+konf_tree_t *konf_tree_new(const char * line, unsigned short priority);
+int konf_tree_bt_compare(const void *clientnode, const void *clientkey);
+void konf_tree_bt_getkey(const void *clientnode, lub_bintree_key_t * key);
+size_t konf_tree_bt_offset(void);
+
+/*-----------------
+ * methods
+ *----------------- */
+void konf_tree_delete(konf_tree_t * instance);
+void konf_tree_fprintf(konf_tree_t * instance, FILE * stream,
+		const char *pattern,
+		int depth, unsigned char prev_pri_hi);
+konf_tree_t *konf_tree_new_conf(konf_tree_t * instance,
+				const char *line, unsigned short priority);
+konf_tree_t *konf_tree_find_conf(konf_tree_t * instance,
+				const char *line, unsigned short priority);
+void konf_tree_del_pattern(konf_tree_t *this,
+				const char *pattern);
+
+/*-----------------
+ * attributes 
+ *----------------- */
+unsigned konf_tree__get_depth(const konf_tree_t * instance);
+unsigned short konf_tree__get_priority(const konf_tree_t * instance);
+unsigned char konf_tree__get_priority_hi(const konf_tree_t * instance);
+unsigned char konf_tree__get_priority_lo(const konf_tree_t * instance);
+bool_t konf_tree__get_splitter(const konf_tree_t * instance);
+void konf_tree__set_splitter(konf_tree_t *instance, bool_t splitter);
+
+#endif				/* _konf_tree_h */
+/** @} clish_conf */

+ 3 - 0
konf/tree/module.am

@@ -0,0 +1,3 @@
+libkonf_la_SOURCES +=	konf/tree/tree.c	\
+			konf/tree/tree_dump.c	\
+			konf/tree/private.h

+ 4 - 4
cliconf/conf/private.h → konf/tree/private.h

@@ -1,17 +1,17 @@
 /*
  * conf.h
  */
-#ifndef conf_private_h
-#define conf_private_h
+#ifndef _konf_tree_private_h
+#define _konf_tree_private_h
 
-#include "cliconf/conf.h"
+#include "konf/tree.h"
 #include "lub/types.h"
 #include "lub/bintree.h"
 
 /*---------------------------------------------------------
  * PRIVATE TYPES
  *--------------------------------------------------------- */
-struct cliconf_s {
+struct konf_tree_s {
 	lub_bintree_t tree;
 	lub_bintree_node_t bt_node;
 	char *line;

+ 41 - 42
cliconf/conf/conf.c → konf/tree/tree.c

@@ -16,23 +16,23 @@
 /*---------------------------------------------------------
  * PRIVATE META FUNCTIONS
  *--------------------------------------------------------- */
-int cliconf_bt_compare(const void *clientnode, const void *clientkey)
+int konf_tree_bt_compare(const void *clientnode, const void *clientkey)
 {
-	const cliconf_t *this = clientnode;
+	const konf_tree_t *this = clientnode;
 	unsigned short *pri = (unsigned short *)clientkey;
 	char *line = ((char *)clientkey + sizeof(unsigned short));
 
 /*	printf("COMPARE: node_pri=%d node_line=[%s] key_pri=%d key_line=[%s]\n",
-	cliconf__get_priority(this), this->line, *pri, line);
+	konf_tree__get_priority(this), this->line, *pri, line);
 */
-	if (cliconf__get_priority(this) == *pri)
+	if (konf_tree__get_priority(this) == *pri)
 		return lub_string_nocasecmp(this->line, line);
 
-	return (cliconf__get_priority(this) - *pri);
+	return (konf_tree__get_priority(this) - *pri);
 }
 
 /*-------------------------------------------------------- */
-static void cliconf_key(lub_bintree_key_t * key,
+static void konf_tree_key(lub_bintree_key_t * key,
 	unsigned short priority, const char *text)
 {
 	unsigned short *pri = (unsigned short *)key;
@@ -44,18 +44,18 @@ static void cliconf_key(lub_bintree_key_t * key,
 }
 
 /*-------------------------------------------------------- */
-void cliconf_bt_getkey(const void *clientnode, lub_bintree_key_t * key)
+void konf_tree_bt_getkey(const void *clientnode, lub_bintree_key_t * key)
 {
-	const cliconf_t *this = clientnode;
+	const konf_tree_t *this = clientnode;
 
-	cliconf_key(key, cliconf__get_priority(this), this->line);
+	konf_tree_key(key, konf_tree__get_priority(this), this->line);
 }
 
 /*---------------------------------------------------------
  * PRIVATE METHODS
  *--------------------------------------------------------- */
 static void
-cliconf_init(cliconf_t * this, const char *line, unsigned short priority)
+konf_tree_init(konf_tree_t * this, const char *line, unsigned short priority)
 {
 	/* set up defaults */
 	this->line = lub_string_dup(line);
@@ -67,21 +67,21 @@ cliconf_init(cliconf_t * this, const char *line, unsigned short priority)
 
 	/* initialise the tree of commands for this conf */
 	lub_bintree_init(&this->tree,
-		cliconf_bt_offset(),
-		 cliconf_bt_compare, cliconf_bt_getkey);
+		konf_tree_bt_offset(),
+		 konf_tree_bt_compare, konf_tree_bt_getkey);
 }
 
 /*--------------------------------------------------------- */
-static void cliconf_fini(cliconf_t * this)
+static void konf_tree_fini(konf_tree_t * this)
 {
-	cliconf_t *conf;
+	konf_tree_t *conf;
 
 	/* delete each conf held by this conf */
 	while ((conf = lub_bintree_findfirst(&this->tree))) {
 		/* remove the conf from the tree */
 		lub_bintree_remove(&this->tree, conf);
 		/* release the instance */
-		cliconf_delete(conf);
+		konf_tree_delete(conf);
 	}
 
 	/* free our memory */
@@ -92,18 +92,18 @@ static void cliconf_fini(cliconf_t * this)
 /*---------------------------------------------------------
  * PUBLIC META FUNCTIONS
  *--------------------------------------------------------- */
-size_t cliconf_bt_offset(void)
+size_t konf_tree_bt_offset(void)
 {
-	return offsetof(cliconf_t, bt_node);
+	return offsetof(konf_tree_t, bt_node);
 }
 
 /*--------------------------------------------------------- */
-cliconf_t *cliconf_new(const char *line, unsigned short priority)
+konf_tree_t *konf_tree_new(const char *line, unsigned short priority)
 {
-	cliconf_t *this = malloc(sizeof(cliconf_t));
+	konf_tree_t *this = malloc(sizeof(konf_tree_t));
 
 	if (this) {
-		cliconf_init(this, line, priority);
+		konf_tree_init(this, line, priority);
 	}
 
 	return this;
@@ -112,17 +112,17 @@ cliconf_t *cliconf_new(const char *line, unsigned short priority)
 /*---------------------------------------------------------
  * PUBLIC METHODS
  *--------------------------------------------------------- */
-void cliconf_delete(cliconf_t * this)
+void konf_tree_delete(konf_tree_t * this)
 {
-	cliconf_fini(this);
+	konf_tree_fini(this);
 	free(this);
 }
 
-void cliconf_fprintf(cliconf_t * this, FILE * stream,
+void konf_tree_fprintf(konf_tree_t * this, FILE * stream,
 		const char *pattern, int depth,
 		unsigned char prev_pri_hi)
 {
-	cliconf_t *conf;
+	konf_tree_t *conf;
 	lub_bintree_iterator_t iter;
 	unsigned char pri = 0;
 
@@ -136,7 +136,7 @@ void cliconf_fprintf(cliconf_t * this, FILE * stream,
 		}
 		if ((0 == depth) &&
 			(this->splitter ||
-			(cliconf__get_priority_hi(this) != prev_pri_hi)))
+			(konf_tree__get_priority_hi(this) != prev_pri_hi)))
 			fprintf(stream, "!\n");
 		fprintf(stream, "%s%s\n", space ? space : "", this->line);
 		free(space);
@@ -151,23 +151,23 @@ void cliconf_fprintf(cliconf_t * this, FILE * stream,
 		if (pattern &&
 			(lub_string_nocasestr(conf->line, pattern) != conf->line))
 			continue;
-		cliconf_fprintf(conf, stream, NULL, depth + 1, pri);
-		pri = cliconf__get_priority_hi(conf);
+		konf_tree_fprintf(conf, stream, NULL, depth + 1, pri);
+		pri = konf_tree__get_priority_hi(conf);
 	}
 }
 
 /*--------------------------------------------------------- */
-cliconf_t *cliconf_new_conf(cliconf_t * this,
+konf_tree_t *konf_tree_new_conf(konf_tree_t * this,
 					const char *line, unsigned short priority)
 {
 	/* allocate the memory for a new child element */
-	cliconf_t *conf = cliconf_new(line, priority);
+	konf_tree_t *conf = konf_tree_new(line, priority);
 	assert(conf);
 
 	/* ...insert it into the binary tree for this conf */
 	if (-1 == lub_bintree_insert(&this->tree, conf)) {
 		/* inserting a duplicate command is bad */
-		cliconf_delete(conf);
+		konf_tree_delete(conf);
 		conf = NULL;
 	}
 
@@ -175,15 +175,15 @@ cliconf_t *cliconf_new_conf(cliconf_t * this,
 }
 
 /*--------------------------------------------------------- */
-cliconf_t *cliconf_find_conf(cliconf_t * this,
+konf_tree_t *konf_tree_find_conf(konf_tree_t * this,
 	const char *line, unsigned short priority)
 {
-	cliconf_t *conf;
+	konf_tree_t *conf;
 	lub_bintree_key_t key;
 	lub_bintree_iterator_t iter;
 
 	if (0 != priority) {
-		cliconf_key(&key, priority, line);
+		konf_tree_key(&key, priority, line);
 		return lub_bintree_find(&this->tree, &key);
 	}
 
@@ -202,10 +202,10 @@ cliconf_t *cliconf_find_conf(cliconf_t * this,
 }
 
 /*--------------------------------------------------------- */
-void cliconf_del_pattern(cliconf_t *this,
+void konf_tree_del_pattern(konf_tree_t *this,
 	const char *pattern)
 {
-	cliconf_t *conf;
+	konf_tree_t *conf;
 	lub_bintree_iterator_t iter;
 
 	/* Empty tree */
@@ -216,38 +216,37 @@ void cliconf_del_pattern(cliconf_t *this,
 	do {
 		if (lub_string_nocasestr(conf->line, pattern) == conf->line) {
 			lub_bintree_remove(&this->tree, conf);
-			cliconf_delete(conf);
+			konf_tree_delete(conf);
 		}
 	} while ((conf = lub_bintree_iterator_next(&iter)));
 }
 
 /*--------------------------------------------------------- */
-unsigned short cliconf__get_priority(const cliconf_t * this)
+unsigned short konf_tree__get_priority(const konf_tree_t * this)
 {
 	return this->priority;
 }
 
 /*--------------------------------------------------------- */
-unsigned char cliconf__get_priority_hi(const cliconf_t * this)
+unsigned char konf_tree__get_priority_hi(const konf_tree_t * this)
 {
 	return (unsigned char)(this->priority >> 8);
 }
 
 /*--------------------------------------------------------- */
-unsigned char cliconf__get_priority_lo(const cliconf_t * this)
+unsigned char konf_tree__get_priority_lo(const konf_tree_t * this)
 {
 	return (unsigned char)(this->priority & 0xff);
 }
 
 /*--------------------------------------------------------- */
-bool_t cliconf__get_splitter(const cliconf_t * this)
+bool_t konf_tree__get_splitter(const konf_tree_t * this)
 {
 	return this->splitter;
 }
 
 /*--------------------------------------------------------- */
-void cliconf__set_splitter(cliconf_t *this, bool_t splitter)
+void konf_tree__set_splitter(konf_tree_t *this, bool_t splitter)
 {
 	this->splitter = splitter;
 }
-

+ 0 - 0
cliconf/conf/conf_dump.c → konf/tree/tree_dump.c


Some files were not shown because too many files changed in this diff